NetBurner 3.5.7
PDF Version
gps_config.h
1#ifndef GPS_CONFIG_H
2#define GPS_CONFIG_H
3
4#include <config_obj.h>
5
16{
17 public:
18 // Operating Mode
19 config_chooser m_mode{
20 0,
21 "Mode",
22 "GPS operating mode: 0=Mobile (don't use saved position), 1=Fixed (use saved position for faster startup)",
23 {"Mobile", "Fixed"}
24 };
25
26 // Last Known Position (for Fixed mode quick start)
27 config_double m_lastLatitude{
28 0.0,
29 "LastLatitude",
30 "Last known latitude in decimal degrees (-90 to +90)"
31 };
32
33 config_double m_lastLongitude{
34 0.0,
35 "LastLongitude",
36 "Last known longitude in decimal degrees (-180 to +180)"
37 };
38
39 config_double m_lastAltitude{
40 0.0,
41 "LastAltitude",
42 "Last known altitude in meters above sea level"
43 };
44
45 config_int m_lastPositionTime{
46 0,
47 "LastPositionTime",
48 "Unix timestamp when position was last saved (epoch seconds)"
49 };
50
51 // NTP Time Assistance
52 config_bool m_useNtpForTimeAiding{
53 true,
54 "UseNtpTimeAiding",
55 "Use NTP pool servers to get time for GPS startup assistance (recommended for NTP server applications)"
56 };
57
58 config_string m_ntpServer{
59 "pool.ntp.org",
60 "NtpServer",
61 "NTP server for time aiding (default: pool.ntp.org)"
62 };
63
64 // AssistNow Data Management
65 config_int m_assistSaveIntervalHours{
66 24,
67 "AssistSaveInterval",
68 "How often to save AssistNow data to flash (hours, min=12, max=168)"
69 };
70
71 config_int m_minRuntimeBeforeSave{
72 4,
73 "MinRuntimeBeforeSave",
74 "Minimum GPS runtime before saving AssistNow data (hours, ensures good data quality)"
75 };
76
77 config_int m_minSatellitesForSave{
78 6,
79 "MinSatellitesForSave",
80 "Minimum satellites required to save AssistNow data (ensures good fix quality)"
81 };
82
83 // Position Auto-Save (for Fixed mode)
84 config_bool m_autoSavePosition{
85 true,
86 "AutoSavePosition",
87 "Automatically save position after achieving good fix (recommended for Fixed mode)"
88 };
89
90 config_int m_positionSaveThreshold{
91 60,
92 "PositionSaveThreshold",
93 "Save position after this many seconds of good fix (prevents saving during initial acquisition)"
94 };
95
96 ConfigEndMarker;
97
98 GPSAssistConfig(config_obj &owner, const char *name, const char *desc = nullptr)
99 : config_obj(owner, name, desc) {}
100
101 // Helper methods
102 bool isFixedMode() const { return m_mode.GetValue() == 1; }
103 bool isMobileMode() const { return m_mode.GetValue() == 0; }
104
105 bool hasValidPosition() const {
106 // Check if we have a reasonably recent position (within 30 days)
107 time_t now = time(nullptr);
108 time_t lastPos = m_lastPositionTime.GetValue();
109 return (lastPos > 0) && (now - lastPos < 30 * 24 * 3600);
110 }
111
112 // Get save interval in seconds
113 uint32_t getAssistSaveIntervalSeconds() const {
114 return m_assistSaveIntervalHours.GetValue() * 3600;
115 }
116
117 uint32_t getMinRuntimeSeconds() const {
118 return m_minRuntimeBeforeSave.GetValue() * 3600;
119 }
120};
121
122// Global configuration instance - declare as extern here, define in main.cpp
123extern GPSAssistConfig gGPSAssistConfig;
124
125#endif // GPS_CONFIG_H
Definition gps_config.h:16
Boolean Configuration Variable.
Definition config_obj.h:998
Chooser Configuration Variable - Select From a List of Items.
Definition config_obj.h:2033
Double Float Configuration Variable.
Definition config_obj.h:817
Signed 32-bit Integer Configuration Variable.
Definition config_obj.h:701
Base class used to create configuration objects.
Definition config_obj.h:321
String Configuration Variable.
Definition config_obj.h:1128
time_t time(time_t *pt)
Gets the current system GMT time.