mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-12-06 21:23:05 +05:00
fix: normalize setting changes and reject non-finite control values
Round settings to their stored precision before detecting changes and applying relevant range checks. Accept the minimum sensor factor of 0.09. Handle matching NaNs and infinities consistently in float comparisons. Reject non-finite OpenTherm setpoints and PID results before they affect heating control.
This commit is contained in:
1 parent
09b5f6c9e0
commit
a629589122
4 files changed
+76
-30
No files matched your search
@@ -85,30 +85,50 @@ static float getCh2ChannelSetpoint() {
|
||||
}
|
||||
|
||||
static bool needWriteRoomSetpoint(const float target) {
|
||||
if (!std::isfinite(target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !roomSetpointWriteTime ||
|
||||
millis() - roomSetpointWriteTime > roomSetpointWriteInterval ||
|
||||
isFloatDifferent(target, vars.slave.heating.roomTargetTemp, 0.05f);
|
||||
}
|
||||
|
||||
static bool needWriteRoomSetpointCh2(const float target) {
|
||||
if (!std::isfinite(target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !ch2RoomSetpointWriteTime ||
|
||||
millis() - ch2RoomSetpointWriteTime > roomSetpointWriteInterval ||
|
||||
isFloatDifferent(target, vars.slave.ch2.roomTargetTemp, 0.05f);
|
||||
}
|
||||
|
||||
static bool needWriteDhwSetpoint(const float target) {
|
||||
if (!std::isfinite(target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !dhwSetpointWriteTime ||
|
||||
millis() - dhwSetpointWriteTime > dhwSetpointWriteInterval ||
|
||||
isFloatDifferent(target, vars.slave.dhw.targetTemp, 0.05f);
|
||||
}
|
||||
|
||||
static bool needWriteHeatingSetpoint(const float target) {
|
||||
if (!std::isfinite(target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !heatingSetpointWriteTime ||
|
||||
millis() - heatingSetpointWriteTime > heatingSetpointWriteInterval ||
|
||||
isFloatDifferent(target, vars.slave.heating.targetTemp, 0.05f);
|
||||
}
|
||||
|
||||
static bool needWriteCh2Setpoint(const float target) {
|
||||
if (!std::isfinite(target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !ch2SetpointWriteTime ||
|
||||
millis() - ch2SetpointWriteTime > ch2SetpointWriteInterval ||
|
||||
isFloatDifferent(target, vars.slave.ch2.targetTemp, 0.05f);
|
||||
|
||||
Reference in new issue
Block a user