bugfix and first reboot handler code

This commit is contained in:
Robin Müller 2022-02-23 11:37:13 +01:00
parent fa93ca4dc0
commit dbba10185c
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 11 additions and 2 deletions

View File

@ -1135,3 +1135,10 @@ void CoreController::performWatchdogControlOperation() {
} }
} }
} }
void CoreController::performRebootFileHandling() {
if(doPerformRebootFileHandling and sdcMan->isSdCardMounted(sdInfo.pref)) {
auto mntPrefix = std::filesystem::path(sdcMan->getCurrentMountPrefix(sdInfo.pref));
doPerformRebootFileHandling = false;
}
}

View File

@ -19,7 +19,7 @@ class CoreController : public ExtendedControllerBase {
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh"; static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt"; static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt"; static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
static constexpr char VERSION_FILE[] = "/conf/sd_status"; static constexpr char VERSION_FILE[] = "/conf/version.txt";
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0; static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
static constexpr ActionId_t REBOOT_OBC = 32; static constexpr ActionId_t REBOOT_OBC = 32;
@ -122,6 +122,7 @@ class CoreController : public ExtendedControllerBase {
sd::SdState commandedState = sd::SdState::OFF; sd::SdState commandedState = sd::SdState::OFF;
}; };
SdInfo sdInfo; SdInfo sdInfo;
bool doPerformRebootFileHandling = true;
/** /**
* Index 0: Chip 0 Copy 0 * Index 0: Chip 0 Copy 0
@ -152,6 +153,7 @@ class CoreController : public ExtendedControllerBase {
void determinePreferredSdCard(); void determinePreferredSdCard();
void executeNextExternalSdCommand(); void executeNextExternalSdCommand();
void checkExternalSdCommandStatus(); void checkExternalSdCommandStatus();
void performRebootFileHandling();
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy, ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size); const uint8_t* data, size_t size);

View File

@ -183,7 +183,7 @@ class SdCardManager {
/** /**
* @brief Checks if an SD card is mounted * @brief Checks if an SD card is mounted
* *
* @param sdCard The SD crad to check * @param sdCard The SD card to check
* *
* @return true if mounted, otherwise false * @return true if mounted, otherwise false
*/ */