From f95abfe032109a60ed9e8a452787e87e540d4977 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 19 Feb 2022 17:07:11 +0100 Subject: [PATCH] avoid code duplication --- linux/devices/GPSHyperionLinuxController.cpp | 1 - linux/devices/GPSHyperionLinuxController.h | 2 +- .../devicedefinitions/GPSDefinitions.h | 63 ------------------- 3 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 linux/devices/devicedefinitions/GPSDefinitions.h diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index c47414a8..982d82be 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -2,7 +2,6 @@ #include -#include "devicedefinitions/GPSDefinitions.h" #include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/timemanager/Clock.h" diff --git a/linux/devices/GPSHyperionLinuxController.h b/linux/devices/GPSHyperionLinuxController.h index 57da40e6..a39ee9ac 100644 --- a/linux/devices/GPSHyperionLinuxController.h +++ b/linux/devices/GPSHyperionLinuxController.h @@ -1,7 +1,7 @@ #ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_ #define MISSION_DEVICES_GPSHYPERIONHANDLER_H_ -#include "devicedefinitions/GPSDefinitions.h" +#include "mission/devices/devicedefinitions/GPSDefinitions.h" #include "fsfw/FSFW.h" #include "fsfw/controller/ExtendedControllerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h" diff --git a/linux/devices/devicedefinitions/GPSDefinitions.h b/linux/devices/devicedefinitions/GPSDefinitions.h deleted file mode 100644 index 5a565fea..00000000 --- a/linux/devices/devicedefinitions/GPSDefinitions.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GPSDEFINITIONS_H_ -#define MISSION_DEVICES_DEVICEDEFINITIONS_GPSDEFINITIONS_H_ - -#include "fsfw/datapoollocal/StaticLocalDataSet.h" -#include "fsfw/devicehandlers/DeviceHandlerIF.h" - -namespace GpsHyperion { - -static constexpr DeviceCommandId_t GPS_REPLY = 0; -static constexpr DeviceCommandId_t TRIGGER_RESET_PIN = 5; - -static constexpr uint32_t DATASET_ID = 0; - -enum GpsPoolIds : lp_id_t { - LATITUDE = 0, - LONGITUDE = 1, - ALTITUDE = 2, - SPEED = 3, - FIX_MODE = 4, - SATS_IN_USE = 5, - SATS_IN_VIEW = 6, - UNIX_SECONDS = 7, - YEAR = 8, - MONTH = 9, - DAY = 10, - HOURS = 11, - MINUTES = 12, - SECONDS = 13 -}; - -enum GpsFixModes : uint8_t { INVALID = 0, NO_FIX = 1, FIX_2D = 2, FIX_3D = 3 }; - -} // namespace GpsHyperion - -class GpsPrimaryDataset : public StaticLocalDataSet<18> { - public: - GpsPrimaryDataset(object_id_t gpsId) : StaticLocalDataSet(sid_t(gpsId, GpsHyperion::DATASET_ID)) { - setAllVariablesReadOnly(); - } - - lp_var_t latitude = lp_var_t(sid.objectId, GpsHyperion::LATITUDE, this); - lp_var_t longitude = lp_var_t(sid.objectId, GpsHyperion::LONGITUDE, this); - lp_var_t altitude = lp_var_t(sid.objectId, GpsHyperion::ALTITUDE, this); - lp_var_t speed = lp_var_t(sid.objectId, GpsHyperion::SPEED, this); - lp_var_t fixMode = lp_var_t(sid.objectId, GpsHyperion::FIX_MODE, this); - lp_var_t satInUse = lp_var_t(sid.objectId, GpsHyperion::SATS_IN_USE, this); - lp_var_t satInView = lp_var_t(sid.objectId, GpsHyperion::SATS_IN_VIEW, this); - lp_var_t year = lp_var_t(sid.objectId, GpsHyperion::YEAR, this); - lp_var_t month = lp_var_t(sid.objectId, GpsHyperion::MONTH, this); - lp_var_t day = lp_var_t(sid.objectId, GpsHyperion::DAY, this); - lp_var_t hours = lp_var_t(sid.objectId, GpsHyperion::HOURS, this); - lp_var_t minutes = lp_var_t(sid.objectId, GpsHyperion::MINUTES, this); - lp_var_t seconds = lp_var_t(sid.objectId, GpsHyperion::SECONDS, this); - lp_var_t unixSeconds = - lp_var_t(sid.objectId, GpsHyperion::UNIX_SECONDS, this); - - private: - friend class GPSHyperionLinuxController; - GpsPrimaryDataset(HasLocalDataPoolIF* hkOwner) - : StaticLocalDataSet(hkOwner, GpsHyperion::DATASET_ID) {} -}; - -#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GPSDEFINITIONS_H_ */