@@ -267,6 +267,26 @@ t_cliResult processCommand(char *cmdBuffer)
267
267
else if (strcmp (tokens[1 ], " LIST" ) == 0 )
268
268
{
269
269
// 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
270
290
printAvailableSettings ();
271
291
commandSendExecuteOkResponse (tokens[0 ], tokens[1 ]);
272
292
return (CLI_OK);
@@ -469,8 +489,22 @@ void commandSendResponse(const char *innerBuffer)
469
489
470
490
sprintf (responseBuffer, " $%s*%02X\r\n " , innerBuffer, calculatedChecksum);
471
491
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;
474
508
}
475
509
476
510
// Checks structure of command and checksum
@@ -1506,7 +1540,7 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
1506
1540
}
1507
1541
1508
1542
// Check if this setting is read only
1509
- if (knownSetting == false )
1543
+ if (knownSetting == false )
1510
1544
{
1511
1545
const char *table[] = {
1512
1546
" batteryLevelPercent" ,
@@ -1516,12 +1550,13 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
1516
1550
" deviceId" ,
1517
1551
" deviceName" ,
1518
1552
" gnssModuleInfo" ,
1553
+ " list" ,
1519
1554
" rtkFirmwareVersion" ,
1520
1555
" rtkRemoteFirmwareVersion" ,
1521
1556
};
1522
1557
const int tableEntries = sizeof (table) / sizeof (table[0 ]);
1523
1558
1524
- if (commandCheckListForVariable (settingName, table, tableEntries))
1559
+ if (commandCheckListForVariable (settingName, table, tableEntries))
1525
1560
return (SETTING_KNOWN_READ_ONLY);
1526
1561
}
1527
1562
@@ -3938,7 +3973,7 @@ void printAvailableSettings()
3938
3973
checkBatteryLevels ();
3939
3974
3940
3975
// Convert int to string
3941
- char batteryLvlStr[4 ] = {0 }; // 104
3976
+ char batteryLvlStr[4 ] = {0 }; // 104
3942
3977
snprintf (batteryLvlStr, sizeof (batteryLvlStr), " %d" , batteryLevelPercent);
3943
3978
3944
3979
// Create the settingType based on the length of the firmware version
@@ -3964,7 +3999,7 @@ void printAvailableSettings()
3964
3999
commandSendExecuteListResponse (" batteryVoltage" , settingType, batteryVoltageStr);
3965
4000
}
3966
4001
3967
- // Display the current battery charging percent per hour
4002
+ // Display the current battery charging percent per hour
3968
4003
else if (commandIndex[i] == COMMAND_BATTERY_CHARGING_PERCENT)
3969
4004
{
3970
4005
checkBatteryLevels ();
@@ -4010,5 +4045,4 @@ void printAvailableSettings()
4010
4045
commandSendExecuteListResponse (" deviceId" , settingType, printDeviceId ());
4011
4046
}
4012
4047
}
4013
- systemPrintln ();
4014
4048
}
0 commit comments