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:
Yurii committed 2026-11-29 05:43:52 +03:00
1 parent 09b5f6c9e0
commit a629589122
4 files changed
+76 -30

No files matched your search

+12
View File
@@ -159,6 +159,18 @@ inline bool isValidTemp(const float value, UnitSystem unit, const float min = 0.
}
inline bool isFloatDifferent(float first, float second, float tolerance) {
if (first == second) {
return false;
}
if (std::isnan(first) && std::isnan(second)) {
return false;
}
if (!std::isfinite(first) || !std::isfinite(second)) {
return true;
}
return fabsf(first - second) > tolerance;
}