[rotary_encoder] Fix volatile increment/decrement deprecation warnings (#7958)

This commit is contained in:
Edward Firmo 2024-12-13 22:16:11 +01:00 committed by GitHub
parent c187cb547c
commit 88742e0399
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -93,13 +93,17 @@ void IRAM_ATTR HOT RotaryEncoderSensorStore::gpio_intr(RotaryEncoderSensorStore
int8_t rotation_dir = 0;
uint16_t new_state = STATE_LOOKUP_TABLE[input_state];
if ((new_state & arg->resolution & STATE_HAS_INCREMENTED) != 0) {
if (arg->counter < arg->max_value)
arg->counter++;
if (arg->counter < arg->max_value) {
auto x = arg->counter + 1;
arg->counter = x;
}
rotation_dir = 1;
}
if ((new_state & arg->resolution & STATE_HAS_DECREMENTED) != 0) {
if (arg->counter > arg->min_value)
arg->counter--;
if (arg->counter > arg->min_value) {
auto x = arg->counter - 1;
arg->counter = x;
}
rotation_dir = -1;
}