Commit 42ea30b1 authored by Projects's avatar Projects

Fixed interpretation of voltage status bits

parent f3b96b13
...@@ -99,13 +99,6 @@ int DIOT_Crate::GetTemp(unsigned int sensor) ...@@ -99,13 +99,6 @@ int DIOT_Crate::GetTemp(unsigned int sensor)
} }
bool DIOT_Crate::GetVoltStatus(VOLTAGE volt)
{
// status bit == 1 indicates failure, hence negation
return !(GetVoltStatusAll() & volt);
}
std::string DIOT_Crate::GetVoltName(VOLTAGE volt) std::string DIOT_Crate::GetVoltName(VOLTAGE volt)
{ {
for (const auto& volt_pair : VOLTAGES) { for (const auto& volt_pair : VOLTAGES) {
......
...@@ -176,13 +176,14 @@ public: ...@@ -176,13 +176,14 @@ public:
P5V0 = 0x02, P5V0 = 0x02,
P12V0 = 0x04, P12V0 = 0x04,
M12V0 = 0x08, M12V0 = 0x08,
GOOD = 0x0f, ///< Value describing all voltages valid
INVALID = 0xff INVALID = 0xff
}; };
/** /**
* Return power supply status. * Return power supply status.
* @return 0 when all voltages are correct, else check which bits are * @return VOLTAGE::GOOD when all voltages are correct, else check which
* asserted to determine faulty voltages. * bits are reset to determine faulty voltages.
* @see VOLTAGE * @see VOLTAGE
*/ */
int GetVoltStatusAll() int GetVoltStatusAll()
...@@ -191,11 +192,14 @@ public: ...@@ -191,11 +192,14 @@ public:
} }
/** /**
* Return status of a particular votlage. * Return status of a particular voltage.
* @param volt is the checked voltage. * @param volt is the checked voltage.
* @return True when voltage is correct, false otherwise. * @return True when voltage is correct, false otherwise.
*/ */
bool GetVoltStatus(VOLTAGE volt); bool GetVoltStatus(VOLTAGE volt)
{
return GetVoltStatusAll() & volt;
}
/** /**
* Return vector of available voltage enums and their descriptions. * Return vector of available voltage enums and their descriptions.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment