In chapter 2.2 “Creating a Button with Events” there are a few errors, due to which the published sketch doesn’t work (at least not on my CYD). I’ve described the problem – and the solution – in detail in this document: https://drive.google.com/file/d/1-IW4Uwl_bA2k_kA8upkVc76PjYsPQbEN/view?usp=sharing.
The short version: the Width and Height of the screen are #defined for a portrait orientation, while the sketch is intended for a landscape orientation. Moreover, the functions touchscreen.setRotation(2) and lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_270) have contradicting parameters: value 2 is for portrait, while value LV_DISPLAY_ROTATION_270 = 3 is for landscape.
Finally the function lv_display_set_rotation() doesn’t work. When I replace this function with its TFT_eSPI equivalent tft.setRotation(), then I get what I expect. I’ve read somewhere that there may be issues related to rotating “in hardware” vs rotating using LVGL. Maybe that’s the case here?
Hi.
Thanks for letting me know.
Can you tell me the version of the TFT_eSPI and LVGL libraries that you’re using?
Also, tell me the version of the ESP32 boards you have installed.
regards,
Sara
Sara,
version information is in the doc which I posted on Google Drive. I believen Thatcher ESP IDF is Version 5, but I need to check.
Gilbert.
Board selected: ESP32-2432S028R CYD, partition schem: HUGE APP
Arduino ESP32 IDF board package: 3.0.7
Arduino ESP IDF version: v5.1.4-972-g632e0c2a9f-dirty
This is what the compiler reports:
FQBN: esp32:esp32:jczn_2432s028r:PartitionScheme=huge_app
Using board ‘jczn_2432s028r’ from platform in folder: C:\Users\Gilbert\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7
Using core ‘esp32’ from platform in folder: C:\Users\Gilbert\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7
Saudações,
Gilbert
Thanks for letting me know.
I tested our codes and they work as expected for us. I believe you might have a slightly different version of the display.
But, your explanation makes much more sense.
Can you share your complete code with the changes so that I can test it on my display?
Regards,
Sara
Wow – the sketch as published in the book works out of the box? Amazing – despite the fact that conflicting orientation settings are used for touchscreen and display?
I can’t check if my display controller is really ILI9341 because the controller chip is sandwiched between the display and the PCB. The shop on AliExpress (Sunton Store) doesn’t provide those details. The shop site provides a link to the manufacturer’s site (http://pan.jczn1688.com/directlink/1/ESP32%20module/2.8inch_ESP32-2432S028R.rar), but you never know if the board is really coming from there. You’ll get a warning that the site is not safe because it uses http, but you can ignore that.
In the manufacturer’s documentation it is mentioned that the controller is ILI9341. Other than orientation I have not (yet) encountered issues which suggest that something is wrong with the display. The manufacturer’s doc also contains the schematics. Looks pretty straightforward to me.
I’ll clean up the code and post it asap.
Regards,
Gilbert
Yes.
After a library update, that was the only way I could get my CYD to properly display the orientation I wanted. We tried many different combinations.
Thanks, then share it with us so that I can also test it.
Regards,
Sara