@@ -218,6 +218,11 @@ t_cliResult processCommand(char *cmdBuffer)
218
218
value); // Wrap the string setting in quotes in the response, add OK
219
219
return (CLI_OK);
220
220
}
221
+ else if (response == SETTING_KNOWN_READ_ONLY)
222
+ {
223
+ commandSendErrorResponse (tokens[0 ], field, (char *)" Setting is read only" );
224
+ return (CLI_SETTING_READ_ONLY);
225
+ }
221
226
else
222
227
{
223
228
commandSendErrorResponse (tokens[0 ], field, (char *)" Unknown setting" );
@@ -604,7 +609,7 @@ int commandLookupSettingNameSelective(bool inCommands, const char *settingName,
604
609
}
605
610
606
611
// Check for unknown variables
607
- bool commandCheckForUnknownVariable (const char *settingName, const char **entry, int tableEntries)
612
+ bool commandCheckListForVariable (const char *settingName, const char **entry, int tableEntries)
608
613
{
609
614
const char **tableEnd;
610
615
@@ -1341,8 +1346,8 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
1341
1346
1342
1347
ESP.restart ();
1343
1348
}
1344
-
1345
- // setProfile was used in the original Web Config interface
1349
+
1350
+ // setProfile was used in the original Web Config interface
1346
1351
else if (strcmp (settingName, " setProfile" ) == 0 )
1347
1352
{
1348
1353
// Change to new profile
@@ -1368,7 +1373,7 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
1368
1373
knownSetting = true ;
1369
1374
}
1370
1375
1371
- // profileNumber is used in the newer CLI with get/set capabilities
1376
+ // profileNumber is used in the newer CLI with get/set capabilities
1372
1377
else if (strcmp (settingName, " profileNumber" ) == 0 )
1373
1378
{
1374
1379
// Change to new profile
@@ -1405,10 +1410,11 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
1405
1410
sendStringToWebsocket (settingsCSV);
1406
1411
knownSetting = true ;
1407
1412
}
1408
-
1413
+
1409
1414
// Is this a profile name change request? ie, 'profile2Name'
1410
1415
// Search by first letter first to speed up search
1411
- else if ((settingName[0 ] == ' p' ) && (strstr (settingName, " profile" ) != nullptr ) && (strcmp (&settingName[8 ], " Name" ) == 0 ))
1416
+ else if ((settingName[0 ] == ' p' ) && (strstr (settingName, " profile" ) != nullptr ) &&
1417
+ (strcmp (&settingName[8 ], " Name" ) == 0 ))
1412
1418
{
1413
1419
int profileNumber = settingName[7 ] - ' 0' ;
1414
1420
if (profileNumber >= 0 && profileNumber <= MAX_PROFILE_COUNT)
@@ -1475,7 +1481,7 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
1475
1481
knownSetting = true ;
1476
1482
}
1477
1483
1478
- // Unused variables - read to avoid errors
1484
+ // Unused variables from the Web Config interface - read to avoid errors
1479
1485
else
1480
1486
{
1481
1487
const char *table[] = {
@@ -1495,7 +1501,27 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
1495
1501
};
1496
1502
const int tableEntries = sizeof (table) / sizeof (table[0 ]);
1497
1503
1498
- knownSetting = commandCheckForUnknownVariable (settingName, table, tableEntries);
1504
+ knownSetting = commandCheckListForVariable (settingName, table, tableEntries);
1505
+ }
1506
+
1507
+ // Check if this setting is read only
1508
+ if (knownSetting == false )
1509
+ {
1510
+ const char *table[] = {
1511
+ " batteryLevelPercent" ,
1512
+ " batteryVoltage" ,
1513
+ " batteryChargingPercentPerHour" ,
1514
+ " bluetoothId" ,
1515
+ " deviceId" ,
1516
+ " deviceName" ,
1517
+ " gnssModuleInfo" ,
1518
+ " rtkFirmwareVersion" ,
1519
+ " rtkRemoteFirmwareVersion" ,
1520
+ };
1521
+ const int tableEntries = sizeof (table) / sizeof (table[0 ]);
1522
+
1523
+ if (commandCheckListForVariable (settingName, table, tableEntries))
1524
+ return (SETTING_KNOWN_READ_ONLY);
1499
1525
}
1500
1526
1501
1527
// If we've received a setting update for a setting that is not valid to this platform,
@@ -1539,7 +1565,7 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
1539
1565
}
1540
1566
1541
1567
if (rtkIndex >= numRtkSettingsEntries)
1542
- systemPrintf (" ERROR : Unknown '%s': %0.3lf\r\n " , settingName, settingValue);
1568
+ systemPrintf (" updateSettingWithValue : Unknown '%s': %0.3lf\r\n " , settingName, settingValue);
1543
1569
else
1544
1570
{
1545
1571
// Display the warning
@@ -2960,7 +2986,8 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
2960
2986
2961
2987
// Is this a profile name request? profile2Name
2962
2988
// Search by first letter first to speed up search
2963
- if ((settingName[0 ] == ' p' ) && (strstr (settingName, " profile" ) != nullptr ) && (strcmp (&settingName[8 ], " Name" ) == 0 ))
2989
+ if ((settingName[0 ] == ' p' ) && (strstr (settingName, " profile" ) != nullptr ) &&
2990
+ (strcmp (&settingName[8 ], " Name" ) == 0 ))
2964
2991
{
2965
2992
int profileNumber = settingName[7 ] - ' 0' ;
2966
2993
if (profileNumber >= 0 && profileNumber <= MAX_PROFILE_COUNT)
@@ -3079,7 +3106,7 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
3079
3106
};
3080
3107
const int tableEntries = sizeof (table) / sizeof (table[0 ]);
3081
3108
3082
- knownSetting = commandCheckForUnknownVariable (settingName, table, tableEntries);
3109
+ knownSetting = commandCheckListForVariable (settingName, table, tableEntries);
3083
3110
}
3084
3111
3085
3112
if (knownSetting == false )
@@ -3894,7 +3921,7 @@ void printAvailableSettings()
3894
3921
commandSendExecuteListResponse (" enableRCFirmware" , " bool" , " false" );
3895
3922
}
3896
3923
3897
- // Display the current RTK Firmware version
3924
+ // Display the GNSS receiver info
3898
3925
else if (commandIndex[i] == COMMAND_GNSS_MODULE_INFO)
3899
3926
{
3900
3927
// Create the settingType based on the length of the firmware version
0 commit comments