Sync button_v2

This commit is contained in:
Theo Arends 2022-09-26 10:37:43 +02:00
parent 650d72706a
commit e3c77331c6
2 changed files with 6 additions and 3 deletions

View File

@ -388,8 +388,8 @@ void ButtonHandler(void) {
if (NOT_PRESSED == button) {
Button.hold_timer[button_index] = 0;
if (Settings->flag3.mqtt_buttons && PRESSED == Button.last_state[button_index] && !Button.press_counter[button_index]) { // SetOption73 (0) - Decouple button from relay and send just mqtt topic
MqttButtonTopic(button_index + 1, 6, 0);
if (Settings->flag3.mqtt_buttons && (PRESSED == Button.last_state[button_index]) && !Button.press_counter[button_index]) { // SetOption73 (0) - Decouple button from relay and send just mqtt topic
MqttButtonTopic(button_index +1, 6, 0);
}
} else {
Button.hold_timer[button_index]++;

View File

@ -29,7 +29,7 @@
#define TOUCH_HIT_THRESHOLD 3 // successful hits to filter out noise
const char kMultiPress[] PROGMEM =
"|SINGLE|DOUBLE|TRIPLE|QUAD|PENTA|";
"|SINGLE|DOUBLE|TRIPLE|QUAD|PENTA|CLEAR|";
struct BUTTON {
uint32_t debounce = 0; // Button debounce timer
@ -256,6 +256,9 @@ void ButtonHandler(void) {
if (NOT_PRESSED == button) {
Button.hold_timer[button_index] = 0;
if (Settings->flag3.mqtt_buttons && (PRESSED == Button.last_state[button_index]) && !Button.press_counter[button_index]) { // SetOption73 (0) - Decouple button from relay and send just mqtt topic
MqttButtonTopic(button_index +1, 6, 0);
}
} else {
Button.hold_timer[button_index]++;
if (Settings->flag.button_single) { // SetOption13 (0) - Allow only single button press for immediate action