mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
add ESP.eraseESPconfig() to erase the ESP SDK configuration (including wifi)
improve WiFiMulti
This commit is contained in:
parent
dc52cf82c5
commit
5852c484ca
@ -294,3 +294,25 @@ String EspClass::getResetInfo(void) {
|
|||||||
struct rst_info * EspClass::getResetInfoPtr(void) {
|
struct rst_info * EspClass::getResetInfoPtr(void) {
|
||||||
return &resetInfo;
|
return &resetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EspClass::eraseESPconfig(void) {
|
||||||
|
bool ret = true;
|
||||||
|
size_t cfgAddr = (ESP.getFlashChipSize() - 0x3000);
|
||||||
|
size_t cfgSize = (8*1024);
|
||||||
|
|
||||||
|
noInterrupts();
|
||||||
|
while(cfgSize) {
|
||||||
|
|
||||||
|
if(spi_flash_erase_sector((cfgAddr / SPI_FLASH_SEC_SIZE)) != SPI_FLASH_RESULT_OK) {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cfgSize -= SPI_FLASH_SEC_SIZE;
|
||||||
|
cfgAddr += SPI_FLASH_SEC_SIZE;
|
||||||
|
}
|
||||||
|
interrupts();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,6 +101,8 @@ class EspClass {
|
|||||||
String getResetInfo(void);
|
String getResetInfo(void);
|
||||||
struct rst_info * getResetInfoPtr(void);
|
struct rst_info * getResetInfoPtr(void);
|
||||||
|
|
||||||
|
bool eraseESPconfig(void);
|
||||||
|
|
||||||
inline uint32_t getCycleCount(void);
|
inline uint32_t getCycleCount(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +47,10 @@ wl_status_t ESP8266WiFiMulti::run(void) {
|
|||||||
uint8 bestBSSID[6];
|
uint8 bestBSSID[6];
|
||||||
int32_t bestChannel;
|
int32_t bestChannel;
|
||||||
|
|
||||||
|
DEBUG_WIFI_MULTI("[WIFI] delete old wifi config...\n");
|
||||||
|
WiFi.disconnect();
|
||||||
|
|
||||||
|
DEBUG_WIFI_MULTI("[WIFI] start scan\n");
|
||||||
// WiFi.scanNetworks will return the number of networks found
|
// WiFi.scanNetworks will return the number of networks found
|
||||||
int8_t n = WiFi.scanNetworks();
|
int8_t n = WiFi.scanNetworks();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user