Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to cause WS2812 strip switching to be independent from relay/power #386

Closed
joecotton opened this issue Apr 25, 2017 · 4 comments
Closed
Labels
enhancement Type - Enhancement that will be worked on

Comments

@joecotton
Copy link

The WS2812 module checks and modifies the global power variable, which means that sending the power on or off commands also changes the WS2812 strip. The patch below causes this to happen only if the module is SONOFF_LED.

Ref: #85

--- a/sonoff/xdrv_ws2812.ino
+++ b/sonoff/xdrv_ws2812.ino
@@ -384,7 +384,7 @@ void ws2812_animate()
   uint8_t fadeValue;

   stripTimerCntr++;
-  if (power == 0) {  // Power Off
+  if ((sysCfg.module == SONOFF_LED) && (power == 0)) {  // Power Off
     sleep = sysCfg.sleep;
     stripTimerCntr = 0;
     tcolor = 0;
@@ -512,14 +512,14 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
     if (data_len == 6) {
 //        ws2812_setColor(0, dataBufUc);
       ws2812_setColor(0, dataBuf);
-      power = 1;
+      if (sysCfg.module == SONOFF_LED) power = 1;
     }
     ws2812_getColor(0, svalue, ssvalue);
   }
   else if (!strcmp(type,"DIMMER")) {
     if ((data_len > 0) && (payload >= 0) && (payload <= 100)) {
       sysCfg.ws_dimmer = payload;
-      power = 1;
+      if (sysCfg.module == SONOFF_LED) power = 1;
 #ifdef USE_DOMOTICZ
       mqtt_publishDomoticzPowerState(index);
 #endif  // USE_DOMOTICZ
@@ -578,7 +578,7 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
     if ((data_len > 0) && (payload >= 0) && (payload <= 9)) {
       sysCfg.ws_scheme = payload;
       if (sysCfg.ws_scheme == 1) ws2812_resetWakupState();
-      power = 1;
+      if (sysCfg.module == SONOFF_LED) power = 1;
       ws2812_resetStripTimer();
     }
     snprintf_P(svalue, ssvalue, PSTR("{\"Scheme\":%d}"), sysCfg.ws_scheme);

@davidelang
Copy link
Collaborator

could you make this into a PR please?

@joecotton
Copy link
Author

Done

@arendst arendst added the enhancement Type - Enhancement that will be worked on label May 5, 2017
@arendst
Copy link
Owner

arendst commented May 14, 2017

PR rewritten and now supports all modules as an extra "virtual" relay. Will be released in next version (5.1.1).

arendst added a commit that referenced this issue May 17, 2017
5.1.1 20170517
* Allow command FullTopic in group mode
* Prepare for more use of RTC memory
* Add independant WS2812 led string power control (#386, #390)
* Add command Counter<x> to control up to four GPIO falling edge
interrupt counters or timers (#459)
* Add command CounterType<x> to select between pulse counting or pulse
timing
* Add command CounterDebounce to select global counter debounce time in
mSec
@ascillato2
Copy link
Collaborator

Hi,

Seems that your question has been addressed. Closing this issue. Please reopen if needed. Thanks.

curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.1.1 20170517
* Allow command FullTopic in group mode
* Prepare for more use of RTC memory
* Add independant WS2812 led string power control (arendst#386, arendst#390)
* Add command Counter<x> to control up to four GPIO falling edge
interrupt counters or timers (arendst#459)
* Add command CounterType<x> to select between pulse counting or pulse
timing
* Add command CounterDebounce to select global counter debounce time in
mSec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on
Projects
None yet
Development

No branches or pull requests

4 participants