feat: add src/reading.cpp
This commit is contained in:
10
src/reading.cpp
Normal file
10
src/reading.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "reading.hpp"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
ChannelAssessment assess_channel(const Reading& reading, std::int64_t now_ms) {
|
||||||
|
if (reading.timestamp_ms > now_ms || now_ms - reading.timestamp_ms > 5000)
|
||||||
|
return {reading, ChannelState::Stale};
|
||||||
|
if (!std::isfinite(reading.celsius) || reading.celsius < -40.0 || reading.celsius > 125.0)
|
||||||
|
return {reading, ChannelState::OutOfRange};
|
||||||
|
return {reading, ChannelState::Healthy};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user