mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-21 09:46:31 +00:00
Add command `SetOption73 1
` for button decoupling
Add command ``SetOption73 1`` for button decoupling and send multi-press and hold MQTT messages by Federico Leoni (#8235)
This commit is contained in:
parent
780b250d9d
commit
0b08c72247
@ -71,6 +71,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
|||||||
- Add commands ``NrfPage``, ``NrfIgnore``, ``NrfScan`` and ``NrfBeacon`` to NRF24 Bluetooth driver (#8075)
|
- Add commands ``NrfPage``, ``NrfIgnore``, ``NrfScan`` and ``NrfBeacon`` to NRF24 Bluetooth driver (#8075)
|
||||||
- Add commands ``GlobalTemp`` and ``GlobalHum`` to init sensor data (#8152)
|
- Add commands ``GlobalTemp`` and ``GlobalHum`` to init sensor data (#8152)
|
||||||
- Add command ``SetOption41 <x>`` to force sending gratuitous ARP every <x> seconds
|
- Add command ``SetOption41 <x>`` to force sending gratuitous ARP every <x> seconds
|
||||||
|
- Add command ``SetOption73 1`` for button decoupling and send multi-press and hold MQTT messages by Federico Leoni (#8235)
|
||||||
- Add command ``SetOption90 1`` to disable non-json MQTT messages (#8044)
|
- Add command ``SetOption90 1`` to disable non-json MQTT messages (#8044)
|
||||||
- Add command ``SetOption91 1`` to enable fading at startup / power on
|
- Add command ``SetOption91 1`` to enable fading at startup / power on
|
||||||
- Add command ``Sensor10 0/1/2`` to control BH1750 resolution - 0 = High (default), 1 = High2, 2 = Low (#8016)
|
- Add command ``Sensor10 0/1/2`` to control BH1750 resolution - 0 = High (default), 1 = High2, 2 = Low (#8016)
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
### 8.2.0.4 20200417
|
### 8.2.0.4 20200417
|
||||||
|
|
||||||
- Add config version tag
|
|
||||||
- Fix Zigbee DimmerUp/DimmerDown malformed
|
- Fix Zigbee DimmerUp/DimmerDown malformed
|
||||||
|
- Add config version tag
|
||||||
|
- Add command ``SetOption73 1`` for button decoupling and send multi-press and hold MQTT messages by Federico Leoni (#8235)
|
||||||
|
|
||||||
### 8.2.0.3 20200329
|
### 8.2.0.3 20200329
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BUTTON_V1
|
//#define BUTTON_V1
|
||||||
#ifdef BUTTON_V1
|
#ifdef BUTTON_V1
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Button support
|
* Button support
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define BUTTON_V2
|
#define BUTTON_V2
|
||||||
#ifdef BUTTON_V2
|
#ifdef BUTTON_V2
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Button support
|
* Button support
|
||||||
@ -99,7 +99,8 @@ uint8_t ButtonSerial(uint8_t serial_in_byte)
|
|||||||
* Button handler with single press only or multi-press and hold on all buttons
|
* Button handler with single press only or multi-press and hold on all buttons
|
||||||
*
|
*
|
||||||
* ButtonDebounce (50) - Debounce time in mSec
|
* ButtonDebounce (50) - Debounce time in mSec
|
||||||
* SetOption11 (0) - If set perform single press action on double press and reverse
|
* SetOption1 (0) - If set do not execute commands WifiConfig and Reset
|
||||||
|
* SetOption11 (0) - If set perform single press action on double press and reverse (on two relay devices only)
|
||||||
* SetOption13 (0) - If set act on single press only
|
* SetOption13 (0) - If set act on single press only
|
||||||
* SetOption73 (0) - Decouple button from relay and send just mqtt topic
|
* SetOption73 (0) - Decouple button from relay and send just mqtt topic
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
@ -216,10 +217,12 @@ void ButtonHandler(void)
|
|||||||
SendKey(KEY_BUTTON, button_index +1, POWER_HOLD); // Execute Hold command via MQTT if ButtonTopic is set
|
SendKey(KEY_BUTTON, button_index +1, POWER_HOLD); // Execute Hold command via MQTT if ButtonTopic is set
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((Button.hold_timer[button_index] == loops_per_second * hold_time_extent * Settings.param[P_HOLD_TIME] / 10)) { // SetOption32 (40) - Button held for factor times longer
|
if (!Settings.flag.button_restrict) {
|
||||||
Button.press_counter[button_index] = 0;
|
if ((Button.hold_timer[button_index] == loops_per_second * hold_time_extent * Settings.param[P_HOLD_TIME] / 10)) { // SetOption32 (40) - Button held for factor times longer
|
||||||
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_RESET " 1"));
|
Button.press_counter[button_index] = 0;
|
||||||
ExecuteCommand(scmnd, SRC_BUTTON);
|
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_RESET " 1"));
|
||||||
|
ExecuteCommand(scmnd, SRC_BUTTON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -272,8 +275,10 @@ void ButtonHandler(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else { // 6 press start wificonfig 2
|
} else { // 6 press start wificonfig 2
|
||||||
|
if (!Settings.flag.button_restrict) {
|
||||||
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_WIFICONFIG " 2"));
|
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_WIFICONFIG " 2"));
|
||||||
ExecuteCommand(scmnd, SRC_BUTTON);
|
ExecuteCommand(scmnd, SRC_BUTTON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Settings.flag3.mqtt_buttons) { // SetOption73 (0) - Decouple button from relay and send just mqtt topic
|
if (Settings.flag3.mqtt_buttons) { // SetOption73 (0) - Decouple button from relay and send just mqtt topic
|
||||||
if (Button.press_counter[button_index] >= 1 && Button.press_counter[button_index] <= 5) {
|
if (Button.press_counter[button_index] >= 1 && Button.press_counter[button_index] <= 5) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user