diff --git a/src/HomeSpan.h b/src/HomeSpan.h index 88d29c3..5f29530 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -191,7 +191,6 @@ class Span{ const char *defaultSetupCode=DEFAULT_SETUP_CODE; // Setup Code used for pairing int statusPin=DEFAULT_STATUS_PIN; // pin for Status LED uint16_t autoOffLED=0; // automatic turn-off duration (in seconds) for Status LED -// int controlPin=DEFAULT_CONTROL_PIN; // pin for Control Pushbutton uint8_t logLevel=DEFAULT_LOG_LEVEL; // level for writing out log messages to serial monitor uint8_t maxConnections=CONFIG_LWIP_MAX_SOCKETS-2; // maximum number of allowed simultaneous HAP connections uint8_t requestedMaxCon=CONFIG_LWIP_MAX_SOCKETS-2; // requested maximum number of simultaneous HAP connections diff --git a/src/Settings.h b/src/Settings.h index e04fefa..b64e020 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -71,7 +71,6 @@ #define DEFAULT_QR_ID "HSPN" // change with homeSpan.setQRID(qrID); -//#define DEFAULT_CONTROL_PIN -1 // change with homeSpan.setControlPin(pin) #define DEFAULT_STATUS_PIN -1 // change with homeSpan.setStatusPin(pin) #define DEFAULT_AP_SSID "HomeSpan-Setup" // change with homeSpan.setApSSID(ssid) diff --git a/src/Utils.cpp b/src/Utils.cpp index 282d0e0..98f06c7 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -85,22 +85,9 @@ String Utils::mask(char *c, int n){ // PushButton // //////////////////////////////// -PushButton::PushButton(){} - -////////////////////////////////////// - PushButton::PushButton(int pin){ - init(pin); -} - -////////////////////////////////////// - -void PushButton::init(int pin){ this->pin=pin; - if(pin<0) - return; - status=0; doubleCheck=false; pinMode(pin, INPUT_PULLUP); @@ -110,9 +97,6 @@ void PushButton::init(int pin){ boolean PushButton::triggered(uint16_t singleTime, uint16_t longTime, uint16_t doubleTime){ - if(pin<0) - return(false); - unsigned long cTime=millis(); switch(status){ @@ -189,10 +173,7 @@ boolean PushButton::triggered(uint16_t singleTime, uint16_t longTime, uint16_t d ////////////////////////////////////// boolean PushButton::primed(){ - - if(pin<0) - return(false); - + if(millis()>singleAlarm && status==1){ status=2; return(true); @@ -209,11 +190,7 @@ int PushButton::type(){ ////////////////////////////////////// -void PushButton::wait(){ - - if(pin<0) - return; - +void PushButton::wait(){ while(!digitalRead(pin)); } diff --git a/src/Utils.h b/src/Utils.h index 18bf612..040ea44 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -89,27 +89,12 @@ class PushButton{ LONG=2 }; - PushButton(); PushButton(int pin); -// Creates generic pushbutton functionality on specified pin -// that is wired to connect to ground when the button is pressed. -// -// In the first form, a PushButton is instantiated without specifying -// the pin. In this case the pin must be specified in a subsequent call -// to init() before the PushButton can be used. -// -// In the second form, a PushButton is instantiated and initialized with -// the specified pin, obviating the need for a separate call to init(). +// Creates generic pushbutton functionality on specified pin. // // pin: Pin mumber to which pushbutton connects to ground when pressed - - void init(int pin); - -// Initializes PushButton, if not configured during instantiation. -// -// pin: Pin mumber to which pushbutton connects to ground when pressed - + void reset(); // Resets state of PushButton. Should be called once before any loops that will