Add load info variable (combines state and error_flags)
This commit is contained in:
@@ -204,10 +204,10 @@ const data_object_t data_objects[] = {
|
||||
// using IDs >= 0x70 except for high priority data objects
|
||||
|
||||
// high priority data objects (low IDs)
|
||||
TS_DATA_OBJ_UINT32(0x04, "LoadState", &load.state,
|
||||
TS_DATA_OBJ_INT32(0x04, "LoadInfo", &load.info,
|
||||
TS_OUTPUT, TS_READ_ALL),
|
||||
|
||||
TS_DATA_OBJ_UINT32(0x05, "UsbState", &usb_pwr.state,
|
||||
TS_DATA_OBJ_INT32(0x05, "UsbInfo", &usb_pwr.info,
|
||||
TS_OUTPUT, TS_READ_ALL),
|
||||
|
||||
TS_DATA_OBJ_UINT16(0x06, "SOC_%", &charger.soc, // output will be uint8_t
|
||||
@@ -280,9 +280,6 @@ const data_object_t data_objects[] = {
|
||||
TS_DATA_OBJ_UINT32(0x90, "ErrorFlags", &dev_stat.error_flags,
|
||||
TS_OUTPUT, TS_READ_ALL),
|
||||
|
||||
TS_DATA_OBJ_UINT32(0x91, "LoadErrorFlags", &load.error_flags,
|
||||
TS_OUTPUT, TS_READ_ALL),
|
||||
|
||||
// RECORDED DATA ///////////////////////////////////////////////////////
|
||||
// using IDs >= 0xA0
|
||||
|
||||
|
||||
@@ -116,6 +116,8 @@ void LoadOutput::control()
|
||||
state = LOAD_STATE_ON;
|
||||
}
|
||||
}
|
||||
|
||||
info = error_flags > 0 ? -error_flags : state;
|
||||
}
|
||||
|
||||
void LoadOutput::stop(uint32_t flag)
|
||||
|
||||
+6
-3
@@ -122,10 +122,13 @@ public:
|
||||
*/
|
||||
void set_voltage_limits(float lvd, float lvr, float ov);
|
||||
|
||||
uint32_t state; ///< Current state of load output switch (negative value means
|
||||
///< error state, indicated by LoadErrorFlags)
|
||||
uint32_t state; ///< Current state of load output switch
|
||||
|
||||
uint32_t error_flags = 0;
|
||||
uint32_t error_flags = 0; ///< Stores error flags as bits according to LoadErrorFlag enum
|
||||
|
||||
int32_t info; ///< Contains either the state or negative value of error_flags
|
||||
///< in case of error_flags > 0. This allows to have a single
|
||||
///< variable for load state diagnosis.
|
||||
|
||||
bool enable = false; ///< Target on state set via communication port (overruled if
|
||||
///< battery is empty or any errors occured)
|
||||
|
||||
Reference in New Issue
Block a user