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

feat: add ESP-IDF support #33

Merged
merged 1 commit into from
Aug 2, 2024
Merged

feat: add ESP-IDF support #33

merged 1 commit into from
Aug 2, 2024

Conversation

sairon
Copy link
Owner

@sairon sairon commented Dec 1, 2023

Add support for esp-idf framework, partially based on ESPHome PR esphome/esphome#5667 by @edwardtfn (thank you, Edward!). The upstream code has been refactored to share more when Arduino or ESP-IDF is used and to use baud rate switching used in this "fork".

This is currently still WIP, I will do a bit more refactoring and testing, but initial tests are looking good and there are indeed some resource savings when compared to Arduino, as seen with my testing config:

Arduino:

RAM:   [=         ]  14.6% (used 47928 bytes from 327680 bytes)
Flash: [=======   ]  71.1% (used 1304205 bytes from 1835008 bytes)

ESP-IDF:

RAM:   [=         ]  10.7% (used 35048 bytes from 327680 bytes)
Flash: [======    ]  61.2% (used 1123305 bytes from 1835008 bytes)

Fixes #23.

For those who are eager to try (more testers are always welcome!), simply update ref in your config to add-esp-idf-support, and ideally also the refresh time:

external_components:
  - source:
      type: git
      url: https://github.com/sairon/esphome-nspanel-lovelace-ui
      ref: add-esp-idf-support
    refresh: 0s
    components: [ nspanel_lovelace ]

It is recommended to use serial for transition from Arduino to IDF, because IIRC the partition layout is a bit different, but I have tested the OTA works both ways without problems too.

@rschueler
Copy link

rschueler commented Dec 1, 2023

Thanks! Compiled it together with bluetooth proxy and worked. Flash 91% ... Upload of new TFT file also worked fine!

@edwardtfn
Copy link

I'm curious here... Why don't you guys use the Nextion component from ESPHome? I see your library is way simpler and probably easier to maintain, but other than that, is there a reason to be by the side?
It would be nice if we can collaborate more with each other... 😉
And please let me know if you have issues with the idf code for uploading TFT. I will be happy to help.

@sairon
Copy link
Owner Author

sairon commented Dec 2, 2023

@edwardtfn The reason for a separate component is that it implements the custom protocol used by the NSPanel Lovelace UI Nextion firmware. See the repo's readme for details - the goal is to have an easy to use component, similarly to what Jesse did (but never merged) for the stock NSPanel FW. I imagine the same might be possible to achieve with the Nextion component and bunch of lambda scripts, but it will be hard to use and maintain. And using a custom component for comms and upstream Nextion for upload is not possible either, because they will have to share the same UART.

@randybb
Copy link

randybb commented Dec 2, 2023

I have switched all my 6 panels from arduino to idf - no issues so far. Thanks a loot

@rschueler
Copy link

From time to time I have follwing warnings in the logs:
[17:17:52][W][component:214]: Component mqtt took a long time for an operation (0.12 s).
[17:17:52][W][component:215]: Components should block for at most 20-30ms.
[17:18:00][W][component:214]: Component mqtt took a long time for an operation (0.08 s).
[17:18:00][W][component:215]: Components should block for at most 20-30ms.

@edwardtfn
Copy link

https://esphome.io/changelog/2023.7.0.html#a-new-warning-in-the-logs

@edwardtfn
Copy link

Hey, you may wanna know that the original version where I've added support to ESP-IDF wasn't supporting HTTPS. I've added that support to the ESPHome component (esphome/esphome#6051) and it works pretty solid.
You can use that to download the files directly from GitHub, removing the need of copying the files to a local http server.

@Bascht74
Copy link

Now it works with https:
esphome/esphome#6051

@sairon Could you merge then? It works stable in my condiguration for some time and now https is possible

@Bascht74
Copy link

Bascht74 commented Mar 4, 2024

Hi @sairon I still hope you can merge this pull request so that this PR comes into focus:
#34

@sairon sairon marked this pull request as ready for review August 2, 2024 10:29
@sairon sairon merged commit db5f576 into dev Aug 2, 2024
@sairon sairon deleted the add-esp-idf-support branch August 2, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use component with ESP-IDF framework
5 participants