From 21258c2d79d872fe09f125d2193b535d96f2f938 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 11 Oct 2022 22:58:31 +0200 Subject: [PATCH] fix core controller --- bsp_q7s/core/CoreController.cpp | 40 ++++++++++++------------ bsp_q7s/core/CoreController.h | 2 +- fsfw | 2 +- mission/controller/ThermalController.cpp | 10 +++--- tmtc | 2 +- 5 files changed, 29 insertions(+), 27 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 56734032..083aebf5 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -1230,29 +1230,29 @@ void CoreController::performWatchdogControlOperation() { } void CoreController::performMountedSdCardOperations() { - auto mountedSdCardOp = [&](bool &mntSwitch, sd::SdCard sdCard, std::string mntPoint) { - if (mntSwitch) { - bool sdCardMounted = sdcMan->isSdCardUsable(sdCard); - if (sdCardMounted and not performOneShotSdCardOpsSwitch) { - std::ostringstream path; - path << mntPoint << "/" << CONF_FOLDER; - if (not std::filesystem::exists(path.str())) { - std::filesystem::create_directory(path.str()); - } - initVersionFile(); - initClockFromTimeFile(); - performRebootFileHandling(false); - performOneShotSdCardOpsSwitch = true; + auto mountedSdCardOp = [&](sd::SdCard sdCard, std::string mntPoint) { + if (not performOneShotSdCardOpsSwitch) { + std::ostringstream path; + path << mntPoint << "/" << CONF_FOLDER; + if (not std::filesystem::exists(path.str())) { + std::filesystem::create_directory(path.str()); } - mntSwitch = false; + initVersionFile(); + initClockFromTimeFile(); + performRebootFileHandling(false); } }; - if (sdInfo.active == sd::SdCard::SLOT_1) { - mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, config::SD_1_MOUNT_POINT); - mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, config::SD_0_MOUNT_POINT); - } else { - mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, config::SD_0_MOUNT_POINT); - mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, config::SD_1_MOUNT_POINT); + bool clearOneShotFlag = false; + if (sdInfo.active == sd::SdCard::SLOT_0 and sdcMan->isSdCardUsable(sd::SdCard::SLOT_0)) { + mountedSdCardOp(sd::SdCard::SLOT_0, config::SD_0_MOUNT_POINT); + clearOneShotFlag = true; + } + if (sdInfo.active == sd::SdCard::SLOT_1 and sdcMan->isSdCardUsable(sd::SdCard::SLOT_1)) { + mountedSdCardOp(sd::SdCard::SLOT_1, config::SD_1_MOUNT_POINT); + clearOneShotFlag = true; + } + if (clearOneShotFlag) { + performOneShotSdCardOpsSwitch = true; } timeFileHandler(); } diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 206a93c9..3c205e4a 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -205,7 +205,7 @@ class CoreController : public ExtendedControllerBase { RebootFile rebootFile = {}; std::string currMntPrefix; - bool performOneShotSdCardOpsSwitch = true; + bool performOneShotSdCardOpsSwitch = false; /** * Index 0: Chip 0 Copy 0 diff --git a/fsfw b/fsfw index a8fb83df..692be9df 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit a8fb83dfcedb5391ac942d6bcffa64f0cbca38c5 +Subproject commit 692be9df8d06beb3bfc83aad77cefd727d8f7c35 diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 30f5e176..10c74fca 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -238,7 +238,8 @@ void ThermalController::copySensors() { PoolReadGuard pg0(&max31865Set0); if (pg0.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_ploc_heatspreader.value = max31865Set0.temperatureCelcius.value; - sensorTemperatures.sensor_ploc_heatspreader.setValid(max31865Set0.temperatureCelcius.isValid()); + sensorTemperatures.sensor_ploc_heatspreader.setValid( + max31865Set0.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_ploc_heatspreader.isValid()) { sensorTemperatures.sensor_ploc_heatspreader.value = INVALID_TEMPERATURE; } @@ -249,7 +250,8 @@ void ThermalController::copySensors() { PoolReadGuard pg1(&max31865Set1); if (pg1.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_ploc_missionboard.value = max31865Set1.temperatureCelcius.value; - sensorTemperatures.sensor_ploc_missionboard.setValid(max31865Set1.temperatureCelcius.isValid()); + sensorTemperatures.sensor_ploc_missionboard.setValid( + max31865Set1.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_ploc_missionboard.isValid()) { sensorTemperatures.sensor_ploc_missionboard.value = INVALID_TEMPERATURE; } @@ -271,7 +273,8 @@ void ThermalController::copySensors() { PoolReadGuard pg3(&max31865Set3); if (pg3.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_dac_heatspreader.value = max31865Set3.temperatureCelcius.value; - sensorTemperatures.sensor_dac_heatspreader.setValid(max31865Set3.temperatureCelcius.isValid()); + sensorTemperatures.sensor_dac_heatspreader.setValid( + max31865Set3.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_dac_heatspreader.isValid()) { sensorTemperatures.sensor_dac_heatspreader.value = INVALID_TEMPERATURE; } @@ -389,7 +392,6 @@ void ThermalController::copySensors() { } } - { PoolReadGuard pg14(&max31865Set14); if (pg14.getReadResult() == returnvalue::OK) { diff --git a/tmtc b/tmtc index a91d40f3..4c3f5f28 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a91d40f3337a948bc061b033e194dd629fd34be1 +Subproject commit 4c3f5f28256be0dbfc5b46ea87f8f484c93a9996