SD shutdown handling non-blocking #753
@ -559,15 +559,16 @@ ReturnValue_t CoreController::sdStateMachine() {
|
||||
auto nonBlockingSdcOpChecking = [&](SdStates newStateOnSuccess, uint16_t maxCycleCount,
|
||||
std::string opPrintout) {
|
||||
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;
|
||||
sdInfo.commandPending = false;
|
||||
sdInfo.cycleCount = 0;
|
||||
if (sdInfo.cycleCount > 4) {
|
||||
if (sdInfo.cycleCount > maxCycleCount) {
|
||||
sif::warning << "CoreController::sdStateMachine: " << opPrintout << " takes too long"
|
||||
<< std::endl;
|
||||
sdInfo.cycleCount = 0;
|
||||
return -1;
|
||||
}
|
||||
sdInfo.cycleCount = 0;
|
||||
return 0;
|
||||
};
|
||||
return 1;
|
||||
|
@ -199,6 +199,7 @@ ReturnValue_t SdCardManager::getSdCardsStatus(SdStatePair& sdStates) {
|
||||
ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
|
||||
using namespace std;
|
||||
if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
|
||||
sif::warning << "SdCardManager::mountSdCard: Command still pending" << std::endl;
|
||||
return CommandExecutor::COMMAND_PENDING;
|
||||
}
|
||||
if (sdCard == sd::SdCard::BOTH) {
|
||||
|
Loading…
Reference in New Issue
Block a user