15min refresh time between heats

This commit is contained in:
Lukas Heiligenbrunner 2020-11-17 18:37:47 +01:00
parent 94b635252d
commit ffb62b9297

View File

@ -9,7 +9,7 @@ void Heating::init(Temperature *tempsensor, unsigned mode) {
switch (mode) { switch (mode) {
case TIME: { case TIME: {
const unsigned percentOn = 20; const unsigned percentOn = 20;
const unsigned refreshperiod = 60; const unsigned refreshperiod = 900;
const auto func = [this]() { const auto func = [this]() {
mLuefterTicker.detach(); mLuefterTicker.detach();
@ -20,13 +20,13 @@ void Heating::init(Temperature *tempsensor, unsigned mode) {
Serial.println("Turning on heating"); Serial.println("Turning on heating");
mTurnOffTicker.once(refreshperiod * percentOn / 100, []() { mTurnOffTicker.once((int)((float)refreshperiod * (float)percentOn / 100.0), []() {
digitalWrite(HeizungPin, LOW); digitalWrite(HeizungPin, LOW);
Serial.println("Turned off heating!"); Serial.println("Turned off heating!");
}); });
mLuefterTicker.once((refreshperiod * percentOn / 100) + 30, []() { mLuefterTicker.once((int)(((float)refreshperiod * (float)percentOn / 100.0) + 30.0), []() {
digitalWrite(LuefterPin, LOW); digitalWrite(LuefterPin, LOW);
Serial.println("Turned off fan!"); Serial.println("Turned off fan!");
@ -34,7 +34,7 @@ void Heating::init(Temperature *tempsensor, unsigned mode) {
}; };
func(); func();
mHeizungTicker.attach(60, func); mHeizungTicker.attach(refreshperiod, func);
break; break;
} }
case HUMIDITY: case HUMIDITY: