Resync `lcd_encoder_diff` when clicking

Flash: +4B
SRAM: 0B
This commit is contained in:
Alex Voinea 2023-04-23 10:07:52 +02:00
parent c037e6dfba
commit 5778e39687
No known key found for this signature in database
GPG Key ID: 37EDFD565CB33BAD
1 changed files with 5 additions and 0 deletions

View File

@ -692,6 +692,11 @@ void lcd_knob_update() {
lcd_encoder_diff %= ENCODER_PULSES_PER_STEP;
did_rotate = true;
}
else {
// Get lcd_encoder_diff in sync with the encoder hard steps.
// We assume that a click happens only when the knob is rotated into a stable position
lcd_encoder_diff = 0;
}
}
Sound_MakeSound(did_rotate ? e_SOUND_TYPE_EncoderMove : e_SOUND_TYPE_ButtonEcho);