cleanup
parent
800869979f
commit
ccf7fc3068
|
@ -189,7 +189,7 @@ void tsInit(const TouchscreenDriver *ts) {
|
||||||
coord_t tsReadX(void) {
|
coord_t tsReadX(void) {
|
||||||
coord_t x, y;
|
coord_t x, y;
|
||||||
|
|
||||||
#if TOUCHSCREEN_XY_INVERTED == TRUE
|
#if TOUCHSCREEN_XY_INVERTED
|
||||||
x = _tsReadRealY();
|
x = _tsReadRealY();
|
||||||
y = _tsReadRealX();
|
y = _tsReadRealX();
|
||||||
#else
|
#else
|
||||||
|
@ -223,7 +223,7 @@ coord_t tsReadX(void) {
|
||||||
coord_t tsReadY(void) {
|
coord_t tsReadY(void) {
|
||||||
coord_t x, y;
|
coord_t x, y;
|
||||||
|
|
||||||
#if TOUCHSCREEN_XY_INVERTED == TRUE
|
#if TOUCHSCREEN_XY_INVERTED
|
||||||
x = _tsReadRealY();
|
x = _tsReadRealY();
|
||||||
y = _tsReadRealX();
|
y = _tsReadRealX();
|
||||||
#else
|
#else
|
||||||
|
@ -320,19 +320,18 @@ calibrate:
|
||||||
/* Take a little more samples per point and their average
|
/* Take a little more samples per point and their average
|
||||||
* for precise calibration */
|
* for precise calibration */
|
||||||
px = py = 0;
|
px = py = 0;
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
while(j < MAX_CAL_SAMPLES) {
|
|
||||||
if(tsPressed()) {
|
|
||||||
/* We have valid pointer data */
|
|
||||||
|
|
||||||
#if TOUCHSCREEN_XY_INVERTED == TRUE
|
while(j < MAX_CAL_SAMPLES) {
|
||||||
|
if(tsPressed()) { /* We have valid pointer data */
|
||||||
|
#if TOUCHSCREEN_XY_INVERTED
|
||||||
py += _tsReadRealX();
|
py += _tsReadRealX();
|
||||||
px += _tsReadRealY();
|
px += _tsReadRealY();
|
||||||
#else
|
#else
|
||||||
px += _tsReadRealX();
|
px += _tsReadRealX();
|
||||||
py += _tsReadRealY();
|
py += _tsReadRealY();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,7 +350,7 @@ calibrate:
|
||||||
/* Apply 3 point calibration algorithm */
|
/* Apply 3 point calibration algorithm */
|
||||||
_tsDo3PointCalibration(cross, points, cal);
|
_tsDo3PointCalibration(cross, points, cal);
|
||||||
|
|
||||||
#if TOUCHSCREEN_VERIFY_CALIBRATION
|
#if TOUCHSCREEN_VERIFY_CALIBRATION
|
||||||
/* Verification of correctness of calibration (optional) :
|
/* Verification of correctness of calibration (optional) :
|
||||||
* See if the 4th point (Middle of the screen) coincides with the calibrated
|
* See if the 4th point (Middle of the screen) coincides with the calibrated
|
||||||
* result. If point is with +/- 2 pixel margin, then successful calibration
|
* result. If point is with +/- 2 pixel margin, then successful calibration
|
||||||
|
@ -367,7 +366,7 @@ calibrate:
|
||||||
|
|
||||||
if(px > 4)
|
if(px > 4)
|
||||||
goto calibrate;
|
goto calibrate;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If enabled, serialize the calibration values for storage */
|
/* If enabled, serialize the calibration values for storage */
|
||||||
#if TOUCHSCREEN_STORE_CALIBRATION
|
#if TOUCHSCREEN_STORE_CALIBRATION
|
||||||
|
|
Loading…
Reference in New Issue