Skip to content
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

Modify LVGL touch driver #22817

Merged
merged 24 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
aa595f5
Merge pull request #1 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 11, 2020
d5d325c
Merge pull request #2 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 13, 2020
d8d5c0f
Merge pull request #4 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 14, 2020
a1055dd
Merge pull request #6 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 18, 2020
8b349b1
Merge pull request #7 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 22, 2020
8c42e50
Merge pull request #14 from MarlinFirmware/bugfix-2.0.x
makerbase-mks Jun 27, 2020
626ed70
Merge pull request #15 from MarlinFirmware/bugfix-2.0.x
makerbase-mks Jul 1, 2020
80a2552
Merge pull request #16 from MarlinFirmware/bugfix-2.0.x
MKS-Sean Jul 2, 2020
8386fdf
Merge pull request #54 from MarlinFirmware/bugfix-2.0.x
MKS-Sean Jun 11, 2021
3034d86
mks robin nano v3 add function of wifi
MKS-Sean Jun 11, 2021
8975478
Update irq_overrid.cpp
thinkyhead Jun 11, 2021
5708db5
Fix the header file path
MKS-Sean Jun 12, 2021
321a2fa
Update printer_operation.cpp
thinkyhead Jun 13, 2021
523f2db
split up wifiserial
thinkyhead Jun 13, 2021
f86189c
updata
solawc Jul 21, 2021
f2d1f15
Merge pull request #61 from MarlinFirmware/bugfix-2.0.x
solawc Jul 21, 2021
98bdb52
Merge pull request #63 from MarlinFirmware/bugfix-2.0.x
solawc Sep 10, 2021
976abe9
change lvgl lcd disp driver
solawc Sep 10, 2021
5a8c30b
fix and add
solawc Sep 16, 2021
88646c2
misc. cleanup
thinkyhead Sep 16, 2021
46c0e0a
MKS UI cosmetic changes
thinkyhead Sep 16, 2021
09daeb7
Merge pull request #64 from MarlinFirmware/bugfix-2.0.x
solawc Sep 22, 2021
49b9451
Modify LVGL touch driver
solawc Sep 22, 2021
e7a20ab
clean up, fix typos
thinkyhead Sep 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 18 additions & 28 deletions Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,7 @@ unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
}

static bool get_point(int16_t *x, int16_t *y) {
bool is_touched = touch.getRawPoint(x, y);

if (!is_touched) return false;
if (!touch.getRawPoint(x, y)) return false;

#if ENABLED(TOUCH_SCREEN_CALIBRATION)
const calibrationState state = touch_calibration.get_calibration_state();
Expand All @@ -286,34 +284,26 @@ static bool get_point(int16_t *x, int16_t *y) {

bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) {
static int16_t last_x = 0, last_y = 0;
static uint8_t last_touch_state = LV_INDEV_STATE_REL;
static int32_t touch_time1 = 0;
uint32_t tmpTime, diffTime = 0;

tmpTime = millis();
diffTime = getTickDiff(tmpTime, touch_time1);
if (diffTime > 20) {
if (get_point(&last_x, &last_y)) {

if (last_touch_state == LV_INDEV_STATE_PR) return false;
data->state = LV_INDEV_STATE_PR;

// Set the coordinates (if released use the last-pressed coordinates)
if (get_point(&last_x, &last_y)) {
#if TFT_ROTATION == TFT_ROTATE_180
data->point.x = TFT_WIDTH - last_x;
data->point.y = TFT_HEIGHT - last_y;
#else
data->point.x = last_x;
data->point.y = last_y;

last_x = last_y = 0;
last_touch_state = LV_INDEV_STATE_PR;
}
else {
if (last_touch_state == LV_INDEV_STATE_PR)
data->state = LV_INDEV_STATE_REL;
last_touch_state = LV_INDEV_STATE_REL;
}

touch_time1 = tmpTime;
#endif
data->state = LV_INDEV_STATE_PR;
}
else {
#if TFT_ROTATION == TFT_ROTATE_180
data->point.x = TFT_WIDTH - last_x;
data->point.y = TFT_HEIGHT - last_y;
#else
data->point.x = last_x;
data->point.y = last_y;
#endif
data->state = LV_INDEV_STATE_REL;
}

return false; // Return `false` since no data is buffering or left to read
}

Expand Down
1 change: 1 addition & 0 deletions buildroot/tests/mks_robin_maple
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ exec_test $1 $2 "MKS Robin config (FSMC Color UI)" "$3"
use_example_configs Mks/Robin
opt_disable TFT_CLASSIC_UI TFT_COLOR_UI TOUCH_SCREEN TFT_RES_320x240
opt_enable TFT_LVGL_UI TFT_RES_480x320
opt_set TFT_ROTATION TFT_ROTATE_180
exec_test $1 $2 "MKS Robin nano v1.2 LVGL FSMC" "$3"

# cleanup
Expand Down