Skip to content

Problem with the orientation of the touch sensor relative to the display itself. #60

@devil2012devil

Description

@devil2012devil

Thank you so much for the project!

  1. When assembling the ESP32-DIV on a breadboard using pre-made modules, a problem arises with the incorrect operation of the display touch sensor.
    Chinese display manufacturers can install the touch sensor in any orientation, so touch inputs can be mirrored both horizontally and vertically (in my case, I press a button on the right, but the left menu item is triggered).
    The problem is easily solved by swapping the values of the variables in the Touchscreen.h file. Take the value of the TS_MIN_ variable and put it into the TS_MAX_ variable,
    and put TS_MAX_ into TS_MIN_.
    But the whole trouble is that this will only change the behavior in the main menu. It won't work in submenus because hardcoded values are used there instead of the variables.
    In my files ESP32-DIV.ino, bluetooth.cpp, subghz.cpp, utils.cpp, wifi.cpp, I changed the lines:
x = ::map(p.x, 300, 3800, 0, SCREEN_WIDTH - 1);
y = ::map(p.y, 3800, 300, 0, SCREEN_HEIGHT - 1);

to

x = ::map(p.x, TS_MINX, TS_MAXX, 0, 239);
y = ::map(p.y, TS_MAXY, TS_MINY, 0, 319);

Now, when changes are made in the Touchscreen.h file, the touch sensor orientation changes everywhere.
I suggest you make the same changes to the source code and add a note to the project description about adjusting the touch sensor orientation in this file.

  1. It also wouldn't hurt to add touch sensor calibration relative to the display. With the values 300 and 3800, touching the panel doesn't quite correspond to the information displayed on the screen.
    After some effort using DeepSeek, I created a small calibration program for this particular display instance. My results were:
#define TS_MINX 3944
#define TS_MAXX 232
#define TS_MINY 353
#define TS_MAXY 3944

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions