From e4211c872c8cbe05553f8e8e986707c5d1e131e0 Mon Sep 17 00:00:00 2001 From: Yurii Date: Fri, 1 Nov 2024 12:47:32 +0300 Subject: [PATCH] fix: hysteresis with native heating control has been fixed --- src/OpenThermTask.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/OpenThermTask.h b/src/OpenThermTask.h index 7a676a8..b37fcfe 100644 --- a/src/OpenThermTask.h +++ b/src/OpenThermTask.h @@ -667,26 +667,25 @@ protected: } } } + } + // Hysteresis + // Only if enabled PID or/and Equitherm or Native heating control via OT + bool useHyst = false; + if (settings.heating.hysteresis > 0.01f && vars.sensors.indoor.connected) { + useHyst = settings.equitherm.enable || settings.pid.enable || settings.opentherm.nativeHeatingControl; + } - // Hysteresis - // Only if enabled PID or/and Equitherm or Native heating control via OT - bool useHyst = false; - if (settings.heating.hysteresis > 0.01f && vars.sensors.indoor.connected) { - useHyst = settings.equitherm.enable || settings.pid.enable || settings.opentherm.nativeHeatingControl; - } + if (useHyst) { + if (!this->heatingBlocking && vars.temperatures.indoor - settings.heating.target + 0.0001f >= settings.heating.hysteresis) { + this->heatingBlocking = true; - if (useHyst) { - if (!this->heatingBlocking && vars.temperatures.indoor - settings.heating.target + 0.0001f >= settings.heating.hysteresis) { - this->heatingBlocking = true; - - } else if (this->heatingBlocking && vars.temperatures.indoor - settings.heating.target - 0.0001f <= -(settings.heating.hysteresis)) { - this->heatingBlocking = false; - } - - } else if (this->heatingBlocking) { + } else if (this->heatingBlocking && vars.temperatures.indoor - settings.heating.target - 0.0001f <= -(settings.heating.hysteresis)) { this->heatingBlocking = false; } + + } else if (this->heatingBlocking) { + this->heatingBlocking = false; } }