File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -117,8 +117,12 @@ bool touchDisable() {
117117  if  (!enabled ) {  // Already disabled 
118118    return  true;
119119  }
120-   if  (!running  &&  (touch_sensor_disable (touch_sensor_handle ) !=  ESP_OK )) {
121-     log_e ("Touch sensor still running or disable failed!" );
120+   if  (running ) {
121+     log_e ("Touch sensor still running!" );
122+     return  false;
123+   }
124+   if  (touch_sensor_disable (touch_sensor_handle ) !=  ESP_OK ) {
125+     log_e ("Touch sensor disable failed!" );
122126    return  false;
123127  }
124128  enabled  =  false;
@@ -129,8 +133,12 @@ bool touchStart() {
129133  if  (running ) {  // Already running 
130134    return  true;
131135  }
132-   if  (!enabled  &&  (touch_sensor_start_continuous_scanning (touch_sensor_handle ) !=  ESP_OK )) {
133-     log_e ("Touch sensor not enabled or failed to start continuous scanning failed!" );
136+   if  (!enabled ) {
137+     log_e ("Touch sensor not enabled!" );
138+     return  false;
139+   }
140+   if  (touch_sensor_start_continuous_scanning (touch_sensor_handle ) !=  ESP_OK ) {
141+     log_e ("Touch sensor failed to start continuous scanning!" );
134142    return  false;
135143  }
136144  running  =  true;
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments