mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-11 18:54:28 +05:00
refactor: some changes
This commit is contained in:
@@ -470,17 +470,19 @@ protected:
|
|||||||
float power = 0.0f;
|
float power = 0.0f;
|
||||||
if (settings.opentherm.maxPower > 0.1f) {
|
if (settings.opentherm.maxPower > 0.1f) {
|
||||||
power += settings.opentherm.minPower;
|
power += settings.opentherm.minPower;
|
||||||
|
|
||||||
if (vars.slave.modulation.current > 0) {
|
if (vars.slave.modulation.current > 0) {
|
||||||
power += (
|
power += (
|
||||||
settings.opentherm.maxPower - settings.opentherm.minPower
|
settings.opentherm.maxPower - settings.opentherm.minPower
|
||||||
) / 100.0f * vars.slave.modulation.current;
|
) / 100.0f * vars.slave.modulation.current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
vars.slave.power.current = power;
|
||||||
|
|
||||||
Log.snoticeln(
|
Log.snoticeln(
|
||||||
FPSTR(L_OT), F("Received modulation level: %hhu%%, power: %.2f of %.2f kW (min: %.2f kW)"),
|
FPSTR(L_OT), F("Received modulation level: %hhu%%, power: %.2f of %.2f kW (min: %.2f kW)"),
|
||||||
vars.slave.modulation.current, power, settings.opentherm.maxPower, settings.opentherm.minPower
|
vars.slave.modulation.current, vars.slave.power.current,
|
||||||
|
settings.opentherm.maxPower, settings.opentherm.minPower
|
||||||
);
|
);
|
||||||
|
|
||||||
// Modulation level sensors
|
// Modulation level sensors
|
||||||
@@ -491,7 +493,7 @@ protected:
|
|||||||
|
|
||||||
// Power sensors
|
// Power sensors
|
||||||
Sensors::setValueByType(
|
Sensors::setValueByType(
|
||||||
Sensors::Type::OT_CURRENT_POWER, power,
|
Sensors::Type::OT_CURRENT_POWER, vars.slave.power.current,
|
||||||
Sensors::ValueType::PRIMARY, true, true
|
Sensors::ValueType::PRIMARY, true, true
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -501,16 +503,17 @@ protected:
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
vars.slave.modulation.current = 0;
|
vars.slave.modulation.current = 0;
|
||||||
|
vars.slave.power.current = 0.0f;
|
||||||
|
|
||||||
// Modulation level sensors
|
// Modulation level sensors
|
||||||
Sensors::setValueByType(
|
Sensors::setValueByType(
|
||||||
Sensors::Type::OT_MODULATION_LEVEL, 0.0f,
|
Sensors::Type::OT_MODULATION_LEVEL, vars.slave.modulation.current,
|
||||||
Sensors::ValueType::PRIMARY, true, true
|
Sensors::ValueType::PRIMARY, true, true
|
||||||
);
|
);
|
||||||
|
|
||||||
// Power sensors
|
// Power sensors
|
||||||
Sensors::setValueByType(
|
Sensors::setValueByType(
|
||||||
Sensors::Type::OT_CURRENT_POWER, 0.0f,
|
Sensors::Type::OT_CURRENT_POWER, vars.slave.power.current,
|
||||||
Sensors::ValueType::PRIMARY, true, true
|
Sensors::ValueType::PRIMARY, true, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user