Added check to ignore PushButton::TOUCH is compiling on ESP32-C3
The C3 does not have touch capability. Compiler will throw an error is PushButton::TOUCH is referenced when compiling for C3.
This commit is contained in:
parent
ee55f268bd
commit
dbcd9e267b
|
|
@ -712,7 +712,7 @@ class SpanButton : PushButton {
|
|||
};
|
||||
|
||||
SpanButton(int pin, uint16_t longTime=2000, uint16_t singleTime=5, uint16_t doubleTime=200, pressTest_t pressed=GROUNDED);
|
||||
SpanButton(int pin, pressTest_t pressed=GROUNDED, uint16_t longTime=2000, uint16_t singleTime=5, uint16_t doubleTime=200) : SpanButton(pin,longTime,singleTime,doubleTime,pressed){};
|
||||
SpanButton(int pin, pressTest_t pressed, uint16_t longTime=2000, uint16_t singleTime=5, uint16_t doubleTime=200) : SpanButton(pin,longTime,singleTime,doubleTime,pressed){};
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -209,8 +209,10 @@ void PushButton::reset(){
|
|||
//////////////////////////////////////
|
||||
|
||||
void PushButton::configureTouch(uint16_t measureTime, uint16_t sleepTime, uint16_t thresh){
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32C3
|
||||
touchSetCycles(measureTime,sleepTime);
|
||||
touchThreshold=thresh;
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -99,7 +99,10 @@ class PushButton{
|
|||
|
||||
static boolean GROUNDED(int pin){return(!digitalRead(pin));}
|
||||
static boolean POWERED(int pin){return(digitalRead(pin));}
|
||||
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32C3
|
||||
static boolean TOUCH(int pin){return(touchRead(pin)<touchThreshold);}
|
||||
#endif
|
||||
|
||||
PushButton(int pin, pressTest_t pressed=GROUNDED);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,6 @@ void setup() {
|
|||
|
||||
Serial.begin(115200);
|
||||
|
||||
touchSetCycles(4000,1000);
|
||||
|
||||
while(1){
|
||||
Serial.println(touchRead(4));
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
// homeSpan.setLogLevel(2);
|
||||
// homeSpan.setStatusPin(13);
|
||||
homeSpan.setControlPin(33);
|
||||
|
|
|
|||
Loading…
Reference in New Issue