Skip to content

Commit aa3f81a

Browse files
committed
Rework gnssDetectReceiverType
1 parent f41bcce commit aa3f81a

File tree

2 files changed

+35
-28
lines changed

2 files changed

+35
-28
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ void pinGnssUartTask(void *pvParameters)
11731173
}
11741174
else if (settings.detectedGnssReceiver == GNSS_RECEIVER_MOSAIC_X5)
11751175
{
1176-
// Mosaic defaults to 115200, but mosaicIsPresentOnFlex() increases to 460800bps
1176+
// Mosaic defaults to 115200, but mosaicIsPresentOnFlex() increases COM1 to 460800bps
11771177
platformGnssCommunicationRate = 115200 * 4;
11781178
}
11791179
else

Firmware/RTK_Everywhere/GNSS.ino

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -118,58 +118,65 @@ void gnssDetectReceiverType()
118118
gnssBoot(); // Tell GNSS to run
119119

120120
// TODO remove after testing, force retest on each boot
121+
// Note: with this in place, the X5 detection will take a lot longer due to the baud rate change
121122
settings.detectedGnssReceiver = GNSS_RECEIVER_UNKNOWN;
122123

123124
// Start auto-detect if NVM is not yet set
124125
if (settings.detectedGnssReceiver == GNSS_RECEIVER_UNKNOWN)
125126
{
127+
// The COMPILE guards prevent else if
128+
// Use a do while (0) so we can break when GNSS is detected
129+
do {
126130
#ifdef COMPILE_LG290P
127-
if (lg290pIsPresent() == true)
128-
{
129-
systemPrintln("Auto-detected GNSS receiver: LG290P");
130-
131-
present.gnss_lg290p = true;
132-
present.minCno = true;
133-
present.minElevation = true;
134-
present.needsExternalPpl = true; // Uses the PointPerfect Library
135-
136-
settings.detectedGnssReceiver = GNSS_RECEIVER_LG290P;
137-
recordSystemSettings(); // Record the detected GNSS receiver and avoid this test in the future
138-
}
131+
if (lg290pIsPresent() == true)
132+
{
133+
systemPrintln("Auto-detected GNSS receiver: LG290P");
134+
settings.detectedGnssReceiver = GNSS_RECEIVER_LG290P;
135+
recordSystemSettings(); // Record the detected GNSS receiver and avoid this test in the future
136+
break;
137+
}
139138
#else // COMPILE_LGP290P
140-
systemPrintln("<<<<<<<<<< !!!!!!!!!! LG290P NOT COMPILED !!!!!!!!!! >>>>>>>>>>");
139+
systemPrintln("<<<<<<<<<< !!!!!!!!!! LG290P NOT COMPILED !!!!!!!!!! >>>>>>>>>>");
141140
#endif // COMPILE_LGP290P
142141

143142
#ifdef COMPILE_MOSAICX5
144-
if (mosaicIsPresentOnFlex() == true)
145-
{
146-
systemPrintln("Auto-detected GNSS receiver: mosaic-X5");
147-
148-
present.gnss_mosaicX5 = true;
149-
present.minCno = true;
150-
present.minElevation = true;
151-
present.dynamicModel = true;
152-
present.needsExternalPpl = true; // Uses the PointPerfect Library
153-
154-
settings.detectedGnssReceiver = GNSS_RECEIVER_MOSAIC_X5;
155-
recordSystemSettings(); // Record the detected GNSS receiver and avoid this test in the future
156-
}
143+
if (mosaicIsPresentOnFlex() == true) // Note: this changes the COM1 baud from 115200 to 460800
144+
{
145+
systemPrintln("Auto-detected GNSS receiver: mosaic-X5");
146+
settings.detectedGnssReceiver = GNSS_RECEIVER_MOSAIC_X5;
147+
recordSystemSettings(); // Record the detected GNSS receiver and avoid this test in the future
148+
break;
149+
}
157150
#else // COMPILE_MOSAICX5
158-
systemPrintln("<<<<<<<<<< !!!!!!!!!! MOSAICX5 NOT COMPILED !!!!!!!!!! >>>>>>>>>>");
151+
systemPrintln("<<<<<<<<<< !!!!!!!!!! MOSAICX5 NOT COMPILED !!!!!!!!!! >>>>>>>>>>");
159152
#endif // COMPILE_MOSAICX5
153+
} while (0);
160154
}
161155

162156
// Start the detected receiver
163157
if (settings.detectedGnssReceiver == GNSS_RECEIVER_LG290P)
164158
{
165159
#ifdef COMPILE_LG290P
166160
gnss = (GNSS *)new GNSS_LG290P();
161+
162+
present.gnss_lg290p = true;
163+
present.minCno = true;
164+
present.minElevation = true;
165+
present.needsExternalPpl = true; // Uses the PointPerfect Library
166+
167167
#endif // COMPILE_LGP290P
168168
}
169169
else if (settings.detectedGnssReceiver == GNSS_RECEIVER_MOSAIC_X5)
170170
{
171171
#ifdef COMPILE_MOSAICX5
172172
gnss = (GNSS *)new GNSS_MOSAIC();
173+
174+
present.gnss_mosaicX5 = true;
175+
present.minCno = true;
176+
present.minElevation = true;
177+
present.dynamicModel = true;
178+
// present.needsExternalPpl = true; // Nope. No L-Band support...
179+
173180
#endif // COMPILE_MOSAICX5
174181
}
175182

0 commit comments

Comments
 (0)