mirror of https://github.com/arendst/Tasmota.git
fix wrong flashmode report
This commit is contained in:
parent
1cb2ae4dac
commit
7cbdd409b5
|
@ -121,6 +121,8 @@ String GetDeviceHardwareRevision(void) {
|
|||
#ifdef ESP32
|
||||
|
||||
#include "bootloader_flash.h"
|
||||
#include "soc/soc.h"
|
||||
#include "soc/spi_reg.h"
|
||||
// ESP32_ARCH contains the name of the architecture (used by autoconf)
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#ifdef CORE32SOLO1
|
||||
|
@ -981,7 +983,26 @@ typedef enum {
|
|||
} FlashMode_t;
|
||||
*/
|
||||
String ESP_getFlashChipMode(void) {
|
||||
#if ESP8266
|
||||
uint32_t flash_mode = ESP.getFlashChipMode();
|
||||
#else
|
||||
uint32_t spi_ctrl = REG_READ(SPI_CTRL_REG(0));
|
||||
uint32_t flash_mode;
|
||||
/* Not all of the following constants are already defined in older versions of spi_reg.h, so do it manually for now*/
|
||||
if (spi_ctrl & BIT(24)) { //SPI_FREAD_QIO
|
||||
flash_mode = 0;
|
||||
} else if (spi_ctrl & BIT(20)) { //SPI_FREAD_QUAD
|
||||
flash_mode = 1;
|
||||
} else if (spi_ctrl & BIT(23)) { //SPI_FREAD_DIO
|
||||
flash_mode = 2;
|
||||
} else if (spi_ctrl & BIT(14)) { // SPI_FREAD_DUAL
|
||||
flash_mode = 3;
|
||||
} else if (spi_ctrl & BIT(13)) { //SPI_FASTRD_MODE
|
||||
flash_mode = 4;
|
||||
} else {
|
||||
flash_mode = 5;
|
||||
}
|
||||
#endif
|
||||
if (flash_mode > 5) { flash_mode = 3; }
|
||||
char stemp[6];
|
||||
return GetTextIndexed(stemp, sizeof(stemp), flash_mode, kFlashModes);
|
||||
|
|
Loading…
Reference in New Issue