important bugfixes for core controller
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2021-08-07 18:52:36 +02:00
parent 2fb54f7de9
commit e186bff4e4
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -224,9 +224,11 @@ ReturnValue_t CoreController::sdInitStateMachine() {
// 2. Hot redundant case: Other SD card needs to be mounted and switched on
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
if(sdInfo.otherState == sd::SdState::ON) {
sif::debug << "Determine: Setting other state off" << std::endl;
sdInfo.state = SdStates::SET_STATE_OTHER;
}
else if(sdInfo.otherState == sd::SdState::MOUNTED) {
sif::debug << "Determine: Unmounting other" << std::endl;
sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER;
}
else {
@ -235,9 +237,11 @@ ReturnValue_t CoreController::sdInitStateMachine() {
}
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
if(sdInfo.otherState == sd::SdState::OFF) {
sif::debug << "Determine: Setting other state on" << std::endl;
sdInfo.state = SdStates::SET_STATE_OTHER;
}
else if(sdInfo.otherState == sd::SdState::ON) {
sif::debug << "Determine: Mounting other" << std::endl;
sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER;
}
else {
@ -252,19 +256,24 @@ ReturnValue_t CoreController::sdInitStateMachine() {
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
if(not sdInfo.commandExecuted) {
sif::debug << "Set state other off" << std::endl;
result = sdCardSetup(sdInfo.pref, sd::SdState::OFF, sdInfo.prefChar);
result = sdCardSetup(sdInfo.other, sd::SdState::OFF, sdInfo.otherChar);
sdInfo.commandExecuted = true;
}
else {
nonBlockingOpChecking(SdStates::UPDATE_INFO, 10, "Switching off other SD card");
}
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
if(not sdInfo.commandExecuted) {
sif::debug << "Set state other on" << std::endl;
result = sdCardSetup(sdInfo.pref, sd::SdState::ON, sdInfo.prefChar);
result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar);
sdInfo.commandExecuted = true;
}
#endif
else {
nonBlockingOpChecking(SdStates::MOUNT_UNMOUNT_OTHER, 10, "Switching off other SD card");
nonBlockingOpChecking(SdStates::SdStates::MOUNT_UNMOUNT_OTHER, 10,
"Switching on other SD card");
}
#endif
}
if(sdInfo.state == SdStates::MOUNT_UNMOUNT_OTHER) {
@ -272,23 +281,21 @@ ReturnValue_t CoreController::sdInitStateMachine() {
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
if(not sdInfo.commandExecuted) {
sif::debug << "Unmount other" << std::endl;
result = sdCardSetup(sdInfo.pref, sd::SdState::ON, sdInfo.prefChar);
result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar);
sdInfo.commandExecuted = true;
}
else {
nonBlockingOpChecking(SdStates::SET_STATE_OTHER, 10, "Unmounting other SD card");
}
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
if(not sdInfo.commandExecuted) {
result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
result = sdCardSetup(sdInfo.other, sd::SdState::MOUNTED, sdInfo.otherChar);
sdInfo.commandExecuted = true;
}
#endif
else {
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
std::string opPrint = "Switching off other SD card";
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
std::string opPrint = "Mounting other SD card";
#endif
nonBlockingOpChecking(SdStates::MOUNT_UNMOUNT_OTHER, 10, opPrint);
nonBlockingOpChecking(SdStates::UPDATE_INFO, 4, "Mounting other SD card");
}
#endif
}
if(sdInfo.state == SdStates::UPDATE_INFO) {
@ -338,7 +345,7 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS
}
if(state == sd::SdState::MOUNTED) {
if(targetState == sd::SdState::OFF) {
sif::info << "Switching off SD card" << sdChar << std::endl;
sif::info << "Switching off SD card " << sdChar << std::endl;
return sdcMan->switchOffSdCard(sdCard, true, &sdInfo.currentState);
}
else if(targetState == sd::SdState::ON) {
@ -375,7 +382,7 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS
return sdcMan->mountSdCard(sdCard);
}
else if(targetState == sd::SdState::OFF) {
sif::info << "Switching off SD card" << sdChar << std::endl;
sif::info << "Switching off SD card " << sdChar << std::endl;
return sdcMan->switchOffSdCard(sdCard, false, &sdInfo.currentState);
}
}