Prevent repeatedly reading PLDM sensors when proc garded
If a processor was garded, the OCC sensor would never be enabled.
The prior could would continue to try reading a sensor until it became
enabled.
Code change will stop attempting to read a sensor once a signal or valid
response has been received.
Tested on HW
Change-Id: I9c43840fb25803af4f320ae9de00e896daf190f6
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_status.hpp b/occ_status.hpp
index 9ae8fe7..fa9d2d9 100644
--- a/occ_status.hpp
+++ b/occ_status.hpp
@@ -201,6 +201,25 @@
*/
CmdStatus sendAmbient(const uint8_t ambient = 0xFF,
const uint16_t altitude = 0xFFFF);
+
+ /** @brief Set flag indicating if PLDM sensor has been received
+ *
+ * @param[in] wasReceived - true if PLDM sensor was read
+ */
+ void setPldmSensorReceived(const bool wasReceived)
+ {
+ pldmSensorStateReceived = wasReceived;
+ }
+
+ /** @brief Read flag indicating if PLDM sensor has been read
+ *
+ * @return true if sensor has been read
+ */
+ bool getPldmSensorReceived()
+ {
+ return pldmSensorStateReceived;
+ }
+
#endif // POWER10
/** @brief Return the HWMON path for this OCC
@@ -266,6 +285,9 @@
/** @brief hwmon path for this OCC */
fs::path hwmonPath;
+ /** @brief flag indicating if the OCC sensor has been received */
+ bool pldmSensorStateReceived = false;
+
/** @brief Callback function on host control signals
*
* @param[in] msg - Data associated with subscribed signal