Removed magic values

This commit is contained in:
Martijn Scheepers
2021-03-23 09:50:50 +01:00
parent 8cc825de8d
commit b35d873473

View File

@@ -18,23 +18,23 @@ void checkEeprom()
writeCheck = true;
}
if (eepromStruct.password[0] == 255)
if (eepromStruct.password[0] == UCHAR_MAX)
{
strcpy(eepromStruct.ssid, "SDNmtr\0");
strcpy(eepromStruct.password, "LockedSDN\0");
writeCheck = true;
}
if (eepromStruct.noderedHost[0] == 255)
if (eepromStruct.noderedHost[0] == UCHAR_MAX)
{
strcpy(eepromStruct.noderedHost, "http://nodered.sdnsupport.nl:1880\0");
writeCheck = true;
}
if (eepromStruct.noderedUrl[0] == 255)
if (eepromStruct.noderedUrl[0] == UCHAR_MAX)
{
strcpy(eepromStruct.noderedUrl, "Default\0");
writeCheck = true;
}
if (eepromStruct.device[0] == 255)
if (eepromStruct.device[0] == UCHAR_MAX)
{
strcpy(eepromStruct.device, "WSEN0000\0");
writeCheck = true;
@@ -47,43 +47,43 @@ void checkEeprom()
writeCheck = true;
}
if (eepromStruct.updateTime == 0xffffffff)
if (eepromStruct.updateTime == UINT_MAX)
{
eepromStruct.updateTime = 900;
writeCheck = true;
}
if (eepromStruct.channel[1].channel[0] == 255)
if (eepromStruct.channel[1].channel[0] == UCHAR_MAX)
{
strcpy(eepromStruct.channel[1].channel, "channel1\0");
eepromStruct.channel[1].enable = false;
writeCheck = true;
}
if (eepromStruct.channel[2].channel[0] == 255)
if (eepromStruct.channel[2].channel[0] == UCHAR_MAX)
{
strcpy(eepromStruct.channel[2].channel, "channel2\0");
eepromStruct.channel[2].enable = false;
writeCheck = true;
}
if (eepromStruct.channel[3].channel[0] == 255)
if (eepromStruct.channel[3].channel[0] == UCHAR_MAX)
{
strcpy(eepromStruct.channel[3].channel, "channel3\0");
eepromStruct.channel[3].enable = false;
writeCheck = true;
}
if (eepromStruct.channel[4].channel[0] == 255)
if (eepromStruct.channel[4].channel[0] == UCHAR_MAX)
{
strcpy(eepromStruct.channel[4].channel, "channel4\0");
eepromStruct.channel[4].enable = false;
writeCheck = true;
}
if (eepromStruct.www_username[0] == 255)
if (eepromStruct.www_username[0] == UCHAR_MAX)
{
strcpy(eepromStruct.www_username, "admin\0");
writeCheck = true;
}
if (eepromStruct.www_password[0] == 255)
if (eepromStruct.www_password[0] == UCHAR_MAX)
{
strcpy(eepromStruct.www_password, "password\0");
writeCheck = true;
@@ -103,7 +103,7 @@ void checkEeprom()
writeCheck = true;
}
if (eepromStruct.prtgHost[0] == 255)
if (eepromStruct.prtgHost[0] == UCHAR_MAX)
{
strcpy(eepromStruct.prtgHost, "prtg.sdnsupport.nl\0");
writeCheck = true;
@@ -113,7 +113,7 @@ void checkEeprom()
eepromStruct.prtgHttpPort = 5050;
writeCheck = true;
}
if (eepromStruct.serialnumber[0] == 255)
if (eepromStruct.serialnumber[0] == UCHAR_MAX)
{
strcpy(eepromStruct.serialnumber, "XXXXXXX\0");
writeCheck = true;