From 7a7f25a63837f530a835358693a9e3f99a037187 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 3 Mar 2023 14:36:52 +0100 Subject: [PATCH 1/2] lets see if this fixes issues --- CHANGELOG.md | 3 +++ fsfw | 2 +- linux/devices/AcsBoardPolling.cpp | 1 - linux/devices/GpsHyperionLinuxController.cpp | 5 ++--- linux/devices/GpsHyperionLinuxController.h | 4 ++-- linux/devices/Max31865RtdPolling.cpp | 2 -- linux/devices/RwPollingTask.cpp | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3fea248..496d9cfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ will consitute of a breaking change warranting a new major release: - IMTQ: Sets were filled with wrong data, e.g. Raw MTM was filled with calibrated MTM measurements. - Set RM3100 dataset to valid. - Fixed units in calculation of ACS control laws safe and detumble. +- Bump FSFW for change in Countdown: Use system clock instead of reading uptime from file + to prevent possible race condition. +- GPS: No fix for 30 minutes considered a faulty now instead of 5 hours. ## Added diff --git a/fsfw b/fsfw index 245886c5..78cf0031 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 245886c55500b9e70ba71eab68c46d44af9f6836 +Subproject commit 78cf00315d5bb9a05d47976a564d16c5978f1f41 diff --git a/linux/devices/AcsBoardPolling.cpp b/linux/devices/AcsBoardPolling.cpp index 6a16d816..5685cbde 100644 --- a/linux/devices/AcsBoardPolling.cpp +++ b/linux/devices/AcsBoardPolling.cpp @@ -110,7 +110,6 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send if (req->mode == acs::SimpleSensorMode::NORMAL) { adis.type = req->type; adis.countdown.setTimeout(adis1650x::START_UP_TIME); - adis.countdown.resetTimer(); if (adis.type == adis1650x::Type::ADIS16507) { adis.ownReply.data.accelScaling = adis1650x::ACCELEROMETER_RANGE_16507; } else if (adis.type == adis1650x::Type::ADIS16505) { diff --git a/linux/devices/GpsHyperionLinuxController.cpp b/linux/devices/GpsHyperionLinuxController.cpp index 3b396504..e3982a1c 100644 --- a/linux/devices/GpsHyperionLinuxController.cpp +++ b/linux/devices/GpsHyperionLinuxController.cpp @@ -20,7 +20,6 @@ GpsHyperionLinuxController::GpsHyperionLinuxController(object_id_t objectId, object_id_t parentId, bool debugHyperionGps) : ExtendedControllerBase(objectId), gpsSet(this), debugHyperionGps(debugHyperionGps) { - timeUpdateCd.resetTimer(); } GpsHyperionLinuxController::~GpsHyperionLinuxController() { @@ -196,8 +195,8 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { if (mode != MODE_OFF) { if (maxTimeToReachFix.hasTimedOut() and oneShotSwitches.cantGetFixSwitch) { sif::warning << "GpsHyperionLinuxController: No mode could be set in allowed " - << maxTimeToReachFix.timeout / 1000 << " seconds" << std::endl; - triggerEvent(GpsHyperion::CANT_GET_FIX, maxTimeToReachFix.timeout); + << maxTimeToReachFix.getTimeoutMs() / 1000 << " seconds" << std::endl; + triggerEvent(GpsHyperion::CANT_GET_FIX, maxTimeToReachFix.getTimeoutMs()); oneShotSwitches.cantGetFixSwitch = false; } modeIsSet = false; diff --git a/linux/devices/GpsHyperionLinuxController.h b/linux/devices/GpsHyperionLinuxController.h index df08d8a4..f00724bd 100644 --- a/linux/devices/GpsHyperionLinuxController.h +++ b/linux/devices/GpsHyperionLinuxController.h @@ -23,7 +23,8 @@ */ class GpsHyperionLinuxController : public ExtendedControllerBase { public: - static constexpr uint32_t MAX_SECONDS_TO_REACH_FIX = 60 * 60 * 5; + // 30 minutes + static constexpr uint32_t MAX_SECONDS_TO_REACH_FIX = 60 * 30; enum ReadModes { SHM = 0, SOCKET = 1 }; @@ -79,7 +80,6 @@ class GpsHyperionLinuxController : public ExtendedControllerBase { bool debugHyperionGps = false; int32_t noModeSetCntr = 0; - Countdown timeUpdateCd = Countdown(60); // Returns true if the function should be called again or false if other // controller handling can be done. diff --git a/linux/devices/Max31865RtdPolling.cpp b/linux/devices/Max31865RtdPolling.cpp index 004e7c60..53aad8fe 100644 --- a/linux/devices/Max31865RtdPolling.cpp +++ b/linux/devices/Max31865RtdPolling.cpp @@ -240,7 +240,6 @@ ReturnValue_t Max31865RtdPolling::sendMessage(CookieIF* cookie, const uint8_t* s case (EiveMax31855::RtdCommands::ON): { if (not rtdCookie->on) { rtdCookie->cd.setTimeout(MAX31865::WARMUP_MS); - rtdCookie->cd.resetTimer(); rtdCookie->on = true; rtdCookie->db.active = false; rtdCookie->db.configured = false; @@ -253,7 +252,6 @@ ReturnValue_t Max31865RtdPolling::sendMessage(CookieIF* cookie, const uint8_t* s case (EiveMax31855::RtdCommands::ACTIVE): { if (not rtdCookie->on) { rtdCookie->cd.setTimeout(MAX31865::WARMUP_MS); - rtdCookie->cd.resetTimer(); rtdCookie->on = true; rtdCookie->db.active = true; rtdCookie->db.configured = false; diff --git a/linux/devices/RwPollingTask.cpp b/linux/devices/RwPollingTask.cpp index 2d05ac8b..7dff31bb 100644 --- a/linux/devices/RwPollingTask.cpp +++ b/linux/devices/RwPollingTask.cpp @@ -220,7 +220,7 @@ ReturnValue_t RwPollingTask::readNextReply(RwCookie& rwCookie, uint8_t* replyBuf } pullCsLow(gpioId, gpioIF); bool lastByteWasFrameMarker = false; - Countdown cd(3000); + Countdown cd(2000); size_t readIdx = 0; while (true) { From 53133573e137f104543206bf49ec3263fc0e5b06 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 3 Mar 2023 14:58:03 +0100 Subject: [PATCH 2/2] measurement base code and comment --- fsfw | 2 +- linux/devices/AcsBoardPolling.cpp | 21 ++++++++++++-------- linux/devices/GpsHyperionLinuxController.cpp | 3 +-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/fsfw b/fsfw index 78cf0031..64537d44 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 78cf00315d5bb9a05d47976a564d16c5978f1f41 +Subproject commit 64537d442a335500bdc87ff382099de65f0b7aa7 diff --git a/linux/devices/AcsBoardPolling.cpp b/linux/devices/AcsBoardPolling.cpp index 5685cbde..3b35167d 100644 --- a/linux/devices/AcsBoardPolling.cpp +++ b/linux/devices/AcsBoardPolling.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -31,14 +32,18 @@ ReturnValue_t AcsBoardPolling::performOperation(uint8_t operationCode) { semaphore->acquire(); // Give all tasks or the PST some time to submit all consecutive requests. TaskFactory::delayTask(2); - gyroAdisHandler(gyro0Adis); - gyroAdisHandler(gyro2Adis); - gyroL3gHandler(gyro1L3g); - gyroL3gHandler(gyro3L3g); - mgmRm3100Handler(mgm1Rm3100); - mgmRm3100Handler(mgm3Rm3100); - mgmLis3Handler(mgm0Lis3); - mgmLis3Handler(mgm2Lis3); + { + // Measured to take 0-1 ms in debug build. + // Stopwatch watch; + gyroAdisHandler(gyro0Adis); + gyroAdisHandler(gyro2Adis); + gyroL3gHandler(gyro1L3g); + gyroL3gHandler(gyro3L3g); + mgmRm3100Handler(mgm1Rm3100); + mgmRm3100Handler(mgm3Rm3100); + mgmLis3Handler(mgm0Lis3); + mgmLis3Handler(mgm2Lis3); + } // To prevent task being not reactivated by tardy tasks TaskFactory::delayTask(20); } diff --git a/linux/devices/GpsHyperionLinuxController.cpp b/linux/devices/GpsHyperionLinuxController.cpp index e3982a1c..3beb0d87 100644 --- a/linux/devices/GpsHyperionLinuxController.cpp +++ b/linux/devices/GpsHyperionLinuxController.cpp @@ -19,8 +19,7 @@ GpsHyperionLinuxController::GpsHyperionLinuxController(object_id_t objectId, object_id_t parentId, bool debugHyperionGps) - : ExtendedControllerBase(objectId), gpsSet(this), debugHyperionGps(debugHyperionGps) { -} + : ExtendedControllerBase(objectId), gpsSet(this), debugHyperionGps(debugHyperionGps) {} GpsHyperionLinuxController::~GpsHyperionLinuxController() { gps_stream(&gps, WATCH_DISABLE, nullptr);