Исправил баг физической кнопки (проверил работает)

This commit is contained in:
Dmitry Borisenko
2020-06-21 16:47:50 +02:00
parent f2aabd0349
commit b53660d4bf
3 changed files with 7 additions and 4 deletions

View File

@@ -56,6 +56,9 @@ extern AsyncWebServer server;
extern DallasTemperature sensors; extern DallasTemperature sensors;
extern boolean but[NUM_BUTTONS];
extern Bounce *buttons;
/* /*
* Global vars * Global vars
*/ */

View File

@@ -3,9 +3,6 @@
Servo myServo1; Servo myServo1;
Servo myServo2; Servo myServo2;
boolean but[NUM_BUTTONS];
Bounce *buttons;
void CMD_init() { void CMD_init() {
sCmd.addCommand("button", button); sCmd.addCommand("button", button);
sCmd.addCommand("buttonSet", buttonSet); sCmd.addCommand("buttonSet", buttonSet);
@@ -257,7 +254,7 @@ void handleButton() {
} }
} }
switch_number++; switch_number++;
if (switch_number == 6) switch_number = 0; if (switch_number == NUM_BUTTONS) switch_number = 0;
} }
//===================================================================================================================================== //=====================================================================================================================================

View File

@@ -21,6 +21,9 @@ AsyncWebServer server(80);
DallasTemperature sensors; DallasTemperature sensors;
boolean but[NUM_BUTTONS];
Bounce *buttons = new Bounce[NUM_BUTTONS];
/* /*
* Global vars * Global vars
*/ */