fix(display_drivers): store mirror x/y values and invert them in the rotation function to work with touch
Description
- Add
mirror_xandmirror_yvariables to the display drivers which are copied from the config. - Update the display drivers'
rotate()functions to additionally account for themirror_xandmirror_ysettings, similar to how they were accounting for theswap_xysetting. - Update the display drivers'
rotate()functions to flip the bits instead of or-ing them
Motivation and Context
It was found that the latest changes from #265 which added the rotate function caused lvgl to not properly match the touch location with the screen location (found in https://github.com/esp-cpp/esp-box-emu/pull/87).
This PR addresses that issue (which was tested specifically with the ST7789 used in the ESP32-S3-BOX, but which was applied similarly to the ili9341 and gc9a01 components).
How has this been tested?
- Building and running the main code within https://github.com/esp-cpp/esp-box-emu/pull/87
- Building and running the examples on the appropriate hardware:
esp-box/examplematouch-rotary-display/examplet-deck/examplet-dongle-s3/examplewrover-kit/example
Note, that while this change is principally targeting fixing the mapping of touch coordinates, not all the examples above have touchscreens - but were tested for completeness.
Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation Update
- [ ] Hardware (schematic, board, system design) change
- [x] Software change
Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have added / updated the documentation related to this change via either README or WIKI
Software
- [ ] I have added tests to cover my changes.
- [ ] I have updated the
.github/workflows/build.ymlfile to add my new test to the automated cloud build github action. - [x] All new and existing tests passed.
- [x] My code follows the code style of this project.
@abrondijk Can you test this change on your systems? I needed this for fully functioning touch input on the esp-box (for the esp-box-emu project), but I want to make sure this doesn't mess up others' projects.
:white_check_mark:Static analysis result - no issues found! :white_check_mark:
@finger563 Sure, I'll run this on our hardware either today or tomorrow!
@finger563 Appears to be working just fine and does not break any of our stuff!
@finger563 Appears to be working just fine and does not break any of our stuff!
@abrondijk that's awesome, glad to hear it! I'm working through some odd behavior on the t-deck w.r.t. the touch screen coordinates in portrait and portrait inverted mode, but once that's fixed I'll merge this :)