Skip to content

Commit

Permalink
Merge pull request #78 from ncmreynolds/main
Browse files Browse the repository at this point in the history
Conditional touch features, fixes #74
  • Loading branch information
evert-arias authored Apr 26, 2023
2 parents 4e81841 + f118f0e commit a00856a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/EasyButtonTouch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#if defined(ESP32)
#include "EasyButtonTouch.h"
#if defined(SOC_TOUCH_SENSOR_SUPPORTED) || (defined(SOC_TOUCH_SENSOR_NUM) && SOC_TOUCH_SENSOR_NUM > 1)

void EasyButtonTouch::setThreshold(int threshold)
{
Expand All @@ -33,5 +34,5 @@ bool EasyButtonTouch::_readPin()
ADCFilter.Filter(touchRead(_pin));
return ADCFilter.Current() < _touch_threshold;
}

#endif
#endif
4 changes: 3 additions & 1 deletion src/EasyButtonTouch.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#if !defined(_EasyButtonTouch_h) and defined(ESP32)
#define _EasyButtonTouch_h
#include <include/soc/soc_caps.h>
#if defined(SOC_TOUCH_SENSOR_SUPPORTED) || (defined(SOC_TOUCH_SENSOR_NUM) && SOC_TOUCH_SENSOR_NUM > 1)

#include <Arduino.h>
#include <Filter.h>
Expand All @@ -26,5 +28,5 @@ class EasyButtonTouch : public EasyButton

bool _readPin();
};

#endif
#endif

0 comments on commit a00856a

Please sign in to comment.