touch: slight improvements towards dual-touch detection

This commit is contained in:
Lephe 2025-04-12 19:57:49 +02:00
parent 416331d48b
commit 4e20f7bc5b
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -129,16 +129,36 @@ int touch_adconv_get_dots(
dots->y2 = 0; dots->y2 = 0;
dots->z2 = 0; dots->z2 = 0;
break; break;
case 2: case 2: {
dots->type = TS_DOTS_TYPE_DUAL; dots->type = TS_DOTS_TYPE_DUAL;
dots->x1 = ((adconv->x1 - x_base) * 0x100) / x_div; int xmin = ((adconv->x1 - x_base) * 0x100) / x_div;
dots->y1 = ((adconv->y1 - y_base) * 0x100) / y_div; int ymin = ((adconv->y1 - y_base) * 0x100) / y_div;
// x2 end-to-end: ~185 (changes along the height)
// y2 end-to-end: 470
// x2 *= 1.64
// y2 *= 0.96
int xmax = xmin + adconv->x2 * 0x1ba / 0x100;
int ymax = ymin + adconv->y2 * 0x11f / 0x100;
dots->z1 = adconv->z1; dots->z1 = adconv->z1;
dots->x2 = ((adconv->x2 - x_base) * 0x100) / x_div;
dots->y2 = ((adconv->y2 - y_base) * 0x100) / y_div;
dots->z2 = adconv->z2; dots->z2 = adconv->z2;
if(dots->z2 >= 0) {
dots->x1 = xmin;
dots->y1 = ymin;
dots->x2 = xmax;
dots->y2 = ymax;
}
else {
dots->x1 = xmin;
dots->y1 = ymax;
dots->x2 = xmax;
dots->y2 = ymin;
}
dots->z1 = adconv->x2;
dots->z2 = adconv->y2;
break; break;
} }
}
cpu_atomic_end(); cpu_atomic_end();
return type; return type;
} }