mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-07 16:23:38 +03:00
move flash size check to a function in ESP class,
allow real size bigger the IDE for Update
This commit is contained in:
parent
28dd31a80f
commit
f57ab609ec
@ -298,6 +298,24 @@ uint32_t EspClass::getFlashChipSizeByChipId(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check the Flash settings from IDE against the Real flash size
|
||||||
|
* @param needsEquals (return only true it equals)
|
||||||
|
* @return ok or not
|
||||||
|
*/
|
||||||
|
bool EspClass::checkFlashConfig(bool needsEquals) {
|
||||||
|
if(needsEquals) {
|
||||||
|
if(getFlashChipRealSize() == getFlashChipSize()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(getFlashChipRealSize() >= getFlashChipSize()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
String EspClass::getResetInfo(void) {
|
String EspClass::getResetInfo(void) {
|
||||||
if(resetInfo.reason != 0) {
|
if(resetInfo.reason != 0) {
|
||||||
char buff[200];
|
char buff[200];
|
||||||
|
@ -117,6 +117,8 @@ class EspClass {
|
|||||||
FlashMode_t getFlashChipMode();
|
FlashMode_t getFlashChipMode();
|
||||||
uint32_t getFlashChipSizeByChipId();
|
uint32_t getFlashChipSizeByChipId();
|
||||||
|
|
||||||
|
bool checkFlashConfig(bool needsEquals = false);
|
||||||
|
|
||||||
bool flashEraseSector(uint32_t sector);
|
bool flashEraseSector(uint32_t sector);
|
||||||
bool flashWrite(uint32_t offset, uint32_t *data, size_t size);
|
bool flashWrite(uint32_t offset, uint32_t *data, size_t size);
|
||||||
bool flashRead(uint32_t offset, uint32_t *data, size_t size);
|
bool flashRead(uint32_t offset, uint32_t *data, size_t size);
|
||||||
|
@ -57,7 +57,7 @@ bool UpdaterClass::begin(size_t size, int command) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ESP.getFlashChipRealSize() != ESP.getFlashChipSize()) {
|
if(ESP.checkFlashConfig(false)) {
|
||||||
_error = UPDATE_ERROR_FLASH_CONFIG;
|
_error = UPDATE_ERROR_FLASH_CONFIG;
|
||||||
#ifdef DEBUG_UPDATER
|
#ifdef DEBUG_UPDATER
|
||||||
printError(DEBUG_UPDATER);
|
printError(DEBUG_UPDATER);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user