2021-10-30 01:06 AM
TouchCalibration tsCalibration; // TouchGFX 4.17
MATRIX matrix ; // Carlos E. Vidales
touchgfx::Point lcdCalibPoints[3] = {
{ 0, 0},
{ 0, 240 - 1},
{320 - 1, 240 - 1}
};
touchgfx::Point tsCalibPoints[3] = {
{ 0, 0},
{ 0, 240 - 1},
{320 - 1, 240 - 1}
};
void STM32TouchController::init() {
tsCalibration.setCalibrationMatrix(lcdCalibPoints, tsCalibPoints);
setCalibrationMatrix((POINT *)lcdCalibPoints, (POINT *)tsCalibPoints, &matrix );
}
bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y) {
POINT display, screen ;
touchgfx::Point tsPos;
x = tsCalibPoints[0].x;
y = tsCalibPoints[0].y;
tsPos.x = x;
tsPos.y = y;
screen.x = x;
screen.y = y;
tsCalibration.translatePoint(tsPos);
getDisplayPoint(&display, &screen, &matrix);
// Here tsPos.x == -1, tsPos.y == -2. x and y should be 0 ??
// display.x == 0, display.y == 0
x = tsCalibPoints[2].x;
y = tsCalibPoints[2].y;
tsPos.x = x;
tsPos.y = y;
screen.x = x;
screen.y = y;
tsCalibration.translatePoint(tsPos);
getDisplayPoint(&display, &screen, &matrix);
// Here tsPos.x == 318, tsPos.y == 237. x should be 319 and y should be 239 ??
// display.x == 319, display.y == 239
return false;
}
2021-10-30 04:54 AM
Additional info:
tsCalibration.matrix.An == matrix.An
tsCalibration.matrix.Bn == matrix.Bn
tsCalibration.matrix.Cn == matrix.Cn
tsCalibration.matrix.Dn == matrix.Dn
tsCalibration.matrix.En == matrix.En
tsCalibration.matrix.Fn == matrix.Fn
tsCalibration.matrix.Divider == matrix.Divider
tsCalibration.matrix.clzuAn no such field in matrix
tsCalibration.matrix.clzuBn no such field in matrix
tsCalibration.matrix.clzuDn no such field in matrix
tsCalibration.matrix.clzuEn no such field in matrix