From a1c3b1786f073e20e65ce177d47b2aad6c807c61 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Apr 2022 10:07:42 +0200 Subject: [PATCH 1/3] bump submodules --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 24ef96d1..d61fe7db 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 24ef96d1b802e768d395f94b69f9f81a3c6d1e66 +Subproject commit d61fe7db93b37dd6652dbfee5b7c93f400ac5a11 diff --git a/tmtc b/tmtc index 28983d38..76da8042 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 28983d387b82578a73fbfe052cb53dec1910d021 +Subproject commit 76da8042a4601087e99fa856af241afe9e43695d From 584700a2ba089224ddd08a5f025ba544b936c293 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Apr 2022 10:21:04 +0200 Subject: [PATCH 2/3] do not add ETL lib --- CMakeLists.txt | 6 ------ linux/devices/GPSHyperionLinuxController.cpp | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9291e0db..79017dda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -301,12 +301,6 @@ target_include_directories(${WATCHDOG_NAME} PUBLIC #unittests add_executable(${UNITTEST_NAME} EXCLUDE_FROM_ALL) - - -if(EIVE_ADD_ETL_LIB) - add_subdirectory(${LIB_ETL_PATH}) -endif() - if(EIVE_ADD_JSON_LIB) add_subdirectory(${LIB_JSON_PATH}) endif() diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index 9c762842..669438b9 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -106,7 +106,7 @@ ReturnValue_t GPSHyperionLinuxController::handleCommandMessage(CommandMessage *m #ifdef FSFW_OSAL_LINUX void GPSHyperionLinuxController::readGpsDataFromGpsd() { - gpsmm myGpsmm(GPSD_SHARED_MEMORY, nullptr); + gpsmm myGpsmm("localhost", DEFAULT_GPSD_PORT); // The data from the device will generally be read all at once. Therefore, we // can set all field here if (not myGpsmm.is_open()) { From 234a6b7ac351de2beed25f18124604315fdb91d3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Apr 2022 10:50:39 +0200 Subject: [PATCH 3/3] switch gps ctrl to socket API --- linux/devices/GPSHyperionLinuxController.cpp | 45 ++++++++++++++++---- linux/devices/GPSHyperionLinuxController.h | 1 + 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index 669438b9..5a7d9808 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -1,5 +1,7 @@ #include "GPSHyperionLinuxController.h" +#include + #include "OBSWConfig.h" #include "fsfw/FSFW.h" #include "fsfw/datapool/PoolReadGuard.h" @@ -106,10 +108,10 @@ ReturnValue_t GPSHyperionLinuxController::handleCommandMessage(CommandMessage *m #ifdef FSFW_OSAL_LINUX void GPSHyperionLinuxController::readGpsDataFromGpsd() { - gpsmm myGpsmm("localhost", DEFAULT_GPSD_PORT); + gpsmm gpsmm("localhost", DEFAULT_GPSD_PORT); // The data from the device will generally be read all at once. Therefore, we // can set all field here - if (not myGpsmm.is_open()) { + if (not gpsmm.is_open()) { if (gpsNotOpenSwitch) { // Opening failed #if FSFW_VERBOSE_LEVEL >= 1 @@ -121,16 +123,41 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { } return; } + // Stopwatch watch; gps_data_t *gps = nullptr; - gps = myGpsmm.read(); + gps = gpsmm.stream(WATCH_ENABLE | WATCH_JSON); if (gps == nullptr) { - if (gpsReadFailedSwitch) { - gpsReadFailedSwitch = false; - sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed" - << std::endl; - } - return; + sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd:: Setting GPSD watch " + "policy failed" + << std::endl; } + while (gpsmm.waiting(2000)) { + gps = gpsmm.read(); + if (gps == nullptr) { + if (gpsReadFailedSwitch) { + gpsReadFailedSwitch = false; + sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed" + << std::endl; + } + return; + } + if (MODE_SET != (MODE_SET & gps->set)) { + if (noModeSetCntr >= 0) { + noModeSetCntr++; + } + if (noModeSetCntr == 10) { + // TODO: Trigger event here + sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: No mode could be " + "read for 10 consecutive reads" + << std::endl; + noModeSetCntr = -1; + } + return; + } else { + noModeSetCntr = 0; + } + } + gps = gpsmm.stream(WATCH_DISABLE); PoolReadGuard pg(&gpsSet); if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { #if FSFW_VERBOSE_LEVEL >= 1 diff --git a/linux/devices/GPSHyperionLinuxController.h b/linux/devices/GPSHyperionLinuxController.h index 42e9741b..8d0ec0cd 100644 --- a/linux/devices/GPSHyperionLinuxController.h +++ b/linux/devices/GPSHyperionLinuxController.h @@ -55,6 +55,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase { bool gpsNotOpenSwitch = true; bool gpsReadFailedSwitch = true; bool debugHyperionGps = false; + int32_t noModeSetCntr = 0; uint32_t timeIsConstantCounter = 0; Countdown timeUpdateCd = Countdown(60);