Modified version of the DmTftLibrary, optimized for the LPC4088 Experiment Base Board

Dependents:   lpc4088_ebb_dm_calc lpc4088_ebb_dm_bubbles

Fork of DmTftLibrary by Display Module

Revision:
9:bac5439e3c1c
Parent:
7:6cd8c36cbdb3
--- 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 {