Merge pull request 'Core Controller Bugfix' (#83) from mueller/core-controller-bugfix into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #83
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
This commit is contained in:
Jakob Meier 2021-08-11 16:48:24 +02:00
commit be43dbd293

View File

@ -197,6 +197,10 @@ ReturnValue_t CoreController::sdStateMachine() {
result = sdcMan->getSdCardActiveStatus(sdInfo.currentState); result = sdcMan->getSdCardActiveStatus(sdInfo.currentState);
determinePreferredSdCard(); determinePreferredSdCard();
updateSdInfoOther(); updateSdInfoOther();
if(sdInfo.pref != sd::SdCard::SLOT_0 and sdInfo.pref != sd::SdCard::SLOT_1) {
sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl;
sdInfo.pref = sd::SdCard::SLOT_0;
}
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Getting SD card activity status failed" << std::endl; sif::warning << "Getting SD card activity status failed" << std::endl;
} }
@ -833,7 +837,8 @@ void CoreController::determinePreferredSdCard() {
if(result == scratch::KEY_NOT_FOUND) { if(result == scratch::KEY_NOT_FOUND) {
sif::warning << "CoreController::sdCardInit: " sif::warning << "CoreController::sdCardInit: "
"Preferred SD card not set. Setting to 0" << std::endl; "Preferred SD card not set. Setting to 0" << std::endl;
sdcMan->setPreferredSdCard(sdInfo.pref); sdcMan->setPreferredSdCard(sd::SdCard::SLOT_0);
sdInfo.pref = sd::SdCard::SLOT_0;
} }
else { else {
sif::warning << "CoreController::sdCardInit: Could not get preferred SD card" sif::warning << "CoreController::sdCardInit: Could not get preferred SD card"
@ -852,13 +857,16 @@ void CoreController::updateSdInfoOther() {
sdInfo.other = sd::SdCard::SLOT_1; sdInfo.other = sd::SdCard::SLOT_1;
} }
else { else if(sdInfo.pref == sd::SdCard::SLOT_1) {
sdInfo.prefChar = "1"; sdInfo.prefChar = "1";
sdInfo.otherChar = "0"; sdInfo.otherChar = "0";
sdInfo.otherState = sdInfo.currentState.first; sdInfo.otherState = sdInfo.currentState.first;
sdInfo.prefState = sdInfo.currentState.second; sdInfo.prefState = sdInfo.currentState.second;
sdInfo.other = sd::SdCard::SLOT_0; sdInfo.other = sd::SdCard::SLOT_0;
} }
else {
sif::warning << "CoreController::updateSdInfoOther: Invalid SD card passed" << std::endl;
}
} }
bool CoreController::sdInitFinished() const { bool CoreController::sdInitFinished() const {