File tree Expand file tree Collapse file tree 7 files changed +68
-19
lines changed Expand file tree Collapse file tree 7 files changed +68
-19
lines changed Original file line number Diff line number Diff line change @@ -309,18 +309,14 @@ void loop()
309
309
310
310
updateLogs (); // Record any new data. Create or close files as needed.
311
311
312
+ reportHeap (); // If debug enabled, report free heap
313
+
312
314
// Menu system via ESP32 USB connection
313
315
if (Serial.available ()) menuMain (); // Present user menu
314
316
315
317
// Convert current system time to minutes. This is used in F9PSerialReadTask()/updateLogs() to see if we are within max log window.
316
318
systemTime_minutes = millis () / 1000L / 60 ;
317
319
318
- if (millis () - lastHeapReport > 1000 )
319
- {
320
- lastHeapReport = millis ();
321
- Serial.printf (" freeHeap: %d\n\r " , ESP.getFreeHeap ());
322
- }
323
-
324
320
delay (10 ); // A small delay prevents panic if no other I2C or functions are called
325
321
}
326
322
Original file line number Diff line number Diff line change @@ -751,3 +751,16 @@ bool logUBXMessages()
751
751
return (true );
752
752
return (false );
753
753
}
754
+
755
+ // If debug option is on, print available heap
756
+ void reportHeap ()
757
+ {
758
+ if (settings.enableHeapReport == true )
759
+ {
760
+ if (millis () - lastHeapReport > 1000 )
761
+ {
762
+ lastHeapReport = millis ();
763
+ Serial.printf (" freeHeap: %d\n\r " , ESP.getFreeHeap ());
764
+ }
765
+ }
766
+ }
Original file line number Diff line number Diff line change
1
+ // Toggle control of heap reports and I2C GNSS debug
2
+ void menuDebug ()
3
+ {
4
+ while (1 )
5
+ {
6
+ Serial.println ();
7
+ Serial.println (F (" Menu: Debug Menu" ));
8
+
9
+ Serial.print (F (" 1) Toggle I2C Debugging Output: " ));
10
+ if (settings.enableI2Cdebug == true ) Serial.println (F (" Enabled" ));
11
+ else Serial.println (F (" Disabled" ));
12
+
13
+ Serial.print (F (" 2) Toggle Heap Reporting: " ));
14
+ if (settings.enableHeapReport == true ) Serial.println (F (" Enabled" ));
15
+ else Serial.println (F (" Disabled" ));
16
+
17
+ Serial.println (F (" x) Exit" ));
18
+
19
+ byte incoming = getByteChoice (30 ); // Timeout after x seconds
20
+
21
+ if (incoming == ' 1' )
22
+ {
23
+ settings.enableI2Cdebug ^= 1 ;
24
+
25
+ if (settings.enableI2Cdebug )
26
+ i2cGNSS.enableDebugging (Serial, true ); // Enable only the critical debug messages over Serial
27
+ else
28
+ i2cGNSS.disableDebugging ();
29
+ }
30
+ else if (incoming == ' 2' )
31
+ {
32
+ settings.enableHeapReport ^= 1 ;
33
+ }
34
+ else if (incoming == ' x' )
35
+ break ;
36
+ else if (incoming == STATUS_GETBYTE_TIMEOUT)
37
+ {
38
+ break ;
39
+ }
40
+ else
41
+ printUnknown (incoming);
42
+ }
43
+
44
+ while (Serial.available ()) Serial.read (); // Empty buffer of any newline chars
45
+ }
Original file line number Diff line number Diff line change @@ -20,10 +20,6 @@ void menuGNSS()
20
20
if (getSBAS () == true ) Serial.println (F (" Enabled" ));
21
21
else Serial.println (F (" Disabled" ));
22
22
23
- Serial.print (F (" 4) Toggle I2C Debugging Output: " ));
24
- if (settings.enableI2Cdebug == true ) Serial.println (F (" Enabled" ));
25
- else Serial.println (F (" Disabled" ));
26
-
27
23
Serial.println (F (" x) Exit" ));
28
24
29
25
int incoming = getNumber (30 ); // Timeout after x seconds
@@ -71,15 +67,6 @@ void menuGNSS()
71
67
settings.enableSBAS = true ;
72
68
}
73
69
}
74
- else if (incoming == 4 )
75
- {
76
- settings.enableI2Cdebug ^= 1 ;
77
-
78
- if (settings.enableI2Cdebug )
79
- i2cGNSS.enableDebugging (Serial, true ); // Enable only the critical debug messages over Serial
80
- else
81
- i2cGNSS.disableDebugging ();
82
- }
83
70
else if (incoming == STATUS_PRESSED_X)
84
71
break ;
85
72
else if (incoming == STATUS_GETNUMBER_TIMEOUT)
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ void menuMain()
25
25
26
26
Serial.println (F (" 5) Configure Ports" ));
27
27
28
+ Serial.println (F (" d) Configure Debug" ));
29
+
28
30
Serial.println (F (" r) Reset all settings to default" ));
29
31
30
32
if (binCount > 0 )
@@ -46,6 +48,8 @@ void menuMain()
46
48
menuBase ();
47
49
else if (incoming == ' 5' )
48
50
menuPorts ();
51
+ else if (incoming == ' d' )
52
+ menuDebug ();
49
53
else if (incoming == ' r' )
50
54
{
51
55
Serial.println (F (" \r\n Resetting to factory defaults. Press 'y' to confirm:" ));
Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ void recordSystemSettingsToFile()
133
133
settingsFile.println (" log.rawx=" + (String)settings.log .rawx );
134
134
settingsFile.println (" log.sfrbx=" + (String)settings.log .sfrbx );
135
135
settingsFile.println (" enableI2Cdebug=" + (String)settings.enableI2Cdebug );
136
+ settingsFile.println (" enableHeapReport=" + (String)settings.enableHeapReport );
136
137
137
138
if (online.gnss )
138
139
updateDataFileAccess (&settingsFile); // Update the file access time & date
@@ -364,6 +365,8 @@ bool parseLine(char* str) {
364
365
settings.log .sfrbx = d;
365
366
else if (strcmp (settingName, " enableI2Cdebug" ) == 0 )
366
367
settings.enableI2Cdebug = d;
368
+ else if (strcmp (settingName, " enableHeapReport" ) == 0 )
369
+ settings.enableHeapReport = d;
367
370
368
371
else
369
372
Serial.printf (" Unknown setting %s on line: %s\r\n " , settingName, str);
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ struct struct_settings {
109
109
gnssMessages broadcast ;
110
110
gnssMessages log ;
111
111
bool enableI2Cdebug = false; //Turn on to display GNSS library debug messages
112
+ bool enableHeapReport = false; //Turn on to display free heap
112
113
} settings ;
113
114
114
115
//These are the devices on board RTK Surveyor that may be on or offline.
You can’t perform that action at this time.
0 commit comments