From 3a5f1a3a74f994daee3f896184e2c31d5ce3f3f1 Mon Sep 17 00:00:00 2001 From: lukas Date: Wed, 31 Mar 2021 17:46:36 +0200 Subject: [PATCH] interrupt full heat cycle when pump starts --- src/Heating.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Heating.cpp b/src/Heating.cpp index 53ae6ab..ea25d59 100644 --- a/src/Heating.cpp +++ b/src/Heating.cpp @@ -62,7 +62,10 @@ void Heating::init(unsigned mode, const SettingState *settings, HeatingInfoServi }); mHeizungTicker.attach(10, [this]() { - sensor.read(); + // only check if no pump cycle is active + if (!mPumpCycleActive) { + sensor.read(); + } }); break; @@ -78,10 +81,8 @@ void Heating::handleHeatingEvents() { // turn off active turnoff timers mLuefterTicker.detach(); //Serial.println("heating should run now!"); - // turn on heating and fan - if (!mPumpCycleActive) { - digitalWrite(LuefterPin, HIGH); - } + + digitalWrite(LuefterPin, HIGH); digitalWrite(HeizungPin, HIGH); @@ -150,9 +151,21 @@ void Heating::setPumCycleActive(bool active) { // turn off fan if pumpcycleactive if (active) { digitalWrite(LuefterPin, LOW); - } else { + digitalWrite(HeizungPin, LOW); + + mHeizungTicker.detach(); + if (mHeatingStatus) { - digitalWrite(LuefterPin, HIGH); + // to add the correct time to the heat min counter! + mheatingservice->addHeatTime(Timer::getSystemSeconds() - mheatingservice->getLastHeatingStartTime()); } + } else { + mHeizungTicker.detach(); + mHeizungTicker.attach(10, [this]() { + // only check if no pump cycle is active + if (!mPumpCycleActive) { + sensor.read(); + } + }); } }