Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 9 additions & 9 deletions cores/esp32/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ FlashMode_t EspClass::getFlashChipMode(void) {
}
#endif // if !defined(CONFIG_IDF_TARGET_ESP32P4)

uint32_t EspClass::magicFlashChipSize(uint8_t byte) {
uint32_t EspClass::magicFlashChipSize(uint8_t flashByte) {
/*
FLASH_SIZES = {
"1MB": 0x00,
Expand All @@ -391,7 +391,7 @@ uint32_t EspClass::magicFlashChipSize(uint8_t byte) {
"128MB": 0x70,
}
*/
switch (byte & 0x0F) {
switch (flashByte & 0x0F) {
case 0x0: return (1_MB); // 8 MBit (1MB)
case 0x1: return (2_MB); // 16 MBit (2MB)
case 0x2: return (4_MB); // 32 MBit (4MB)
Expand All @@ -405,7 +405,7 @@ uint32_t EspClass::magicFlashChipSize(uint8_t byte) {
}
}

uint32_t EspClass::magicFlashChipSpeed(uint8_t byte) {
uint32_t EspClass::magicFlashChipSpeed(uint8_t flashByte) {
#if CONFIG_IDF_TARGET_ESP32C2
/*
FLASH_FREQUENCY = {
Expand All @@ -415,7 +415,7 @@ uint32_t EspClass::magicFlashChipSpeed(uint8_t byte) {
"15m": 0x2,
}
*/
switch (byte & 0x0F) {
switch (flashByte & 0x0F) {
case 0xF: return (60_MHz);
case 0x0: return (30_MHz);
case 0x1: return (20_MHz);
Expand All @@ -432,7 +432,7 @@ uint32_t EspClass::magicFlashChipSpeed(uint8_t byte) {
"20m": 0x2,
}
*/
switch (byte & 0x0F) {
switch (flashByte & 0x0F) {
case 0x0: return (80_MHz);
case 0x2: return (20_MHz);
default: // fail?
Expand All @@ -449,7 +449,7 @@ uint32_t EspClass::magicFlashChipSpeed(uint8_t byte) {
"12m": 0x2,
}
*/
switch (byte & 0x0F) {
switch (flashByte & 0x0F) {
case 0xF: return (48_MHz);
case 0x0: return (24_MHz);
case 0x1: return (16_MHz);
Expand All @@ -467,7 +467,7 @@ uint32_t EspClass::magicFlashChipSpeed(uint8_t byte) {
"20m": 0x2,
}
*/
switch (byte & 0x0F) {
switch (flashByte & 0x0F) {
case 0xF: return (80_MHz);
case 0x0: return (40_MHz);
case 0x1: return (26_MHz);
Expand All @@ -478,8 +478,8 @@ uint32_t EspClass::magicFlashChipSpeed(uint8_t byte) {
#endif
}

FlashMode_t EspClass::magicFlashChipMode(uint8_t byte) {
FlashMode_t mode = (FlashMode_t)byte;
FlashMode_t EspClass::magicFlashChipMode(uint8_t flashByte) {
FlashMode_t mode = (FlashMode_t)flashByte;
if (mode > FM_SLOW_READ) {
mode = FM_UNKNOWN;
}
Expand Down
6 changes: 3 additions & 3 deletions cores/esp32/Esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ class EspClass {
uint32_t getFlashChipSpeed();
FlashMode_t getFlashChipMode();

uint32_t magicFlashChipSize(uint8_t byte);
uint32_t magicFlashChipSpeed(uint8_t byte);
FlashMode_t magicFlashChipMode(uint8_t byte);
uint32_t magicFlashChipSize(uint8_t flashByte);
uint32_t magicFlashChipSpeed(uint8_t flashByte);
FlashMode_t magicFlashChipMode(uint8_t flashByte);

uint32_t getSketchSize();
String getSketchMD5();
Expand Down
Loading