Skip to content

Commit 41b9812

Browse files
committed
Improve warning reports for known settings (but not supported on platform)
1 parent 7f8b4e9 commit 41b9812

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

Firmware/RTK_Everywhere/menuCommands.ino

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,10 +1587,12 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
15871587
}
15881588

15891589
// Unused variables from the Web Config interface - read to avoid errors
1590-
else
1590+
// Check if this setting an unused element from the Web Config interface
1591+
if (knownSetting == false)
15911592
{
15921593
const char *table[] = {
15931594
"baseTypeSurveyIn",
1595+
"enableAutoReset",
15941596
"enableFactoryDefaults",
15951597
"enableFirmwareUpdate",
15961598
"enableForgetRadios",
@@ -1601,15 +1603,20 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
16011603
"nicknameECEF",
16021604
"nicknameGeodetic",
16031605
"saveToArduino",
1604-
"enableAutoReset",
16051606
"shutdownNoChargeTimeoutMinutesCheckbox",
16061607
};
16071608
const int tableEntries = sizeof(table) / sizeof(table[0]);
16081609

1609-
knownSetting = commandCheckListForVariable(settingName, table, tableEntries);
1610+
// Compare the above table against this settingName
1611+
if (commandCheckListForVariable(settingName, table, tableEntries))
1612+
{
1613+
if (settings.debugWebServer == true)
1614+
systemPrintf("Setting '%s' is known web interface element. Ignoring.\r\n", settingName);
1615+
return (SETTING_KNOWN_WEB_CONFIG_INTERFACE_ELEMENT);
1616+
}
16101617
}
16111618

1612-
// Check if this setting is read only
1619+
// Check if this setting is read only. Used with the CLI.
16131620
if (knownSetting == false)
16141621
{
16151622
const char *table[] = {
@@ -1626,19 +1633,11 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
16261633
};
16271634
const int tableEntries = sizeof(table) / sizeof(table[0]);
16281635

1636+
// Compare the above table against this settingName
16291637
if (commandCheckListForVariable(settingName, table, tableEntries))
16301638
return (SETTING_KNOWN_READ_ONLY);
16311639
}
16321640

1633-
// If we've received a setting update for a setting that is not valid to this platform,
1634-
// allow it, but throw a warning.
1635-
// This is often caused by the Web Config page reporting all cells including
1636-
// those that are hidden because of platform limitations
1637-
if (knownSetting == true && settingAvailableOnPlatform(i) == false)
1638-
{
1639-
systemPrintf("Setting '%s' stored but not supported on this platform\r\n", settingName);
1640-
}
1641-
16421641
// Last catch
16431642
if (knownSetting == false)
16441643
{
@@ -1685,6 +1684,16 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
16851684
rtkFree(name, "name & suffix buffers");
16861685
}
16871686

1687+
// If we've received a setting update for a setting that is not valid to this platform,
1688+
// allow it, but throw a warning.
1689+
// This is often caused by the Web Config page reporting all cells including
1690+
// those that are hidden because of platform limitations
1691+
if (knownSetting == false && rtkSettingsEntries[i].inWebConfig && (settingAvailableOnPlatform(i) == false))
1692+
{
1693+
if (settings.debugWebServer == true)
1694+
systemPrintf("Setting '%s' received but not supported on this platform\r\n", settingName);
1695+
}
1696+
16881697
if (knownSetting == true && settingIsString == true)
16891698
return (SETTING_KNOWN_STRING);
16901699
else if (knownSetting == true)

Firmware/RTK_Everywhere/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ typedef enum
553553
SETTING_KNOWN,
554554
SETTING_KNOWN_STRING,
555555
SETTING_KNOWN_READ_ONLY,
556+
SETTING_KNOWN_WEB_CONFIG_INTERFACE_ELEMENT,
556557
} SettingValueResponse;
557558

558559
#define INCHES_IN_A_METER 39.37007874

0 commit comments

Comments
 (0)