Some RW improvements
- Moved Events to definitions file - Added new event if reset occurs - Deliver state if there is an error (going to be 0, still deliver it)
This commit is contained in:
@ -47,11 +47,6 @@ ReturnValue_t RwHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
*id = RwDefinitions::GET_LAST_RESET_STATUS;
|
||||
internalState = InternalState::READ_TEMPERATURE;
|
||||
break;
|
||||
case InternalState::CLEAR_RESET_STATUS:
|
||||
*id = RwDefinitions::CLEAR_LAST_RESET_STATUS;
|
||||
/** After reset status is cleared, reset status will be polled again for verification */
|
||||
internalState = InternalState::GET_RESET_STATUS;
|
||||
break;
|
||||
case InternalState::READ_TEMPERATURE:
|
||||
*id = RwDefinitions::GET_TEMPERATURE;
|
||||
internalState = InternalState::GET_RW_SATUS;
|
||||
@ -60,6 +55,11 @@ ReturnValue_t RwHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
*id = RwDefinitions::GET_RW_STATUS;
|
||||
internalState = InternalState::GET_RESET_STATUS;
|
||||
break;
|
||||
case InternalState::CLEAR_RESET_STATUS:
|
||||
*id = RwDefinitions::CLEAR_LAST_RESET_STATUS;
|
||||
/** After reset status is cleared, reset status will be polled again for verification */
|
||||
internalState = InternalState::GET_RESET_STATUS;
|
||||
break;
|
||||
default:
|
||||
sif::debug << "RwHandler::buildNormalDeviceCommand: Invalid internal step" << std::endl;
|
||||
break;
|
||||
@ -240,8 +240,6 @@ ReturnValue_t RwHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void RwHandler::setNormalDatapoolEntriesInvalid() {}
|
||||
|
||||
uint32_t RwHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
|
||||
|
||||
ReturnValue_t RwHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
@ -336,18 +334,19 @@ void RwHandler::prepareSetSpeedCmd(const uint8_t* commandData, size_t commandDat
|
||||
void RwHandler::handleResetStatusReply(const uint8_t* packet) {
|
||||
PoolReadGuard rg(&lastResetStatusSet);
|
||||
uint8_t offset = 2;
|
||||
uint8_t resetStatus = *(packet + offset);
|
||||
uint8_t resetStatus = packet[offset];
|
||||
if (resetStatus != RwDefinitions::CLEARED) {
|
||||
internalState = InternalState::CLEAR_RESET_STATUS;
|
||||
lastResetStatusSet.lastResetStatus = resetStatus;
|
||||
lastResetStatusSet.lastNonClearedResetStatus = resetStatus;
|
||||
triggerEvent(RwDefinitions::RESET_OCCURED, resetStatus, 0);
|
||||
}
|
||||
lastResetStatusSet.currentResetStatus = resetStatus;
|
||||
lastResetStatusSet.lastResetStatus = resetStatus;
|
||||
if (debugMode) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "RwHandler::handleResetStatusReply: Last reset status: "
|
||||
<< static_cast<unsigned int>(lastResetStatusSet.lastResetStatus.value) << std::endl;
|
||||
<< static_cast<unsigned int>(lastResetStatusSet.lastNonClearedResetStatus.value) << std::endl;
|
||||
sif::info << "RwHandler::handleResetStatusReply: Current reset status: "
|
||||
<< static_cast<unsigned int>(lastResetStatusSet.currentResetStatus.value)
|
||||
<< static_cast<unsigned int>(lastResetStatusSet.lastResetStatus.value)
|
||||
<< std::endl;
|
||||
#endif
|
||||
}
|
||||
@ -367,11 +366,9 @@ void RwHandler::handleGetRwStatusReply(const uint8_t* packet) {
|
||||
statusSet.clcMode = *(packet + offset);
|
||||
|
||||
if (statusSet.state == RwDefinitions::STATE_ERROR) {
|
||||
/**
|
||||
* This requires the commanding of the init reaction wheel controller command to recover
|
||||
* form error state which must be handled by the FDIR instance.
|
||||
*/
|
||||
triggerEvent(ERROR_STATE);
|
||||
// This requires the commanding of the init reaction wheel controller command to recover
|
||||
// from error state which must be handled by the FDIR instance.
|
||||
triggerEvent(RwDefinitions::ERROR_STATE, statusSet.state.value, 0);
|
||||
sif::error << "RwHandler::handleGetRwStatusReply: Reaction wheel in error state" << std::endl;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user