From b53660d4bfc1b72cc79b3efae36e34a858b78955 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Sun, 21 Jun 2020 16:47:50 +0200 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B1=D0=B0=D0=B3=20=D1=84=D0=B8=D0=B7=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D1=81=D0=BA=D0=BE=D0=B9=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA?= =?UTF-8?q?=D0=B8=20(=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=B8=D0=BB=20?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/Global.h | 3 +++ src/Cmd.cpp | 5 +---- src/Global.cpp | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/Global.h b/include/Global.h index 78e771c0..556ac2c5 100644 --- a/include/Global.h +++ b/include/Global.h @@ -56,6 +56,9 @@ extern AsyncWebServer server; extern DallasTemperature sensors; +extern boolean but[NUM_BUTTONS]; +extern Bounce *buttons; + /* * Global vars */ diff --git a/src/Cmd.cpp b/src/Cmd.cpp index 93ec23cc..8ddfb8b9 100644 --- a/src/Cmd.cpp +++ b/src/Cmd.cpp @@ -3,9 +3,6 @@ Servo myServo1; Servo myServo2; -boolean but[NUM_BUTTONS]; -Bounce *buttons; - void CMD_init() { sCmd.addCommand("button", button); sCmd.addCommand("buttonSet", buttonSet); @@ -257,7 +254,7 @@ void handleButton() { } } switch_number++; - if (switch_number == 6) switch_number = 0; + if (switch_number == NUM_BUTTONS) switch_number = 0; } //===================================================================================================================================== diff --git a/src/Global.cpp b/src/Global.cpp index 1aff5ed0..27ea46bf 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -21,6 +21,9 @@ AsyncWebServer server(80); DallasTemperature sensors; +boolean but[NUM_BUTTONS]; +Bounce *buttons = new Bounce[NUM_BUTTONS]; + /* * Global vars */