SD shutdown handling non-blocking #753
@ -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;
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user