|
1 | 1 | char otaOutcome[21] = {0}; // Modified by otaUpdate(), used to respond to rtkRemoteFirmwareVersion commands
|
2 |
| -int systemWriteLength = 0; // Modified by systemWrite(), used to calculate the size of LIST command for CLI |
| 2 | +int systemWriteCounts = |
| 3 | + 0; // Modified by systemWrite(), used to calculate the number of items in the LIST command for CLI |
3 | 4 |
|
4 | 5 | void menuCommands()
|
5 | 6 | {
|
@@ -268,22 +269,16 @@ t_cliResult processCommand(char *cmdBuffer)
|
268 | 269 | {
|
269 | 270 | // Respond with a list of variables, types, and current value
|
270 | 271 |
|
271 |
| - // First calculate the size of the LIST response |
| 272 | + // First calculate the lines in the LIST response |
272 | 273 | PrintEndpoint originalPrintEndpoint = printEndpoint;
|
273 | 274 | printEndpoint = PRINT_ENDPOINT_COUNT;
|
274 |
| - systemWriteLength = 0; |
| 275 | + systemWriteCounts = 0; |
275 | 276 | printAvailableSettings();
|
276 | 277 | printEndpoint = originalPrintEndpoint;
|
277 | 278 |
|
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); |
| 279 | + // Print the list entry with the number of items in the list, including the list entry |
| 280 | + char settingValue[6]; // 12345 |
| 281 | + snprintf(settingValue, sizeof(settingValue), "%d", systemWriteCounts + 1); // Add list command |
287 | 282 | commandSendExecuteListResponse("list", "int", settingValue);
|
288 | 283 |
|
289 | 284 | // Now actually print the list
|
@@ -501,8 +496,21 @@ void commandSendAllInterfaces(char *rxData)
|
501 | 496 |
|
502 | 497 | // Don't re-direct if we're doing a count of the print output
|
503 | 498 | if (printEndpoint != PRINT_ENDPOINT_COUNT)
|
| 499 | + { |
504 | 500 | printEndpoint = PRINT_ENDPOINT_ALL;
|
505 | 501 |
|
| 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 | + |
506 | 514 | systemPrint(rxData); // Send command output to BLE, SPP, and Serial
|
507 | 515 | printEndpoint = originalPrintEndpoint;
|
508 | 516 | }
|
@@ -679,8 +687,8 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
|
679 | 687 | settingValue = 0;
|
680 | 688 |
|
681 | 689 | bool knownSetting = false;
|
682 |
| - bool settingIsString = false; // Goes true when setting needs to be surrounded by quotes during command response. |
683 |
| - // Generally char arrays but some others. |
| 690 | + bool settingIsString = false; // Goes true when setting needs to be surrounded by quotes during command |
| 691 | + // response. Generally char arrays but some others. |
684 | 692 |
|
685 | 693 | // Loop through the valid command entries
|
686 | 694 | i = commandLookupSettingName(inCommands, settingName, truncatedName, sizeof(truncatedName), suffix, sizeof(suffix));
|
@@ -807,8 +815,8 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
|
807 | 815 |
|
808 | 816 | // Update the profile name in the file system if necessary
|
809 | 817 | if (strcmp(settingName, "profileName") == 0)
|
810 |
| - setProfileName(profileNumber); // Copy the current settings.profileName into the array of profile names |
811 |
| - // at location profileNumber |
| 818 | + setProfileName(profileNumber); // Copy the current settings.profileName into the array of profile |
| 819 | + // names at location profileNumber |
812 | 820 | settingIsString = true;
|
813 | 821 | }
|
814 | 822 | break;
|
@@ -1919,9 +1927,9 @@ void createSettingsString(char *newSettings)
|
1919 | 1927 | break;
|
1920 | 1928 | case tUmConst: {
|
1921 | 1929 | // Record UM980 Constellations
|
1922 |
| - // um980Constellations are uint8_t, but here we have to convert to bool (true / false) so the web page |
1923 |
| - // check boxes are populated correctly. (We can't make it bool, otherwise the 254 initializer will |
1924 |
| - // probably fail...) |
| 1930 | + // um980Constellations are uint8_t, but here we have to convert to bool (true / false) so the web |
| 1931 | + // page check boxes are populated correctly. (We can't make it bool, otherwise the 254 initializer |
| 1932 | + // will probably fail...) |
1925 | 1933 | for (int x = 0; x < rtkSettingsEntries[i].qualifier; x++)
|
1926 | 1934 | {
|
1927 | 1935 | char tempString[50]; // um980Constellations.GLONASS=true
|
@@ -2086,9 +2094,9 @@ void createSettingsString(char *newSettings)
|
2086 | 2094 | break;
|
2087 | 2095 | case tLgConst: {
|
2088 | 2096 | // Record LG290P Constellations
|
2089 |
| - // lg290pConstellations are uint8_t, but here we have to convert to bool (true / false) so the web page |
2090 |
| - // check boxes are populated correctly. (We can't make it bool, otherwise the 254 initializer will |
2091 |
| - // probably fail...) |
| 2097 | + // lg290pConstellations are uint8_t, but here we have to convert to bool (true / false) so the web |
| 2098 | + // page check boxes are populated correctly. (We can't make it bool, otherwise the 254 initializer |
| 2099 | + // will probably fail...) |
2092 | 2100 | for (int x = 0; x < rtkSettingsEntries[i].qualifier; x++)
|
2093 | 2101 | {
|
2094 | 2102 | char tempString[50]; // lg290pConstellations.GLONASS=true
|
@@ -2487,8 +2495,8 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
|
2487 | 2495 | void *var;
|
2488 | 2496 |
|
2489 | 2497 | bool knownSetting = false;
|
2490 |
| - bool settingIsString = false; // Goes true when setting needs to be surrounded by quotes during command response. |
2491 |
| - // Generally char arrays but some others. |
| 2498 | + bool settingIsString = false; // Goes true when setting needs to be surrounded by quotes during command |
| 2499 | + // response. Generally char arrays but some others. |
2492 | 2500 |
|
2493 | 2501 | // Loop through the valid command entries - but skip the priority settings and use the GNSS-specific types
|
2494 | 2502 | i = commandLookupSettingNameAfterPriority(inCommands, settingName, truncatedName, sizeof(truncatedName), suffix,
|
|
0 commit comments