mirror of
https://github.com/esphome/esphome.git
synced 2026-08-22 22:26:21 +00:00
[rotary_encoder] account for min and max value when resetting (#18197)
This commit is contained in:
@@ -220,7 +220,7 @@ void RotaryEncoderSensor::loop() {
|
||||
}
|
||||
|
||||
if (this->pin_i_ != nullptr && this->pin_i_->digital_read()) {
|
||||
this->store_.counter = 0;
|
||||
this->store_.counter = std::clamp<int32_t>(0, this->store_.min_value, this->store_.max_value);
|
||||
}
|
||||
int counter = this->store_.counter;
|
||||
if (this->store_.last_read != counter || this->publish_initial_value_) {
|
||||
|
||||
Reference in New Issue
Block a user