From dbba10185c71a80fe09ea2057d839032714b6511 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 23 Feb 2022 11:37:13 +0100 Subject: [PATCH] bugfix and first reboot handler code --- bsp_q7s/core/CoreController.cpp | 7 +++++++ bsp_q7s/core/CoreController.h | 4 +++- bsp_q7s/memory/SdCardManager.h | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 47baa13e..21e4b65e 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -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; + } +} diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 5365000a..75ac0433 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -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_STATE_FILE[] = "/tmp/chip_prot_status.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 REBOOT_OBC = 32; @@ -122,6 +122,7 @@ class CoreController : public ExtendedControllerBase { sd::SdState commandedState = sd::SdState::OFF; }; SdInfo sdInfo; + bool doPerformRebootFileHandling = true; /** * Index 0: Chip 0 Copy 0 @@ -152,6 +153,7 @@ class CoreController : public ExtendedControllerBase { void determinePreferredSdCard(); void executeNextExternalSdCommand(); void checkExternalSdCommandStatus(); + void performRebootFileHandling(); ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size); diff --git a/bsp_q7s/memory/SdCardManager.h b/bsp_q7s/memory/SdCardManager.h index 4446a102..ba5c934a 100644 --- a/bsp_q7s/memory/SdCardManager.h +++ b/bsp_q7s/memory/SdCardManager.h @@ -183,7 +183,7 @@ class SdCardManager { /** * @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 */