button press mqtt publish
This commit is contained in:
parent
c7ab482ae0
commit
8947ea108b
1 changed files with 15 additions and 0 deletions
|
@ -597,9 +597,16 @@ void shortKeyPress() {
|
|||
if (buttonState == false) {
|
||||
setModeByStateString(BTN_MODE_SHORT);
|
||||
buttonState = true;
|
||||
#ifdef ENABLE_MQTT
|
||||
mqtt_client.publish(mqtt_outtopic, String("OK =static white").c_str());
|
||||
#endif
|
||||
} else {
|
||||
mode = OFF;
|
||||
buttonState = false;
|
||||
#ifdef ENABLE_MQTT
|
||||
mqtt_client.publish(mqtt_outtopic, String("OK =off").c_str());
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -607,12 +614,20 @@ void shortKeyPress() {
|
|||
void mediumKeyPress() {
|
||||
DBG_OUTPUT_PORT.printf("Medium button press\n");
|
||||
setModeByStateString(BTN_MODE_MEDIUM);
|
||||
#ifdef ENABLE_MQTT
|
||||
mqtt_client.publish(mqtt_outtopic, String("OK =fire flicker").c_str());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// called when button is kept pressed for 2 seconds or more
|
||||
void longKeyPress() {
|
||||
DBG_OUTPUT_PORT.printf("Long button press\n");
|
||||
setModeByStateString(BTN_MODE_LONG);
|
||||
#ifdef ENABLE_MQTT
|
||||
mqtt_client.publish(mqtt_outtopic, String("OK =fireworks random").c_str());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void button() {
|
||||
|
|
Loading…
Reference in a new issue