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