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

Use ESP-IDF only for WiFi #253

Merged
merged 64 commits into from
Dec 4, 2024
Merged

Use ESP-IDF only for WiFi #253

merged 64 commits into from
Dec 4, 2024

Conversation

lptr
Copy link
Member

@lptr lptr commented Dec 1, 2024

This is a major refactor, and a big step towards dropping Arduino completely.

Fixes #224.

Changes

  • The network connection and all network services are now handled via ESP-IDF-only code.
    • Removed MQTTPubSubClient, NTPClient and their dependencies for built-in functions.
    • mDNS doens't use Arduino either.
    • HTTP update works without Arduino, too.
  • Logging has been refactored to use the built-in ESP_LOGX() macros. This way logging is significantly simpler, and we get to handle all the system notifications as well in a uniform way (including reporting them over MQTT).
  • The firmware works now in Wokwi locally.
  • Lots of improvements to heap tracing.
  • Many smallimprovements.

One thing that got significantly better with the rewrite is MQTT connections: they happen much faster, and the device is much more responsive. I guess this is because we don't rely on a poll-based mechanism anymore. Yay! 🎉

Most importantly this fixes the memory leak with repeated WiFi reconnections -- see #224. \o/

Known issues

  • The code does not work on the MK4 as there is just not enough memory on the ESP32-S2 (it has 320 kB instead of 512 kB on the ESP32-S3). I'm a bit baffled by this, since we've mostly just switched existing functionality provided by Arduino on top of ESP32 to the native implementations, yet we seem to be using more memory, not less. 🤷 I'm hoping that once we drop Arduino completely we'll get back a bunch of said memory.

@lptr lptr added the internal Internal change label Dec 1, 2024
@lptr lptr self-assigned this Dec 1, 2024
@lptr lptr force-pushed the use-esp-idf-wifi branch from 9dcd797 to e542631 Compare December 1, 2024 17:08
@lptr lptr force-pushed the use-esp-idf-wifi branch from fd720c5 to 425d138 Compare December 1, 2024 18:08
@lptr lptr force-pushed the use-esp-idf-wifi branch from 425d138 to 74a72db Compare December 1, 2024 18:08
@lptr lptr marked this pull request as ready for review December 4, 2024 10:26
@lptr lptr merged commit 4609d1c into main Dec 4, 2024
7 checks passed
@lptr lptr deleted the use-esp-idf-wifi branch December 4, 2024 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Internal change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory leak when connecting / disconnecting to WiFi
1 participant