Skip to content

Commit

Permalink
[ESP8285] Remove ESP8285 specific builds, detect at runtime (letscont…
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed Jan 28, 2022
1 parent bed5ede commit ced8d79
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 103 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ _[hardware-type]_ cn be any of:
Hardware type | Description |
-----------------|---------------------------------------------|
ESP8266 | Espressif ESP8266 generic boards |
ESP8285 | Espressif ESP8285 generic boards 1MB Flash |
WROOM02 | Espressif ESP8266 WRoom02 boards |
ESP32 | Espressif ESP32 generic boards |
ESP32-wrover-kit | Espressif ESP32 wrover-kit boards |
Expand Down Expand Up @@ -112,7 +111,6 @@ Some example firmware names:
Firmware name | Hardware | Included plugins |
---------------------------------------------------|-------------------------|-------------------------------|
ESPEasy_mega-20210501_normal_ESP8266_1M.bin | ESP8266 with 1MB flash | Stable |
ESPEasy_mega-20210501_normal_ESP8285_1M.bin | ESP8285 with 1MB flash | Stable |
ESPEasy_mega-20210501_normal_ESP8266_4M1M.bin | ESP8266 with 4MB flash | Stable |
ESPEasy_mega-20210501_test_A_ESP8266_4M1M.bin | ESP8266 with 4MB flash | Stable + Testing base + set A |
ESPEasy_mega-20210501_normal_ESP32_4M316k.bin | ESP32 with 4MB flash | Stable |
Expand Down
6 changes: 4 additions & 2 deletions dist/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ There is also a number of special builds:
- normal_beta => "Normal" using the staged (beta) branch of the esp8266/Arduino repository.

Chip can be:
- ESP8266 => Most likely option
- ESP8285 => Used in some Sonoff modules
- ESP8266 => Most likely option (use also for ESP8285 chips)
- ESP32 => Showing up in commercial products, but mainly seen on NodeMCU like boards.
- ESP32-S2 => Newer version of ESP32, with more GPIO pins, but lacking some features of ESP32.
- ESP32-S3 => Not yet supported in ESPEasy. (hardly available to buy)
- ESP32-C3 => Support in ESPEasy will be added soon.

MemorySize can be:
- 1M => 1 MB flash modules (e.g. almost all Sonoff modules)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/Participate/PlatformIO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ The environment definitions all have at least the used micro controller in the n
For example:

* ..._ESP8266_4Mnn -> ESP8266 has external flash, which can vary in size from 512 kB to 16 MB, with nn configured as filesystem.
* ..._ESP8285_1M -> ESP8285 has the flash internal, so is always 1 MB.
* ..._ESP8266_1M -> ESP8285 has the flash internal, which is almost always 1 MB. ESP8266 does have an external flash chip, which allows for exchanging it for a larger flash chip (recommended).
* ..._ESP32_4M316k -> ESP32 with 4 MB flash and a 1.8 MB partition for the sketch. (316k SPIFFS)
* ..._ESP32_16M2M_LittleFS -> ESP32 with 16 MB flash and a 4 MB partition for the sketch. (2MB LittleFS)
* ..._ESP32_16M8M_LittleFS -> ESP32 with 16 MB flash and a 4 MB partition for the sketch. (8MB LittleFS)
* ..._ESP32_16M1M_ETH -> ESP32 with 16 MB flash and a 4 MB partition for the sketch. (1MB SPIFFS, Wired ethernet support)

Make a custom build using PlatformIO
Expand Down
7 changes: 5 additions & 2 deletions docs/source/Participate/ProjectStructure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ ESP Chip Type
-------------

* ``ESP8266`` Most likely option.
* ``ESP8285`` Used in some Sonoff modules. This chip has embedded flash, so no extra flash chip.
* ``ESP32`` Experimental support at this moment.
* ``ESP8285`` Supported in ``ESP8266`` builds. Used in some Sonoff modules. This chip has embedded flash, so no extra flash chip.
* ``ESP32`` Allows for more memory and more GPIO pins.
* ``ESP32-S2`` Newer version of ESP32. Has even more GPIO pins, but some specific features of ESP32 were removed.
* ``ESP32-S3`` Not yet available.
* ``ESP32-C3`` Support will be added soon.

Memory Size and Partitioning
----------------------------
Expand Down
10 changes: 0 additions & 10 deletions platformio_esp82xx_base.ini
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ build_flags = -DSIZE_1M
extends = esp82xx_1M
board = esp01_1m

[esp8285_1M]
extends = esp82xx_1M
board = esp8285
build_flags = ${esp8266_1M.build_flags} -DESP8285


;;; Minimal ***********************************************************
; Minimal build size for OTA ;
Expand All @@ -185,11 +180,6 @@ build_flags = ${esp82xx_1M.build_flags} -DPLUGIN_BUILD_MINIMAL_OTA
extends = esp82xx_1M_OTA
board = esp01_1m

[esp8285_1M_OTA]
extends = esp82xx_1M_OTA
board = esp8285
build_flags = ${esp82xx_1M_OTA.build_flags} -DESP8285


;;; 2MB flash nodes **************************************************
; Layout for 2M flash nodes ;
Expand Down
63 changes: 0 additions & 63 deletions platformio_esp82xx_envs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,6 @@ build_flags = ${regular_platform_alt_wifi.build_flags}
-D FEATURE_ADC_VCC=true


; NORMAL: 1024k for esp8285 ----------------------
[env:normal_ESP8285_1M]
extends = esp8285_1M
platform = ${regular_platform.platform}
platform_packages = ${regular_platform.platform_packages}
build_flags = ${regular_platform.build_flags}
${esp8285_1M.build_flags}


; NORMAL: 2048k WROOM02 version --------------------------
[env:normal_WROOM02_2M]
extends = espWroom2M
Expand Down Expand Up @@ -281,13 +272,6 @@ build_flags = ${regular_platform.build_flags}
${esp8266_1M_OTA.build_flags}
${minimal_OTA_domoticz.build_flags}

[env:minimal_core_274_ESP8285_1M_OTA_Domoticz]
extends = esp8285_1M_OTA
platform = ${regular_platform.platform}
platform_packages = ${regular_platform.platform_packages}
build_flags = ${regular_platform.build_flags}
${esp8285_1M_OTA.build_flags}
${minimal_OTA_domoticz.build_flags}

[env:minimal_core_274_sdk3_ESP8266_1M_OTA_Domoticz]
extends = esp8266_1M_OTA
Expand All @@ -297,14 +281,6 @@ build_flags = ${core_2_7_4_sdk3.build_flags}
${esp8266_1M_OTA.build_flags}
${minimal_OTA_domoticz.build_flags}

[env:minimal_core_274_sdk3_ESP8285_1M_OTA_Domoticz]
extends = esp8285_1M_OTA
platform = ${core_2_7_4_sdk3.platform}
platform_packages = ${core_2_7_4_sdk3.platform_packages}
build_flags = ${core_2_7_4_sdk3.build_flags}
${esp8285_1M_OTA.build_flags}
${minimal_OTA_domoticz.build_flags}


[env:minimal_core_274_ESP8266_1M_OTA_FHEM_HA]
extends = esp8266_1M_OTA
Expand All @@ -314,13 +290,6 @@ build_flags = ${regular_platform.build_flags}
${esp8266_1M_OTA.build_flags}
${minimal_OTA_FHEM_HA.build_flags}

[env:minimal_core_274_ESP8285_1M_OTA_FHEM_HA]
extends = esp8285_1M_OTA
platform = ${regular_platform.platform}
platform_packages = ${regular_platform.platform_packages}
build_flags = ${regular_platform.build_flags}
${esp8285_1M_OTA.build_flags}
${minimal_OTA_FHEM_HA.build_flags}

[env:minimal_core_274_sdk3_ESP8266_1M_OTA_FHEM_HA]
extends = esp8266_1M_OTA
Expand All @@ -330,14 +299,6 @@ build_flags = ${core_2_7_4_sdk3.build_flags}
${esp8266_1M_OTA.build_flags}
${minimal_OTA_FHEM_HA.build_flags}

[env:minimal_core_274_sdk3_ESP8285_1M_OTA_FHEM_HA]
extends = esp8285_1M_OTA
platform = ${core_2_7_4_sdk3.platform}
platform_packages = ${core_2_7_4_sdk3.platform_packages}
build_flags = ${core_2_7_4_sdk3.build_flags}
${esp8285_1M_OTA.build_flags}
${minimal_OTA_FHEM_HA.build_flags}



;;; IR ***********************************************************
Expand Down Expand Up @@ -741,30 +702,6 @@ build_flags = ${hard_esp82xx.build_flags}
-D PLUGIN_SET_SONOFF_POW


; ITEAD / SONOFF S20 version --------------------
;[env:hard_SONOFF_S20_1M]
;extends = esp8266_1M_OTA, hard_esp82xx
;platform = ${hard_esp82xx.platform}
;platform_packages = ${hard_esp82xx.platform_packages}
;build_flags = ${hard_esp82xx.build_flags} ${esp8266_1M_OTA.build_flags} -D PLUGIN_SET_SONOFF_S2x


; ITEAD / SONOFF 4CH version --------------------
;[env:hard_SONOFF_4CH_1M]
;extends = esp8285_1M_OTA, hard_esp82xx
;platform = ${hard_esp82xx.platform}
;platform_packages = ${hard_esp82xx.platform_packages}
;build_flags = ${hard_esp82xx.build_flags} ${esp8285_1M_OTA.build_flags} -D PLUGIN_SET_SONOFF_4CH



; ITEAD / SONOFF TOUCH version ------------------
;[env:hard_SONOFF_TOUCH_1M]
;extends = esp8285_1M_OTA, hard_esp82xx
;platform = ${hard_esp82xx.platform}
;platform_packages = ${hard_esp82xx.platform_packages}
;build_flags = ${hard_esp82xx.build_flags} ${esp8285_1M_OTA.build_flags} -D PLUGIN_SET_SONOFF_TOUCH


; Shelly1 Open Source (ESP8266-2MB)
; https://shelly.cloud/shelly1-open-source/
Expand Down
56 changes: 34 additions & 22 deletions src/src/Helpers/Hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,14 +597,30 @@ const __FlashStringHelper * getChipModel() {
}
}
#endif
#elif defined(ESP8285)
return F("ESP8285");
#elif defined(ESP8266)
return F("ESP8266");
return isESP8285() ? F("ESP8285") : F("ESP8266");
#endif
return F("Unknown");
}

