some bugfixes
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-09-27 12:19:42 +02:00
parent 2c3c3c76af
commit ff243fa46c
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 12 additions and 6 deletions

View File

@ -217,14 +217,16 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
return executeSwUpdate(SwUpdateSources::TMP_DIR, data, size);
}
case (SWITCH_TO_SD_0): {
if (not startSdStateMachine(sd::SdCard::SLOT_0, SdCfgMode::COLD_REDUNDANT)) {
if (not startSdStateMachine(sd::SdCard::SLOT_0, SdCfgMode::COLD_REDUNDANT, commandedBy,
actionId)) {
return HasActionsIF::IS_BUSY;
}
// Completion will be reported by SD card state machine
return returnvalue::OK;
}
case (SWITCH_TO_SD_1): {
if (not startSdStateMachine(sd::SdCard::SLOT_1, SdCfgMode::COLD_REDUNDANT)) {
if (not startSdStateMachine(sd::SdCard::SLOT_1, SdCfgMode::COLD_REDUNDANT, commandedBy,
actionId)) {
return HasActionsIF::IS_BUSY;
}
// Completion will be reported by SD card state machine
@ -240,7 +242,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
return HasActionsIF::INVALID_PARAMETERS;
}
auto active = static_cast<sd::SdCard>(data[0]);
if (not startSdStateMachine(active, SdCfgMode::HOT_REDUNDANT)) {
if (not startSdStateMachine(active, SdCfgMode::HOT_REDUNDANT, commandedBy, actionId)) {
return HasActionsIF::IS_BUSY;
}
// Completion will be reported by SD card state machine
@ -393,7 +395,7 @@ ReturnValue_t CoreController::sdStateMachine() {
sif::warning << "Getting SD card activity status failed" << std::endl;
}
if (sdInfo.cfgMode == SdCfgMode::COLD_REDUNDANT) {
sif::info << "Cold redundant SD card configuration, preferred SD card: "
sif::info << "Cold redundant SD card configuration, target SD card: "
<< static_cast<int>(sdInfo.active) << std::endl;
}
if (sdInfo.activeState == sd::SdState::MOUNTED) {
@ -1958,13 +1960,16 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u
return HasActionsIF::EXECUTION_FINISHED;
}
bool CoreController::startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode) {
bool CoreController::startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode,
MessageQueueId_t commander, DeviceCommandId_t actionId) {
if (sdFsmState != SdStates::IDLE or sdCommandingInfo.cmdPending) {
return false;
}
sdFsmState = SdStates::START;
sdInfo.active = targetActiveSd;
sdInfo.cfgMode = mode;
sdCommandingInfo.actionId = actionId;
sdCommandingInfo.commander = commander;
sdCommandingInfo.cmdPending = true;
return true;
}

View File

@ -233,7 +233,8 @@ class CoreController : public ExtendedControllerBase {
ReturnValue_t initBootCopy();
ReturnValue_t initWatchdogFifo();
ReturnValue_t initSdCardBlocking();
bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode);
bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode, MessageQueueId_t commander,
DeviceCommandId_t actionId);
void initPrint();
ReturnValue_t sdStateMachine();