Skip to content

Commit

Permalink
Touch fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Nov 23, 2023
1 parent ded942a commit 53991fb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft_io/touch_calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void TouchCalibration::validate_calibration() {
}
}

bool TouchCalibration::handleTouch(const xy_int_t &point) {
bool TouchCalibration::handleTouch(const xy_uint_t &point) {
const millis_t now = millis();
if (next_touch_update_ms && PENDING(now, next_touch_update_ms)) return false;
next_touch_update_ms = now + BUTTON_DELAY_MENU;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft_io/touch_calibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class TouchCalibration {
return !need_calibration();
}

static bool handleTouch(const xy_int_t &point);
static bool handleTouch(const xy_uint_t &point);
};

extern TouchCalibration touch_calibration;
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/lcd/touch/touch_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ uint8_t TouchButtons::read_buttons() {
no_touch = true;
return 0;
}
x = int16_t((int32_t(x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X;
y = int16_t((int32_t(y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y;
#else
x = uint16_t((uint32_t(x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X;
y = uint16_t((uint32_t(y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y;
#endif
x = uint16_t((uint32_t(x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X;
y = uint16_t((uint32_t(y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y;

#elif ENABLED(TFT_TOUCH_DEVICE_GT911)

Expand Down

0 comments on commit 53991fb

Please sign in to comment.