File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -461,6 +461,13 @@ float batteryChargingPercentPerHour;
461461// USB serial port and PC.
462462volatile bool forwardGnssDataToUsbSerial;
463463
464+ // Timeout between + characters to enter the +++ sequence while
465+ // forwardGnssDataToUsbSerial is true. When sequence is properly entered
466+ // forwardGnssDataToUsbSerial is set to false and menuMain is displayed.
467+ // If the timeout between characters occurs or an invalid character is
468+ // entered then no changes are made and the +++ sequence must be re-entered.
469+ #define PLUS_PLUS_PLUS_TIMEOUT (2 * 1000 ) // Milliseconds
470+
464471#define platformPrefix platformPrefixTable[productVariant] // Sets the prefix for broadcast names
465472
466473#include < driver/uart.h> // Required for uart_set_rx_full_threshold() on cores <v2.0.5
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ void terminalUpdate()
1111 periodicDisplay = settings.periodicDisplay ;
1212 }
1313
14+ // Check for USB serial input
1415 if (systemAvailable ())
1516 {
1617 byte incoming = systemRead ();
@@ -21,7 +22,40 @@ void terminalUpdate()
2122 printCurrentConditionsNMEA ();
2223 }
2324 else
25+ {
26+ // When outputting GNSS data to USB serial, check for +++
27+ if (forwardGnssDataToUsbSerial)
28+ {
29+ static uint32_t plusTimeout;
30+ static uint8_t plusCount;
31+
32+ // Reset plusCount on timeout
33+ if ((millis () - plusTimeout) > PLUS_PLUS_PLUS_TIMEOUT)
34+ plusCount = 0 ;
35+
36+ // Check for + input
37+ if (incoming != ' +' )
38+ {
39+ // Must start over looking for +++
40+ plusCount = 0 ;
41+ return ;
42+ }
43+ else
44+ {
45+ // + entered, check for the +++ sequence
46+ plusCount++;
47+ if (plusCount < 3 )
48+ {
49+ // Restart the timeout
50+ plusTimeout = millis ();
51+ return ;
52+ }
53+
54+ // +++ was entered, display the main menu
55+ }
56+ }
2457 menuMain (); // Present user menu
58+ }
2559 }
2660}
2761
You can’t perform that action at this time.
0 commit comments