gps test worked
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
2022-01-15 13:05:11 +01:00
parent 2323fd0506
commit e73dc2f191
4 changed files with 35 additions and 1 deletions

View File

@ -12,8 +12,12 @@
#include "test/DummyParameter.h"
#include <nlohmann/json.hpp>
#include <gps.h>
#include <libgpsmm.h>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
@ -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<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);