turn of fan when pump cycle starts to prevent too much current draw
This commit is contained in:
parent
a9671773f3
commit
39a8ecde85
@ -12,6 +12,7 @@ Heating::Heating() : mHeizungTicker(),
|
||||
msettings(nullptr),
|
||||
mheatingservice(nullptr),
|
||||
mHeatingStatus(false),
|
||||
mPumpCycleActive(false),
|
||||
lasttemp(0),
|
||||
lasthum(0),
|
||||
sensor() {}
|
||||
@ -32,8 +33,8 @@ void Heating::init(unsigned mode, const SettingState *settings, HeatingInfoServi
|
||||
|
||||
sensor.onData([this](float hum, float temp) {
|
||||
schedule_function([hum, temp, this]() {
|
||||
Serial.printf("Temp: %gdegC\n", temp);
|
||||
Serial.printf("Humid: %g%%\n", hum);
|
||||
// Serial.printf("Temp: %gdegC\n", temp);
|
||||
// Serial.printf("Humid: %g%%\n", hum);
|
||||
|
||||
mheatingservice->setSensorData(hum, temp);
|
||||
|
||||
@ -76,9 +77,12 @@ void Heating::handleHeatingEvents() {
|
||||
if (mHeatingStatus == false) {
|
||||
// turn off active turnoff timers
|
||||
mLuefterTicker.detach();
|
||||
////Serial.println("heating should run now!");
|
||||
//Serial.println("heating should run now!");
|
||||
// turn on heating and fan
|
||||
digitalWrite(LuefterPin, HIGH);
|
||||
if (!mPumpCycleActive) {
|
||||
digitalWrite(LuefterPin, HIGH);
|
||||
}
|
||||
|
||||
digitalWrite(HeizungPin, HIGH);
|
||||
|
||||
mHeatingStatus = true;
|
||||
@ -139,3 +143,16 @@ void Heating::handleTimeHeater() {
|
||||
func();
|
||||
mHeizungTicker.attach(refreshperiod, func);
|
||||
}
|
||||
|
||||
void Heating::setPumCycleActive(bool active) {
|
||||
mPumpCycleActive = active;
|
||||
|
||||
// turn off fan if pumpcycleactive
|
||||
if (active) {
|
||||
digitalWrite(LuefterPin, LOW);
|
||||
} else {
|
||||
if (mHeatingStatus) {
|
||||
digitalWrite(LuefterPin, HIGH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ public:
|
||||
*/
|
||||
void init(unsigned mode, const SettingState* settings, HeatingInfoService *heatingservice);
|
||||
|
||||
void setPumCycleActive(bool active);
|
||||
|
||||
enum MODES {TIME, HUMIDITY};
|
||||
private:
|
||||
Ticker mHeizungTicker;
|
||||
@ -30,7 +32,7 @@ private:
|
||||
const SettingState* msettings;
|
||||
HeatingInfoService *mheatingservice;
|
||||
|
||||
bool mHeatingStatus;
|
||||
bool mHeatingStatus, mPumpCycleActive;
|
||||
|
||||
float lasttemp;
|
||||
float lasthum;
|
||||
|
@ -45,6 +45,9 @@ void pumpeSchalten(bool on) {
|
||||
pumpcycles++;
|
||||
generalinfo.setPumpCycles(pumpcycles);
|
||||
|
||||
// pump cycle started
|
||||
mHeat.setPumCycleActive(true);
|
||||
|
||||
pumpendauer.once((float) settingsservice.getSettings()->maxpumpduration + 1, []() {
|
||||
//erlaube keine einschaltung von mehr als 60 sek
|
||||
if (Timer::getSystemSeconds() - turnontime >=
|
||||
@ -57,6 +60,9 @@ void pumpeSchalten(bool on) {
|
||||
});
|
||||
} else {
|
||||
generalinfo.setPumpDuration(Timer::getSystemSeconds() - turnontime);
|
||||
|
||||
// pump cycle stopped...
|
||||
mHeat.setPumCycleActive(false);
|
||||
}
|
||||
|
||||
// save pump start time
|
||||
|
Loading…
Reference in New Issue
Block a user