mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 01:08:03 +01:00
Clamp rotary_encoder restored value to min and max (#3184)
This commit is contained in:
parent
8dcc9d6b66
commit
f376a39e55
1 changed files with 2 additions and 0 deletions
|
@ -138,6 +138,8 @@ void RotaryEncoderSensor::setup() {
|
||||||
initial_value = 0;
|
initial_value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
initial_value = clamp(initial_value, this->store_.min_value, this->store_.max_value);
|
||||||
|
|
||||||
this->store_.counter = initial_value;
|
this->store_.counter = initial_value;
|
||||||
this->store_.last_read = initial_value;
|
this->store_.last_read = initial_value;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue