mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-14 20:24:28 +05:00
feat: setting the cooling setpoint if cooling support is enabled
This commit is contained in:
@@ -236,7 +236,7 @@ protected:
|
||||
vars.slave.heating.active = CustomOpenTherm::isCentralHeatingActive(response);
|
||||
vars.slave.dhw.active = settings.opentherm.options.dhwSupport ? CustomOpenTherm::isHotWaterActive(response) : false;
|
||||
vars.slave.flame = CustomOpenTherm::isFlameOn(response);
|
||||
vars.slave.cooling = CustomOpenTherm::isCoolingActive(response);
|
||||
vars.slave.cooling.active = CustomOpenTherm::isCoolingActive(response);
|
||||
vars.slave.ch2.active = CustomOpenTherm::isCh2Active(response);
|
||||
vars.slave.fault.active = CustomOpenTherm::isFault(response);
|
||||
|
||||
@@ -250,7 +250,7 @@ protected:
|
||||
Log.snoticeln(
|
||||
FPSTR(L_OT), F("Received boiler status. Heating: %hhu; DHW: %hhu; flame: %hhu; cooling: %hhu; channel 2: %hhu; fault: %hhu; diag: %hhu"),
|
||||
vars.slave.heating.active, vars.slave.dhw.active,
|
||||
vars.slave.flame, vars.slave.cooling, vars.slave.ch2.active, vars.slave.fault.active, vars.slave.diag.active
|
||||
vars.slave.flame, vars.slave.cooling.active, vars.slave.ch2.active, vars.slave.fault.active, vars.slave.diag.active
|
||||
);
|
||||
}
|
||||
|
||||
@@ -318,6 +318,8 @@ protected:
|
||||
vars.slave.dhw.enabled = false;
|
||||
vars.slave.dhw.active = false;
|
||||
vars.slave.flame = false;
|
||||
vars.slave.cooling.active = false;
|
||||
vars.slave.cooling.setpoint = 0;
|
||||
vars.slave.fault.active = false;
|
||||
vars.slave.fault.code = 0;
|
||||
vars.slave.diag.active = false;
|
||||
@@ -688,6 +690,22 @@ protected:
|
||||
this->prevUpdateNonEssentialVars = millis();
|
||||
}
|
||||
|
||||
// Set cooling setpoint = heating max modulation
|
||||
if (settings.opentherm.options.coolingSupport) {
|
||||
if (this->setCoolingSetpoint(settings.heating.maxModulation)) {
|
||||
Log.snoticeln(
|
||||
FPSTR(L_OT), F("Set cooling setpoint: %hhu%% (response: %hhu%%)"),
|
||||
settings.heating.maxModulation, vars.slave.cooling.setpoint
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.swarningln(
|
||||
FPSTR(L_OT), F("Failed set cooling setpoint: %hhu%% (response: %hhu%%)"),
|
||||
settings.heating.maxModulation, vars.slave.cooling.setpoint
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set max modulation level
|
||||
uint8_t targetMaxModulation = vars.slave.modulation.max;
|
||||
if (vars.slave.heating.active) {
|
||||
@@ -1568,6 +1586,26 @@ protected:
|
||||
return CustomOpenTherm::getUInt(response) == request;
|
||||
}
|
||||
|
||||
bool setCoolingSetpoint(const uint8_t value) {
|
||||
const unsigned int request = CustomOpenTherm::toFloat(value);
|
||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||
OpenThermRequestType::WRITE_DATA,
|
||||
OpenThermMessageID::CoolingControl,
|
||||
request
|
||||
));
|
||||
|
||||
if (!CustomOpenTherm::isValidResponse(response)) {
|
||||
return false;
|
||||
|
||||
} else if (!CustomOpenTherm::isValidResponseId(response, OpenThermMessageID::CoolingControl)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
vars.slave.cooling.setpoint = CustomOpenTherm::getFloat(response);
|
||||
|
||||
return CustomOpenTherm::getUInt(response) == request;
|
||||
}
|
||||
|
||||
bool setMaxModulationLevel(const uint8_t value) {
|
||||
const unsigned int request = CustomOpenTherm::toFloat(value);
|
||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||
|
||||
Reference in New Issue
Block a user