this should remove the fix changed spam
This commit is contained in:
parent
9a8c059e05
commit
236916bf67
@ -2072,8 +2072,7 @@ ReturnValue_t CoreController::initClockFromTimeFile() {
|
|||||||
std::string fileName = currMntPrefix + BACKUP_TIME_FILE;
|
std::string fileName = currMntPrefix + BACKUP_TIME_FILE;
|
||||||
std::error_code e;
|
std::error_code e;
|
||||||
if (sdcMan->isSdCardUsable(std::nullopt) and std::filesystem::exists(fileName, e) and
|
if (sdcMan->isSdCardUsable(std::nullopt) and std::filesystem::exists(fileName, e) and
|
||||||
((gpsFix == FixMode::UNKNOWN or gpsFix == FixMode::NOT_SEEN) or
|
((gpsFix == FixMode::NOT_SEEN) or not utility::timeSanityCheck())) {
|
||||||
not utility::timeSanityCheck())) {
|
|
||||||
ifstream timeFile(fileName);
|
ifstream timeFile(fileName);
|
||||||
string nextWord;
|
string nextWord;
|
||||||
getline(timeFile, nextWord);
|
getline(timeFile, nextWord);
|
||||||
|
@ -209,7 +209,7 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
|
|||||||
static constexpr MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
|
static constexpr MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
|
||||||
static constexpr uint32_t MUTEX_TIMEOUT = 20;
|
static constexpr uint32_t MUTEX_TIMEOUT = 20;
|
||||||
bool enableHkSet = false;
|
bool enableHkSet = false;
|
||||||
GpsHyperion::FixMode gpsFix = GpsHyperion::FixMode::UNKNOWN;
|
GpsHyperion::FixMode gpsFix = GpsHyperion::FixMode::NOT_SEEN;
|
||||||
|
|
||||||
// States for SD state machine, which is used in non-blocking mode
|
// States for SD state machine, which is used in non-blocking mode
|
||||||
enum class SdStates {
|
enum class SdStates {
|
||||||
|
@ -58,8 +58,8 @@ ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_
|
|||||||
PoolReadGuard pg(&gpsSet);
|
PoolReadGuard pg(&gpsSet);
|
||||||
gpsSet.setValidity(false, true);
|
gpsSet.setValidity(false, true);
|
||||||
// There can't be a fix with a device that is off.
|
// There can't be a fix with a device that is off.
|
||||||
triggerEvent(GpsHyperion::GPS_FIX_CHANGE, gpsSet.fixMode.value, 0);
|
handleFixChangedEvent(GpsHyperion::FixMode::NOT_SEEN);
|
||||||
gpsSet.fixMode.value = 0;
|
gpsSet.fixMode.value = GpsHyperion::FixMode::NOT_SEEN;
|
||||||
oneShotSwitches.reset();
|
oneShotSwitches.reset();
|
||||||
modeCommanded = false;
|
modeCommanded = false;
|
||||||
}
|
}
|
||||||
@ -249,11 +249,12 @@ ReturnValue_t GpsHyperionLinuxController::handleCoreTelemetry(bool modeIsSet) {
|
|||||||
uint8_t newFix = 0;
|
uint8_t newFix = 0;
|
||||||
if (modeIsSet) {
|
if (modeIsSet) {
|
||||||
// 0: Not seen, 1: No fix, 2: 2D-Fix, 3: 3D-Fix
|
// 0: Not seen, 1: No fix, 2: 2D-Fix, 3: 3D-Fix
|
||||||
if (gps.fix.mode == 2 or gps.fix.mode == 3) {
|
if (gps.fix.mode == GpsHyperion::FixMode::FIX_2D or
|
||||||
|
gps.fix.mode == GpsHyperion::FixMode::FIX_3D) {
|
||||||
validFix = true;
|
validFix = true;
|
||||||
}
|
}
|
||||||
newFix = gps.fix.mode;
|
newFix = gps.fix.mode;
|
||||||
if (newFix == 0 or newFix == 1) {
|
if (newFix == GpsHyperion::FixMode::NOT_SEEN or newFix == GpsHyperion::FixMode::NO_FIX) {
|
||||||
if (modeCommanded and maxTimeToReachFix.hasTimedOut()) {
|
if (modeCommanded and maxTimeToReachFix.hasTimedOut()) {
|
||||||
// We are supposed to be on and functioning, but no fix was found
|
// We are supposed to be on and functioning, but no fix was found
|
||||||
if (mode == MODE_ON or mode == MODE_NORMAL) {
|
if (mode == MODE_ON or mode == MODE_NORMAL) {
|
||||||
@ -264,9 +265,7 @@ ReturnValue_t GpsHyperionLinuxController::handleCoreTelemetry(bool modeIsSet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gpsSet.fixMode.value != newFix) {
|
if (gpsSet.fixMode.value != newFix) {
|
||||||
#if OBSW_Q7S_EM != 1
|
handleFixChangedEvent(newFix);
|
||||||
triggerEvent(GpsHyperion::GPS_FIX_CHANGE, gpsSet.fixMode.value, newFix);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
gpsSet.fixMode = newFix;
|
gpsSet.fixMode = newFix;
|
||||||
gpsSet.fixMode.setValid(modeIsSet);
|
gpsSet.fixMode.setValid(modeIsSet);
|
||||||
@ -297,7 +296,7 @@ ReturnValue_t GpsHyperionLinuxController::handleCoreTelemetry(bool modeIsSet) {
|
|||||||
// Negative latitude -> South direction
|
// Negative latitude -> South direction
|
||||||
gpsSet.latitude.value = gps.fix.latitude;
|
gpsSet.latitude.value = gps.fix.latitude;
|
||||||
// As specified in gps.h: Only valid if mode >= 2
|
// As specified in gps.h: Only valid if mode >= 2
|
||||||
if (gps.fix.mode >= 2) {
|
if (gps.fix.mode >= GpsHyperion::FixMode::FIX_2D) {
|
||||||
latValid = true;
|
latValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,7 +305,7 @@ ReturnValue_t GpsHyperionLinuxController::handleCoreTelemetry(bool modeIsSet) {
|
|||||||
// Negative longitude -> West direction
|
// Negative longitude -> West direction
|
||||||
gpsSet.longitude.value = gps.fix.longitude;
|
gpsSet.longitude.value = gps.fix.longitude;
|
||||||
// As specified in gps.h: Only valid if mode >= 2
|
// As specified in gps.h: Only valid if mode >= 2
|
||||||
if (gps.fix.mode >= 2) {
|
if (gps.fix.mode >= GpsHyperion::FixMode::FIX_2D) {
|
||||||
longValid = true;
|
longValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,7 +318,7 @@ ReturnValue_t GpsHyperionLinuxController::handleCoreTelemetry(bool modeIsSet) {
|
|||||||
if (ALTITUDE_SET == (ALTITUDE_SET & gps.set) && std::isfinite(gps.fix.altitude)) {
|
if (ALTITUDE_SET == (ALTITUDE_SET & gps.set) && std::isfinite(gps.fix.altitude)) {
|
||||||
gpsSet.altitude.value = gps.fix.altitude;
|
gpsSet.altitude.value = gps.fix.altitude;
|
||||||
// As specified in gps.h: Only valid if mode == 3
|
// As specified in gps.h: Only valid if mode == 3
|
||||||
if (gps.fix.mode == 3) {
|
if (gps.fix.mode == GpsHyperion::FixMode::FIX_3D) {
|
||||||
altitudeValid = true;
|
altitudeValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,3 +429,12 @@ void GpsHyperionLinuxController::overwriteTimeIfNotSane(timeval time, bool valid
|
|||||||
timeInit = true;
|
timeInit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GpsHyperionLinuxController::handleFixChangedEvent(uint8_t newFix) {
|
||||||
|
if (gainedNewFix.hasTimedOut()) {
|
||||||
|
triggerEvent(GpsHyperion::GPS_FIX_CHANGE, newFix, fixChangeCounter);
|
||||||
|
fixChangeCounter = 0;
|
||||||
|
}
|
||||||
|
fixChangeCounter++;
|
||||||
|
gainedNewFix.resetTimer();
|
||||||
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||||
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||||
|
|
||||||
|
#include <common/config/eive/eventSubsystemIds.h>
|
||||||
|
#include <fsfw/FSFW.h>
|
||||||
|
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
#include <mission/acs/archive/GPSDefinitions.h>
|
#include <mission/acs/archive/GPSDefinitions.h>
|
||||||
#include <mission/utility/trace.h>
|
#include <mission/utility/trace.h>
|
||||||
|
|
||||||
#include "eive/eventSubsystemIds.h"
|
|
||||||
#include "fsfw/FSFW.h"
|
|
||||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
|
||||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
|
||||||
|
|
||||||
#ifdef FSFW_OSAL_LINUX
|
#ifdef FSFW_OSAL_LINUX
|
||||||
#include <gps.h>
|
#include <gps.h>
|
||||||
#include <libgpsmm.h>
|
#include <libgpsmm.h>
|
||||||
@ -65,6 +64,8 @@ class GpsHyperionLinuxController : public ExtendedControllerBase {
|
|||||||
const char* currentClientBuf = nullptr;
|
const char* currentClientBuf = nullptr;
|
||||||
ReadModes readMode = ReadModes::SOCKET;
|
ReadModes readMode = ReadModes::SOCKET;
|
||||||
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
|
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
|
||||||
|
Countdown gainedNewFix = Countdown(60 * 2 * 1000);
|
||||||
|
uint32_t fixChangeCounter = 0;
|
||||||
bool modeCommanded = false;
|
bool modeCommanded = false;
|
||||||
bool timeInit = false;
|
bool timeInit = false;
|
||||||
uint8_t satNotSetCounter = 0;
|
uint8_t satNotSetCounter = 0;
|
||||||
@ -92,6 +93,8 @@ class GpsHyperionLinuxController : public ExtendedControllerBase {
|
|||||||
// we set it with the roughly valid time from the GPS. For some reason, NTP might only work
|
// we set it with the roughly valid time from the GPS. For some reason, NTP might only work
|
||||||
// if the time difference between sys time and current time is not too large
|
// if the time difference between sys time and current time is not too large
|
||||||
void overwriteTimeIfNotSane(timeval time, bool validFix);
|
void overwriteTimeIfNotSane(timeval time, bool validFix);
|
||||||
|
|
||||||
|
void handleFixChangedEvent(uint8_t newFix);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_GPSHYPERIONHANDLER_H_ */
|
#endif /* MISSION_DEVICES_GPSHYPERIONHANDLER_H_ */
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
namespace GpsHyperion {
|
namespace GpsHyperion {
|
||||||
|
|
||||||
enum class FixMode : uint8_t { NOT_SEEN = 0, NO_FIX = 1, FIX_2D = 2, FIX_3D = 3, UNKNOWN = 4 };
|
enum FixMode : uint8_t { NOT_SEEN = 0, NO_FIX = 1, FIX_2D = 2, FIX_3D = 3 };
|
||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::GPS_HANDLER;
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::GPS_HANDLER;
|
||||||
//! [EXPORT] : [COMMENT] Fix has changed. P1: Old fix. P2: New fix
|
//! [EXPORT] : [COMMENT] Fix has changed. P1: New fix. P2: Missed fix changes
|
||||||
//! 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix
|
//! 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix
|
||||||
static constexpr Event GPS_FIX_CHANGE = event::makeEvent(SUBSYSTEM_ID, 0, severity::INFO);
|
static constexpr Event GPS_FIX_CHANGE = event::makeEvent(SUBSYSTEM_ID, 0, severity::INFO);
|
||||||
//! [EXPORT] : [COMMENT] Could not get fix in maximum allowed time. P1: Maximum allowed time
|
//! [EXPORT] : [COMMENT] Could not get fix in maximum allowed time. P1: Maximum allowed time
|
||||||
@ -53,8 +53,6 @@ static constexpr uint8_t SKYVIEW_ENTRIES = 6;
|
|||||||
|
|
||||||
static constexpr uint8_t MAX_SATELLITES = 30;
|
static constexpr uint8_t MAX_SATELLITES = 30;
|
||||||
|
|
||||||
enum GpsFixModes : uint8_t { INVALID = 0, NO_FIX = 1, FIX_2D = 2, FIX_3D = 3 };
|
|
||||||
|
|
||||||
} // namespace GpsHyperion
|
} // namespace GpsHyperion
|
||||||
|
|
||||||
class GpsPrimaryDataset : public StaticLocalDataSet<GpsHyperion::CORE_DATASET_ENTRIES> {
|
class GpsPrimaryDataset : public StaticLocalDataSet<GpsHyperion::CORE_DATASET_ENTRIES> {
|
||||||
|
Loading…
Reference in New Issue
Block a user