mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 16:47:57 +01:00
Fix PIDController::in_deadband() to give correct result when error is zero (#5078)
This commit is contained in:
parent
a539197bc4
commit
9344d85414
@ -29,7 +29,7 @@ float PIDController::update(float setpoint, float process_value) {
|
|||||||
bool PIDController::in_deadband() {
|
bool PIDController::in_deadband() {
|
||||||
// return (fabs(error) < deadband_threshold);
|
// return (fabs(error) < deadband_threshold);
|
||||||
float err = -error_;
|
float err = -error_;
|
||||||
return ((err > 0 && err < threshold_high_) || (err < 0 && err > threshold_low_));
|
return (threshold_low_ < err && err < threshold_high_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIDController::calculate_proportional_term_() {
|
void PIDController::calculate_proportional_term_() {
|
||||||
|
Loading…
Reference in New Issue
Block a user