Cleaned up some public/private permissioning inside PushButton and SpanButton
Ensure users can access constants like TRIGGER_ON_HIGH, TRIGGER_ON_LOW, etc. using any of these equivalent fully-qualified names: * PushButton::TRIGGER_ON_HIGH * SpanButton::TRIGGER_ON_HIGH * SpanToggle::TRIGGER_ON_HIGH
This commit is contained in:
parent
260be21462
commit
437771fabd
|
|
@ -852,15 +852,6 @@ class SpanButton : public PushButton {
|
|||
|
||||
public:
|
||||
|
||||
static constexpr triggerType_t TRIGGER_ON_LOW=PushButton::TRIGGER_ON_LOW;
|
||||
static constexpr triggerType_t TRIGGER_ON_HIGH=PushButton::TRIGGER_ON_HIGH;
|
||||
|
||||
#if SOC_TOUCH_SENSOR_NUM > 0
|
||||
static constexpr triggerType_t TRIGGER_ON_TOUCH=PushButton::TRIGGER_ON_TOUCH;
|
||||
static void setTouchCycles(uint16_t measureTime, uint16_t sleepTime){PushButton::setTouchCycles(measureTime,sleepTime);}
|
||||
static void setTouchThreshold(touch_value_t thresh){PushButton::setTouchThreshold(thresh);}
|
||||
#endif
|
||||
|
||||
SpanButton(int pin, uint16_t longTime=2000, uint16_t singleTime=5, uint16_t doubleTime=200, triggerType_t triggerType=TRIGGER_ON_LOW);
|
||||
SpanButton(int pin, triggerType_t triggerType, uint16_t longTime=2000, uint16_t singleTime=5, uint16_t doubleTime=200) : SpanButton(pin,longTime,singleTime,doubleTime,triggerType){};
|
||||
|
||||
|
|
|
|||
|
|
@ -278,4 +278,4 @@ void PushButton::reset(){
|
|||
|
||||
//////////////////////////////////////
|
||||
|
||||
touch_value_t PushButton::threshold=0;
|
||||
PushButton::touch_value_t PushButton::threshold=0;
|
||||
|
|
|
|||
20
src/Utils.h
20
src/Utils.h
|
|
@ -103,16 +103,8 @@ class TempBuffer {
|
|||
// PushButton //
|
||||
////////////////////////////////
|
||||
|
||||
#if SOC_TOUCH_VERSION_2
|
||||
typedef uint32_t touch_value_t;
|
||||
#else
|
||||
typedef uint16_t touch_value_t;
|
||||
#endif
|
||||
|
||||
class PushButton{
|
||||
|
||||
friend class Span;
|
||||
|
||||
int status;
|
||||
int toggleStatus;
|
||||
boolean doubleCheck;
|
||||
|
|
@ -120,14 +112,22 @@ class PushButton{
|
|||
uint32_t doubleAlarm;
|
||||
uint32_t longAlarm;
|
||||
|
||||
#if SOC_TOUCH_VERSION_2
|
||||
typedef uint32_t touch_value_t;
|
||||
#else
|
||||
typedef uint16_t touch_value_t;
|
||||
#endif
|
||||
|
||||
static touch_value_t threshold;
|
||||
static const int calibCount=20;
|
||||
|
||||
public:
|
||||
|
||||
typedef boolean (*triggerType_t)(int pin);
|
||||
|
||||
protected:
|
||||
|
||||
int pressType;
|
||||
typedef boolean (*triggerType_t)(int pin);
|
||||
|
||||
int pin;
|
||||
triggerType_t triggerType;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ void setup() {
|
|||
|
||||
Serial.begin(115200);
|
||||
|
||||
homeSpan.setLogLevel(1).setControlPin(21,SpanButton::TRIGGER_ON_HIGH).setStatusPin(13);
|
||||
homeSpan.setLogLevel(1).setStatusPin(13);
|
||||
pinMode(21,OUTPUT);
|
||||
homeSpan.setControlPin(21,SpanToggle::TRIGGER_ON_HIGH );
|
||||
homeSpan.setControlPin(21,PushButton::TRIGGER_ON_HIGH );
|
||||
homeSpan.enableWebLog(50,"pool.ntp.org","UTC");
|
||||
|
||||
homeSpan.begin(Category::Lighting,"HomeSpan Max");
|
||||
|
|
|
|||
Loading…
Reference in New Issue