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:
parent
28c9e33d1c
commit
590fe6ca39
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit f59b05c86cd54390d2a259eda770ee7935587112
|
||||
Subproject commit 71f704c980ec8847bdd0bb1bf354c8de30d3524b
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -66,13 +66,12 @@ class RwHandler : public DeviceHandlerBase {
|
||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||
size_t* foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
void setNormalDatapoolEntriesInvalid() override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
|
||||
private:
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::RW_HANDLER;
|
||||
|
||||
|
||||
//! [EXPORT] : [COMMENT] Action Message with invalid speed was received. Valid speeds must be in
|
||||
//! the range of [-65000; 1000] or [1000; 65000]
|
||||
@ -86,9 +85,6 @@ class RwHandler : public DeviceHandlerBase {
|
||||
//! [EXPORT] : [COMMENT] Reaction wheel reply has invalid crc
|
||||
static const ReturnValue_t CRC_ERROR = MAKE_RETURN_CODE(0xA4);
|
||||
|
||||
//! [EXPORT] : [COMMENT] Reaction wheel signals an error state
|
||||
static const Event ERROR_STATE = MAKE_EVENT(1, severity::HIGH);
|
||||
|
||||
GpioIF* gpioComIF = nullptr;
|
||||
gpioId_t enableGpio = gpio::NO_GPIO;
|
||||
bool debugMode = false;
|
||||
|
@ -9,6 +9,13 @@
|
||||
|
||||
namespace RwDefinitions {
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::RW_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Reaction wheel signals an error state
|
||||
static constexpr Event ERROR_STATE = MAKE_EVENT(1, severity::HIGH);
|
||||
|
||||
static constexpr Event RESET_OCCURED = event::makeEvent(SUBSYSTEM_ID, 2, severity::HIGH);
|
||||
|
||||
static const uint32_t SPI_REPLY_DELAY = 70000; // us
|
||||
|
||||
enum PoolIds : lp_id_t {
|
||||
@ -133,9 +140,11 @@ class LastResetSatus : public StaticLocalDataSet<LAST_RESET_ENTRIES> {
|
||||
|
||||
LastResetSatus(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LAST_RESET_ID)) {}
|
||||
|
||||
lp_var_t<uint8_t> lastResetStatus =
|
||||
// If a reset occurs, the status code will be cached into this variable
|
||||
lp_var_t<uint8_t> lastNonClearedResetStatus =
|
||||
lp_var_t<uint8_t>(sid.objectId, PoolIds::LAST_RESET_STATUS, this);
|
||||
lp_var_t<uint8_t> currentResetStatus =
|
||||
// This will always contain the last polled reset status
|
||||
lp_var_t<uint8_t> lastResetStatus =
|
||||
lp_var_t<uint8_t>(sid.objectId, PoolIds::CURRRENT_RESET_STATUS, this);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user