works better for long pressed

This commit is contained in:
Wolfgang Hottgenroth
2018-01-25 15:36:03 +01:00
parent 6dfe9e363a
commit 52e4ea6dce
2 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@
#ifndef DEFINES_H_ #ifndef DEFINES_H_
#define DEFINES_H_ #define DEFINES_H_
#define DEBUG // #define DEBUG
// #define SLEEP // #define SLEEP
#define EEPROM_ADDR 0 #define EEPROM_ADDR 0

View File

@ -19,7 +19,7 @@
typedef enum { NOT_PRESSED, PRESSED, LONG_PRESSED } tPressedState; typedef enum { NOT_PRESSED, PRESSED, LONG_PRESSED_PREPARE, LONG_PRESSED } tPressedState;
WiFiClientSecure espClient; WiFiClientSecure espClient;
@ -158,6 +158,9 @@ void loopProduction() {
state = PRESSED; state = PRESSED;
break; break;
case PRESSED: case PRESSED:
state = LONG_PRESSED_PREPARE;
break;
case LONG_PRESSED_PREPARE:
state = LONG_PRESSED; state = LONG_PRESSED;
client.publish(configBlock.mqttTopic, "LONG_BEGIN"); client.publish(configBlock.mqttTopic, "LONG_BEGIN");
break; break;
@ -171,6 +174,7 @@ void loopProduction() {
case NOT_PRESSED: case NOT_PRESSED:
break; break;
case PRESSED: case PRESSED:
case LONG_PRESSED_PREPARE:
client.publish(configBlock.mqttTopic, "SHORT"); client.publish(configBlock.mqttTopic, "SHORT");
break; break;
case LONG_PRESSED: case LONG_PRESSED: