Fixed bug in touch sensor logic that would cause failure to compile under 2.0.0-2.0.2
Verified that Unit Test compiles under all version 2.0.0 through 2.0.5 and works on 2.0.0 as well as 2.0.5
This commit is contained in:
parent
078ffa35ed
commit
f8be2847bd
|
|
@ -222,6 +222,4 @@ void PushButton::reset(){
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
||||||
#if SOC_TOUCH_SENSOR_NUM > 0
|
touch_value_t PushButton::threshold=0;
|
||||||
touch_value_t PushButton::threshold=0;
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
18
src/Utils.h
18
src/Utils.h
|
|
@ -71,6 +71,12 @@ struct TempBuffer {
|
||||||
// PushButton //
|
// PushButton //
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
#if SOC_TOUCH_VERSION_2
|
||||||
|
typedef uint32_t touch_value_t;
|
||||||
|
#else
|
||||||
|
typedef uint16_t touch_value_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
class PushButton{
|
class PushButton{
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
|
|
@ -79,11 +85,9 @@ class PushButton{
|
||||||
uint32_t doubleAlarm;
|
uint32_t doubleAlarm;
|
||||||
uint32_t longAlarm;
|
uint32_t longAlarm;
|
||||||
int pressType;
|
int pressType;
|
||||||
|
|
||||||
#if SOC_TOUCH_SENSOR_NUM > 0
|
|
||||||
static touch_value_t threshold;
|
static touch_value_t threshold;
|
||||||
static const int calibCount=20;
|
static const int calibCount=20;
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
@ -103,10 +107,12 @@ class PushButton{
|
||||||
static boolean TRIGGER_ON_LOW(int pin){return(!digitalRead(pin));}
|
static boolean TRIGGER_ON_LOW(int pin){return(!digitalRead(pin));}
|
||||||
static boolean TRIGGER_ON_HIGH(int pin){return(digitalRead(pin));}
|
static boolean TRIGGER_ON_HIGH(int pin){return(digitalRead(pin));}
|
||||||
|
|
||||||
#if SOC_TOUCH_VERSION_1 // ESP32
|
#if SOC_TOUCH_SENSOR_NUM > 0
|
||||||
static boolean TRIGGER_ON_TOUCH(int pin){return(touchRead(pin)<threshold);}
|
#if SOC_TOUCH_VERSION_2
|
||||||
#elif SOC_TOUCH_VERSION_2 // ESP32S2 ESP32S3
|
|
||||||
static boolean TRIGGER_ON_TOUCH(int pin){return(touchRead(pin)>threshold);}
|
static boolean TRIGGER_ON_TOUCH(int pin){return(touchRead(pin)>threshold);}
|
||||||
|
#else
|
||||||
|
static boolean TRIGGER_ON_TOUCH(int pin){return(touchRead(pin)<threshold);}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PushButton(int pin, triggerType_t triggerType=TRIGGER_ON_LOW);
|
PushButton(int pin, triggerType_t triggerType=TRIGGER_ON_LOW);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue