mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-13 19:54:28 +05:00
feat: added freeze protection parameter for heating, removed forced start of heating in emergency mode #157
This commit is contained in:
@@ -152,6 +152,7 @@ protected:
|
||||
}
|
||||
this->yield();
|
||||
|
||||
this->heating();
|
||||
this->emergency();
|
||||
this->ledStatus();
|
||||
this->cascadeControl();
|
||||
@@ -228,6 +229,52 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
void heating() {
|
||||
// anti freeze protection
|
||||
if (!settings.heating.enabled) {
|
||||
float minTemp = 255.0f;
|
||||
uint8_t availableSensors = 0;
|
||||
|
||||
if (Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::INDOOR_TEMP)) {
|
||||
auto value = Sensors::getMeanValueByPurpose(Sensors::Purpose::INDOOR_TEMP, Sensors::ValueType::PRIMARY);
|
||||
if (value < minTemp) {
|
||||
minTemp = value;
|
||||
}
|
||||
|
||||
availableSensors++;
|
||||
}
|
||||
|
||||
if (Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::HEATING_TEMP)) {
|
||||
auto value = Sensors::getMeanValueByPurpose(Sensors::Purpose::HEATING_TEMP, Sensors::ValueType::PRIMARY);
|
||||
if (value < minTemp) {
|
||||
minTemp = value;
|
||||
}
|
||||
|
||||
availableSensors++;
|
||||
}
|
||||
|
||||
if (Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::HEATING_RETURN_TEMP)) {
|
||||
auto value = Sensors::getMeanValueByPurpose(Sensors::Purpose::HEATING_RETURN_TEMP, Sensors::ValueType::PRIMARY);
|
||||
if (value < minTemp) {
|
||||
minTemp = value;
|
||||
}
|
||||
|
||||
availableSensors++;
|
||||
}
|
||||
|
||||
if (availableSensors && minTemp <= settings.heating.antiFreezeTemp) {
|
||||
settings.heating.enabled = true;
|
||||
fsSettings.update();
|
||||
|
||||
Log.sinfoln(
|
||||
FPSTR(L_MAIN),
|
||||
F("Heating turned on by anti freeze protection, current min temp: %.2f, threshold: %hhu"),
|
||||
minTemp, settings.heating.antiFreezeTemp
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void emergency() {
|
||||
// flags
|
||||
uint8_t emergencyFlags = 0b00000000;
|
||||
|
||||
Reference in New Issue
Block a user