Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wrong flashmode report #16280

Merged
merged 1 commit into from
Aug 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tasmota/tasmota_support/support_esp.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down