Ajout Thermostat

This commit is contained in:
Serge NOEL
2026-03-11 11:50:45 +01:00
parent d3db51dba2
commit ab74dc5fbe
14 changed files with 496 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
#include "thermostat.h"
Thermostat::Thermostat() : mode(MODE_OFF), targetTemp(0), heating(false) {
presetTemps[MODE_CONFORT] = 21.0;
presetTemps[MODE_ECO] = 18.0;
presetTemps[MODE_BOOST] = 23.0;
presetTemps[MODE_HORS_GEL] = 7.0;
presetTemps[MODE_OFF] = 0.0;
}
void Thermostat::setMode(ThermostatMode m) {
mode = m;
targetTemp = presetTemps[mode];
}
void Thermostat::setTemperature(float temp) {
targetTemp = temp;
}
void Thermostat::setPresetTemp(ThermostatMode m, float temp) {
presetTemps[m] = temp;
if (mode == m) targetTemp = temp;
}
void Thermostat::update(float currentTemp) {
if (mode == MODE_OFF) {
heating = false;
} else {
heating = (currentTemp < targetTemp);
}
}
bool Thermostat::isHeating() const { return heating; }
ThermostatMode Thermostat::getMode() const { return mode; }
float Thermostat::getTargetTemp() const { return targetTemp; }