-->
Page 2 of 3

Re: How can I check the ESP type with code?

PostPosted: Sat Jul 11, 2020 3:07 pm
by btidey
2 thoughts.

If you check the flash size in your start up code (ESP.getFlashChipSize()) that should show as 4MByte on ESP-12 modules but I think most ESP-01 only have 1MByte.

If you can spare a pin on the esp-12 variant then you could wire that to 0V. Setting it to Input with internal pull up should then allow you to see that as a 0 on the ESP12 but not on the esp-01

Re: How can I check the ESP type with code?

PostPosted: Mon Jul 13, 2020 2:49 am
by pangolin
ESP-01 has usually 512k, ESP-01S has 1MB but checking "less than 4MB" would work for now... beware though, esp8285 (e.g. wemos d1 mini lite) has same external pins as 4MB, but also only 1MB...

Depending on how many you have, ypou could "hard-code" the (amost) unique chip id of the ESP-01 and sat "if chipid != "aabbcc" (or whatever) then do stuff with button"

Finally you CAN have a button on the ESP-01 if you don't need t serial by using either GPIO 1 or 3 (TX / RX)...I do. :)

Re: How can I check the ESP type with code?

PostPosted: Mon Jul 13, 2020 5:19 am
by GHBLoos
It's a good idea to check the memory size and based upon that resukt store the ESP type in flash memory with a second variable 'setup=initial_Setup'. If, after reset, the code works fine, it could be set to 'setup=definitive_setup'. If the code fails, change the ESP type and store that in flash memory.

Re: How can I check the ESP type with code?

PostPosted: Tue Jul 14, 2020 6:54 am
by Lea
I solved a similar configuration problem by using the MAC address as an index into a JSON file kept in the onboard file system. The code is the same for each device, just have to add each new device to the file and upload it Over The Air.