Closed Bacto closed 1 year ago
Hello, I will try to help. When looking at code I can see that default start color seems to be all off: _float ledrawLerpCurrent[5] = { 0 }; which doesn't seem to explain the behaviour you observed.
My first question now would be.... does the same happen for PWM lights?
I have PWM lights so have been playing around with the code. Below are some observations I've found with the flag:
Without flag 18 (expected behavior):
With flag 18:
Looking through the code I think I know why this is:
RGB mode interpolates to finalColors[i]
This array is initialized to all 255s, so when the light first boots, all LEDs will be turned on.
When the LED is toggled on and off with "Toggle Light", apply_smart_light
will write finalColors[i]
to 0 if the LED is disabled, or the correct color if it is enabled.
However, the 2-PWM alternate CW mode interpolates the brightness to led_current_value_brightness
. This variable does not depend on whether the LED is toggled on or off, so this is why "Toggle Light" does not work with this mode.
I'll write up a PR quickly.
Thanks. Can anyone else check this PR with both CW and RGBCW lights before I merge?
Hi,
Tested on a RGBCW (BK7231T with BP5758D) and a CW (BK7231T with PWM). It works, there is no default color set anymore. Thank you :)
The negative point is that there is a small delay between powering-up the light and having it fade-in.
When finalColors[i]
was fill with 255s, the fade-in started immediately.
Is there a way to speed-up the startup command or define the default color (via finalColors[i]
) on start?
My startup command is this one:
backlog ; BP5758D_Map 1 0 2 3 4 ; led_dimmer 100 ; led_basecolor_rgbcw #000000FFFF ; led_enableAll 1
.
I tried to improve it by setting color first but the delay seems to be the same:
backlog ; led_basecolor_rgbcw #000000FFFF ; led_enableAll 1 ; BP5758D_Map 1 0 2 3 4
Thank you for your input, @Bacto . I am not sure at this moment if that's the good solution, but maybe I could just add a command that allows you to set finalColors field directly? It sounds hacky, but adding command is easy and I could get it ready for you in 5 minutes and you'd check if it works...
NOTE: the order of command won't change anything here
IDEA 2: I could add a command something like "led_applyColorNow" that would skip whole interpolation at the time of execution (it would set instantly lerp values to targets...)
what do you need testing.
i have the same light and never experienced those problems but if have save color settings enabled. so it is on warm white and when i reboot it stays on warm white
It looks like the delay from the startup commands is because the commands run once WiFi has been successfully started. Whereas the option that saves the color settings will apply these before wifi is set up.
I wonder if as an alternative to making a command that sets finalColors, there could be two startup command options: one that runs before the wifi is set up (for setting LED values) and one that runs afterwards (for mqtt publishing or other wifi-dependent commands).
@rianadon interesting. Is waiting for WiFi to start mandatory to accept MQTT and other commands?
Waiting for a better solution, having a second startup commands field seems great to me. What do you think @openshwprojects?
two startup lines may be a good thing. note that early.bat is now called early, and autoexec.bat is called after delay (which is still before wifi...).
:tada: This issue has been resolved in version 1.15.178 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Sorry, github automatically closed it with PR merge. The question is - did that PR help?
Two startup commands are not needed, you already have:
also added command: "led_finishFullLerp". If you have lerp enabled, and you do backlog led_basecolor_rgb FF0000; led_finishFullLerp; , it fill apply color fully at the execution of led_finishFullLerp
Hi,
Sorry my late reply, didn't got time to check this.
I confirm that using the early.bat
file it works like a charm :)
For those who would have the same problem:
early.bat
file (in "Launch Web Application", "Filesystem", "Create File") and put this in it: backlog ; BP5758D_Map 1 0 2 3 4 ; led_dimmer 100 ; led_basecolor_rgbcw #000000FFFF ; led_enableAll 1
Thank you to all of you for the patch and the explanations! 🥰
Adrien
Thank you!
Hi,
The "Smooth transitions for LED" flag is awesome:
There is only one problem: the default color on start is cold (RGBCW is set to #000000FF00). And I haven't found a way to change it.
I use this startup command:
backlog ; BP5758D_Map 1 0 2 3 4 ; led_dimmer 100 ; led_basecolor_rgbcw #000000FFFF ; led_enableAll 1
. On start the bulb fade-in to cold white and then the script is executed and bulb fades to cold+warm white.Is it possible to have a way to define the default color?
Adrien