mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 06:06:33 +00:00
[opentherm.output] Fix `lerp
` (#9506)
This commit is contained in:
parent
11a051401f
commit
321f2f87b0
@ -10,7 +10,7 @@ void opentherm::OpenthermOutput::write_state(float state) {
|
|||||||
ESP_LOGD(TAG, "Received state: %.2f. Min value: %.2f, max value: %.2f", state, min_value_, max_value_);
|
ESP_LOGD(TAG, "Received state: %.2f. Min value: %.2f, max value: %.2f", state, min_value_, max_value_);
|
||||||
this->state = state < 0.003 && this->zero_means_zero_
|
this->state = state < 0.003 && this->zero_means_zero_
|
||||||
? 0.0
|
? 0.0
|
||||||
: clamp(lerp(state, min_value_, max_value_), min_value_, max_value_);
|
: clamp(std::lerp(min_value_, max_value_, state), min_value_, max_value_);
|
||||||
this->has_state_ = true;
|
this->has_state_ = true;
|
||||||
ESP_LOGD(TAG, "Output %s set to %.2f", this->id_, this->state);
|
ESP_LOGD(TAG, "Output %s set to %.2f", this->id_, this->state);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user