From 7c32f7a364519fe460b6d531105ecee9ff4843aa Mon Sep 17 00:00:00 2001 From: Gregg Date: Thu, 21 Oct 2021 20:32:25 -0500 Subject: [PATCH] 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. --- src/Utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index ea34718..15de921 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -97,12 +97,12 @@ PushButton::PushButton(int pin){ void PushButton::init(int pin){ + this->pin=pin; if(pin<0) return; - + status=0; doubleCheck=false; - this->pin=pin; pinMode(pin, INPUT_PULLUP); }