mirror of
https://github.com/esphome/esphome.git
synced 2024-12-20 16:18:49 +01:00
[rotary_encoder] Fix volatile increment/decrement deprecation warnings (#7958)
This commit is contained in:
parent
c187cb547c
commit
88742e0399
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user