added get reset and clear reset command to rw handler

This commit is contained in:
2021-06-28 08:57:37 +02:00
parent 7c8127714e
commit 8ef9760f78
3 changed files with 137 additions and 16 deletions

View File

@ -15,7 +15,8 @@ enum PoolIds: lp_id_t {
CURR_SPEED,
REFERENCE_SPEED,
STATE,
CLC_MODE
CLC_MODE,
LAST_RESET_STATUS
};
enum States: uint8_t {
@ -30,13 +31,16 @@ static const DeviceCommandId_t RESET_MCU = 1;
static const DeviceCommandId_t GET_LAST_RESET_STATUS = 2;
static const DeviceCommandId_t CLEAR_LAST_RESET_STATUS = 3;
static const DeviceCommandId_t GET_RW_STATUS = 4;
/** This command is needed to recover from error state */
static const DeviceCommandId_t INIT_RW_CONTROLLER = 5;
static const DeviceCommandId_t SET_SPEED = 6;
static const DeviceCommandId_t GET_TEMPERATURE = 8;
static const uint32_t TEMPERATURE_SET_ID = GET_TEMPERATURE;
static const uint32_t STATUS_SET_ID = GET_RW_STATUS;
static const uint32_t LAST_RESET_ID = GET_LAST_RESET_STATUS;
static const size_t SIZE_GET_RESET_STATUS = 5;
static const size_t SIZE_GET_RW_STATUS = 14;
static const size_t SIZE_SET_SPEED_REPLY = 4;
static const size_t SIZE_GET_TEMPERATURE_REPLY = 8;
@ -47,6 +51,7 @@ static const size_t SIZE_GET_TELEMETRY_REPLY = 83;
static const size_t MAX_CMD_SIZE = 9;
static const size_t MAX_REPLY_SIZE = SIZE_GET_TELEMETRY_REPLY;
static const uint8_t LAST_RESET_ENTRIES = 1;
static const uint8_t TEMPERATURE_SET_ENTRIES = 1;
static const uint8_t STATUS_SET_ENTRIES = 4;
@ -94,6 +99,25 @@ public:
PoolIds::CLC_MODE, this);
};
/**
* @brief This dataset stores the last reset status.
*/
class LastResetSatus:
public StaticLocalDataSet<LAST_RESET_ENTRIES> {
public:
LastResetSatus(HasLocalDataPoolIF* owner):
StaticLocalDataSet(owner, LAST_RESET_ID) {
}
LastResetSatus(object_id_t objectId):
StaticLocalDataSet(sid_t(objectId, LAST_RESET_ID)) {
}
lp_var_t<uint8_t> lastResetStatus = lp_var_t<uint8_t>(sid.objectId,
PoolIds::LAST_RESET_STATUS, this);
};
}
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_RWDEFINITIONS_H_ */