From 141f82d0a9c86913a9479862a26afdeef8cd9f11 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 1 Mar 2024 15:27:13 +0100 Subject: [PATCH 01/16] prevent ctrl values from becoming NaN --- mission/controller/acs/Guidance.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mission/controller/acs/Guidance.cpp b/mission/controller/acs/Guidance.cpp index f9182cbd..0a70e003 100644 --- a/mission/controller/acs/Guidance.cpp +++ b/mission/controller/acs/Guidance.cpp @@ -273,7 +273,11 @@ void Guidance::limitReferenceRotation(const double xAxisIX[3], double quatIX[4]) QuaternionOperations::multiply(quatIXtilde, quatXI, quatXXtilde); double phiResidual = 0, phiResidualVec[3] = {0, 0, 0}; - phiResidual = std::sqrt((phiMax * phiMax) - (phiX * phiX)); + if ((phiX * phiX) > (phiMax * phiMax)) { + phiResidual = 0; + } else { + phiResidual = std::sqrt((phiMax * phiMax) - (phiX * phiX)); + } std::memcpy(phiResidualVec, quatXXtilde, sizeof(phiResidualVec)); VectorOperations::normalize(phiResidualVec, phiResidualVec, 3); -- 2.43.0 From 6da37c0fa41d0fd320668cdaa23c044618408ec4 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 1 Mar 2024 15:29:14 +0100 Subject: [PATCH 02/16] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47237e1a..27d132e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Fixed + +- Fixed case in which control values within the `AcsController` could become NaN. + # [v7.7.0] 2024-02-29 - Bumped `eive-tmtc` to v6.1.0 -- 2.43.0 From cda2a9df332d9c909a1d71d368d3053a15fee37f Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 4 Mar 2024 11:57:10 +0100 Subject: [PATCH 03/16] use existing function --- mission/controller/acs/Igrf13Model.cpp | 6 ++++-- mission/controller/acs/Igrf13Model.h | 2 +- mission/controller/acs/SensorProcessing.cpp | 3 ++- mission/controller/acs/SensorProcessing.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mission/controller/acs/Igrf13Model.cpp b/mission/controller/acs/Igrf13Model.cpp index 4ae7c93a..b15edada 100644 --- a/mission/controller/acs/Igrf13Model.cpp +++ b/mission/controller/acs/Igrf13Model.cpp @@ -69,7 +69,8 @@ void Igrf13Model::magFieldComp(const double longitude, const double gcLatitude, magFieldModel[1] *= -1; magFieldModel[2] *= (-1 / sin(theta)); - double JD2000 = TimeSystems::convertUnixToJD2000(timeOfMagMeasurement); + double JD2000 = 0; + Clock::convertTimevalToJD2000(timeOfMagMeasurement, &JD2000); double UT1 = JD2000 / 36525.; double gst = @@ -93,7 +94,8 @@ void Igrf13Model::magFieldComp(const double longitude, const double gcLatitude, void Igrf13Model::updateCoeffGH(timeval timeOfMagMeasurement) { double JD2000Igrf = (2458850.0 - 2451545); // Begin of IGRF-13 (2020-01-01,00:00:00) in JD2000 - double JD2000 = TimeSystems::convertUnixToJD2000(timeOfMagMeasurement); + double JD2000 = 0; + Clock::convertTimevalToJD2000(timeOfMagMeasurement, &JD2000); double days = ceil(JD2000 - JD2000Igrf); for (int i = 0; i <= igrfOrder; i++) { for (int j = 0; j <= (igrfOrder - 1); j++) { diff --git a/mission/controller/acs/Igrf13Model.h b/mission/controller/acs/Igrf13Model.h index 9a7feb34..f0936b7f 100644 --- a/mission/controller/acs/Igrf13Model.h +++ b/mission/controller/acs/Igrf13Model.h @@ -16,11 +16,11 @@ #ifndef IGRF13MODEL_H_ #define IGRF13MODEL_H_ -#include #include #include #include #include +#include #include diff --git a/mission/controller/acs/SensorProcessing.cpp b/mission/controller/acs/SensorProcessing.cpp index ac82e891..46be5db2 100644 --- a/mission/controller/acs/SensorProcessing.cpp +++ b/mission/controller/acs/SensorProcessing.cpp @@ -180,7 +180,8 @@ void SensorProcessing::processSus( const AcsParameters::SunModelParameters *sunModelParameters, acsctrl::SusDataProcessed *susDataProcessed) { /* -------- Sun Model Direction (IJK frame) ------- */ - double JD2000 = TimeSystems::convertUnixToJD2000(timeAbsolute); + double JD2000 = 0; + Clock::convertTimevalToJD2000(timeAbsolute, &JD2000); // Julean Centuries double sunIjkModel[3] = {0.0, 0.0, 0.0}; diff --git a/mission/controller/acs/SensorProcessing.h b/mission/controller/acs/SensorProcessing.h index e5efba71..baa43117 100644 --- a/mission/controller/acs/SensorProcessing.h +++ b/mission/controller/acs/SensorProcessing.h @@ -4,13 +4,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include #include #include -- 2.43.0 From 2a2a173ebd342e3d99e147b085decfecb26c0c14 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 09:06:48 +0100 Subject: [PATCH 04/16] prep for leap seconds --- bsp_q7s/core/CoreController.cpp | 58 ++++++++++++++++++++++++++++++++ bsp_q7s/core/CoreController.h | 6 ++++ common/config/eive/definitions.h | 3 ++ mission/sysDefs.h | 3 ++ 4 files changed, 70 insertions(+) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index e1b48fd2..f8bdb416 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -480,6 +480,13 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ successRecipient = commandedBy; return returnvalue::OK; } + case (UPDATE_LEAP_SECONDS): { + ReturnValue_t result = actionUpdateLeapSeconds(); + if (result != returnvalue::OK) { + return result; + } + return HasActionsIF::EXECUTION_FINISHED; + } default: { return HasActionsIF::INVALID_ACTION_ID; } @@ -2066,9 +2073,60 @@ ReturnValue_t CoreController::backupTimeFileHandler() { return returnvalue::OK; } +void CoreController::initLeapSeconds() { + ReturnValue_t result = initLeapSecondsFromFile(); + if (result != returnvalue::OK) { + Clock::setLeapSeconds(config::LEAP_SECONDS); + writeLeapSecondsToFile(config::LEAP_SECONDS); + } +} + +ReturnValue_t CoreController::initLeapSecondsFromFile() { + std::string fileName = currMntPrefix + LEAP_SECONDS_FILE; + std::error_code e; + if (sdcMan->isSdCardUsable(std::nullopt) and std::filesystem::exists(fileName, e)) { + std::ifstream leapSecondsFile(fileName); + std::string nextWord; + std::getline(leapSecondsFile, nextWord); + std::istringstream iss(nextWord); + iss >> nextWord; + if (iss.bad() or nextWord != "LEAP") { + return returnvalue::FAILED; + } + iss >> nextWord; + if (iss.bad() or nextWord != "SECONDS:") { + return returnvalue::FAILED; + } + iss >> nextWord; + uint16_t leapSeconds = 0; + size_t checkPtr; + leapSeconds = std::stoi(nextWord.c_str(), &checkPtr, 10); + if (iss.bad() or *checkPtr) { + return returnvalue::FAILED; + } + Clock::setLeapSeconds(leapSeconds); + return returnvalue::OK; + } + return returnvalue::FAILED; +}; + +ReturnValue_t CoreController::writeLeapSecondsToFile(const uint16_t leapSeconds) { + std::string fileName = currMntPrefix + LEAP_SECONDS_FILE; + if (sdcMan->isSdCardUsable(std::nullopt)) { + std::ofstream leapSecondsFile(fileName.c_str(), std::ofstream::out | std::ofstream::trunc); + if (leapSecondsFile.is_open()) { + leapSecondsFile << "LEAP SECONDS: " << leapSeconds << std::endl; + } + } + return returnvalue::FAILED; +}; + +ReturnValue_t CoreController::actionUpdateLeapSeconds() { ; } + ReturnValue_t CoreController::initClockFromTimeFile() { using namespace GpsHyperion; using namespace std; + std::string fileName = currMntPrefix + BACKUP_TIME_FILE; std::error_code e; if (sdcMan->isSdCardUsable(std::nullopt) and std::filesystem::exists(fileName, e) and diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 79224ed2..0aa2a690 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -150,6 +150,8 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe std::string(core::LEGACY_REBOOT_WATCHDOG_FILE_NAME); const std::string REBOOT_WATCHDOG_FILE = "/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::REBOOT_WATCHDOG_FILE_NAME); + const std::string LEAP_SECONDS_FILE = + "/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::LEAP_SECONDS_FILE_NAME); const std::string BACKUP_TIME_FILE = "/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::TIME_FILE_NAME); const std::string REBOOT_COUNTERS_FILE = @@ -335,7 +337,11 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe void performMountedSdCardOperations(); ReturnValue_t initVersionFile(); + void initLeapSeconds(); + ReturnValue_t initLeapSecondsFromFile(); ReturnValue_t initClockFromTimeFile(); + ReturnValue_t actionUpdateLeapSeconds(); + ReturnValue_t writeLeapSecondsToFile(const uint16_t leapSeconds); ReturnValue_t performSdCardCheck(); ReturnValue_t backupTimeFileHandler(); ReturnValue_t initBootCopyFile(); diff --git a/common/config/eive/definitions.h b/common/config/eive/definitions.h index 0b63a017..4c96c3a5 100644 --- a/common/config/eive/definitions.h +++ b/common/config/eive/definitions.h @@ -20,6 +20,9 @@ static constexpr char OBSW_VERSION_FILE_PATH[] = "/usr/share/eive-obsw/obsw_vers // ISO8601 timestamp. static constexpr char FILE_DATE_FORMAT[] = "%FT%H%M%SZ"; +// Leap Seconds as of 2024-03-04 +static constexpr uint16_t LEAP_SECONDS = 37; + static constexpr uint16_t EIVE_PUS_APID = 0x65; static constexpr uint16_t EIVE_CFDP_APID = 0x66; static constexpr uint16_t EIVE_LOCAL_CFDP_ENTITY_ID = EIVE_CFDP_APID; diff --git a/mission/sysDefs.h b/mission/sysDefs.h index 8fade60a..924b1a9e 100644 --- a/mission/sysDefs.h +++ b/mission/sysDefs.h @@ -55,6 +55,7 @@ static constexpr char VERSION_FILE_NAME[] = "version.txt"; static constexpr char LEGACY_REBOOT_WATCHDOG_FILE_NAME[] = "reboot.txt"; static constexpr char REBOOT_WATCHDOG_FILE_NAME[] = "reboot_watchdog.txt"; static constexpr char REBOOT_COUNTER_FILE_NAME[] = "reboot_counters.txt"; +static constexpr char LEAP_SECONDS_FILE_NAME[] = "leapseconds.txt"; static constexpr char TIME_FILE_NAME[] = "time_backup.txt"; static constexpr uint32_t SYS_ROM_BASE_ADDR = 0x80000000; @@ -93,6 +94,8 @@ static constexpr ActionId_t MV_HELPER = 53; static constexpr ActionId_t RM_HELPER = 54; static constexpr ActionId_t MKDIR_HELPER = 55; +static constexpr ActionId_t UPDATE_LEAP_SECONDS = 60; + static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE; static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM); -- 2.43.0 From 85ed8420fd12ff610e20c704f14ae0ca562159fe Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 11:51:02 +0100 Subject: [PATCH 05/16] act cmd --- bsp_q7s/core/CoreController.cpp | 17 ++++++++++++++--- bsp_q7s/core/CoreController.h | 2 +- tmtc | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index f8bdb416..426f8989 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -481,7 +481,10 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ return returnvalue::OK; } case (UPDATE_LEAP_SECONDS): { - ReturnValue_t result = actionUpdateLeapSeconds(); + if (size != 2) { + return HasActionsIF::INVALID_PARAMETERS; + } + ReturnValue_t result = actionUpdateLeapSeconds(data); if (result != returnvalue::OK) { return result; } @@ -2101,7 +2104,7 @@ ReturnValue_t CoreController::initLeapSecondsFromFile() { uint16_t leapSeconds = 0; size_t checkPtr; leapSeconds = std::stoi(nextWord.c_str(), &checkPtr, 10); - if (iss.bad() or *checkPtr) { + if (iss.bad() or checkPtr) { return returnvalue::FAILED; } Clock::setLeapSeconds(leapSeconds); @@ -2121,7 +2124,15 @@ ReturnValue_t CoreController::writeLeapSecondsToFile(const uint16_t leapSeconds) return returnvalue::FAILED; }; -ReturnValue_t CoreController::actionUpdateLeapSeconds() { ; } +ReturnValue_t CoreController::actionUpdateLeapSeconds(const uint8_t *data) { + uint16_t leapSeconds = data[1] | (data[0] << 8); + ReturnValue_t result = writeLeapSecondsToFile(leapSeconds); + if (result != returnvalue::OK) { + return result; + } + Clock::setLeapSeconds(leapSeconds); + return returnvalue::OK; +} ReturnValue_t CoreController::initClockFromTimeFile() { using namespace GpsHyperion; diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 0aa2a690..4864a2ec 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -340,7 +340,7 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe void initLeapSeconds(); ReturnValue_t initLeapSecondsFromFile(); ReturnValue_t initClockFromTimeFile(); - ReturnValue_t actionUpdateLeapSeconds(); + ReturnValue_t actionUpdateLeapSeconds(const uint8_t* data); ReturnValue_t writeLeapSecondsToFile(const uint16_t leapSeconds); ReturnValue_t performSdCardCheck(); ReturnValue_t backupTimeFileHandler(); diff --git a/tmtc b/tmtc index 73a4260f..811786fd 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 73a4260f337aa39475baef999466b200c9123e62 +Subproject commit 811786fd78d5953956a8abba1c10c18c6e494422 -- 2.43.0 From 440d989490160789da0da8b409abf25d345adfe3 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 13:08:29 +0100 Subject: [PATCH 06/16] whoops --- bsp_q7s/core/CoreController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 426f8989..b3c62ead 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -481,7 +481,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ return returnvalue::OK; } case (UPDATE_LEAP_SECONDS): { - if (size != 2) { + if (size != sizeof(uint16_t)) { return HasActionsIF::INVALID_PARAMETERS; } ReturnValue_t result = actionUpdateLeapSeconds(data); -- 2.43.0 From c2d8ef9fe4db3b015771a461881adf23ee4daa50 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 13:48:09 +0100 Subject: [PATCH 07/16] should be enough --- bsp_q7s/core/CoreController.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index b3c62ead..77e499b1 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -2102,9 +2102,8 @@ ReturnValue_t CoreController::initLeapSecondsFromFile() { } iss >> nextWord; uint16_t leapSeconds = 0; - size_t checkPtr; - leapSeconds = std::stoi(nextWord.c_str(), &checkPtr, 10); - if (iss.bad() or checkPtr) { + leapSeconds = std::stoi(nextWord.c_str()); + if (iss.bad()) { return returnvalue::FAILED; } Clock::setLeapSeconds(leapSeconds); -- 2.43.0 From aa4bfa8d88152fda322782e5bc8d9d0c714fcc9d Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 14:09:40 +0100 Subject: [PATCH 08/16] we might want an OK --- bsp_q7s/core/CoreController.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 77e499b1..a60f4fd7 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -2114,13 +2114,17 @@ ReturnValue_t CoreController::initLeapSecondsFromFile() { ReturnValue_t CoreController::writeLeapSecondsToFile(const uint16_t leapSeconds) { std::string fileName = currMntPrefix + LEAP_SECONDS_FILE; - if (sdcMan->isSdCardUsable(std::nullopt)) { - std::ofstream leapSecondsFile(fileName.c_str(), std::ofstream::out | std::ofstream::trunc); - if (leapSecondsFile.is_open()) { - leapSecondsFile << "LEAP SECONDS: " << leapSeconds << std::endl; - } + if (not sdcMan->isSdCardUsable(std::nullopt)) { + return returnvalue::FAILED; } - return returnvalue::FAILED; + std::ofstream leapSecondsFile(fileName.c_str(), std::ofstream::out | std::ofstream::trunc); + if (not leapSecondsFile.good()) { + sif::error << "CoreController::leapSecondsFileHandler: Error opening time file: " + << strerror(errno) << std::endl; + return returnvalue::FAILED; + } + leapSecondsFile << "LEAP SECONDS: " << leapSeconds << std::endl; + return returnvalue::OK; }; ReturnValue_t CoreController::actionUpdateLeapSeconds(const uint8_t *data) { -- 2.43.0 From 39032249b249fcde868436de448a3416783d4610 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 14:10:32 +0100 Subject: [PATCH 09/16] - --- bsp_q7s/core/CoreController.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index a60f4fd7..20e66f0c 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -2140,7 +2140,6 @@ ReturnValue_t CoreController::actionUpdateLeapSeconds(const uint8_t *data) { ReturnValue_t CoreController::initClockFromTimeFile() { using namespace GpsHyperion; using namespace std; - std::string fileName = currMntPrefix + BACKUP_TIME_FILE; std::error_code e; if (sdcMan->isSdCardUsable(std::nullopt) and std::filesystem::exists(fileName, e) and -- 2.43.0 From fb8a92ecb54e894bbecdbb146d9310bb96bdacc6 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 14:30:13 +0100 Subject: [PATCH 10/16] bumped fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 516357d8..518a07d0 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 516357d855c07786b492e981230988186376d301 +Subproject commit 518a07d05b09b0cebe0d68628757266ce5facc4c -- 2.43.0 From c52818a5ce536df46e34d1315e026e81631834dc Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 15:49:11 +0100 Subject: [PATCH 11/16] changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27d132e8..af0fcb86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,13 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +- Bumped `eive-tmtc` to v +- Bumped `eive-fsfw` + +## Added + +- + ## Fixed - Fixed case in which control values within the `AcsController` could become NaN. -- 2.43.0 From efaf48beff279db2461ba223f6c75340f9ea17e6 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 6 Mar 2024 09:46:51 +0100 Subject: [PATCH 12/16] we should actually use this --- bsp_q7s/core/CoreController.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 20e66f0c..432befff 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -79,6 +79,7 @@ CoreController::CoreController(object_id_t objectId, bool enableHkSet) } catch (const std::filesystem::filesystem_error &e) { sif::error << "CoreController::CoreController: Failed with exception " << e.what() << std::endl; } + initLeapSeconds(); // Add script folder to path char *currentEnvPath = getenv("PATH"); std::string updatedEnvPath = std::string(currentEnvPath) + ":/home/root/scripts:/usr/local/bin"; @@ -2109,6 +2110,9 @@ ReturnValue_t CoreController::initLeapSecondsFromFile() { Clock::setLeapSeconds(leapSeconds); return returnvalue::OK; } + sif::error + << "CoreController::leapSecondsFileHandler: Initalization of leap seconds from file failed" + << std::endl; return returnvalue::FAILED; }; @@ -2119,7 +2123,7 @@ ReturnValue_t CoreController::writeLeapSecondsToFile(const uint16_t leapSeconds) } std::ofstream leapSecondsFile(fileName.c_str(), std::ofstream::out | std::ofstream::trunc); if (not leapSecondsFile.good()) { - sif::error << "CoreController::leapSecondsFileHandler: Error opening time file: " + sif::error << "CoreController::leapSecondsFileHandler: Error opening leap seconds file: " << strerror(errno) << std::endl; return returnvalue::FAILED; } -- 2.43.0 From 3501763cf0cb06114f6c0720a2a9cd07317c5b60 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 6 Mar 2024 09:47:06 +0100 Subject: [PATCH 13/16] fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 518a07d0..26730702 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 518a07d05b09b0cebe0d68628757266ce5facc4c +Subproject commit 26730702045f24ca23e15d3db1148ab1f3ce47d9 -- 2.43.0 From 616803c6a86c5afaa9960e222c02222607ec752b Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 6 Mar 2024 09:47:47 +0100 Subject: [PATCH 14/16] changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af0fcb86..75a6be09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,9 @@ will consitute of a breaking change warranting a new major release: ## Added -- +- The `CoreController` now sets the leap seconds on initalization. They are stored in a persistent + file. If the file does yet not exist, it will be created. The leap seconds can be updated using an + action command. This will also update the file. ## Fixed -- 2.43.0 From 7efd48c6954099b4cd7135de41a41a8f1a56c316 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 6 Mar 2024 11:09:23 +0100 Subject: [PATCH 15/16] make robin happy --- bsp_q7s/core/CoreController.cpp | 5 ++++- bsp_q7s/core/CoreController.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 432befff..1f6fdec6 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -79,7 +79,6 @@ CoreController::CoreController(object_id_t objectId, bool enableHkSet) } catch (const std::filesystem::filesystem_error &e) { sif::error << "CoreController::CoreController: Failed with exception " << e.what() << std::endl; } - initLeapSeconds(); // Add script folder to path char *currentEnvPath = getenv("PATH"); std::string updatedEnvPath = std::string(currentEnvPath) + ":/home/root/scripts:/usr/local/bin"; @@ -1422,6 +1421,9 @@ void CoreController::performMountedSdCardOperations() { if (not timeFileInitDone) { initClockFromTimeFile(); } + if (not leapSecondsInitDone) { + initLeapSeconds(); + } performRebootWatchdogHandling(false); performRebootCountersHandling(false); } @@ -2083,6 +2085,7 @@ void CoreController::initLeapSeconds() { Clock::setLeapSeconds(config::LEAP_SECONDS); writeLeapSecondsToFile(config::LEAP_SECONDS); } + leapSecondsInitDone = true; } ReturnValue_t CoreController::initLeapSecondsFromFile() { diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 4864a2ec..1b1f9853 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -298,6 +298,7 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe std::string currMntPrefix; bool timeFileInitDone = false; + bool leapSecondsInitDone = false; bool performOneShotSdCardOpsSwitch = false; uint8_t shortSdCardCdCounter = 0; #if OBSW_THREAD_TRACING == 1 -- 2.43.0 From 781feffc9036aeaf6bb7c85397eff40d19e7a8eb Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 6 Mar 2024 11:10:35 +0100 Subject: [PATCH 16/16] bumped submodules --- CHANGELOG.md | 2 +- fsfw | 2 +- tmtc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 425d121e..12e6e1ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ will consitute of a breaking change warranting a new major release: # [unreleased] -- Bumped `eive-tmtc` to v +- Bumped `eive-tmtc` to v6.1.1 - Bumped `eive-fsfw` ## Added diff --git a/fsfw b/fsfw index 26730702..47b21caf 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 26730702045f24ca23e15d3db1148ab1f3ce47d9 +Subproject commit 47b21caf5fa2a27c7ace89f960141b3f24c329ee diff --git a/tmtc b/tmtc index 811786fd..c843356c 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 811786fd78d5953956a8abba1c10c18c6e494422 +Subproject commit c843356c8af22bf45a04c71c93813716c9d743ec -- 2.43.0