Driver Library with inverted screen and increased SPI speed (16MHz). You need to use this library with the sx1280
Dependents: MSNV2-Terminal_V1-6 SX1280DevKit SX126xDevKit SX126xDevKit ... more
Fork of DmTftLibrary by
Diff: DmTouchCalibration.cpp
- Revision:
- 9:bac5439e3c1c
- Parent:
- 7:6cd8c36cbdb3
- Child:
- 11:264e19992620
--- a/DmTouchCalibration.cpp Mon Jul 07 10:38:09 2014 +0000 +++ b/DmTouchCalibration.cpp Mon Jul 07 13:30:33 2014 +0000 @@ -92,16 +92,20 @@ bool DmTouchCalibration::getRawTouch(uint16_t& x, uint16_t& y) const { bool touched = false; - bool hasAllSamples = false; + bool haveAllSamples = false; while(!touched) { if (_touch->isTouched()) { //Serial.println("is touched"); - hasAllSamples = _touch->getMiddleXY(x, y); - touched = true; + haveAllSamples = _touch->getMiddleXY(x, y); + + // As many samples are take during calibration it is important to + // make sure that the screen is still touched. If the user has let + // go already then the gathered samples are not good enough. + touched = haveAllSamples && _touch->isTouched(); } } - return hasAllSamples; + return haveAllSamples; } void DmTouchCalibration::drawCalibPoint(uint16_t x, uint16_t y) const {