feat: added freeze protection parameter for heating, removed forced start of heating in emergency mode #157

This commit is contained in:
Yurii
2025-06-27 00:28:38 +03:00
parent 58b0c18448
commit f6cfdf3263
9 changed files with 87 additions and 7 deletions

View File

@@ -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;