gps contd
This commit is contained in:
parent
9f795e3a3e
commit
74b320d8e4
@ -2,6 +2,7 @@
|
||||
#include "devicedefinitions/GPSDefinitions.h"
|
||||
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
#include "fsfw/timemanager/Clock.h"
|
||||
|
||||
#include "lwgps/lwgps.h"
|
||||
|
||||
@ -77,9 +78,28 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len,
|
||||
// Set all entries valid now, set invalid on case basis if values are sanitized
|
||||
gpsSet.setValidity(true, true);
|
||||
}
|
||||
// Negative latitude -> South direction
|
||||
gpsSet.latitude.value = gpsData.latitude;
|
||||
// Negative longitude -> West direction
|
||||
gpsSet.longitude.value = gpsData.latitude;
|
||||
gpsSet.fixMode.value = gpsData.fix_mode;
|
||||
gpsSet.satInUse.value = gpsData.sats_in_use;
|
||||
Clock::TimeOfDay_t timeStruct = {};
|
||||
timeStruct.day = gpsData.date;
|
||||
timeStruct.hour = gpsData.hours;
|
||||
timeStruct.minute = gpsData.minutes;
|
||||
timeStruct.month = gpsData.month;
|
||||
timeStruct.second = gpsData.seconds;
|
||||
// Convert two-digit year to full year (AD)
|
||||
timeStruct.year = gpsData.year + 2000;
|
||||
timeval timeval = {};
|
||||
Clock::convertTimeOfDayToTimeval(&timeStruct, &timeval);
|
||||
gpsSet.year = timeStruct.year;
|
||||
gpsSet.month = gpsData.month;
|
||||
gpsSet.day = gpsData.date;
|
||||
gpsSet.hours = gpsData.hours;
|
||||
gpsSet.minutes = gpsData.minutes;
|
||||
gpsSet.seconds = gpsData.seconds;
|
||||
#if FSFW_HAL_DEBUG_HYPERION_GPS == 1
|
||||
sif::info << "GPS Data" << std::endl;
|
||||
printf("Valid status: %d\n", gpsData.is_valid);
|
||||
@ -105,6 +125,18 @@ uint32_t GPSHyperionHandler::getTransitionDelayMs(Mode_t from, Mode_t to) {
|
||||
|
||||
ReturnValue_t GPSHyperionHandler::initializeLocalDataPool(
|
||||
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(GpsHyperion::ALTITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::LONGITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::LATITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::YEAR, new PoolEntry<uint16_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::MONTH, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::DAY, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::HOURS, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::MINUTES, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::SECONDS, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::UNIX_SECONDS, new PoolEntry<uint32_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -15,11 +15,26 @@ enum GpsPoolIds: lp_id_t {
|
||||
LONGITUDE = 1,
|
||||
ALTITUDE = 2,
|
||||
FIX_MODE = 3,
|
||||
SATS_IN_USE = 4,
|
||||
UNIX_SECONDS = 5,
|
||||
YEAR = 6,
|
||||
MONTH = 7,
|
||||
DAY = 8,
|
||||
HOURS = 9,
|
||||
MINUTES = 10,
|
||||
SECONDS = 11
|
||||
};
|
||||
|
||||
enum GpsFixModes: uint8_t {
|
||||
INVALID = 0,
|
||||
NO_FIX = 1,
|
||||
FIX_2D = 2,
|
||||
FIX_3D = 3
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class GpsPrimaryDataset: public StaticLocalDataSet<5> {
|
||||
class GpsPrimaryDataset: public StaticLocalDataSet<18> {
|
||||
public:
|
||||
GpsPrimaryDataset(object_id_t gpsId):
|
||||
StaticLocalDataSet(sid_t(gpsId, GpsHyperion::DATASET_ID)) {
|
||||
@ -32,6 +47,15 @@ public:
|
||||
GpsHyperion::LONGITUDE, this);
|
||||
lp_var_t<double> altitude = lp_var_t<double>(sid.objectId, GpsHyperion::ALTITUDE, this);
|
||||
lp_var_t<uint8_t> fixMode = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::FIX_MODE, this);
|
||||
lp_var_t<uint8_t> satInUse = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::SATS_IN_USE, this);
|
||||
lp_var_t<uint16_t> year = lp_var_t<uint16_t>(sid.objectId, GpsHyperion::YEAR, this);
|
||||
lp_var_t<uint8_t> month = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::MONTH, this);
|
||||
lp_var_t<uint8_t> day = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::DAY, this);
|
||||
lp_var_t<uint8_t> hours = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::HOURS, this);
|
||||
lp_var_t<uint8_t> minutes = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::MINUTES, this);
|
||||
lp_var_t<uint8_t> seconds = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::SECONDS, this);
|
||||
lp_var_t<uint32_t> unixSeconds = lp_var_t<uint32_t>(sid.objectId,
|
||||
GpsHyperion::UNIX_SECONDS, this);
|
||||
private:
|
||||
friend class GPSHyperionHandler;
|
||||
GpsPrimaryDataset(HasLocalDataPoolIF* hkOwner):
|
||||
|
Loading…
Reference in New Issue
Block a user