Tick threshold should be a reflection of the actual change in the encoder's value.
This commit is contained in:
parent
82927519ce
commit
70d7bdd3b2
|
@ -127,10 +127,9 @@ bool EncoderButton::Update(Joystick* js) {
|
|||
|
||||
bool changed = false;
|
||||
long new_value = encoder->read();
|
||||
if (new_value > last_value) {
|
||||
ticks++;
|
||||
} else if (new_value < last_value) {
|
||||
ticks--;
|
||||
if (new_value != last_value) {
|
||||
ticks += last_value - new_value;
|
||||
last_value = new_value;
|
||||
}
|
||||
|
||||
if (ticks >= tick_threshold) {
|
||||
|
@ -146,6 +145,5 @@ bool EncoderButton::Update(Joystick* js) {
|
|||
ticks = 0;
|
||||
}
|
||||
|
||||
last_value = new_value;
|
||||
return changed;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user