mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
SetOption129 0 (default) triggers the single press event (State#2) at push (for mode 12 it is inverted) SetOption129 1 triggers the single press event (State#2) at release (for mode 12 it is inverted) This makes the double-click usable for other things than switching the relay which is switched by single-click
This commit is contained in:
parent
6e2a3f5d60
commit
e2ca51454b
@ -158,7 +158,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
||||
uint32_t ds18x20_mean : 1; // bit 12 (v9.3.1.2) - SetOption126 - (DS18x20) Enable arithmetic mean over teleperiod for JSON temperature (1)
|
||||
uint32_t wifi_no_sleep : 1; // bit 13 (v9.5.0.2) - SetOption127 - (Wifi) Keep wifi in no-sleep mode, prevents some occasional unresponsiveness
|
||||
uint32_t disable_referer_chk : 1; // bit 14 (v9.5.0.5) - SetOption128 - (Web) Allow access without referer check
|
||||
uint32_t spare15 : 1; // bit 15
|
||||
uint32_t switch_dimmer_act_at_rls : 1; // bit 15 (v9.5.0.7) - SetOption129 - (Switch) With Switchmode11 & 12, State#2 is tiggered at push (0, default) or release (1)
|
||||
uint32_t spare16 : 1; // bit 16
|
||||
uint32_t spare17 : 1; // bit 17
|
||||
uint32_t spare18 : 1; // bit 18
|
||||
|
@ -240,11 +240,14 @@ void SwitchHandler(uint32_t mode) {
|
||||
if (Switch.hold_timer[i] & (((switchmode == PUSHHOLDMULTI) | (switchmode == PUSHHOLDMULTI_INV)) ? SM_TIMER_MASK: SM_NO_TIMER_MASK)) {
|
||||
Switch.hold_timer[i]--;
|
||||
if ((Switch.hold_timer[i] & SM_TIMER_MASK) == loops_per_second * Settings->param[P_HOLD_TIME] / 25) {
|
||||
if ((switchmode == PUSHHOLDMULTI) & (NOT_PRESSED == Switch.last_state[i])) {
|
||||
SendKey(KEY_SWITCH, i +1, POWER_INCREMENT); // Execute command via MQTT
|
||||
}
|
||||
if ((switchmode == PUSHHOLDMULTI_INV) & (PRESSED == Switch.last_state[i])) {
|
||||
SendKey(KEY_SWITCH, i +1, POWER_INCREMENT); // Execute command via MQTT
|
||||
if ((switchmode == PUSHHOLDMULTI) | (switchmode == PUSHHOLDMULTI_INV)){
|
||||
if (((switchmode == PUSHHOLDMULTI) & (NOT_PRESSED == Switch.last_state[i])) | ((switchmode == PUSHHOLDMULTI_INV) & (PRESSED == Switch.last_state[i]))) {
|
||||
SendKey(KEY_SWITCH, i +1, POWER_INCREMENT); // Execute command via MQTT
|
||||
}
|
||||
else if ((Settings->flag5.switch_dimmer_act_at_rls) & ((Switch.hold_timer[i] & ~SM_TIMER_MASK) == SM_FIRST_PRESS)) {
|
||||
switchflag = POWER_TOGGLE; // Toggle with pushbutton
|
||||
Switch.hold_timer[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 == (Switch.hold_timer[i] & (((switchmode == PUSHHOLDMULTI) | (switchmode == PUSHHOLDMULTI_INV)) ? SM_TIMER_MASK: SM_NO_TIMER_MASK))) {
|
||||
@ -351,7 +354,9 @@ void SwitchHandler(uint32_t mode) {
|
||||
if ((Switch.hold_timer[i] & SM_TIMER_MASK) > loops_per_second * Settings->param[P_HOLD_TIME] / 25) {
|
||||
if((Switch.hold_timer[i] & ~SM_TIMER_MASK) != SM_SECOND_PRESS) {
|
||||
Switch.hold_timer[i]= SM_FIRST_PRESS;
|
||||
switchflag = POWER_TOGGLE; // Toggle with pushbutton
|
||||
if (!Settings->flag5.switch_dimmer_act_at_rls){
|
||||
switchflag = POWER_TOGGLE; // Toggle with pushbutton
|
||||
}
|
||||
}
|
||||
else{
|
||||
SendKey(KEY_SWITCH, i +1, POWER_100); // Execute command via MQTT
|
||||
@ -377,7 +382,9 @@ void SwitchHandler(uint32_t mode) {
|
||||
if ((Switch.hold_timer[i] & SM_TIMER_MASK)> loops_per_second * Settings->param[P_HOLD_TIME] / 25) {
|
||||
if((Switch.hold_timer[i] & ~SM_TIMER_MASK) != SM_SECOND_PRESS) {
|
||||
Switch.hold_timer[i]= SM_FIRST_PRESS;
|
||||
switchflag = POWER_TOGGLE; // Toggle with pushbutton
|
||||
if (!Settings->flag5.switch_dimmer_act_at_rls){
|
||||
switchflag = POWER_TOGGLE; // Toggle with pushbutton
|
||||
}
|
||||
}
|
||||
else{
|
||||
SendKey(KEY_SWITCH, i +1, POWER_100); // Execute command via MQTT
|
||||
|
Loading…
x
Reference in New Issue
Block a user