bugfix RW asyy #579

Merged
muellerr merged 2 commits from bugfix_rw_assy into develop 2023-04-06 19:12:23 +02:00
6 changed files with 16 additions and 56 deletions
Showing only changes of commit 77b8c6eb3e - Show all commits

View File

@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release:
# [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.
# [v1.43.2] 2023-04-05
## Changed

View File

@ -7,9 +7,9 @@ RwDummy::RwDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
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; }

View File

@ -7,9 +7,9 @@ StarTrackerDummy::StarTrackerDummy(object_id_t objectId, object_id_t comif, Cook
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) {
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) {
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 (warningSwitch) {
sif::warning << "RwAssembly::checkChildrenStateOn: Only " << devsInCorrectMode
<< " devices in correct mode" << std::endl;
sif::warning << "RW ASSY: Only " << devsInCorrectMode << " devices in correct mode"
<< std::endl;
warningSwitch = false;
}
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 result = returnvalue::OK;
bool needsSecondStep = false;
Mode_t devMode = 0;
object_id_t objId = 0;
try {
for (uint8_t idx = 0; idx < NUMBER_RWS; idx++) {
devMode = childrenMap.at(helper.rwIds[idx]).mode;
objId = helper.rwIds[idx];
if (mode == devMode) {
if (isUseable(objId, mode)) {
modeTable[idx].setMode(mode);
} else if (mode == DeviceHandlerIF::MODE_NORMAL) {
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);
}
modeTable[idx].setSubmode(submode);
}
}
} catch (const std::out_of_range& e) {
sif::error << "TcsBoardAssembly: Invalid children map: " << e.what() << std::endl;
}
if (needsSecondStep) {
result = NEED_SECOND_STEP;
sif::error << "RW ASSY: Invalid children map: " << e.what() << std::endl;
}
return result;
}
@ -172,15 +144,3 @@ ReturnValue_t RwAssembly::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;
void startTransition(Mode_t mode, Submode_t submode) 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_ */

2
tmtc

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