mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-30 10:13:04 +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
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user