mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-04 07:24:20 +01:00
we should send only buttons events that have actions assigned to them or set BUTTON_MQTT_SEND_ALL_EVENTS to 1 to send everything
This commit is contained in:
@@ -97,12 +97,14 @@ void buttonEvent(unsigned int id, unsigned char event) {
|
||||
DEBUG_MSG_P(PSTR("[BUTTON] Button #%u event %u\n"), id, event);
|
||||
if (event == 0) return;
|
||||
|
||||
#if MQTT_SUPPORT
|
||||
buttonMQTT(id, event);
|
||||
#endif
|
||||
|
||||
unsigned char action = buttonAction(id, event);
|
||||
|
||||
#if MQTT_SUPPORT
|
||||
if (action != BUTTON_MODE_NONE || BUTTON_MQTT_SEND_ALL_EVENTS) {
|
||||
buttonMQTT(id, event);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (action == BUTTON_MODE_TOGGLE) {
|
||||
if (_buttons[id].relayID > 0) {
|
||||
relayToggle(_buttons[id].relayID - 1);
|
||||
|
||||
@@ -236,6 +236,8 @@
|
||||
|
||||
#ifndef BUTTON_LNGLNGCLICK_DELAY
|
||||
#define BUTTON_LNGLNGCLICK_DELAY 10000 // Time in ms holding the button down to get a long-long click
|
||||
#define BUTTON_MQTT_SEND_ALL_EVENTS 0 // 0 - to send only events the are bound to actions
|
||||
// 1 - to send all button events to MQTT
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user