From e7a20abd549b0d78db14fe6ecef1e9cb34f9c7b1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 23 Sep 2021 01:51:20 -0500 Subject: [PATCH] clean up, fix typos --- .../extui/mks_ui/tft_lvgl_configuration.cpp | 45 +++---------------- buildroot/tests/mks_robin_maple | 1 + 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index 0da6fb47c1bd..837d7470d600 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -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(); @@ -285,54 +283,21 @@ 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) - // 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; - // } - - bool touched = get_point(&last_x, &last_y); - - if(touched != false) { - + 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; + data->point.y = TFT_HEIGHT - last_y; #else data->point.x = last_x; data->point.y = last_y; #endif data->state = LV_INDEV_STATE_PR; } - else{ + else { #if TFT_ROTATION == TFT_ROTATE_180 data->point.x = TFT_WIDTH - last_x; - data->point.y = TFT_ HEIGHT -last_y; + data->point.y = TFT_HEIGHT - last_y; #else data->point.x = last_x; data->point.y = last_y; diff --git a/buildroot/tests/mks_robin_maple b/buildroot/tests/mks_robin_maple index fcb51183076e..ab4e6d71188b 100755 --- a/buildroot/tests/mks_robin_maple +++ b/buildroot/tests/mks_robin_maple @@ -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