mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-11 02:34:29 +05:00
refactor: some fixes
This commit is contained in:
@@ -30,9 +30,6 @@ lib_deps =
|
|||||||
laxilef/TinyLogger@^1.1.1
|
laxilef/TinyLogger@^1.1.1
|
||||||
build_type = ${secrets.build_type}
|
build_type = ${secrets.build_type}
|
||||||
build_flags =
|
build_flags =
|
||||||
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
|
||||||
;-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
|
|
||||||
-D PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK305
|
|
||||||
-mtext-section-literals
|
-mtext-section-literals
|
||||||
-D MQTT_CLIENT_STD_FUNCTION_CALLBACK=1
|
-D MQTT_CLIENT_STD_FUNCTION_CALLBACK=1
|
||||||
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
||||||
@@ -75,7 +72,11 @@ lib_ignore =
|
|||||||
extra_scripts =
|
extra_scripts =
|
||||||
post:tools/build.py
|
post:tools/build.py
|
||||||
build_type = ${env.build_type}
|
build_type = ${env.build_type}
|
||||||
build_flags = ${env.build_flags}
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||||
|
;-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
|
||||||
|
-D PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK305
|
||||||
board_build.ldscript = eagle.flash.4m1m.ld
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
|
|
||||||
[esp32_defaults]
|
[esp32_defaults]
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ protected:
|
|||||||
Log.sinfoln(FPSTR(L_OT), F("Started. GPIO IN: %hhu, GPIO OUT: %hhu"), settings.opentherm.inGpio, settings.opentherm.outGpio);
|
Log.sinfoln(FPSTR(L_OT), F("Started. GPIO IN: %hhu, GPIO OUT: %hhu"), settings.opentherm.inGpio, settings.opentherm.outGpio);
|
||||||
|
|
||||||
this->instance->setAfterSendRequestCallback([this](unsigned long request, unsigned long response, OpenThermResponseStatus status, byte attempt) {
|
this->instance->setAfterSendRequestCallback([this](unsigned long request, unsigned long response, OpenThermResponseStatus status, byte attempt) {
|
||||||
Log.straceln(
|
Log.sverboseln(
|
||||||
FPSTR(L_OT),
|
FPSTR(L_OT),
|
||||||
F("ID: %4d Request: %8lx Response: %8lx Attempt: %2d Status: %s"),
|
F("ID: %4d Request: %8lx Response: %8lx Attempt: %2d Status: %s"),
|
||||||
CustomOpenTherm::getDataID(request), request, response, attempt, CustomOpenTherm::statusToString(status)
|
CustomOpenTherm::getDataID(request), request, response, attempt, CustomOpenTherm::statusToString(status)
|
||||||
@@ -158,7 +158,7 @@ protected:
|
|||||||
|| (settings.opentherm.dhwToCh2 && settings.opentherm.dhwPresent && settings.dhw.enabled);
|
|| (settings.opentherm.dhwToCh2 && settings.opentherm.dhwPresent && settings.dhw.enabled);
|
||||||
|
|
||||||
if (settings.opentherm.heatingCh1ToCh2) {
|
if (settings.opentherm.heatingCh1ToCh2) {
|
||||||
vars.master.ch2.targetTemp = vars.master.heating.targetTemp;
|
vars.master.ch2.targetTemp = vars.master.heating.setpointTemp;
|
||||||
|
|
||||||
} else if (settings.opentherm.dhwToCh2) {
|
} else if (settings.opentherm.dhwToCh2) {
|
||||||
vars.master.ch2.targetTemp = vars.master.dhw.targetTemp;
|
vars.master.ch2.targetTemp = vars.master.dhw.targetTemp;
|
||||||
@@ -474,6 +474,9 @@ protected:
|
|||||||
} else {
|
} else {
|
||||||
Log.swarningln(FPSTR(L_OT), F("Failed receive modulation level"));
|
Log.swarningln(FPSTR(L_OT), F("Failed receive modulation level"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (vars.slave.modulation.current > 0) {
|
||||||
|
vars.slave.modulation.current = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modulation level sensors
|
// Modulation level sensors
|
||||||
@@ -897,14 +900,14 @@ protected:
|
|||||||
// Normal heating control
|
// Normal heating control
|
||||||
if (!settings.opentherm.nativeHeatingControl && vars.master.heating.enabled) {
|
if (!settings.opentherm.nativeHeatingControl && vars.master.heating.enabled) {
|
||||||
// Converted target heating temp
|
// Converted target heating temp
|
||||||
float convertedTemp = convertTemp(vars.master.heating.targetTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
float convertedTemp = convertTemp(vars.master.heating.setpointTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||||
|
|
||||||
if (this->needSetHeatingTemp(convertedTemp)) {
|
if (this->needSetHeatingTemp(convertedTemp)) {
|
||||||
// Set max heating temp
|
// Set max heating temp
|
||||||
if (this->setMaxHeatingTemp(convertedTemp)) {
|
if (this->setMaxHeatingTemp(convertedTemp)) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set max heating temp: %.2f (converted: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set max heating temp: %.2f (converted: %.2f)"),
|
||||||
vars.master.heating.targetTemp, convertedTemp
|
vars.master.heating.setpointTemp, convertedTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -917,7 +920,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set target temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set target temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
vars.master.heating.targetTemp, convertedTemp, vars.slave.heating.targetTemp
|
vars.master.heating.setpointTemp, convertedTemp, vars.slave.heating.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -55,14 +55,15 @@ protected:
|
|||||||
this->turbo();
|
this->turbo();
|
||||||
this->hysteresis();
|
this->hysteresis();
|
||||||
|
|
||||||
vars.master.heating.targetTemp = constrain(
|
vars.master.heating.targetTemp = settings.heating.target;
|
||||||
this->getHeatingSetpoint(),
|
vars.master.heating.setpointTemp = constrain(
|
||||||
vars.master.heating.minTemp,
|
this->getHeatingSetpointTemp(),
|
||||||
vars.master.heating.maxTemp
|
this->getHeatingMinSetpointTemp(),
|
||||||
|
this->getHeatingMaxSetpointTemp()
|
||||||
);
|
);
|
||||||
|
|
||||||
Sensors::setValueByType(
|
Sensors::setValueByType(
|
||||||
Sensors::Type::HEATING_SETPOINT_TEMP, vars.master.heating.targetTemp,
|
Sensors::Type::HEATING_SETPOINT_TEMP, vars.master.heating.setpointTemp,
|
||||||
Sensors::ValueType::PRIMARY, true, true
|
Sensors::ValueType::PRIMARY, true, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -104,8 +105,25 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline float getHeatingMinSetpointTemp() {
|
||||||
|
if (settings.opentherm.nativeHeatingControl) {
|
||||||
|
return vars.master.heating.minTemp;
|
||||||
|
|
||||||
float getHeatingSetpoint() {
|
} else {
|
||||||
|
return settings.heating.minTemp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float getHeatingMaxSetpointTemp() {
|
||||||
|
if (settings.opentherm.nativeHeatingControl) {
|
||||||
|
return vars.master.heating.maxTemp;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return settings.heating.maxTemp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float getHeatingSetpointTemp() {
|
||||||
float newTemp = 0;
|
float newTemp = 0;
|
||||||
|
|
||||||
if (fabsf(prevHeatingTarget - settings.heating.target) > 0.0001f) {
|
if (fabsf(prevHeatingTarget - settings.heating.target) > 0.0001f) {
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ struct Variables {
|
|||||||
bool blocking = false;
|
bool blocking = false;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
bool indoorTempControl = false;
|
bool indoorTempControl = false;
|
||||||
|
float setpointTemp = 0.0f;
|
||||||
float targetTemp = 0.0f;
|
float targetTemp = 0.0f;
|
||||||
float currentTemp = 0.0f;
|
float currentTemp = 0.0f;
|
||||||
float returnTemp = 0.0f;
|
float returnTemp = 0.0f;
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ const char S_STA[] PROGMEM = "sta";
|
|||||||
const char S_STATE[] PROGMEM = "state";
|
const char S_STATE[] PROGMEM = "state";
|
||||||
const char S_STATIC_CONFIG[] PROGMEM = "staticConfig";
|
const char S_STATIC_CONFIG[] PROGMEM = "staticConfig";
|
||||||
const char S_STATUS_LED_GPIO[] PROGMEM = "statusLedGpio";
|
const char S_STATUS_LED_GPIO[] PROGMEM = "statusLedGpio";
|
||||||
|
const char S_SETPOINT_TEMP[] PROGMEM = "setpointTemp";
|
||||||
const char S_SUBNET[] PROGMEM = "subnet";
|
const char S_SUBNET[] PROGMEM = "subnet";
|
||||||
const char S_SUMMER_WINTER_MODE[] PROGMEM = "summerWinterMode";
|
const char S_SUMMER_WINTER_MODE[] PROGMEM = "summerWinterMode";
|
||||||
const char S_SYSTEM[] PROGMEM = "system";
|
const char S_SYSTEM[] PROGMEM = "system";
|
||||||
|
|||||||
@@ -1735,6 +1735,7 @@ void varsToJson(const Variables& src, JsonVariant dst) {
|
|||||||
mHeating[FPSTR(S_ENABLED)] = src.master.heating.enabled;
|
mHeating[FPSTR(S_ENABLED)] = src.master.heating.enabled;
|
||||||
mHeating[FPSTR(S_BLOCKING)] = src.master.heating.blocking;
|
mHeating[FPSTR(S_BLOCKING)] = src.master.heating.blocking;
|
||||||
mHeating[FPSTR(S_INDOOR_TEMP_CONTROL)] = src.master.heating.indoorTempControl;
|
mHeating[FPSTR(S_INDOOR_TEMP_CONTROL)] = src.master.heating.indoorTempControl;
|
||||||
|
mHeating[FPSTR(S_SETPOINT_TEMP)] = roundf(src.master.heating.setpointTemp, 2);
|
||||||
mHeating[FPSTR(S_TARGET_TEMP)] = roundf(src.master.heating.targetTemp, 2);
|
mHeating[FPSTR(S_TARGET_TEMP)] = roundf(src.master.heating.targetTemp, 2);
|
||||||
mHeating[FPSTR(S_CURRENT_TEMP)] = roundf(src.master.heating.currentTemp, 2);
|
mHeating[FPSTR(S_CURRENT_TEMP)] = roundf(src.master.heating.currentTemp, 2);
|
||||||
mHeating[FPSTR(S_RETURN_TEMP)] = roundf(src.master.heating.returnTemp, 2);
|
mHeating[FPSTR(S_RETURN_TEMP)] = roundf(src.master.heating.returnTemp, 2);
|
||||||
|
|||||||
@@ -105,7 +105,8 @@
|
|||||||
"mHeatEnabled": "Heating enabled",
|
"mHeatEnabled": "Heating enabled",
|
||||||
"mHeatBlocking": "Heating blocked",
|
"mHeatBlocking": "Heating blocked",
|
||||||
"sHeatActive": "Heating active",
|
"sHeatActive": "Heating active",
|
||||||
"mHeatTargetTemp": "Heating setpoint temp",
|
"mHeatSetpointTemp": "Heating setpoint temp",
|
||||||
|
"mHeatTargetTemp": "Heating target temp",
|
||||||
"mHeatCurrTemp": "Heating current temp",
|
"mHeatCurrTemp": "Heating current temp",
|
||||||
"mHeatRetTemp": "Heating return temp",
|
"mHeatRetTemp": "Heating return temp",
|
||||||
"mHeatIndoorTemp": "Heating, indoor temp",
|
"mHeatIndoorTemp": "Heating, indoor temp",
|
||||||
@@ -113,7 +114,7 @@
|
|||||||
|
|
||||||
"mDhwEnabled": "DHW enabled",
|
"mDhwEnabled": "DHW enabled",
|
||||||
"sDhwActive": "DHW active",
|
"sDhwActive": "DHW active",
|
||||||
"mDhwTargetTemp": "DHW setpoint temp",
|
"mDhwTargetTemp": "DHW target temp",
|
||||||
"mDhwCurrTemp": "DHW current temp",
|
"mDhwCurrTemp": "DHW current temp",
|
||||||
"mDhwRetTemp": "DHW return temp"
|
"mDhwRetTemp": "DHW return temp"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,7 @@
|
|||||||
"mHeatEnabled": "Отопление",
|
"mHeatEnabled": "Отопление",
|
||||||
"mHeatBlocking": "Блокировка отопления",
|
"mHeatBlocking": "Блокировка отопления",
|
||||||
"sHeatActive": "Активность отопления",
|
"sHeatActive": "Активность отопления",
|
||||||
|
"mHeatSetpointTemp": "Отопление, уставка",
|
||||||
"mHeatTargetTemp": "Отопление, целевая температура",
|
"mHeatTargetTemp": "Отопление, целевая температура",
|
||||||
"mHeatCurrTemp": "Отопление, текущая температура",
|
"mHeatCurrTemp": "Отопление, текущая температура",
|
||||||
"mHeatRetTemp": "Отопление, температура обратки",
|
"mHeatRetTemp": "Отопление, температура обратки",
|
||||||
|
|||||||
@@ -144,6 +144,10 @@
|
|||||||
<th scope="row" data-i18n>dashboard.states.sHeatActive</th>
|
<th scope="row" data-i18n>dashboard.states.sHeatActive</th>
|
||||||
<td><input type="radio" class="sHeatActive" aria-invalid="false" checked disabled /></td>
|
<td><input type="radio" class="sHeatActive" aria-invalid="false" checked disabled /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" data-i18n>dashboard.states.mHeatSetpointTemp</th>
|
||||||
|
<td><b class="mHeatSetpointTemp"></b> <span class="tempUnit"></span></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row" data-i18n>dashboard.states.mHeatTargetTemp</th>
|
<th scope="row" data-i18n>dashboard.states.mHeatTargetTemp</th>
|
||||||
<td><b class="mHeatTargetTemp"></b> <span class="tempUnit"></span></td>
|
<td><b class="mHeatTargetTemp"></b> <span class="tempUnit"></span></td>
|
||||||
@@ -458,6 +462,7 @@
|
|||||||
setState('.mHeatEnabled', result.master.heating.enabled);
|
setState('.mHeatEnabled', result.master.heating.enabled);
|
||||||
setState('.mHeatBlocking', result.master.heating.blocking);
|
setState('.mHeatBlocking', result.master.heating.blocking);
|
||||||
setState('.mHeatIndoorTempControl', result.master.heating.indoorTempControl);
|
setState('.mHeatIndoorTempControl', result.master.heating.indoorTempControl);
|
||||||
|
setValue('.mHeatSetpointTemp', result.master.heating.setpointTemp);
|
||||||
setValue('.mHeatTargetTemp', result.master.heating.targetTemp);
|
setValue('.mHeatTargetTemp', result.master.heating.targetTemp);
|
||||||
setValue('.mHeatCurrTemp', result.master.heating.currentTemp);
|
setValue('.mHeatCurrTemp', result.master.heating.currentTemp);
|
||||||
setValue('.mHeatRetTemp', result.master.heating.returnTemp);
|
setValue('.mHeatRetTemp', result.master.heating.returnTemp);
|
||||||
|
|||||||
Reference in New Issue
Block a user