From a0e7191d4e653951628767e10bc4bcc2536a608f Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 16 Nov 2022 16:15:31 +0100 Subject: [PATCH] Add command ArtNet - Fix ArtNetStop --- tasmota/include/i18n.h | 1 + tasmota/tasmota_xdrv_driver/xdrv_04_light.ino | 6 +++--- .../xdrv_04_light_artnet.ino | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tasmota/include/i18n.h b/tasmota/include/i18n.h index 7896e761b..8c8e3e4b5 100644 --- a/tasmota/include/i18n.h +++ b/tasmota/include/i18n.h @@ -502,6 +502,7 @@ #define D_CMND_PALETTE "Palette" #define D_CMND_PIXELS "Pixels" #define D_CMND_STEPPIXELS "StepPixels" +#define D_CMND_ARTNET "ArtNet" #define D_CMND_ARTNET_START "ArtNetStart" #define D_CMND_ARTNET_STOP "ArtNetStop" #define D_CMND_ARTNET_CONFIG "ArtNetConfig" diff --git a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino index e6cafd584..ef457a580 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino @@ -151,7 +151,7 @@ const char kLightCommands[] PROGMEM = "|" // No prefix "|" D_CMND_SEQUENCE_OFFSET #endif // USE_DGR_LIGHT_SEQUENCE #ifdef USE_LIGHT_ARTNET - "|" D_CMND_ARTNET_START "|" D_CMND_ARTNET_STOP "|" D_CMND_ARTNET_CONFIG + "|" D_CMND_ARTNET "|" D_CMND_ARTNET_START "|" D_CMND_ARTNET_STOP "|" D_CMND_ARTNET_CONFIG #endif "|UNDOCA" ; @@ -175,7 +175,7 @@ void (* const LightCommand[])(void) PROGMEM = { &CmndSequenceOffset, #endif // USE_DGR_LIGHT_SEQUENCE #ifdef USE_LIGHT_ARTNET - &CmndArtNetStart, &CmndArtNetStop, &CmndArtNetConfig, + &CmndArtNet, &CmndArtNetStart, &CmndArtNetStop, &CmndArtNetConfig, #endif &CmndUndocA }; @@ -1962,7 +1962,7 @@ void LightAnimate(void) Light.fade_start_10[channel_ct] = Light.fade_end_10[channel_ct]; } } - + Light.fade_running = true; Light.fade_duration = 0; // set the value to zero to force a recompute Light.fade_start = 0; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino b/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino index a1ea8328d..8b5218c12 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino @@ -413,6 +413,7 @@ void ArtNetStop(void) { void CmndArtNetStop(void) { ArtNetStop(); + Settings->flag6.artnet_autorun = false; // restore default scheme Settings->light_scheme = LS_POWER; // Restore sleep value @@ -421,5 +422,21 @@ void CmndArtNetStop(void) { ResponseCmndDone(); } +void CmndArtNet(void) { + if (0 == XdrvMailbox.payload) { + ArtNetStop(); + Settings->flag6.artnet_autorun = false; // SetOption148 - (Light) start DMX ArtNet at boot, listen to UDP port as soon as network is up +// Settings->light_scheme = LS_POWER; // restore default scheme + TasmotaGlobal.sleep = Settings->sleep; // Restore sleep value + Light.update = true; // Restore old color + } + if (1 == XdrvMailbox.payload) { + if (!ArtNetStart()) { + Settings->flag6.artnet_autorun = false; // SetOption148 - (Light) start DMX ArtNet at boot, listen to UDP port as soon as network is up + } + } + ResponseCmndStateText(artnet_udp_connected & Settings->flag6.artnet_autorun); +} + #endif // USE_LIGHT_ARTNET #endif // USE_LIGHT