Fix bug in PushButton()

Ensure a pin value of -1 is retained so that any further calls to other methods are disabled if the pin is not defined.
This commit is contained in:
Gregg 2021-10-21 20:32:25 -05:00
parent d4603df58d
commit 7c32f7a364
1 changed files with 2 additions and 2 deletions

View File

@ -97,12 +97,12 @@ PushButton::PushButton(int pin){
void PushButton::init(int pin){ void PushButton::init(int pin){
this->pin=pin;
if(pin<0) if(pin<0)
return; return;
status=0; status=0;
doubleCheck=false; doubleCheck=false;
this->pin=pin;
pinMode(pin, INPUT_PULLUP); pinMode(pin, INPUT_PULLUP);
} }