Provide default for missing NextionBaud

This commit is contained in:
aderusha 2021-11-30 17:38:25 -05:00
parent 4df5919f18
commit ab730188de
3 changed files with 10 additions and 0 deletions

View File

@ -2233,10 +2233,20 @@ void configRead()
{
strcpy(nextionBaud, jsonConfigValues["nextionBaud"]);
}
if (strcmp(nextionBaud, "") == 0)
{ // Cover off any edge case where this value winds up being empty
debugPrintln(F("SPIFFS: [WARNING] /config.json has empty nextionBaud value, setting to '115200'"));
strcpy(nextionBaud, "115200");
}
if (!jsonConfigValues["nextionMaxPages"].isNull())
{
nextionMaxPages = jsonConfigValues["nextionMaxPages"];
}
if (nextionMaxPages < 1)
{ // Cover off any edge case where this value winds up being zero or negative
debugPrintln(F("SPIFFS: [WARNING] /config.json has nextionMaxPages value of zero or negative, setting to '11'"));
nextionMaxPages = 11;
}
if (!jsonConfigValues["motionPinConfig"].isNull())
{
strcpy(motionPinConfig, jsonConfigValues["motionPinConfig"]);