-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Adjust default touch calibration for Core2 #469
Conversation
p->touch(t) call invokes Panel_Device::touchCalibrate and results in setting up the affine matrix to map the touch geometry into the panel one. This is not preferable as the touch geometry contains the virtual screen panel area outside the panel area. This patch changes the order to call setCalibrateAffine with dedicated parameters for Core2 to overwrite the default unexpected matrix.
hi, thanks for your contribution 👍 I'm not sure I understand the changes (didn't observe any anomaly before) how can I reproduce the issue this PR addresses? [edit] changed the target branch |
Hi, I will prepare an example project with that you can reproduce the issue. |
https://github.com/toyoshim/LovyanGFXTest/blob/main/src/main.cc |
after doing some research it appears changing the calibration sequence order will impact existing projects relying on the current behaviour
this is by design, getTouch() and getTouchRaw() are supposed to behave differently, the former is constrained to the lcd area while the latter is constrained to the touch area supporting the touch zone outside the lcd area with M5Core2 can be done as follows: int TOUCH_MAX_POINTS = 2;
lgfx::touch_point_t touch_raw[TOUCH_MAX_POINTS];
int count = tft.getTouchRaw(touch_raw, TOUCH_MAX_POINTS);
while (--count >= 0) {
if( touch_raw[count].y > tft.height() ) {
// (raw.x, raw.y) touch point is in the M5Core2 buttons area
Serial.printf("[%3d:%-3d]\n", touch_raw[count].x, touch_raw[count].y );
}
} |
getTouch() returns adjusted points per the calibrated or restoed affine matrix, and getTouchRaw() returns the original point. https://twitter.com/lovyan03/status/1721701020118695948 Also, sorry. The thread linked above was in Japanese. I can translate it if machine translation doesn't work well for the thread. |
interesting, somehow I believed that getTouch returned a constrained value rather than a scaled value, so this means that any UI code relying on the assumption that touch height == display height is wrong ? |
yeah, actual behavior is returning a scaled value rather than saturated/constrained value, i.e. |
Hi, is there anything I can do here to move the discussion forward? |
let's keep this PR opens until @lovyan03 gives the final word |
ok, sounds good. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
bump |
Sorry for the long wait, and thank you for submitting this pull request...! |
p->touch(t) call invokes Panel_Device::touchCalibrate and results in setting up the affine matrix to map the touch geometry into the panel one. This is not preferable as the touch geometry contains the virtual screen panel area outside the panel area.
This patch changes the order to call setCalibrateAffine with dedicated parameters for Core2 to overwrite the default unexpected matrix.