I2C reboot procedure for EIVE system #578

Merged
muellerr merged 17 commits from feature_i2c_reboot_procedure into develop 2023-04-07 11:07:05 +02:00
6 changed files with 17 additions and 56 deletions
Showing only changes of commit b9d0e4bdd9 - Show all commits

View File

@ -16,6 +16,12 @@ will consitute of a breaking change warranting a new major release:
# [unreleased] # [unreleased]
## Fixed
- RW Assembly: Correctly transition back to off when more than 1 devices is OFF. Also do this
when this was due to two devices being marked faulty.
- RW dummy and STR dummy components: Set/Update modes correctly.
# [v1.43.2] 2023-04-05 # [v1.43.2] 2023-04-05
## Changed ## Changed

View File

@ -7,9 +7,9 @@ RwDummy::RwDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
RwDummy::~RwDummy() {} RwDummy::~RwDummy() {}
void RwDummy::doStartUp() {} void RwDummy::doStartUp() { setMode(MODE_ON); }
void RwDummy::doShutDown() {} void RwDummy::doShutDown() { setMode(MODE_OFF); }
ReturnValue_t RwDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } ReturnValue_t RwDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }

View File

@ -7,9 +7,9 @@ StarTrackerDummy::StarTrackerDummy(object_id_t objectId, object_id_t comif, Cook
StarTrackerDummy::~StarTrackerDummy() {} StarTrackerDummy::~StarTrackerDummy() {}
void StarTrackerDummy::doStartUp() {} void StarTrackerDummy::doStartUp() { setMode(MODE_ON); }
void StarTrackerDummy::doShutDown() {} void StarTrackerDummy::doShutDown() { setMode(_MODE_POWER_DOWN); }
ReturnValue_t StarTrackerDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t StarTrackerDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND; return NOTHING_TO_SEND;

View File

@ -56,12 +56,12 @@ ReturnValue_t RwAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_t want
} }
} }
} catch (const std::out_of_range& e) { } catch (const std::out_of_range& e) {
sif::error << "RwAssembly: Invalid children map: " << e.what() << std::endl; sif::error << "RW ASSY: Invalid children map: " << e.what() << std::endl;
} }
if (devsInCorrectMode < 3) { if (devsInCorrectMode < 3) {
if (warningSwitch) { if (warningSwitch) {
sif::warning << "RwAssembly::checkChildrenStateOn: Only " << devsInCorrectMode sif::warning << "RW ASSY: Only " << devsInCorrectMode << " devices in correct mode"
<< " devices in correct mode" << std::endl; << std::endl;
warningSwitch = false; warningSwitch = false;
} }
return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE;
@ -106,46 +106,18 @@ void RwAssembly::handleModeReached() {
} }
} }
void RwAssembly::handleChildrenLostMode(ReturnValue_t result) {
AssemblyBase::handleChildrenLostMode(result);
}
ReturnValue_t RwAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode) { ReturnValue_t RwAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
bool needsSecondStep = false;
Mode_t devMode = 0;
object_id_t objId = 0; object_id_t objId = 0;
try { try {
for (uint8_t idx = 0; idx < NUMBER_RWS; idx++) { for (uint8_t idx = 0; idx < NUMBER_RWS; idx++) {
devMode = childrenMap.at(helper.rwIds[idx]).mode; if (isUseable(objId, mode)) {
objId = helper.rwIds[idx];
if (mode == devMode) {
modeTable[idx].setMode(mode); modeTable[idx].setMode(mode);
} else if (mode == DeviceHandlerIF::MODE_NORMAL) { modeTable[idx].setSubmode(submode);
if (isUseable(objId, devMode)) {
if (devMode == MODE_ON) {
modeTable[idx].setMode(mode);
modeTable[idx].setSubmode(SUBMODE_NONE);
} else {
modeTable[idx].setMode(MODE_ON);
modeTable[idx].setSubmode(SUBMODE_NONE);
if (internalState != STATE_SECOND_STEP) {
needsSecondStep = true;
}
}
}
} else if (mode == MODE_ON) {
if (isUseable(objId, devMode)) {
modeTable[idx].setMode(MODE_ON);
modeTable[idx].setSubmode(SUBMODE_NONE);
}
} }
} }
} catch (const std::out_of_range& e) { } catch (const std::out_of_range& e) {
sif::error << "TcsBoardAssembly: Invalid children map: " << e.what() << std::endl; sif::error << "RW ASSY: Invalid children map: " << e.what() << std::endl;
}
if (needsSecondStep) {
result = NEED_SECOND_STEP;
} }
return result; return result;
} }
@ -172,15 +144,3 @@ ReturnValue_t RwAssembly::initialize() {
} }
return AssemblyBase::initialize(); return AssemblyBase::initialize();
} }
void RwAssembly::handleModeTransitionFailed(ReturnValue_t result) {
if (targetMode == MODE_OFF) {
AssemblyBase::handleModeTransitionFailed(result);
} else {
if (modeTransitionFailedSwitch) {
// To avoid transitioning back to off
triggerEvent(MODE_TRANSITION_FAILED, result);
modeTransitionFailedSwitch = false;
}
}
}

View File

@ -41,11 +41,6 @@ class RwAssembly : public AssemblyBase {
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override; ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
void startTransition(Mode_t mode, Submode_t submode) override; void startTransition(Mode_t mode, Submode_t submode) override;
void handleModeReached() override; void handleModeReached() override;
// These two overrides prevent a transition of the whole assembly back to off just because
// some devices are not working
void handleChildrenLostMode(ReturnValue_t result) override;
void handleModeTransitionFailed(ReturnValue_t result) override;
}; };
#endif /* MISSION_SYSTEM_RWASS_H_ */ #endif /* MISSION_SYSTEM_RWASS_H_ */

2
tmtc

@ -1 +1 @@
Subproject commit dcf7d0af71f6ba9d569f9f56604e9245a0233427 Subproject commit 7e5fa2e61a3f2b50860fe2e3427f31f7ebaf854f