this should avoid lock issues al together

This commit is contained in:
2023-03-10 02:29:28 +01:00
parent 38907fc0f5
commit fae83a0fca
3 changed files with 65 additions and 59 deletions

View File

@ -25,7 +25,7 @@ class MutexIF;
* state
*/
class SdCardManager : public SystemObject, public SdCardMountedIF {
friend class SdCardAccess;
friend class CoreController;
public:
using mountInitCb = ReturnValue_t (*)(void* args);
@ -125,7 +125,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
* - CommandExecutor::COMMAND_PENDING: Non-blocking command is pending
* - returnvalue::FAILED: blocking command failed
*/
ReturnValue_t updateSdCardStateFile();
ReturnValue_t updateSdCardStateFile(bool blocking);
/**
* Get the state of the SD cards. If the state file does not exist, this function will
@ -218,6 +218,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
private:
CommandExecutor cmdExecutor;
SdStatePair sdStates;
Operations currentOp = Operations::IDLE;
bool blocking = false;
bool sdCardActive = true;
@ -233,10 +234,11 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
SdCardManager();
ReturnValue_t updateSdStatePair();
ReturnValue_t setSdCardState(sd::SdCard sdCard, bool on);
void processSdStatusLine(SdStatePair& active, std::string& line, uint8_t& idx,
sd::SdCard& currentSd);
void processSdStatusLine(std::string& line, uint8_t& idx, sd::SdCard& currentSd);
std::optional<std::string> currentPrefix;