Skip to content

Commit 6059819

Browse files
committed
Add delay to CLI during LIST printing
1 parent bc45482 commit 6059819

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

Firmware/RTK_Everywhere/System.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ void settingsToDefaults()
411411
// Periodically print information if enabled
412412
void printReports()
413413
{
414+
if (bluetoothCommandIsConnected() == true)
415+
return;
416+
414417
// Periodically print the position
415418
if (settings.enablePrintPosition && ((millis() - lastPrintPosition) > 15000))
416419
{

Firmware/RTK_Everywhere/menuCommands.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,21 @@ void commandSendAllInterfaces(char *rxData)
496496

497497
// Don't re-direct if we're doing a count of the print output
498498
if (printEndpoint != PRINT_ENDPOINT_COUNT)
499+
{
499500
printEndpoint = PRINT_ENDPOINT_ALL;
500501

502+
// The LIST command dumps a large amount of data across the BLE link causing "esp_ble_gatts_send_ notify: rc=-1"
503+
// errors
504+
505+
// With debug=debug, 788 characters are printed locally that slow down the interface enough to avoid errors,
506+
// or 68.4ms at 115200
507+
// With debug=error, can we delay 70ms after every line print and avoid errors? Yes! Works
508+
// well. 50ms is good, 25ms works sometimes without error, 5 is bad.
509+
510+
if (bluetoothCommandIsConnected())
511+
delay(settings.cliBlePrintDelay_ms);
512+
}
513+
501514
systemPrint(rxData); // Send command output to BLE, SPP, and Serial
502515
printEndpoint = originalPrintEndpoint;
503516
}

Firmware/RTK_Everywhere/menuSystem.ino

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ void menuDebugHardware()
519519
systemPrint("19) Print CLI Debugging: ");
520520
systemPrintf("%s\r\n", settings.debugCLI ? "Enabled" : "Disabled");
521521

522+
systemPrintf("20) Delay between CLI LIST prints over BLE: %d\r\n", settings.cliBlePrintDelay_ms);
523+
522524
systemPrintln("e) Erase LittleFS");
523525

524526
systemPrintln("t) Test Screen");
@@ -590,7 +592,9 @@ void menuDebugHardware()
590592
else if (present.gnss_lg290p)
591593
{
592594
systemPrintln();
593-
systemPrintf("QGNSS must be connected to CH342 Port B at %dbps. Begin firmware update from QGNSS (hit the play button) then reset the LG290P.\r\n", settings.dataPortBaud);
595+
systemPrintf("QGNSS must be connected to CH342 Port B at %dbps. Begin firmware update from QGNSS (hit "
596+
"the play button) then reset the LG290P.\r\n",
597+
settings.dataPortBaud);
594598
gnssReset();
595599
delay(100);
596600
gnssBoot();
@@ -629,6 +633,15 @@ void menuDebugHardware()
629633
{
630634
settings.debugCLI ^= 1;
631635
}
636+
else if (incoming == 20)
637+
{
638+
systemPrintf("Enter millisecond delay (%d to %d) for CLI LIST command over BLE: ", 0, 1000);
639+
int newDelay = getUserInputNumber(); // Returns EXIT, TIMEOUT, or long
640+
if ((newDelay != INPUT_RESPONSE_GETNUMBER_EXIT) && (newDelay != INPUT_RESPONSE_GETNUMBER_TIMEOUT))
641+
{
642+
settings.cliBlePrintDelay_ms = newDelay;
643+
}
644+
}
632645

633646
else if (incoming == 'e')
634647
{

Firmware/RTK_Everywhere/settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,7 @@ struct Settings
11031103
bool enableNtripCaster = false; //When true, respond as a faux NTRIP Caster to incoming TCP connections
11041104
bool baseCasterOverride = false; //When true, user has put device into 'BaseCast' mode. Change settings, but don't save to NVM.
11051105
bool debugCLI = false; //When true, output BLE CLI interactions over serial
1106+
uint16_t cliBlePrintDelay_ms = 50; // Time delayed between prints during a LIST command to avoid overwhelming the BLE connection
11061107

11071108
// Add new settings to appropriate group above or create new group
11081109
// Then also add to the same group in rtkSettingsEntries below
@@ -1815,6 +1816,7 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
18151816
{ 1, 1, 0, 1, 1, 1, 1, 1, 1, ALL, 1, _bool, 0, & settings.enableNtripCaster, "enableNtripCaster", },
18161817
{ 0, 1, 0, 1, 1, 1, 1, 1, 1, ALL, 1, _bool, 0, & settings.baseCasterOverride, "baseCasterOverride", },
18171818
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, ALL, 1, _bool, 0, & settings.debugCLI, "debugCLI", },
1819+
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, ALL, 1, _uint16_t, 0, & settings.cliBlePrintDelay_ms, "cliBlePrintDelay_ms", },
18181820

18191821

18201822
// Add new settings to appropriate group above or create new group

0 commit comments

Comments
 (0)