@@ -129,7 +129,7 @@ bool touchStart() {
129129 if (running ) { // Already running
130130 return true;
131131 }
132- if (enabled && (touch_sensor_start_continuous_scanning (touch_sensor_handle ) != ESP_OK )) {
132+ if (! enabled && (touch_sensor_start_continuous_scanning (touch_sensor_handle ) != ESP_OK )) {
133133 log_e ("Touch sensor not enabled or failed to start continuous scanning failed!" );
134134 return false;
135135 }
@@ -395,7 +395,7 @@ static void __touchConfigInterrupt(uint8_t pin, void (*userFunc)(void), void *Ar
395395 return ;
396396 }
397397
398- touch_channel_config_t chan_cfg = {} ;
398+ touch_channel_config_t chan_cfg = TOUCH_CHANNEL_DEFAULT_CONFIG () ;
399399 for (int i = 0 ; i < _sample_num ; i ++ ) {
400400#if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
401401 chan_cfg .abs_active_thresh [i ] = threshold ;
@@ -416,17 +416,17 @@ static void __touchConfigInterrupt(uint8_t pin, void (*userFunc)(void), void *Ar
416416
417417// it keeps backwards compatibility
418418static void __touchAttachInterrupt (uint8_t pin , void (* userFunc )(void ), touch_value_t threshold ) {
419- __touchConfigInterrupt (pin , userFunc , NULL , threshold , false );
419+ __touchConfigInterrupt (pin , userFunc , NULL , false, threshold );
420420}
421421
422422// new additional version of the API with User Args
423423static void __touchAttachArgsInterrupt (uint8_t pin , void (* userFunc )(void ), void * args , touch_value_t threshold ) {
424- __touchConfigInterrupt (pin , userFunc , args , threshold , true );
424+ __touchConfigInterrupt (pin , userFunc , args , true, threshold );
425425}
426426
427427// new additional API to detach touch ISR
428428static void __touchDettachInterrupt (uint8_t pin ) {
429- __touchConfigInterrupt (pin , NULL , NULL , 0 , false ); // userFunc as NULL acts as detaching
429+ __touchConfigInterrupt (pin , NULL , NULL , false, 0 ); // userFunc as NULL acts as detaching
430430}
431431
432432// /*
0 commit comments