-
-
Notifications
You must be signed in to change notification settings - Fork 19.5k
Improve XPT2046 touch handling and calibration UI #27892
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
Improve XPT2046 touch handling and calibration UI #27892
Conversation
- Update LVGL library to version 6.1.2 - Fix image rendering issues (lvgl/lvgl#8166) - Implement hash table for faster image lookup and rendering - Optimize SPI flash operations by removing redundant initializations - Improve memory management with adjusted buffer sizes - Enhance drawing routines with configurable parameters - Add image cache invalidation for better UI consistency - Optimize flash memory usage for improved performance
- Implement XPT2046 datasheet recommendations for PENIRQ handling - Modify differential mode based on touch interrupt pin availability - Fix touch calibration UI issues and improve screen transitions - Adjust return button position for better user experience
3791e7d
to
6ea4a16
Compare
37ad06f
to
ed48888
Compare
@@ -86,7 +86,7 @@ void lv_update_touch_calibration_screen() { | |||
// end calibration | |||
str = stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED); | |||
touch_calibration.calibration_end(); | |||
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_TC_RETURN); | |||
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, 180, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_TC_RETURN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this button unique or following a similar layout to others? Can its size / position be expressed in terms of (updated names) BTN_SIZE_X
and INTERVAL_W
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The position of this return button on the calibration interface is slightly different from that of other interfaces. If it is the same, it will overlap with the calibration coordinates. The name of its location can be represented by a separate macro.
@@ -46,7 +46,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { | |||
|
|||
void lv_draw_about() { | |||
scr = lv_screen_create(ABOUT_UI); | |||
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN); | |||
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_SIZE_X * 3 + INTERVAL_W * 4, BTN_SIZE_Y + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming INTERVAL_V
=> INTERVAL_W
because X goes with Width (or Horizontal), Y goes with Height (or Vertical). So either these bitmaps are rotated 90° with X being vertical and Y being horizontal, or these defines are name-swapped.
#define BTN_Y_PIXEL 140 // TFT_screen.btn_y_pixel | ||
#define INTERVAL_W 2 // TFT_screen.gap_v // 2 | ||
#define BTN_SIZE_X 117 // TFT_screen.btn_x_pixel | ||
#define BTN_SIZE_Y 140 // TFT_screen.btn_y_pixel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume that PIXEL
refers to pixel-size, because these defines are used in multiplication.
If you concur with my renaming of some defines, I can merge those separately ahead of this. |
Description
This PR addresses two related areas of the touch interface:
XPT2046 Touch Controller Enhancement:
Implements a recommendation from the XPT2046 datasheet which states:
The implementation modifies the XPT2046 differential mode setting based on whether a dedicated touch interrupt pin is defined. When no such pin exists, it uses mode 0x01, which helps prevent false interrupt triggering.
Touch Calibration UI Improvements:
Testing confirms these changes significantly improve the touch experience, particularly on hardware configurations without a dedicated touch interrupt pin.
Requirements
Benefits
Configurations
The changes automatically adapt based on the existing pin configuration and require no special configuration to test.
Related Issues