[Horus] SD version check simplified
This commit is contained in:
@@ -1097,18 +1097,17 @@ void checkSDVersion()
|
|||||||
char version[sizeof(REQUIRED_SDCARD_VERSION)-1];
|
char version[sizeof(REQUIRED_SDCARD_VERSION)-1];
|
||||||
|
|
||||||
FRESULT result = f_open(&versionFile, "/opentx.sdcard.version", FA_OPEN_EXISTING | FA_READ);
|
FRESULT result = f_open(&versionFile, "/opentx.sdcard.version", FA_OPEN_EXISTING | FA_READ);
|
||||||
if ((result == FR_OK) && (f_size(&versionFile) == sizeof(version))) {
|
if (result == FR_OK) {
|
||||||
f_read(&versionFile, &version, sizeof(version), &read);
|
if (f_read(&versionFile, &version, sizeof(version), &read) != FR_OK ||
|
||||||
if (strncmp(version, REQUIRED_SDCARD_VERSION, sizeof(version)) != 0) {
|
read != sizeof(version) ||
|
||||||
TRACE("sdCheckVersion FAILED: version are not the same");
|
strncmp(version, REQUIRED_SDCARD_VERSION, sizeof(version)) != 0) {
|
||||||
ALERT(STR_SD_CARD, STR_WRONG_SDCARDVERSION, AU_ERROR);
|
ALERT(STR_SD_CARD, STR_WRONG_SDCARDVERSION, AU_ERROR);
|
||||||
}
|
}
|
||||||
|
f_close(&versionFile);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("sdCheckVersion FAILED: opentx.sdcard.version cannot be opened");
|
|
||||||
ALERT(STR_SD_CARD, STR_WRONG_SDCARDVERSION, AU_ERROR);
|
ALERT(STR_SD_CARD, STR_WRONG_SDCARDVERSION, AU_ERROR);
|
||||||
}
|
}
|
||||||
f_close(&versionFile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user