[rotary_encoder] account for min and max value when resetting (#18197)

This commit is contained in:
Samuel Sieb
2026-08-15 11:16:04 -07:00
committed by GitHub
parent 6ed676fe32
commit 5a000cf5e4
@@ -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_) {