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)
}
bool DIOT_Crate::GetVoltStatus(VOLTAGE volt)
{
// status bit == 1 indicates failure, hence negation
return !(GetVoltStatusAll() & volt);
}
std::string DIOT_Crate::GetVoltName(VOLTAGE volt)
{
for (const auto& volt_pair : VOLTAGES) {
......
......@@ -176,13 +176,14 @@ public:
P5V0 = 0x02,
P12V0 = 0x04,
M12V0 = 0x08,
GOOD = 0x0f, ///< Value describing all voltages valid
INVALID = 0xff
};
/**
* Return power supply status.
* @return 0 when all voltages are correct, else check which bits are
* asserted to determine faulty voltages.
* @return VOLTAGE::GOOD when all voltages are correct, else check which
* bits are reset to determine faulty voltages.
* @see VOLTAGE
*/
int GetVoltStatusAll()
......@@ -191,11 +192,14 @@ public:
}
/**
* Return status of a particular votlage.
* Return status of a particular voltage.
* @param volt is the checked voltage.
* @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.
......
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