From 0cb361d24364be57cd614e520310d12de1884c32 Mon Sep 17 00:00:00 2001 From: Yurii Date: Tue, 17 Dec 2024 10:30:06 +0300 Subject: [PATCH] refactor: OT option ``heatingCh2Enabled`` has been renamed to ``ch2AlwaysEnabled`` --- src/OpenThermTask.h | 2 +- src/Settings.h | 2 +- src/strings.h | 2 +- src/utils.h | 16 ++++++++-------- src_data/locales/en.json | 2 +- src_data/locales/ru.json | 2 +- src_data/pages/settings.html | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/OpenThermTask.h b/src/OpenThermTask.h index 1e5cf5c..819d481 100644 --- a/src/OpenThermTask.h +++ b/src/OpenThermTask.h @@ -157,7 +157,7 @@ protected: vars.master.dhw.targetTemp = settings.dhw.target; // CH2 settings - vars.master.ch2.enabled = settings.opentherm.options.heatingCh2Enabled + vars.master.ch2.enabled = settings.opentherm.options.ch2AlwaysEnabled || (settings.opentherm.options.heatingToCh2 && vars.master.heating.enabled) || (settings.opentherm.options.dhwToCh2 && settings.opentherm.options.dhwSupport && settings.dhw.enabled); diff --git a/src/Settings.h b/src/Settings.h index 05f4ef7..2dcae8d 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -61,7 +61,7 @@ struct Settings { bool dhwSupport = true; bool coolingSupport = false; bool summerWinterMode = false; - bool heatingCh2Enabled = true; + bool ch2AlwaysEnabled = true; bool heatingToCh2 = false; bool dhwToCh2 = false; bool dhwBlocking = false; diff --git a/src/strings.h b/src/strings.h index 9f3de05..6f18d3a 100644 --- a/src/strings.h +++ b/src/strings.h @@ -50,6 +50,7 @@ const char S_BSSID[] PROGMEM = "bssid"; const char S_BUILD[] PROGMEM = "build"; const char S_CASCADE_CONTROL[] PROGMEM = "cascadeControl"; const char S_CHANNEL[] PROGMEM = "channel"; +const char S_CH2_ALWAYS_ENABLED[] PROGMEM = "ch2AlwaysEnabled"; const char S_CHIP[] PROGMEM = "chip"; const char S_CODE[] PROGMEM = "code"; const char S_CONNECTED[] PROGMEM = "connected"; @@ -91,7 +92,6 @@ const char S_GPIO[] PROGMEM = "gpio"; const char S_HEAP[] PROGMEM = "heap"; const char S_HEATING[] PROGMEM = "heating"; const char S_HEATING_TO_CH2[] PROGMEM = "heatingToCh2"; -const char S_HEATING_CH2_ENABLED[] PROGMEM = "heatingCh2Enabled"; const char S_HIDDEN[] PROGMEM = "hidden"; const char S_HOME_ASSISTANT_DISCOVERY[] PROGMEM = "homeAssistantDiscovery"; const char S_HOSTNAME[] PROGMEM = "hostname"; diff --git a/src/utils.h b/src/utils.h index 9034381..d6afb27 100644 --- a/src/utils.h +++ b/src/utils.h @@ -382,7 +382,7 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) { otOptions[FPSTR(S_DHW_SUPPORT)] = src.opentherm.options.dhwSupport; otOptions[FPSTR(S_COOLING_SUPPORT)] = src.opentherm.options.coolingSupport; otOptions[FPSTR(S_SUMMER_WINTER_MODE)] = src.opentherm.options.summerWinterMode; - otOptions[FPSTR(S_HEATING_CH2_ENABLED)] = src.opentherm.options.heatingCh2Enabled; + otOptions[FPSTR(S_CH2_ALWAYS_ENABLED)] = src.opentherm.options.ch2AlwaysEnabled; otOptions[FPSTR(S_HEATING_TO_CH2)] = src.opentherm.options.heatingToCh2; otOptions[FPSTR(S_DHW_TO_CH2)] = src.opentherm.options.dhwToCh2; otOptions[FPSTR(S_DHW_BLOCKING)] = src.opentherm.options.dhwBlocking; @@ -748,13 +748,13 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_HEATING_CH2_ENABLED)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_HEATING_CH2_ENABLED)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_CH2_ALWAYS_ENABLED)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_CH2_ALWAYS_ENABLED)].as(); - if (value != dst.opentherm.options.heatingCh2Enabled) { - dst.opentherm.options.heatingCh2Enabled = value; + if (value != dst.opentherm.options.ch2AlwaysEnabled) { + dst.opentherm.options.ch2AlwaysEnabled = value; - if (dst.opentherm.options.heatingCh2Enabled) { + if (dst.opentherm.options.ch2AlwaysEnabled) { dst.opentherm.options.heatingToCh2 = false; dst.opentherm.options.dhwToCh2 = false; } @@ -770,7 +770,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false dst.opentherm.options.heatingToCh2 = value; if (dst.opentherm.options.heatingToCh2) { - dst.opentherm.options.heatingCh2Enabled = false; + dst.opentherm.options.ch2AlwaysEnabled = false; dst.opentherm.options.dhwToCh2 = false; } @@ -785,7 +785,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false dst.opentherm.options.dhwToCh2 = value; if (dst.opentherm.options.dhwToCh2) { - dst.opentherm.options.heatingCh2Enabled = false; + dst.opentherm.options.ch2AlwaysEnabled = false; dst.opentherm.options.heatingToCh2 = false; } diff --git a/src_data/locales/en.json b/src_data/locales/en.json index 9695609..4017852 100644 --- a/src_data/locales/en.json +++ b/src_data/locales/en.json @@ -360,7 +360,7 @@ "dhwSupport": "DHW support", "coolingSupport": "Cooling support", "summerWinterMode": "Summer/winter mode", - "heatingCh2Enabled": "Heating CH2 always enabled", + "ch2AlwaysEnabled": "CH2 always enabled", "heatingToCh2": "Duplicate heating to CH2", "dhwToCh2": "Duplicate DHW to CH2", "dhwBlocking": "DHW blocking", diff --git a/src_data/locales/ru.json b/src_data/locales/ru.json index 89a590e..413acc7 100644 --- a/src_data/locales/ru.json +++ b/src_data/locales/ru.json @@ -360,7 +360,7 @@ "dhwSupport": "Поддержка ГВС", "coolingSupport": "Поддержка охлаждения", "summerWinterMode": "Летний/зимний режим", - "heatingCh2Enabled": "Канал 2 отопления всегда вкл.", + "ch2AlwaysEnabled": "Канал 2 всегда вкл.", "heatingToCh2": "Дублировать параметры отопления в канал 2", "dhwToCh2": "Дублировать параметры ГВС в канал 2", "dhwBlocking": "DHW blocking", diff --git a/src_data/pages/settings.html b/src_data/pages/settings.html index 8110135..9c7ff42 100644 --- a/src_data/pages/settings.html +++ b/src_data/pages/settings.html @@ -420,8 +420,8 @@