Added DTC for LittleFS-Image Version mismatch
This commit is contained in:
@@ -20,7 +20,12 @@ void initWebUI()
|
||||
return;
|
||||
}
|
||||
|
||||
globals.FlashVersion = GetFlashVersion();
|
||||
GetFlashVersion(globals.FlashVersion, sizeof(globals.FlashVersion));
|
||||
|
||||
if (!strcmp(globals.FlashVersion, QUOTE(FLASH_FS_VERSION))
|
||||
{
|
||||
MaintainDTC(DTC_FLASHFS_VERSION_ERROR, DTC_WARN, true);
|
||||
}
|
||||
|
||||
MDNS.begin(globals.DeviceName);
|
||||
MDNS.addService("telnet", "tcp", 23);
|
||||
@@ -312,20 +317,21 @@ void WebserverNotFound_Callback(AsyncWebServerRequest *request)
|
||||
request->send(404, "text/html", "Not found");
|
||||
}
|
||||
|
||||
uint32_t GetFlashVersion()
|
||||
void GetFlashVersion(char *buff, size_t buff_size)
|
||||
{
|
||||
char buffer[20];
|
||||
File this_file = LittleFS.open("version", "r");
|
||||
if (!this_file)
|
||||
{ // failed to open the file, retrn empty result
|
||||
return 0;
|
||||
}
|
||||
if (this_file.available())
|
||||
{
|
||||
this_file.readBytesUntil('\r', buffer, sizeof(buffer));
|
||||
}
|
||||
this_file.close();
|
||||
return atoi(buffer);
|
||||
File this_file = LittleFS.open("version", "r");
|
||||
if (!this_file)
|
||||
{ // failed to open the file, retrn empty result
|
||||
buff[0] = '\0';
|
||||
return;
|
||||
}
|
||||
if (this_file.available())
|
||||
{
|
||||
int bytes_read;
|
||||
bytes_read = this_file.readBytesUntil('\r', buff, buff_size-1);
|
||||
buff[bytes_read] = '\0';
|
||||
}
|
||||
this_file.close();
|
||||
}
|
||||
|
||||
void WebserverFirmwareUpdate_Callback(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, bool final)
|
||||
|
Reference in New Issue
Block a user