refactor: OT option `heatingCh2Enabled has been renamed to ch2AlwaysEnabled`

This commit is contained in:
Yurii
2024-12-17 10:30:06 +03:00
parent c7f54ca4fb
commit 0cb361d243
7 changed files with 16 additions and 16 deletions

View File

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

View File

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

View File

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

View File

@@ -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>()) {
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_HEATING_CH2_ENABLED)].as<bool>();
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_CH2_ALWAYS_ENABLED)].is<bool>()) {
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_CH2_ALWAYS_ENABLED)].as<bool>();
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;
}

View File

@@ -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",

View File

@@ -360,7 +360,7 @@
"dhwSupport": "Поддержка ГВС",
"coolingSupport": "Поддержка охлаждения",
"summerWinterMode": "Летний/зимний режим",
"heatingCh2Enabled": "Канал 2 отопления всегда вкл.",
"ch2AlwaysEnabled": "Канал 2 всегда вкл.",
"heatingToCh2": "Дублировать параметры отопления в канал 2",
"dhwToCh2": "Дублировать параметры ГВС в канал 2",
"dhwBlocking": "DHW blocking",

View File

@@ -420,8 +420,8 @@
</label>
<label>
<input type="checkbox" name="opentherm[options][heatingCh2Enabled]" value="true">
<span data-i18n>settings.ot.options.heatingCh2Enabled</span>
<input type="checkbox" name="opentherm[options][ch2AlwaysEnabled]" value="true">
<span data-i18n>settings.ot.options.ch2AlwaysEnabled</span>
</label>
<label>
@@ -704,7 +704,7 @@
setCheckboxValue("[name='opentherm[options][dhwSupport]']", data.opentherm.options.dhwSupport);
setCheckboxValue("[name='opentherm[options][coolingSupport]']", data.opentherm.options.coolingSupport);
setCheckboxValue("[name='opentherm[options][summerWinterMode]']", data.opentherm.options.summerWinterMode);
setCheckboxValue("[name='opentherm[options][heatingCh2Enabled]']", data.opentherm.options.heatingCh2Enabled);
setCheckboxValue("[name='opentherm[options][ch2AlwaysEnabled]']", data.opentherm.options.ch2AlwaysEnabled);
setCheckboxValue("[name='opentherm[options][heatingToCh2]']", data.opentherm.options.heatingToCh2);
setCheckboxValue("[name='opentherm[options][dhwToCh2]']", data.opentherm.options.dhwToCh2);
setCheckboxValue("[name='opentherm[options][dhwBlocking]']", data.opentherm.options.dhwBlocking);