@@ -267,6 +267,26 @@ t_cliResult processCommand(char *cmdBuffer)
267267 else if (strcmp (tokens[1 ], " LIST" ) == 0 )
268268 {
269269 // Respond with a list of variables, types, and current value
270+
271+ // First calculate the size of the LIST response
272+ PrintEndpoint originalPrintEndpoint = printEndpoint;
273+ printEndpoint = PRINT_ENDPOINT_COUNT;
274+ systemWriteLength = 0 ;
275+ printAvailableSettings ();
276+ printEndpoint = originalPrintEndpoint;
277+
278+ // Use log10 to find the number of digits in systemWriteLength
279+ int systemWriteLengthDigits = floor (log10 (systemWriteLength)) + 1 ;
280+
281+ // Adjust systemWriteLength to include the length of the list entry
282+ systemWriteLength = systemWriteLength + sizeof (" $SPLST,list,int,*2A" ) + systemWriteLengthDigits;
283+
284+ // Print the list entry
285+ char settingValue[6 ]; // 12345
286+ snprintf (settingValue, sizeof (settingValue), " %d" , systemWriteLength);
287+ commandSendExecuteListResponse (" list" , " int" , settingValue);
288+
289+ // Now actually print the list
270290 printAvailableSettings ();
271291 commandSendExecuteOkResponse (tokens[0 ], tokens[1 ]);
272292 return (CLI_OK);
@@ -469,8 +489,22 @@ void commandSendResponse(const char *innerBuffer)
469489
470490 sprintf (responseBuffer, " $%s*%02X\r\n " , innerBuffer, calculatedChecksum);
471491
472- // CLI interactions may come from BLE or serial, respond to both interfaces
473- bluetoothSendCommand (responseBuffer);
492+ // CLI interactions may come from BLE or serial, respond to all interfaces
493+ commandSendAllInterfaces (responseBuffer);
494+ }
495+
496+ // Pass a command string to the all interfaces
497+ void commandSendAllInterfaces (char *rxData)
498+ {
499+ // Direct output to Bluetooth Command
500+ PrintEndpoint originalPrintEndpoint = printEndpoint;
501+
502+ // Don't re-direct if we're doing a count of the print output
503+ if (printEndpoint != PRINT_ENDPOINT_COUNT)
504+ printEndpoint = PRINT_ENDPOINT_ALL;
505+
506+ systemPrint (rxData); // Send command output to BLE, SPP, and Serial
507+ printEndpoint = originalPrintEndpoint;
474508}
475509
476510// Checks structure of command and checksum
@@ -1506,7 +1540,7 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
15061540 }
15071541
15081542 // Check if this setting is read only
1509- if (knownSetting == false )
1543+ if (knownSetting == false )
15101544 {
15111545 const char *table[] = {
15121546 " batteryLevelPercent" ,
@@ -1516,12 +1550,13 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
15161550 " deviceId" ,
15171551 " deviceName" ,
15181552 " gnssModuleInfo" ,
1553+ " list" ,
15191554 " rtkFirmwareVersion" ,
15201555 " rtkRemoteFirmwareVersion" ,
15211556 };
15221557 const int tableEntries = sizeof (table) / sizeof (table[0 ]);
15231558
1524- if (commandCheckListForVariable (settingName, table, tableEntries))
1559+ if (commandCheckListForVariable (settingName, table, tableEntries))
15251560 return (SETTING_KNOWN_READ_ONLY);
15261561 }
15271562
@@ -3938,7 +3973,7 @@ void printAvailableSettings()
39383973 checkBatteryLevels ();
39393974
39403975 // Convert int to string
3941- char batteryLvlStr[4 ] = {0 }; // 104
3976+ char batteryLvlStr[4 ] = {0 }; // 104
39423977 snprintf (batteryLvlStr, sizeof (batteryLvlStr), " %d" , batteryLevelPercent);
39433978
39443979 // Create the settingType based on the length of the firmware version
@@ -3964,7 +3999,7 @@ void printAvailableSettings()
39643999 commandSendExecuteListResponse (" batteryVoltage" , settingType, batteryVoltageStr);
39654000 }
39664001
3967- // Display the current battery charging percent per hour
4002+ // Display the current battery charging percent per hour
39684003 else if (commandIndex[i] == COMMAND_BATTERY_CHARGING_PERCENT)
39694004 {
39704005 checkBatteryLevels ();
@@ -4010,5 +4045,4 @@ void printAvailableSettings()
40104045 commandSendExecuteListResponse (" deviceId" , settingType, printDeviceId ());
40114046 }
40124047 }
4013- systemPrintln ();
40144048}
0 commit comments