SD shutdown handling non-blocking #753

Merged
muellerr merged 7 commits from sd-shutdown-non-blocking into main 2023-07-26 11:09:48 +02:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit ff05181dd3 - Show all commits

View File

@ -559,15 +559,16 @@ ReturnValue_t CoreController::sdStateMachine() {
auto nonBlockingSdcOpChecking = [&](SdStates newStateOnSuccess, uint16_t maxCycleCount, auto nonBlockingSdcOpChecking = [&](SdStates newStateOnSuccess, uint16_t maxCycleCount,
std::string opPrintout) { std::string opPrintout) {
SdCardManager::OpStatus status = sdcMan->checkCurrentOp(operation); SdCardManager::OpStatus status = sdcMan->checkCurrentOp(operation);
if (status == SdCardManager::OpStatus::SUCCESS or sdInfo.cycleCount > 4) { if (status == SdCardManager::OpStatus::SUCCESS or sdInfo.cycleCount > maxCycleCount) {
sdFsmState = newStateOnSuccess; sdFsmState = newStateOnSuccess;
sdInfo.commandPending = false; sdInfo.commandPending = false;
sdInfo.cycleCount = 0; if (sdInfo.cycleCount > maxCycleCount) {
if (sdInfo.cycleCount > 4) {
sif::warning << "CoreController::sdStateMachine: " << opPrintout << " takes too long" sif::warning << "CoreController::sdStateMachine: " << opPrintout << " takes too long"
<< std::endl; << std::endl;
sdInfo.cycleCount = 0;
return -1; return -1;
} }
sdInfo.cycleCount = 0;
return 0; return 0;
}; };
return 1; return 1;

View File

@ -199,6 +199,7 @@ ReturnValue_t SdCardManager::getSdCardsStatus(SdStatePair& sdStates) {
ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) { ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
using namespace std; using namespace std;
if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) { if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
sif::warning << "SdCardManager::mountSdCard: Command still pending" << std::endl;
return CommandExecutor::COMMAND_PENDING; return CommandExecutor::COMMAND_PENDING;
} }
if (sdCard == sd::SdCard::BOTH) { if (sdCard == sd::SdCard::BOTH) {