Skip to content

Commit 1716093

Browse files
committed
Add debugCLI
1 parent 1a1221d commit 1716093

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

Firmware/RTK_Everywhere/Bluetooth.ino

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ void bluetoothProcessCommand(char *rxData)
261261
PrintEndpoint originalPrintEndpoint = printEndpoint;
262262

263263
printEndpoint = PRINT_ENDPOINT_BLUETOOTH_COMMAND;
264+
if (settings.debugCLI == true)
265+
printEndpoint = PRINT_ENDPOINT_ALL;
266+
else
267+
printEndpoint = PRINT_ENDPOINT_BLUETOOTH_COMMAND;
268+
264269
processCommand(rxData); // Send command proccesor output to BLE
265270
printEndpoint = originalPrintEndpoint;
266271

@@ -384,9 +389,9 @@ void bluetoothFlush()
384389
bluetoothSerialBle->flush();
385390
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_ACCESSORY_MODE)
386391
bluetoothSerialSpp->flush(); // Needed? Not sure... TODO
387-
#else // COMPILE_BT
392+
#else // COMPILE_BT
388393
return;
389-
#endif // COMPILE_BT
394+
#endif // COMPILE_BT
390395
}
391396

392397
// Get MAC, start radio
@@ -510,15 +515,16 @@ void bluetoothStart()
510515
{
511516
// Support Apple Accessory
512517

513-
bluetoothSerialSpp->enableSSP(false, false); //Enable secure pairing, authenticate without displaying anything
518+
bluetoothSerialSpp->enableSSP(false,
519+
false); // Enable secure pairing, authenticate without displaying anything
514520

515521
beginSuccess &= bluetoothSerialSpp->begin(
516522
deviceName, true, true, settings.sppRxQueueSize, settings.sppTxQueueSize, 0, 0,
517523
0); // localName, isMaster, disableBLE, rxBufferSize, txBufferSize, serviceID, rxID, txID
518524

519525
if (beginSuccess)
520526
{
521-
//bluetoothSerialSpp.getBtAddress(btMACAddress); // Read the ESP32 BT MAC Address
527+
// bluetoothSerialSpp.getBtAddress(btMACAddress); // Read the ESP32 BT MAC Address
522528

523529
esp_sdp_init();
524530

@@ -598,7 +604,7 @@ void bluetoothStart()
598604

599605
if (pin_bluetoothStatusLED != PIN_UNDEFINED)
600606
{
601-
bluetoothLedTask.detach(); // Reset BT LED blinker task rate to 2Hz
607+
bluetoothLedTask.detach(); // Reset BT LED blinker task rate to 2Hz
602608
bluetoothLedTask.attach(bluetoothLedTaskPace2Hz, tickerBluetoothLedUpdate); // Rate in seconds, callback
603609
}
604610

@@ -608,11 +614,11 @@ void bluetoothStart()
608614
{
609615
if (bluetoothCommandTaskHandle == nullptr)
610616
xTaskCreatePinnedToCore(
611-
bluetoothCommandTask, // Function to run
612-
"BluetoothCommandTask", // Just for humans
613-
4000, // Stack Size - must be ~4000
614-
nullptr, // Task input parameter
615-
0, // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest
617+
bluetoothCommandTask, // Function to run
618+
"BluetoothCommandTask", // Just for humans
619+
4000, // Stack Size - must be ~4000
620+
nullptr, // Task input parameter
621+
0, // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest
616622
&bluetoothCommandTaskHandle, // Task handle
617623
settings.bluetoothInterruptsCore); // Core where task should run, 0 = core, 1 = Arduino
618624
}

Firmware/RTK_Everywhere/menuSystem.ino

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ void menuDebugHardware()
463463
systemPrintf("%s\r\n", settings.enableImuCompensationDebug ? "Enabled" : "Disabled");
464464

465465
// GNSS Firmware upgrades:
466-
// On Torch: we need a direct connection (passthrough) from USB to CH342 B to
466+
// On Torch: we need a direct connection (passthrough) from USB to CH342 B to
467467
// ESP32 UART0 to ESP32 UART1 to UM980 UART3 for firmware upgrade.
468468
// On Postcard: firmware can be updated over USB and the CH342 B connection to GNSS
469469
// UART1. A hardware GNSS reset may be beneficial, but it is possible
@@ -516,6 +516,9 @@ void menuDebugHardware()
516516

517517
systemPrintln("18) Display littleFS stats");
518518

519+
systemPrint("19) Print CLI Debugging: ");
520+
systemPrintf("%s\r\n", settings.debugCLI ? "Enabled" : "Disabled");
521+
519522
systemPrintln("e) Erase LittleFS");
520523

521524
systemPrintln("t) Test Screen");
@@ -587,7 +590,8 @@ void menuDebugHardware()
587590
else if (present.gnss_lg290p)
588591
{
589592
systemPrintln();
590-
systemPrintln("QGNSS must be connected to CH342 Port B at 460800bps. Begin firmware update from QGNSS (hit the play button) then reset the LG290P.");
593+
systemPrintln("QGNSS must be connected to CH342 Port B at 460800bps. Begin firmware update from QGNSS "
594+
"(hit the play button) then reset the LG290P.");
591595
gnssReset();
592596
delay(100);
593597
gnssBoot();
@@ -622,6 +626,10 @@ void menuDebugHardware()
622626
systemPrintf("LittleFS total bytes: %d\r\n", LittleFS.totalBytes());
623627
systemPrintf("LittleFS used bytes: %d\r\n", LittleFS.usedBytes());
624628
}
629+
else if (incoming == 19)
630+
{
631+
settings.debugCLI ^= 1;
632+
}
625633

626634
else if (incoming == 'e')
627635
{
@@ -831,8 +839,7 @@ void menuDebugSoftware()
831839

832840
systemPrintf("40) Print LittleFS and settings management: %s\r\n",
833841
settings.debugSettings ? "Enabled" : "Disabled");
834-
systemPrintf("41) Halt on ESP_RST_PANIC: %s\r\n",
835-
settings.haltOnPanic ? "Enabled" : "Disabled");
842+
systemPrintf("41) Halt on ESP_RST_PANIC: %s\r\n", settings.haltOnPanic ? "Enabled" : "Disabled");
836843

837844
// Tasks
838845
systemPrint("50) Task Highwater Reporting: ");

Firmware/RTK_Everywhere/settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,7 @@ struct Settings
11001100
bool debugSettings = false;
11011101
bool enableNtripCaster = false; //When true, respond as a faux NTRIP Caster to incoming TCP connections
11021102
bool baseCasterOverride = false; //When true, user has put device into 'BaseCast' mode. Change settings, but don't save to NVM.
1103+
bool debugCLI = false; //When true, output BLE CLI interactions over serial
11031104

11041105
// Add new settings to appropriate group above or create new group
11051106
// Then also add to the same group in rtkSettingsEntries below
@@ -1794,6 +1795,7 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
17941795
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, ALL, 1, _bool, 0, & settings.debugSettings, "debugSettings", },
17951796
{ 1, 1, 0, 1, 1, 1, 1, 1, 1, ALL, 1, _bool, 0, & settings.enableNtripCaster, "enableNtripCaster", },
17961797
{ 0, 1, 0, 1, 1, 1, 1, 1, 1, ALL, 1, _bool, 0, & settings.baseCasterOverride, "baseCasterOverride", },
1798+
{ 0, 1, 0, 1, 1, 1, 1, 1, 1, ALL, 1, _bool, 0, & settings.debugCLI, "debugCLI", },
17971799

17981800

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

0 commit comments

Comments
 (0)