bugfixes and improvements
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
- Tests finished
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
#include "OBSWConfig.h"
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
#include "fsfw/timemanager/Clock.h"
|
||||
|
||||
#include "linux/utility/utility.h"
|
||||
#include "mission/utility/compileTime.h"
|
||||
|
||||
#if FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV == 1
|
||||
@ -127,9 +127,14 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
return;
|
||||
}
|
||||
|
||||
bool validFix = false;
|
||||
static_cast<void>(validFix);
|
||||
// 0: Not seen, 1: No fix, 2: 2D-Fix, 3: 3D-Fix
|
||||
int newFixMode = gps->fix.mode;
|
||||
if(gpsSet.fixMode.value != newFixMode) {
|
||||
if (newFixMode == 2 or newFixMode == 3) {
|
||||
validFix = true;
|
||||
}
|
||||
if (gpsSet.fixMode.value != newFixMode) {
|
||||
triggerEvent(GpsHyperion::GPS_FIX_CHANGE, gpsSet.fixMode.value, newFixMode);
|
||||
}
|
||||
gpsSet.fixMode.value = newFixMode;
|
||||
@ -185,11 +190,19 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
} else {
|
||||
timeIsConstantCounter = 0;
|
||||
}
|
||||
if (timeInit) {
|
||||
if (not utility::timeSanityCheck()) {
|
||||
sif::info << "Setting init clock in gps ctrl" << std::endl;
|
||||
// For some reason, the clock needs to be somewhat correct for NTP to work. Really dumb..
|
||||
Clock::setClock(&time);
|
||||
}
|
||||
timeInit = false;
|
||||
}
|
||||
// If the received time does not change anymore for whatever reason, do not set it here
|
||||
// to avoid stale times. Also, don't do it too often often to avoid jumping times
|
||||
if (timeIsConstantCounter < 20 and timeUpdateCd.hasTimedOut()) {
|
||||
// Update the system time here for now. NTP seems to be unable to do so for whatever reason.
|
||||
// Further tests have shown that the time seems to be set by NTPD after sme time..
|
||||
// Further tests have shown that the time seems to be set by NTPD after some time..
|
||||
// Clock::setClock(&time);
|
||||
timeUpdateCd.resetTimer();
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "commonSubsystemIds.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
|
||||
@ -24,7 +24,6 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
|
||||
public:
|
||||
static constexpr uint32_t MAX_SECONDS_TO_REACH_FIX = 60 * 60 * 5;
|
||||
|
||||
|
||||
GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId,
|
||||
bool debugHyperionGps = false);
|
||||
virtual ~GPSHyperionLinuxController();
|
||||
@ -52,6 +51,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
|
||||
GpsPrimaryDataset gpsSet;
|
||||
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
|
||||
bool modeCommanded = true;
|
||||
bool timeInit = true;
|
||||
gpsmm myGpsmm;
|
||||
bool debugHyperionGps = false;
|
||||
uint32_t timeIsConstantCounter = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 183 translations.
|
||||
* @details
|
||||
* Generated on: 2022-04-07 17:27:42
|
||||
* Generated on: 2022-04-08 11:21:58
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 117 translations.
|
||||
* Generated on: 2022-04-07 17:27:42
|
||||
* Generated on: 2022-04-08 11:21:58
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include "utility.h"
|
||||
|
||||
#include <cstring>
|
||||
@ -5,6 +6,7 @@
|
||||
#include "FSFWConfig.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
#include "fsfw/timemanager/Clock.h"
|
||||
|
||||
void utility::handleSystemError(int retcode, std::string function) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
@ -12,3 +14,14 @@ void utility::handleSystemError(int retcode, std::string function) {
|
||||
<< strerror(retcode) << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool utility::timeSanityCheck() {
|
||||
timeval currentTime = {};
|
||||
Clock::getUptime(¤tTime);
|
||||
Clock::TimeOfDay_t currTimeOfDay = {};
|
||||
Clock::convertTimevalToTimeOfDay(¤tTime, &currTimeOfDay);
|
||||
if (currTimeOfDay.year == 2000) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ namespace utility {
|
||||
|
||||
void handleSystemError(int retcode, std::string function);
|
||||
|
||||
}
|
||||
bool timeSanityCheck();
|
||||
|
||||
} // namespace utility
|
||||
|
||||
#endif /* LINUX_UTILITY_UTILITY_H_ */
|
||||
|
Reference in New Issue
Block a user