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;
461
461
// USB serial port and PC.
462
462
volatile bool forwardGnssDataToUsbSerial;
463
463
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
+
464
471
#define platformPrefix platformPrefixTable[productVariant] // Sets the prefix for broadcast names
465
472
466
473
#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()
11
11
periodicDisplay = settings.periodicDisplay ;
12
12
}
13
13
14
+ // Check for USB serial input
14
15
if (systemAvailable ())
15
16
{
16
17
byte incoming = systemRead ();
@@ -21,7 +22,40 @@ void terminalUpdate()
21
22
printCurrentConditionsNMEA ();
22
23
}
23
24
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
+ }
24
57
menuMain (); // Present user menu
58
+ }
25
59
}
26
60
}
27
61
You can’t perform that action at this time.
0 commit comments