mirror of
https://github.com/esphome/esphome.git
synced 2024-12-19 12:04:54 +01:00
[rotary_encoder] Fix volatile increment/decrement deprecation warnings (#7958)
This commit is contained in:
parent
c187cb547c
commit
88742e0399
1 changed files with 8 additions and 4 deletions
|
@ -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 a new issue