Removed version compatibility check

Removed version compatibility check
This commit is contained in:
Theo Arends 2020-11-07 15:43:52 +01:00
parent 53f6e69623
commit 138ddfb16e
5 changed files with 9 additions and 64 deletions

View File

@ -16,6 +16,9 @@ All notable changes to this project will be documented in this file.
### Fixed
- NTP fallback server functionality (#9739)
### Removed
- Version compatibility check
## [Released]
### 9.1.0 20201105

View File

@ -68,3 +68,6 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
### Fixed
- NTP fallback server functionality (#9739)
### Removed
- Version compatibility check

View File

@ -213,57 +213,6 @@ void SetFlashModeDout(void)
#endif // ESP8266
}
bool VersionCompatible(void)
{
#ifdef ESP8266
if (Settings.flag3.compatibility_check) {
return true;
}
eboot_command ebcmd;
eboot_command_read(&ebcmd);
uint32_t start_address = ebcmd.args[0];
uint32_t end_address = start_address + (ebcmd.args[2] & 0xFFFFF000) + FLASH_SECTOR_SIZE;
uint32_t* buffer = new uint32_t[FLASH_SECTOR_SIZE / 4];
uint32_t version[3] = { 0 };
bool found = false;
for (uint32_t address = start_address; address < end_address; address = address + FLASH_SECTOR_SIZE) {
ESP.flashRead(address, (uint32_t*)buffer, FLASH_SECTOR_SIZE);
if ((address == start_address) && (0x1F == (buffer[0] & 0xFF))) {
version[1] = 0xFFFFFFFF; // Ota file is gzipped and can not be checked for compatibility
found = true;
} else {
for (uint32_t i = 0; i < (FLASH_SECTOR_SIZE / 4); i++) {
version[0] = version[1];
version[1] = version[2];
version[2] = buffer[i];
if ((MARKER_START == version[0]) && (MARKER_END == version[2])) {
found = true;
break;
}
}
}
if (found) { break; }
}
delete[] buffer;
if (!found) { version[1] = 0; }
AddLog_P(LOG_LEVEL_DEBUG, PSTR("OTA: Version 0x%08X, Compatible 0x%08X"), version[1], VERSION_COMPATIBLE);
if (version[1] < VERSION_COMPATIBLE) {
uint32_t eboot_magic = 0; // Abandon OTA result
ESP.rtcUserMemoryWrite(0, (uint32_t*)&eboot_magic, sizeof(eboot_magic));
return false;
}
#endif // ESP8266
return true;
}
void SettingsBufferFree(void)
{
if (settings_buffer != nullptr) {

View File

@ -1066,12 +1066,8 @@ void Every250mSeconds(void)
Response_P(PSTR("{\"" D_CMND_UPGRADE "\":\""));
if (ota_result) {
// SetFlashModeDout(); // Force DOUT for both ESP8266 and ESP8285
if (!VersionCompatible()) {
ResponseAppend_P(PSTR(D_JSON_FAILED " " D_UPLOAD_ERR_14));
} else {
ResponseAppend_P(PSTR(D_JSON_SUCCESSFUL ". " D_JSON_RESTARTING));
TasmotaGlobal.restart_flag = 2;
}
ResponseAppend_P(PSTR(D_JSON_SUCCESSFUL ". " D_JSON_RESTARTING));
TasmotaGlobal.restart_flag = 2;
} else {
ResponseAppend_P(PSTR(D_JSON_FAILED " %s"), ESPhttpUpdate.getLastErrorString().c_str());
}

View File

@ -796,7 +796,6 @@ const char kUploadErrors[] PROGMEM =
#ifdef USE_RF_FLASH
"|" D_UPLOAD_ERR_10 "|" D_UPLOAD_ERR_11 "|" D_UPLOAD_ERR_12 "|" D_UPLOAD_ERR_13
#endif
"|" D_UPLOAD_ERR_14
;
const uint16_t DNS_PORT = 53;
@ -2689,8 +2688,7 @@ void HandleUploadDone(void)
#ifdef USE_RF_FLASH
if (Web.upload_error < 15) {
#else
if ((Web.upload_error < 10) || (14 == Web.upload_error)) {
if (14 == Web.upload_error) { Web.upload_error = 10; }
if (Web.upload_error < 10) {
#endif
GetTextIndexed(error, sizeof(error), Web.upload_error -1, kUploadErrors);
} else {
@ -2978,10 +2976,6 @@ void HandleUploadLoop(void)
Web.upload_error = 6; // Upload failed. Enable logging 3
return;
}
if (!VersionCompatible()) {
Web.upload_error = 14; // Not compatible
return;
}
}
if (!Web.upload_error) {
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_SUCCESSFUL " %u bytes"), upload.totalSize);