refactor: cosmetic changes; move maxModulation setting to opentherm section

This commit is contained in:
Yurii
2024-10-15 05:09:20 +03:00
parent c32c643442
commit 57cf98ca19
8 changed files with 91 additions and 110 deletions

View File

@@ -345,6 +345,7 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
dst["opentherm"]["faultStateGpio"] = src.opentherm.faultStateGpio;
dst["opentherm"]["invertFaultState"] = src.opentherm.invertFaultState;
dst["opentherm"]["memberIdCode"] = src.opentherm.memberIdCode;
dst["opentherm"]["maxModulation"] = src.opentherm.maxModulation;
dst["opentherm"]["pressureFactor"] = roundd(src.opentherm.pressureFactor, 2);
dst["opentherm"]["dhwFlowRateFactor"] = roundd(src.opentherm.dhwFlowRateFactor, 2);
dst["opentherm"]["minPower"] = roundd(src.opentherm.minPower, 2);
@@ -388,7 +389,6 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
dst["heating"]["hysteresis"] = roundd(src.heating.hysteresis, 2);
dst["heating"]["minTemp"] = src.heating.minTemp;
dst["heating"]["maxTemp"] = src.heating.maxTemp;
dst["heating"]["maxModulation"] = src.heating.maxModulation;
dst["dhw"]["enable"] = src.dhw.enable;
dst["dhw"]["target"] = roundd(src.dhw.target, 1);
@@ -700,6 +700,15 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
}
}
if (!src["opentherm"]["maxModulation"].isNull()) {
unsigned char value = src["opentherm"]["maxModulation"].as<unsigned char>();
if (value > 0 && value <= 100 && value != dst.opentherm.maxModulation) {
dst.opentherm.maxModulation = value;
changed = true;
}
}
if (!src["opentherm"]["pressureFactor"].isNull()) {
float value = src["opentherm"]["pressureFactor"].as<float>();
@@ -1205,15 +1214,6 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
}
}
if (!src["heating"]["maxModulation"].isNull()) {
unsigned char value = src["heating"]["maxModulation"].as<unsigned char>();
if (value > 0 && value <= 100 && value != dst.heating.maxModulation) {
dst.heating.maxModulation = value;
changed = true;
}
}
// dhw
if (src["dhw"]["enable"].is<bool>()) {