mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Make button press rules override PWM Dimmer functions
This commit is contained in:
parent
500fb147c4
commit
caaf7ac39c
@ -488,12 +488,16 @@ bool SendKey(uint32_t key, uint32_t device, uint32_t state)
|
|||||||
Response_P(PSTR("{\"%s%d\":{\"State\":%d}}"), (key) ? "Switch" : "Button", device, state);
|
Response_P(PSTR("{\"%s%d\":{\"State\":%d}}"), (key) ? "Switch" : "Button", device, state);
|
||||||
result = XdrvRulesProcess();
|
result = XdrvRulesProcess();
|
||||||
}
|
}
|
||||||
|
#ifdef USE_PWM_DIMMER
|
||||||
|
if (PWM_DIMMER == my_module_type && !result) {
|
||||||
|
#endif // USE_PWM_DIMMER
|
||||||
int32_t payload_save = XdrvMailbox.payload;
|
int32_t payload_save = XdrvMailbox.payload;
|
||||||
XdrvMailbox.payload = device_save << 24 | key << 16 | state << 8 | device;
|
XdrvMailbox.payload = device_save << 24 | key << 16 | state << 8 | device;
|
||||||
XdrvCall(FUNC_ANY_KEY);
|
XdrvCall(FUNC_ANY_KEY);
|
||||||
XdrvMailbox.payload = payload_save;
|
XdrvMailbox.payload = payload_save;
|
||||||
#ifdef USE_PWM_DIMMER
|
#ifdef USE_PWM_DIMMER
|
||||||
if (PWM_DIMMER == my_module_type) result = true;
|
result = true;
|
||||||
|
}
|
||||||
#endif // USE_PWM_DIMMER
|
#endif // USE_PWM_DIMMER
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ void PWMModulePreInit(void)
|
|||||||
PWMDimmerSetPoweredOffLed();
|
PWMDimmerSetPoweredOffLed();
|
||||||
|
|
||||||
// The relay initializes to on. If the power is supposed to be off, turn the relay off.
|
// The relay initializes to on. If the power is supposed to be off, turn the relay off.
|
||||||
if (!power && PinUsed(GPIO_REL1)) digitalWrite(Pin(GPIO_REL1), bitRead(rel_inverted, 0) ? 1 : 0);
|
// if (!power && PinUsed(GPIO_REL1)) digitalWrite(Pin(GPIO_REL1), bitRead(rel_inverted, 0) ? 1 : 0);
|
||||||
|
|
||||||
#ifdef USE_PWM_DIMMER_REMOTE
|
#ifdef USE_PWM_DIMMER_REMOTE
|
||||||
// If remote device mode is enabled, set the device group count to the number of buttons
|
// If remote device mode is enabled, set the device group count to the number of buttons
|
||||||
@ -546,7 +546,6 @@ void PWMDimmerHandleButton(uint32_t button_index, bool pressed)
|
|||||||
else
|
else
|
||||||
SendDeviceGroupMessage(power_button_index, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, new_power);
|
SendDeviceGroupMessage(power_button_index, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, new_power);
|
||||||
#endif // USE_DEVICE_GROUPS
|
#endif // USE_DEVICE_GROUPS
|
||||||
|
|
||||||
#ifdef USE_PWM_DIMMER_REMOTE
|
#ifdef USE_PWM_DIMMER_REMOTE
|
||||||
if (active_remote_pwm_dimmer)
|
if (active_remote_pwm_dimmer)
|
||||||
active_remote_pwm_dimmer->power_button_increases_bri = (power_on_bri < 128);
|
active_remote_pwm_dimmer->power_button_increases_bri = (power_on_bri < 128);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user