|
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
|
@@ -679,8 +674,8 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
|
679 | 674 | settingValue = 0;
|
680 | 675 |
|
681 | 676 | 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. |
| 677 | + bool settingIsString = false; // Goes true when setting needs to be surrounded by quotes during command |
| 678 | + // response. Generally char arrays but some others. |
684 | 679 |
|
685 | 680 | // Loop through the valid command entries
|
686 | 681 | i = commandLookupSettingName(inCommands, settingName, truncatedName, sizeof(truncatedName), suffix, sizeof(suffix));
|
@@ -807,8 +802,8 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
|
807 | 802 |
|
808 | 803 | // Update the profile name in the file system if necessary
|
809 | 804 | if (strcmp(settingName, "profileName") == 0)
|
810 |
| - setProfileName(profileNumber); // Copy the current settings.profileName into the array of profile names |
811 |
| - // at location profileNumber |
| 805 | + setProfileName(profileNumber); // Copy the current settings.profileName into the array of profile |
| 806 | + // names at location profileNumber |
812 | 807 | settingIsString = true;
|
813 | 808 | }
|
814 | 809 | break;
|
@@ -1919,9 +1914,9 @@ void createSettingsString(char *newSettings)
|
1919 | 1914 | break;
|
1920 | 1915 | case tUmConst: {
|
1921 | 1916 | // 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...) |
| 1917 | + // um980Constellations are uint8_t, but here we have to convert to bool (true / false) so the web |
| 1918 | + // page check boxes are populated correctly. (We can't make it bool, otherwise the 254 initializer |
| 1919 | + // will probably fail...) |
1925 | 1920 | for (int x = 0; x < rtkSettingsEntries[i].qualifier; x++)
|
1926 | 1921 | {
|
1927 | 1922 | char tempString[50]; // um980Constellations.GLONASS=true
|
@@ -2086,9 +2081,9 @@ void createSettingsString(char *newSettings)
|
2086 | 2081 | break;
|
2087 | 2082 | case tLgConst: {
|
2088 | 2083 | // 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...) |
| 2084 | + // lg290pConstellations are uint8_t, but here we have to convert to bool (true / false) so the web |
| 2085 | + // page check boxes are populated correctly. (We can't make it bool, otherwise the 254 initializer |
| 2086 | + // will probably fail...) |
2092 | 2087 | for (int x = 0; x < rtkSettingsEntries[i].qualifier; x++)
|
2093 | 2088 | {
|
2094 | 2089 | char tempString[50]; // lg290pConstellations.GLONASS=true
|
@@ -2487,8 +2482,8 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
|
2487 | 2482 | void *var;
|
2488 | 2483 |
|
2489 | 2484 | 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. |
| 2485 | + bool settingIsString = false; // Goes true when setting needs to be surrounded by quotes during command |
| 2486 | + // response. Generally char arrays but some others. |
2492 | 2487 |
|
2493 | 2488 | // Loop through the valid command entries - but skip the priority settings and use the GNSS-specific types
|
2494 | 2489 | i = commandLookupSettingNameAfterPriority(inCommands, settingName, truncatedName, sizeof(truncatedName), suffix,
|
|
0 commit comments