bool isESP8285() {
#ifdef ESP8266
const uint32_t efuse_blocks[4] {
READ_PERI_REG(0x3ff00050),
READ_PERI_REG(0x3ff00054),
READ_PERI_REG(0x3ff00058),
READ_PERI_REG(0x3ff0005c)
};

return (
(efuse_blocks[0] & (1 << 4))
|| (efuse_blocks[2] & (1 << 16))
);
#else
return false;
#endif
}

uint8_t getChipRevision() {
uint8_t rev = 0;
#ifdef ESP32
Expand Down Expand Up @@ -1137,28 +1153,24 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
case 16: pinnr = 0; break; // This is used by the deep-sleep mechanism
}
if (isFlashInterfacePin(gpio)) {
#ifdef ESP8285

if ((gpio == 9) || (gpio == 10)) {
// Usable on ESP8285
if (isESP8285()) {
if ((gpio == 9) || (gpio == 10)) {
// Usable on ESP8285
} else {
warning = true;
}
} else {
warning = true;
// On ESP8266 GPIO 9 & 10 are only usable if not connected to flash
if (gpio == 9) {
// GPIO9 is internally used to control the flash memory.
input = false;
output = false;
} else if (gpio == 10) {
// GPIO10 can be used as input only.
output = false;
}
}

#else

warning = true;
// On ESP8266 GPIO 9 & 10 are only usable if not connected to flash
if (gpio == 9) {
// GPIO9 is internally used to control the flash memory.
input = false;
output = false;
} else if (gpio == 10) {
// GPIO10 can be used as input only.
output = false;
}

#endif
}

if (pinnr < 0 || pinnr > 16) {
Expand Down
2 changes: 2 additions & 0 deletions src/src/Helpers/Hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ uint8_t getChipCores();

const __FlashStringHelper * getChipModel();

bool isESP8285();

uint8_t getChipRevision();

uint32_t getSketchSize();
Expand Down

0 comments on commit ced8d79

Please sign in to comment.