rudimentary SD commanding interface
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2022-09-27 10:51:07 +02:00
parent 9b6636fe31
commit 90962c9f8e
11 changed files with 226 additions and 248 deletions

View File

@ -79,6 +79,10 @@ class CoreController : public ExtendedControllerBase {
static constexpr ActionId_t OBSW_UPDATE_FROM_SD_1 = 11;
static constexpr ActionId_t OBSW_UPDATE_FROM_TMP = 12;
static constexpr ActionId_t SWITCH_TO_SD_0 = 16;
static constexpr ActionId_t SWITCH_TO_SD_1 = 17;
static constexpr ActionId_t SWITCH_TO_BOTH_SD_CARDS = 18;
//! Reboot using the xsc_boot_copy command
static constexpr ActionId_t XSC_REBOOT_OBC = 32;
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
@ -164,9 +168,7 @@ class CoreController : public ExtendedControllerBase {
SKIP_CYCLE_BEFORE_INFO_UPDATE,
UPDATE_INFO,
// SD initialization done
IDLE,
// Used if SD switches or mount commands are issued via telecommand
SET_STATE_FROM_COMMAND,
IDLE
};
enum class SwUpdateSources { SD_0, SD_1, TMP_DIR };
@ -176,27 +178,31 @@ class CoreController : public ExtendedControllerBase {
SdCardManager* sdcMan = nullptr;
MessageQueueIF* eventQueue = nullptr;
struct SdInfo {
sd::SdCard pref = sd::SdCard::NONE;
SdStates sdFsmState = SdStates::START;
enum SdCfgMode { PASSIVE, COLD_REDUNDANT, HOT_REDUNDANT };
struct SdFsmParams {
SdCfgMode cfgMode = SdCfgMode::COLD_REDUNDANT;
sd::SdCard active = sd::SdCard::NONE;
sd::SdCard other = sd::SdCard::NONE;
sd::SdState prefState = sd::SdState::OFF;
sd::SdState activeState = sd::SdState::OFF;
sd::SdState otherState = sd::SdState::OFF;
std::string prefChar = "0";
std::string activeChar = "0";
std::string otherChar = "1";
std::pair<bool, bool> mountSwitch = {true, true};
SdStates state = SdStates::START;
// Used to track whether a command was executed
bool commandExecuted = true;
bool initFinished = false;
SdCardManager::SdStatePair currentState;
uint16_t cycleCount = 0;
// These two flags are related to external commanding
bool commandIssued = false;
bool commandFinished = false;
sd::SdState currentlyCommandedState = sd::SdState::OFF;
sd::SdCard commandedCard = sd::SdCard::NONE;
sd::SdState commandedState = sd::SdState::OFF;
} sdInfo;
struct SdCommanding {
bool cmdPending = false;
MessageQueueId_t commander = MessageQueueIF::NO_QUEUE;
DeviceCommandId_t actionId;
} sdCommandingInfo;
RebootFile rebootFile = {};
std::string currMntPrefix;
bool performOneShotSdCardOpsSwitch = true;
@ -227,6 +233,7 @@ class CoreController : public ExtendedControllerBase {
ReturnValue_t initBootCopy();
ReturnValue_t initWatchdogFifo();
ReturnValue_t initSdCardBlocking();
bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode);
void initPrint();
ReturnValue_t sdStateMachine();