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 */