Skip to content

Commit

Permalink
clean up, fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Sep 23, 2021
1 parent 49b9451 commit b76b384
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 35 deletions.
39 changes: 4 additions & 35 deletions Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,54 +285,23 @@ 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 (touched) {
#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;
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

0 comments on commit b76b384

Please sign in to comment.