@@ -218,11 +218,8 @@ void GNSS_MOSAIC::begin()
218
218
// COM3 can be connected to ESP32 UART2 (switched by SW3)
219
219
// COM4 can be connected to ESP32 UART0 (switched by SW2)
220
220
// We need to do everything through COM1: configure, transfer RTCM, receive NMEA
221
- // To make life easier for ourselves, we should:
222
- // Not support L-Band
223
- // Not encapsulate RTCMv3 and NMEA in SBF format
224
- // Configure the rtkParse accordingly
225
- // TODO: increase the COM1 baud rate to help. For now, leave it at 115200
221
+ // We need to Encapsulate RTCMv3 and NMEA in SBF format. Both SBF and NMEA messages start with "$".
222
+ // The alternative would be to add a 'hybrid' parser to the SEMP which can disambiguate SBF and NMEA
226
223
227
224
// On Facet Flex (with IMU):
228
225
// COM1 is connected to the ESP32 UART1
@@ -542,10 +539,8 @@ bool GNSS_MOSAIC::configureNtpMode()
542
539
// ----------------------------------------
543
540
bool GNSS_MOSAIC::configureGNSSCOM (bool enableLBand)
544
541
{
545
- // Configure COM1. NMEA and RTCMv3 will be encapsulated in SBF format on Facet mosaic
546
- String setting = String (" sdio,COM1,auto,RTCMv3+SBF+NMEA" );
547
- if (productVariant == RTK_FACET_MOSAIC)
548
- setting + String (" +Encapsulate" );
542
+ // Configure COM1. NMEA and RTCMv3 will be encapsulated in SBF format
543
+ String setting = String (" sdio,COM1,auto,RTCMv3+SBF+NMEA+Encapsulate" );
549
544
if (enableLBand)
550
545
setting += String (" +LBandBeam1" );
551
546
setting += String (" \n\r " );
@@ -2949,96 +2944,23 @@ bool GNSS_MOSAIC::isPresent()
2949
2944
{
2950
2945
if (productVariant != RTK_FLEX) // productVariant == RTK_FACET_MOSAIC
2951
2946
{
2952
- // Mosaic could still be starting up, so allow many retries
2953
- int retries = 0 ;
2954
- int retryLimit = 20 ;
2955
-
2956
2947
// Set COM4 to: CMD input (only), SBF output (only)
2957
- while (!sendWithResponse (serial2GNSS, " sdio,COM4,CMD,SBF\n\r " , " DataInOut" ))
2958
- {
2959
- if (retries == retryLimit)
2960
- break ;
2961
- retries++;
2962
- sendWithResponse (serial2GNSS, " SSSSSSSSSSSSSSSSSSSS\n\r " , " COM4>" ); // Send escape sequence
2963
- }
2964
-
2965
- if (retries == retryLimit)
2966
- {
2967
- systemPrintln (" Could not communicate with mosaic-X5! Attempting a soft reset..." );
2968
-
2969
- sendWithResponse (serial2GNSS, " erst,soft,none\n\r " , " ResetReceiver" );
2970
-
2971
- retries = 0 ;
2972
-
2973
- // Set COM4 to: CMD input (only), SBF output (only)
2974
- while (!sendWithResponse (serial2GNSS, " sdio,COM4,CMD,SBF\n\r " , " DataInOut" ))
2975
- {
2976
- if (retries == retryLimit)
2977
- break ;
2978
- retries++;
2979
- sendWithResponse (serial2GNSS, " SSSSSSSSSSSSSSSSSSSS\n\r " , " COM4>" ); // Send escape sequence
2980
- }
2981
-
2982
- if (retries == retryLimit)
2983
- {
2984
- systemPrintln (" Could not communicate with mosaic-X5!" );
2985
- return (false );
2986
- }
2987
- }
2988
-
2989
- // Module responded correctly!
2990
- return (true );
2948
+ // Mosaic could still be starting up, so allow many retries
2949
+ return isPresentOnSerial (serial2GNSS, " sdio,COM4,CMD,SBF\n\r " , " DataInOut" , " COM4>" , 20 );
2991
2950
}
2992
2951
else // productVariant == RTK_FLEX
2993
2952
{
2953
+ // Set COM1 to: auto input, RTCMv3+SBF+NMEA+Encapsulate output
2994
2954
// Mosaic could still be starting up, so allow many retries
2995
- int retries = 0 ;
2996
- int retryLimit = 20 ;
2997
-
2998
- // Set COM1 to: auto input, RTCMv3+SBF+NMEA output
2999
- while (!sendWithResponse (serialGNSS, " sdio,COM1,auto,RTCMv3+SBF+NMEA\n\r " , " DataInOut" ))
3000
- {
3001
- if (retries == retryLimit)
3002
- break ;
3003
- retries++;
3004
- sendWithResponse (serialGNSS, " SSSSSSSSSSSSSSSSSSSS\n\r " , " COM1>" ); // Send escape sequence
3005
- }
3006
-
3007
- if (retries == retryLimit)
3008
- {
3009
- systemPrintln (" Could not communicate with mosaic-X5! Attempting a soft reset..." );
3010
-
3011
- sendWithResponse (serialGNSS, " erst,soft,none\n\r " , " ResetReceiver" );
3012
-
3013
- retries = 0 ;
3014
-
3015
- // Set COM1 to: auto input, RTCMv3+SBF+NMEA output
3016
- while (!sendWithResponse (serialGNSS, " sdio,COM1,auto,RTCMv3+SBF+NMEA\n\r " , " DataInOut" ))
3017
- {
3018
- if (retries == retryLimit)
3019
- break ;
3020
- retries++;
3021
- sendWithResponse (serialGNSS, " SSSSSSSSSSSSSSSSSSSS\n\r " , " COM1>" ); // Send escape sequence
3022
- }
3023
-
3024
- if (retries == retryLimit)
3025
- {
3026
- systemPrintln (" Could not communicate with mosaic-X5!" );
3027
- return (false );
3028
- }
3029
- }
3030
-
3031
- // Module responded correctly!
3032
- return (true );
2955
+ return isPresentOnSerial (serialGNSS, " sdio,COM1,auto,RTCMv3+SBF+NMEA+Encapsulate\n\r " , " DataInOut" , " COM1>" , 20 );
3033
2956
}
3034
2957
}
3035
2958
3036
2959
// Return true if the receiver is detected
3037
- bool GNSS_MOSAIC::isPresentOnSerial (HardwareSerial *serialPort, const char *command, const char *response, const char *console)
2960
+ bool GNSS_MOSAIC::isPresentOnSerial (HardwareSerial *serialPort, const char *command, const char *response, const char *console, int retryLimit )
3038
2961
{
3039
2962
// Mosaic could still be starting up, so allow many retries
3040
2963
int retries = 0 ;
3041
- int retryLimit = 20 ;
3042
2964
3043
2965
while (!sendWithResponse (serialPort, command, response))
3044
2966
{
@@ -3338,7 +3260,8 @@ bool mosaicIsPresentOnFlex()
3338
3260
// Check with 115200 initially. If that succeeds, increase to 460800
3339
3261
serialTestGNSS.begin (115200 , SERIAL_8N1, pin_GnssUart_RX, pin_GnssUart_TX);
3340
3262
3341
- if (mosaic.isPresentOnSerial (&serialTestGNSS, " sdio,COM1,auto,RTCMv3+SBF+NMEA\n\r " , " DataInOut" , " COM1>" ) == true )
3263
+ // Only try 3 times. LG290P detection will have been done first. X5 should have booted. Baud rate could be wrong.
3264
+ if (mosaic.isPresentOnSerial (&serialTestGNSS, " sdio,COM1,auto,RTCMv3+SBF+NMEA+Encapsulate\n\r " , " DataInOut" , " COM1>" , 3 ) == true )
3342
3265
{
3343
3266
if (settings.debugGnss )
3344
3267
systemPrintln (" mosaic-X5 detected at 115200 baud" );
@@ -3357,7 +3280,8 @@ bool mosaicIsPresentOnFlex()
3357
3280
serialTestGNSS.end ();
3358
3281
serialTestGNSS.begin (460800 , SERIAL_8N1, pin_GnssUart_RX, pin_GnssUart_TX);
3359
3282
3360
- if (mosaic.isPresentOnSerial (&serialTestGNSS, " sdio,COM1,auto,RTCMv3+SBF+NMEA\n\r " , " DataInOut" , " COM1>" ) == true )
3283
+ // Only try 3 times, so we fail and pass on to the next Facet GNSS detection
3284
+ if (mosaic.isPresentOnSerial (&serialTestGNSS, " sdio,COM1,auto,RTCMv3+SBF+NMEA+Encapsulate\n\r " , " DataInOut" , " COM1>" , 3 ) == true )
3361
3285
{
3362
3286
// serialGNSS and serial2GNSS have not yet been begun. We need to saveConfiguration manually
3363
3287
unsigned long start = millis ();
0 commit comments