Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By grhhm
#78488 Maybe similar question asked. I searched the forum and found nothing satisfying relevant. Please, point me.

The motivation:
Every single project of ESP8266/ESP32 I start with empty sketch, collecting there parts of written examples.
However, I noticed most of "features" are frequently used. And no one example sketch presented.

Features:
- Read the unit parameters from EEPROM and compare with default parameters (WIFI SSID, pass, hostname, NTP addr, IP config, etc.).
- If EEPROM matches default then run WIFI AP with "captive portal". Once user fills the details, Write the details to EEPROM and restart.
- Start WIFI. If not connected in reasonable time, do something :)
- If NTP set, get the local time.
- If MQTT defined, publish to it the unit details from EEPROM and boot time. (Similar for syslog, email, telegram, other reporting systems).
- In the loop, run server waiting for OTA. Receive and Apply new OTA image when request arrived. Report to MQTT and Reboot.
- In the loop, wait for GPIO 0 grounded for more than X seconds. When this happens, set EEPROM to default and reboot.

EasyESP, Espruino and Tasmota have some of these features. However, these frameworks are hard to change/customize.
Can you recommend simple framework or sketch which has these basic features implemented?

Thank you.
User avatar
By btidey
#78491 I also find that many of my projects have common characteristics; OTA, Wifi management, NTP, SPIFFS support, WebServer / client routines, config management, ISR and timer support. However, I didn't find a framework that had everything I wanted. Instead the first few projects were a learning exercise building these in using available libraries where possible.

The loop structure also tends to be similar with calls to app specific functions, small delay and maintenance calls e.g. server.handleClient().

Now for new projects I don't start with a blank sheet, I just copy a previous project, delete any specific application routines, and add on the new stuff. Much faster and one knows that the core stuff has already been proven.
User avatar
By rudy
#78493 Have you looked at https://github.com/philbowles/esparto and https://github.com/marvinroger/homie-esp8266?

So even if there is a framework with everything you ask, there will always be something that you don't like about it. That's how it is for me so I know I need to build my own to get things the way I want.
User avatar
By grhhm
#78508
btidey wrote:Now for new projects I don't start with a blank sheet, I just copy a previous project, delete any specific application routines, and add on the new stuff.


Sounds like a perfect code reuse.
Can you share your base, please?