A keypad to retrieve a single key and then disipears

Revision:
1:b91bd75a5ab8
Parent:
0:85ae7121f6d6
diff -r 85ae7121f6d6 -r b91bd75a5ab8 F7_TSKeypad_SingleKey.cpp
--- a/F7_TSKeypad_SingleKey.cpp	Tue Jun 06 13:58:55 2017 +0000
+++ b/F7_TSKeypad_SingleKey.cpp	Tue Jun 20 12:01:11 2017 +0000
@@ -7,6 +7,7 @@
 {
     btnsize = 50;
     state = 0;
+    key = 0;
     
     status = ts.Init(lcd.GetXSize(), lcd.GetYSize());
     if (status != TS_OK) 
@@ -201,6 +202,7 @@
                         {   
                             state = 15;
                             correcttouch = 1;
+                            key = button;
                             a = 3;
                             b = 3;
                         }
@@ -214,14 +216,14 @@
             }break;
             case 15:
             {  
-                if(correcttouch == 1)
+                if(button == key && button != 0)
                 {     
                     if(TS_State.touchDetected== 0)
                     {  
                         state = 20;                
                     }                    
                 }
-                else if(correcttouch == 0 && button == 0)
+                else if(button != key || button == 0)
                 {   
                     state = 30;
                 } 
@@ -373,7 +375,9 @@
                     recv = 0;
                     correcttouch = 0;
                     state = 0;
-                }                
+                }      
+                
+                key = 0;          
     
             }break; 
             case 30: