From 24b58e50d1d0182c2e495e0985d9e166037526e9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Aug 2021 16:24:41 +0200 Subject: [PATCH 1/2] Merge core controller bugfix --- bsp_q7s/core/CoreController.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index b7394cb9..eca0940c 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -197,6 +197,10 @@ ReturnValue_t CoreController::sdStateMachine() { result = sdcMan->getSdCardActiveStatus(sdInfo.currentState); determinePreferredSdCard(); 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) { sif::warning << "Getting SD card activity status failed" << std::endl; } @@ -833,7 +837,8 @@ void CoreController::determinePreferredSdCard() { if(result == scratch::KEY_NOT_FOUND) { sif::warning << "CoreController::sdCardInit: " "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 { sif::warning << "CoreController::sdCardInit: Could not get preferred SD card" @@ -852,13 +857,16 @@ void CoreController::updateSdInfoOther() { sdInfo.other = sd::SdCard::SLOT_1; } - else { + else if(sdInfo.pref == sd::SdCard::SLOT_1) { sdInfo.prefChar = "1"; sdInfo.otherChar = "0"; sdInfo.otherState = sdInfo.currentState.first; sdInfo.prefState = sdInfo.currentState.second; sdInfo.other = sd::SdCard::SLOT_0; } + else { + sif::warning << "CoreController::updateSdInfoOther: Invalid SD card passed" << std::endl; + } } bool CoreController::sdInitFinished() const { From cf355a0451203945325785141ea784db13ff7966 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Aug 2021 16:29:11 +0200 Subject: [PATCH 2/2] missing : --- bsp_q7s/core/CoreController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index eca0940c..bf1a1b1a 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -198,7 +198,7 @@ ReturnValue_t CoreController::sdStateMachine() { determinePreferredSdCard(); 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; + sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl; sdInfo.pref = sd::SdCard::SLOT_0; } if(result != HasReturnvaluesIF::RETURN_OK) {