-
Notifications
You must be signed in to change notification settings - Fork 0
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
Platformio #1
Comments
@vicelikedust Sorry, I haven't tested it with Platformio. I will find time to take a look. |
@Lzw655 I appreciate it very much, Thank you. |
I humbly also request this - I have a project that is fully set up for platformIO at https://github.com/PockyBum522/esp32-touchscreen-home-assistant-panel It is fully functional on an ESP32-S3-Touch-LCD-7 v1.1 EXCEPT for vertical screen shifting during LVGL animations. I attempted to install the ESP32 board version 3.0.2 in the Arduino IDE per the "How to use" section in the readme of branch main of this repo, (copying the 3.0.2 high_perf files and overwriting some of the files I used the Arduino IDE to download.) Unfortunately, the first errors I get are several instances of: "unrecognized command line option '-std=gnu++2b'; did you mean '-std=gnu++2a'" When attempting to use the modified 3.0.2 files, I specified the path to the modified copy under platform_packages = Which worked well for specifying what packages to use. Note that although that project will complain about not being able to connect to MQTT if you run it, it still displays the LVGL buttons I made for testing fine even with that occurring. The vertical screen shifting happens every few presses of the buttons, during the LVGL animation phase. |
Hi @PockyBum522, If I understand correctly, you’ve successfully replaced the Arduino SDK on PlatformIO. Thank you very much for sharing! Your current issue is that you’re still experiencing shifting problems, correct? If that’s the case, there are two areas you can optimize. You can try the following steps in order:
// Original
#define LVGL_PORT_TASK_CORE (-1)
// After
#include <Arduino.h>
...
#define LVGL_PORT_TASK_CORE (ARDUINO_RUNNING_CORE)
|
EDIT: Ignore this comment, see comments further down in this thread. Original comment: I have indeed modified the Arduino SDK in platformio, however, my problem is that it is not building, so I cannot test whether the screen tearing is happening or not. Here is an example of the log when I try to build a minimal version of my code (That does build fine when I'm not attempting to use the modified arduino SDK)
I believe this is due to platformio using the: toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5 (which I believe is an old version of the toolchain.) If you can confirm that the errors I'm getting about -std=gnu++2b arguments are likely due to using the 8.4.0 version of that toolchain, then I'll work on figuring out how to tell platformIO to use a newer version of that toolchain. |
@Lzw655 Just a heads up, I tried only your modifications in your last comment (without the modified Arduino SDK files) and the screen shifting is at least severely improved. I'm going to test more and let you know, but that might fix it entirely for me. I didn't even change the bounce buffer yet, just the core it was running on per your instructions, and it's looking great. I don't know if it's stock, but my bounce buffer is: #define LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 10) |
Modified setting per Lzw655's instructions at: esp-arduino-libs/arduino-esp32-sdk#1
@Lzw655 I've been sitting here for the last 10 minutes pressing the LVGL buttons on the touchscreen and watching them do their animation for about as long with no screen shifting whatsoever. I'll let you know if I ever see an issue, but just modifying what core the LVGL loop is running on appears to fix it for me on an ESP32-S3-Touch-LCD-7 v1.1 Thank you so much! @vicelikedust please try out this branch: I'm using CLion, but you should be able to just copy everything in src/ over to a new platformIO project, and then modify your platformio.ini to match the one in that project. If you're using the ESP32-S3-Touch-LCD-7 v1.1 then copy what's in boards/ also, if you're not then you'll have to integrate all the correct settings for your board. If that's the case, you may have an easier time just attempting to change your platformio.ini to match mine and doing nothing else other than changing what core the LVGL loop is on per this comment: #1 (comment) (And you'll have to use your original board = in platformio.ini, since the one mine is set to relies on the json file in boards/) EDIT: Ignore this, see below comments for updated info. I did end up having to change the bounce buffer to * 20 Let me know how it goes. |
I went ahead and reintegrated my MQTT and OTA handlers, and it looks like when there's significant blocking processing in loop(), it still shifts the screen vertically, but when there isn't, it works. I'm going to see if I can make the mqtt handler fire less than every loop and see if that helps. However, it still looks solid if there's little processing going on in loop. Will keep you both updated. |
Setting #define LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 20) per your instructions along with the changes I outlined above seems to work, and I'm not running out of ram. I believe I am set for what I need this touchscreen to do! Thank you very much for your help. @vicelikedust I updated the bounce buffer size in my minimal-lvgl-for-testing branch, so you should still be able to pull it down and just modify things to your board/environment and have it work. Start with nothing in loop() and make sure things work, then slowly add back in blocking work to loop() and you should be set assuming you're not doing an extreme amount of processing. |
Hi @PockyBum522, I’m glad I could help, and I really appreciate your feedback. To make it easier for you to understand, I can explain the cause of screen tearing on RGB LCDs. The root cause is that the ESP's RGB peripheral is unable to send out data in real-time according to the timing sequence. The direct reasons for this usually include two points:
As you mentioned, when performing OTA or MQTT operations, these operations will invoke WiFi or Flash interfaces, and the SDK with default configurations will disable the Cache. Since PSRAM needs to be accessed through the Cache, this leads to PSRAM being inaccessible (first point), resulting in screen tearing. Therefore, in this case, it is recommended to use the high-performance version of this library, which enables the 'XIP on PSRAM' feature, ensuring that the Cache is not disabled when operating Flash. Additionally, the 'RGB Bounce Buffer' feature is used because the efficiency of DMA with SRAM is much higher than with PSRAM. By using the Bounce Buffer located in SRAM, DMA's data bandwidth can be significantly improved (second point). |
i started working on a similar project 6 months ago and left it for lack of resources i have a simple hello world code to display as soon as i added wifi screen started shifting/ flickering @PockyBum522 can you please quickly describe to me how you added the new SDK esp32-3.0.2-h ( high_perf) to platformio and maybe how to enable DMA ?
|
@xXhoobaXx have a read through my last 4 comments in this thread. Basically it boils down to:
You may find my repo useful, particularly this branch: That branch is meant as a getting started and has the two modifications that I mention in point #2 in this comment. It may help you to get up and running with the LCD. If you're not using the 7 inch Waveshare, you'll of course still have to plug in the correct settings for your particular LCD. I would start with very little in your loop() and slowly add things. You may find it usable in platformio without worrying about the high_perf Arduino SDK. |
Thank you @PockyBum522 , I did read through everything but I might have misunderstood it Anyway that's what I am planning to do to start from hello world and build it up bit by bit I am not using lvgl library yet And I would like to try to make it work on platform io Now that I wrote this I think I might not need PanelLan library after all if I am switching to lvgl I still would like to know more about DMA |
Using all your input here I think I have got PIO to work with the high_perf modification. What I did was use Arduino IDE to download v3.0.2 and then modified it as per the instructions of this repo. It worked on the Waveshare 7" LCD. Now I used this in my PIO platform.ini:
With the pioarduino version of the v3.0.2 I got toolchain v12 and it looks like it is accepting everything.
@PockyBum522, I used the stock files from the waveshare wiki for the LCD with no modifications. I have not run tests with anything fancy in the loop() except for below but I think it is prommising that PIO is compiling with the high_perf modification anyway.
|
How would this integrate with Platformio?
I have tried utilizing the framework but I consistently encounter compilation errors. While I have been able to alleviate some of these errors by reorganizing files, the issues persist.
The text was updated successfully, but these errors were encountered: