thinkfan
thinkfan copied to clipboard
WIP: Warn about unusual sensor readings
Related issue: #77
This PR attempts to warn user about unusual sensors readings by log messages. In current state it is more like crude attempt and I am open to suggestions, how to make this PR better.
There certainly is room for improvements, just to mention few:
- Is there a generic way to report such readings from any
SensorDriver
instead of impletement it in every driverread_temps()
? - Is it better to use string/stringstream in section of code or predefined string using
#define
in header file?
As in my comment on the issue: It won't work this way. Some implementation-related remarks presupposing you actually want to go through with the mentioned noise estimation:
- The entire logic should go into the
TemperatureState
class. - You should be able to just
<<
everything into thelog(...)
function. - Missing noise should be checked/reported in the
run(...)
function, but only after enough data have been gathered.
Giving it some more thought: If we want to warn/fail only if the noise is actually 0, the noise estimation can (and should) be rather cheap.
Note also that in DANGEROUS mode it should be logged as an error, but thinkfan should keep running. That's what the error(...)
function is for.
Giving it some more thought: If we want to warn/fail only if the noise is actually 0, the noise estimation can (and should) be rather cheap.
Sound reasonable. But just to be on the same side, what exactly do you mean by noise here?
what exactly do you mean by noise here?
Well, the noise in the temperature readings. If there is no noise in a sensor, we can safely assume that sensor isn't measuring anything.
That said, we don't need a "correct" noise measure. We could e.g. just sum up the temperature changes during the last N cycles. If that sum is 0 for a large enough N, we know something must be wrong.
Ok, that sound fairly simple and I'll try to implement it.
Oh just realize this is from 2019. Sorry for digging it up. Do we still need this feature though?