diff --git a/CMakeLists.txt b/CMakeLists.txt index 59d9d32d..17796924 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ set(LIB_ARCSEC wire) set(THIRD_PARTY_FOLDER thirdparty) set(LIB_CXX_FS -lstdc++fs) set(LIB_CATCH2 Catch2) +set(LIB_GPS gps) set(LIB_JSON_NAME nlohmann_json::nlohmann_json) # Set path names @@ -221,6 +222,7 @@ if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG)) if(TGT_BSP MATCHES "arm/q7s") target_link_libraries(${TARGET_NAME} PRIVATE ${LIB_ARCSEC} + ${LIB_GPS} ) endif() endif() diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index 5cead3d5..77bd7e13 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -12,8 +12,12 @@ #include "test/DummyParameter.h" #include +#include +#include +#include #include +#include #include #include @@ -31,6 +35,11 @@ ReturnValue_t Q7STestTask::performOneShotAction() { return TestTask::performOneShotAction(); } +ReturnValue_t Q7STestTask::performPeriodicAction() { + testGpsDaemon(); + return TestTask::performPeriodicAction(); +} + void Q7STestTask::testSdCard() { using namespace std; Stopwatch stopwatch; @@ -224,6 +233,26 @@ void Q7STestTask::testProtHandler() { } } +void Q7STestTask::testGpsDaemon() { + gpsmm gpsmm(GPSD_SHARED_MEMORY, 0); + gps_data_t* gps; + gps = gpsmm.read(); + if(gps == nullptr) { + sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl; + } + sif::info << "-- Q7STestTask: GPS shared memory read test --" << std::endl; + time_t timeRaw = gps->fix.time.tv_sec; + std::tm* time = gmtime(&timeRaw); + sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl; + sif::info << "Visible satellites: " << gps->satellites_visible << std::endl; + sif::info << "Satellites used: " << gps->satellites_used << std::endl; + sif::info << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl; + sif::info << "Latitude: " << gps->fix.latitude << std::endl; + sif::info << "Longitude: " << gps->fix.longitude << std::endl; + sif::info << "Altitude(MSL): " << gps->fix.altMSL << std::endl; + sif::info << "Speed(m/s): " << gps->fix.speed << std::endl; +} + void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { auto fsHandler = ObjectManager::instance()-> get(objects::FILE_SYSTEM_HANDLER); diff --git a/bsp_q7s/boardtest/Q7STestTask.h b/bsp_q7s/boardtest/Q7STestTask.h index 5e11b374..f6da9b7a 100644 --- a/bsp_q7s/boardtest/Q7STestTask.h +++ b/bsp_q7s/boardtest/Q7STestTask.h @@ -11,6 +11,9 @@ public: private: CoreController* coreController = nullptr; ReturnValue_t performOneShotAction() override; + ReturnValue_t performPeriodicAction() override; + + void testGpsDaemon(); void testSdCard(); void fileTests(); diff --git a/fsfw b/fsfw index 5214f8a4..c1e0bcee 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 5214f8a449d195ecfa69f978cc0fe001ef76130a +Subproject commit c1e0bcee6db652d6c474c87a4099e61ecf86b694