Merge pull request #10741 from emontnemery/once_off_speed_fade_simplify

Merge fade2 with speed2
This commit is contained in:
Theo Arends 2021-01-29 11:03:25 +01:00 committed by GitHub
commit fe31aa642e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 14 deletions

View File

@ -2836,17 +2836,6 @@ void CmndRgbwwTable(void)
void CmndFade(void)
{
if (XdrvMailbox.index == 2) {
switch (XdrvMailbox.payload) {
case 0: // Off
case 1: // On
Light.fade_once_enabled = true;
Light.fade_once_value = XdrvMailbox.payload;
break;
}
return;
}
// Fade - Show current Fade state
// Fade 0 - Turn Fade Off
// Fade On - Turn Fade On
@ -2863,18 +2852,19 @@ void CmndFade(void)
#ifdef USE_DEVICE_GROUPS
if (XdrvMailbox.payload >= 0 && XdrvMailbox.payload <= 2) SendDeviceGroupMessage(Light.device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_FADE, Settings.light_fade);
#endif // USE_DEVICE_GROUPS
#ifdef USE_LIGHT
if (!Settings.light_fade) { Light.fade_running = false; }
#endif // USE_LIGHT
ResponseCmndStateText(Settings.light_fade);
}
void CmndSpeed(void)
{
if (XdrvMailbox.index == 2) {
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= 40)) {
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 40)) {
Light.fade_once_enabled = true;
Light.fade_once_value = XdrvMailbox.payload > 0;
Light.speed_once_enabled = true;
Light.speed_once_value = XdrvMailbox.payload;
if (!Light.fade_once_value) { Light.fade_running = false; }
}
return;
}