NVMeBasicContext: Don't poll the sensor if it's not available
This avoids a flood of log messages if the system isn't in the right
state.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I2db6ab05c1eff5b4d2d9c95981dfe34352916652
diff --git a/src/NVMeBasicContext.cpp b/src/NVMeBasicContext.cpp
index 2287431..3c8b74d 100644
--- a/src/NVMeBasicContext.cpp
+++ b/src/NVMeBasicContext.cpp
@@ -292,6 +292,13 @@
std::shared_ptr<NVMeSensor>& sensor = sensors.front();
+ if (!sensor->readingStateGood())
+ {
+ sensor->markAvailable(false);
+ sensor->updateValue(std::numeric_limits<double>::quiet_NaN());
+ return;
+ }
+
/* Ensure sensor query parameters are sensible */
if (sensor->bus < 0)
{