@@ -46,12 +46,18 @@ float GNSS::getSurveyInStartingAccuracy()
46
46
// ----------------------------------------
47
47
// Returns true if the antenna is shorted
48
48
// ----------------------------------------
49
- bool GNSS::isAntennaShorted () { return false ; }
49
+ bool GNSS::isAntennaShorted ()
50
+ {
51
+ return false ;
52
+ }
50
53
51
54
// ----------------------------------------
52
55
// Returns true if the antenna is shorted
53
56
// ----------------------------------------
54
- bool GNSS::isAntennaOpen () { return false ; }
57
+ bool GNSS::isAntennaOpen ()
58
+ {
59
+ return false ;
60
+ }
55
61
56
62
// ----------------------------------------
57
63
// Set the minimum satellite signal level for navigation.
@@ -98,3 +104,106 @@ void pushGPGGA(char *ggaData)
98
104
}
99
105
#endif // COMPILE_NETWORK
100
106
}
107
+
108
+ // Detect what type of GNSS receiver module is installed
109
+ // using serial or other begin() methods
110
+ // To reduce potential false ID's, record the ID to NVM
111
+ // If we have a previous ID, use it
112
+ void gnssDetectReceiverType ()
113
+ {
114
+ // Currently only the Flex requires GNSS receiver detection
115
+ if (productVariant != RTK_FLEX)
116
+ return ;
117
+
118
+ // settings.detectedGnssReceiver = GNSS_RECEIVER_LG290P;
119
+ // gnss = (GNSS *)new GNSS_LG290P();
120
+ // systemPrintln("Starting GNSS receiver: LG290P");
121
+ // return;
122
+
123
+ gnssBoot (); // Tell GNSS to run
124
+
125
+ // TODO remove after testing, force retest on each boot
126
+ settings.detectedGnssReceiver = GNSS_RECEIVER_UNKNOWN;
127
+
128
+ // Start auto-detect if NVM is not yet set
129
+ if (settings.detectedGnssReceiver == GNSS_RECEIVER_UNKNOWN)
130
+ {
131
+ #ifdef COMPILE_LG290P
132
+ if (lg290pIsPresent () == true )
133
+ {
134
+ settings.detectedGnssReceiver = GNSS_RECEIVER_LG290P;
135
+ recordSystemSettings (); // Record the detected GNSS receiver and avoid this test in the future
136
+ }
137
+ #else // COMPILE_LGP290P
138
+ systemPrintln (" <<<<<<<<<< !!!!!!!!!! LG290P NOT COMPILED !!!!!!!!!! >>>>>>>>>>" );
139
+ #endif // COMPILE_LGP290P
140
+
141
+ #ifdef COMPILE_MOSAICX5
142
+ // TODO - this uses UART2, but Flex is UART1. We need to make the mosaic send routines flexible to use
143
+ // whichever UART we specify.
144
+ // if (mosaicIsPresent() == true)
145
+ // settings.detectedGnssReceiver = GNSS_RECEIVER_MOSAIC_X5;
146
+ // recordSystemSettings(); // Record the detected GNSS receiver and avoid this test in the future
147
+ #else // COMPILE_MOSAICX5
148
+ systemPrintln (" <<<<<<<<<< !!!!!!!!!! MOSAICX5 NOT COMPILED !!!!!!!!!! >>>>>>>>>>" );
149
+ #endif // COMPILE_MOSAICX5
150
+ }
151
+
152
+ // Start the detected receiver
153
+ if (settings.detectedGnssReceiver == GNSS_RECEIVER_LG290P)
154
+ {
155
+ #ifdef COMPILE_LG290P
156
+ gnss = (GNSS *)new GNSS_LG290P ();
157
+ present.gnss_lg290p = true ;
158
+ systemPrintln (" Starting GNSS receiver: LG290P" );
159
+ #endif // COMPILE_LGP290P
160
+ }
161
+ else if (settings.detectedGnssReceiver == GNSS_RECEIVER_MOSAIC_X5)
162
+ {
163
+ #ifdef COMPILE_MOSAICX5
164
+ gnss = (GNSS *)new GNSS_MOSAIC ();
165
+ present.gnss_mosaicX5 = true ;
166
+ systemPrintln (" Starting GNSS receiver: mosaic-X5" );
167
+ #endif // COMPILE_MOSAICX5
168
+ }
169
+
170
+ // Auto ID failed, mark everything as unknown
171
+ else if (settings.detectedGnssReceiver == GNSS_RECEIVER_UNKNOWN)
172
+ {
173
+ gnss = (GNSS *)new GNSS_None ();
174
+ }
175
+ }
176
+
177
+ // Based on the platform, put the GNSS receiver into run mode
178
+ void gnssBoot ()
179
+ {
180
+ if (productVariant == RTK_TORCH)
181
+ {
182
+ digitalWrite (pin_GNSS_DR_Reset, HIGH); // Tell UM980 and DR to boot
183
+ }
184
+ else if (productVariant == RTK_FLEX)
185
+ {
186
+ gpioExpanderGnssBoot (); // Drive the GNSS reset pin high
187
+ }
188
+ else if (productVariant == RTK_POSTCARD)
189
+ {
190
+ digitalWrite (pin_GNSS_Reset, HIGH); // Tell LG290P to boot
191
+ }
192
+ }
193
+
194
+ // Based on the platform, put the GNSS receiver into reset
195
+ void gnssReset ()
196
+ {
197
+ if (productVariant == RTK_TORCH)
198
+ {
199
+ digitalWrite (pin_GNSS_DR_Reset, LOW); // Tell UM980 and DR to reset
200
+ }
201
+ else if (productVariant == RTK_FLEX)
202
+ {
203
+ gpioExpanderGnssReset (); // Drive the GNSS reset pin low
204
+ }
205
+ else if (productVariant == RTK_POSTCARD)
206
+ {
207
+ digitalWrite (pin_GNSS_Reset, LOW); // Tell LG290P to reset
208
+ }
209
+ }
0 commit comments