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

Fw1906 Support (based on 0-15) #3810

Merged
merged 6 commits into from
Mar 20, 2024
Merged

Fw1906 Support (based on 0-15) #3810

merged 6 commits into from
Mar 20, 2024

Conversation

deece
Copy link

@deece deece commented Mar 11, 2024

This PR contains the work within #3298 by @Robert-github-com

All the hard work has been done by him, I have just rebased and squashed it.

The work-in-progress commits have been squashed to make the changes easier to review, and the patchset has been rebased on top of 0-15.

I have successfully built this and confirmed that it can drive the LED strip, and that both RGB animations & CCT control works.

@deece deece mentioned this pull request Mar 11, 2024
@blazoncek
Copy link
Collaborator

When you have successfully tested my updates and confirm that it is working, we can proceed merging.

@mathojojo
Copy link

I'm trying to compile, but it fails :

`wled00/wled_server.cpp:3:10: fatal error: html_ui.h: No such file or directory



#include "html_ui.h"
^~~~~~~~~~~
compilation terminated.
Retrieved .pio/build/lolin_s2_mini/lib5f0/SPI/SPI.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRac.cpp.o' from cache
Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRrecv.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRsend.cpp.o' from cache
Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRtimer.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Airton.cpp.o' from cache
Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Airwell.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRutils.cpp.o' from cache
Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRtext.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Amcor.cpp.o' from cache
Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Argo.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Arris.cpp.o' from cache
Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Aiwa.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Bose.cpp.o' from cache
Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Carrier.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Coolix.cpp.o' from cache
Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Corona.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Daikin.cpp.o' from cache
Retrieved `.pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Delonghi.cpp.o' from cache
Compiling .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Denon.cpp.o
*** [.pio/build/lolin_s2_mini/src/wled_server.cpp.o] Error 1
Compiling .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Dish.cpp.o
===================================================================================================================== [FAILED] Took 2.68 seconds =====================================================================================================================

Environment Status Duration


lolin_s2_mini FAILED 00:00:02.675`

Is there something I miss ?

Thank you for your help, I would appreciate to test the FW1906 support.

@deece
Copy link
Author

deece commented Mar 12, 2024

I'm trying to compile, but it fails :

`wled00/wled_server.cpp:3:10: fatal error: html_ui.h: No such file or directory

* Looking for html_ui.h dependency? Check our library registry!

* CLI  > platformio lib search "header:html_ui.h"

* Web  > https://registry.platformio.org/search?q=header:html_ui.h

#include "html_ui.h" ^~~~~~~~~~~ compilation terminated. Retrieved .pio/build/lolin_s2_mini/lib5f0/SPI/SPI.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRac.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRrecv.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRsend.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRtimer.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Airton.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Airwell.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRutils.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/IRtext.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Amcor.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Argo.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Arris.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Aiwa.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Bose.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Carrier.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Coolix.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Corona.cpp.o' from cache Retrieved .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Daikin.cpp.o' from cache Retrieved `.pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Delonghi.cpp.o' from cache Compiling .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Denon.cpp.o *** [.pio/build/lolin_s2_mini/src/wled_server.cpp.o] Error 1 Compiling .pio/build/lolin_s2_mini/lib0cf/IRremoteESP8266/ir_Dish.cpp.o ===================================================================================================================== [FAILED] Took 2.68 seconds =====================================================================================================================

Environment Status Duration

lolin_s2_mini FAILED 00:00:02.675`

Is there something I miss ?

Thank you for your help, I would appreciate to test the FW1906 support.

You need to build the encoded HTML first, heres how I build:

npm run build
pio run

@mathojojo
Copy link

You need to build the encoded HTML first, heres how I build:

npm run build
pio run

Oh, so cool.... compiled and writen into my Wemos S2 Mini !!!

Thous commands are not listed in the Compile wiki... I couldn't guess it.

Thank you @deece

@mathojojo
Copy link

No FW1906 listed for the Led Output settings... Is it normal? or hidden ?

version installed : WLED 0.15.0-b1 (build 2403100)

@deece
Copy link
Author

deece commented Mar 12, 2024

No FW1906 listed for the Led Output settings... Is it normal? or hidden ?

version installed : WLED 0.15.0-b1 (build 2403100)

Please show the output of git branch; git remote -v

@mathojojo
Copy link

No FW1906 listed for the Led Output settings... Is it normal? or hidden ?
version installed : WLED 0.15.0-b1 (build 2403100)

Please show the output of git branch; git remote -v

In fact, I was still on Aircoookie git, 0_15 branch.
So now I removed it, and cloned your git 👍
`mathojojo@mathojojo-pc:~/GIT/WLED$ git branch

  • fw1906_0_15
    main
    mathojojo@mathojojo-pc:~/GIT/WLED$ git remote
    origin
    `
    But now, another probelm is that 'Package version 2.1.0+sha.6bf93e9 doesn't satisfy requirements ~2.0.7 based on PackageMetadata'

@deece
Copy link
Author

deece commented Mar 12, 2024

No FW1906 listed for the Led Output settings... Is it normal? or hidden ?
version installed : WLED 0.15.0-b1 (build 2403100)

Please show the output of git branch; git remote -v

In fact, I was still on Aircoookie git, 0_15 branch. So now I removed it, and cloned your git 👍 `mathojojo@mathojojo-pc:~/GIT/WLED$ git branch

* fw1906_0_15
  main
  mathojojo@mathojojo-pc:~/GIT/WLED$ git remote
  origin
  `
  But now, another probelm is that 'Package version 2.1.0+sha.6bf93e9 doesn't satisfy requirements ~2.0.7 based on PackageMetadata'

I just pushed a fix for that

@mathojojo
Copy link

Perfect, I could compile and install again. FW1906 is now in the list.
Thank you for your help @deece, I will probably start to test it tomorrow

@deece
Copy link
Author

deece commented Mar 12, 2024

@blazoncek It kinda works, RGB is fine, but when I switch to the white channel, both WW & CW are lit, and the controls don't shift between them.

@blazoncek
Copy link
Collaborator

I just pushed a fix for that

Next time pull upstream. The fix is incorrect and will break future updates.

when I switch to the white channel, both WW & CW are lit, and the controls don't shift between them.

Please elaborate on this. Switch? How?

@deece
Copy link
Author

deece commented Mar 13, 2024

. Switch? How?

Sorry, on the Solid effect, I turned the Value/Brightness slider down to 0, then turned the White Channel slider to the maximum.

The expected behaviour when manipulating the White Balance slider is to shift the output between the WW & CW emitters, but they instead remain constant regardless of position.

@blazoncek
Copy link
Collaborator

Do not force push!

@mathojojo
Copy link

Hello @deece, I'm actually trying to drive my FW1906 RGB+CTT strip led.

Considering that first cursor is RGB channel brightness, second cursor is White channel brightness, third cursor is White balance.
Is it expected and normal that you can have white cursor and RGB cursor both different of 0 at the same time ??

1/ Only RGB (White Channel brightness at 0)
-> Everything seems to work as expected

2/ Only White (RGB channel brigtness at 0)
-> The brightness cursor has the expected effect.
-> The White Balance doesn't work at all. I can move this cursor from extreme left to extreme right (WW to CW)... both white leds are always at the same level.

Could it be because of my Led settings ?
image
image
image
image

@deece
Copy link
Author

deece commented Mar 14, 2024

@

Hello @deece, I'm actually trying to drive my FW1906 RGB+CTT strip led.

Considering that first cursor is RGB channel brightness, second cursor is White channel brightness, third cursor is White balance. Is it expected and normal that you can have white cursor and RGB cursor both different of 0 at the same time ??

1/ Only RGB (White Channel brightness at 0) -> Everything seems to work as expected

2/ Only White (RGB channel brigtness at 0) -> The brightness cursor has the expected effect. -> The White Balance doesn't work at all. I can move this cursor from extreme left to extreme right (WW to CW)... both white leds are always at the same level.

Could it be because of my Led settings ?

@mathojojo Could you please git checkout c74db95c1430e2998eae99996c01f8b2de5dca9a, rebuild and test from that commit? I've seen the same issue, but I've got a bunch of debug in my codebase and I'm starting to doubt my memory.

@blazoncek
Copy link
Collaborator

@deece the issue might be in this statement: PolyBus::setPixelColor(_busPtr, _iType, pix, c, co, (cctCW<<8) | cctWW);

Try rewriting it into:

PolyBus::setPixelColor(_busPtr, _iType, pix, c, co, ((uint16_t)cctCW<<8) | (uint16_t)cctWW);

@deece
Copy link
Author

deece commented Mar 14, 2024

@deece the issue might be in this statement: PolyBus::setPixelColor(_busPtr, _iType, pix, c, co, (cctCW<<8) | cctWW);

Try rewriting it into:

PolyBus::setPixelColor(_busPtr, _iType, pix, c, co, ((uint16_t)cctCW<<8) | (uint16_t)cctWW);

Thanks, unfortunately, that didn't work.

I added some debug to calculateCCT:

    static void calculateCCT(uint32_t c, uint8_t &ww, uint8_t &cw) {
      uint8_t cct = 0; //0 - full warm white, 255 - full cold white
      uint8_t w = byte(c >> 24);1

      DEBUG_PRINT(F("calculateCCT _cct="));
      DEBUG_PRINT((int)_cct);
      DEBUG_PRINT(F(" w="));
      DEBUG_PRINTLN((int)w);

      if (_cct > -1) {
        if (_cct >= 1900)    cct = (_cct - 1900) >> 5;
        else if (_cct < 256) cct = _cct;
      } else {
        cct = (approximateKelvinFromRGB(c) - 1900) >> 5;
      }

      DEBUG_PRINT(F("revised cct="));
      DEBUG_PRINTLN((int)cct);

      #ifdef WLED_USE_IC_CCT
      ww = w;
      cw = cct;
      #else
      //0 - linear (CCT 127 = 50% warm, 50% cold), 127 - additive CCT blending (CCT 127 = 100% warm, 100% cold)
      if (cct       < _cctBlend) ww = 255;
      else ww = ((255-cct) * 255) / (255 - _cctBlend);

      if ((255-cct) < _cctBlend) cw = 255;
      else                       cw = (cct * 255) / (255 - _cctBlend);


      DEBUG_PRINT(F("Prescale ww="));
      DEBUG_PRINT((int)ww);
      DEBUG_PRINT(F(" cw="));
      DEBUG_PRINTLN((int)cw);

      ww = (w * ww) / 255; //brightness scaling
      cw = (w * cw) / 255;

      DEBUG_PRINT(F("ww="));
      DEBUG_PRINT((int)ww);
      DEBUG_PRINT(F(" cw="));
      DEBUG_PRINTLN((int)cw);
      #endif
    }

Here are the values when varying the white balance slider:
White balance in the middle:

calculateCCT _cct=-1 w=255
revised cct=145
Prescale ww=110 cw=145
ww=110 cw=145

Max warm white:

calculateCCT _cct=-1 w=255
revised cct=145
Prescale ww=110 cw=145
ww=110 cw=145

Max Cool white:

calculateCCT _cct=-1 w=255
revised cct=145
Prescale ww=110 cw=145
ww=110 cw=145

I then enabled "Calculate CCT from RGB" in the LED settings, and it behaves as expected.

Should it be forced on for RGBCCT devices?

@blazoncek
Copy link
Collaborator

No. That means that CCT value is not taken from the UI.
After you change the CCT slider in UI, _cct should reflect that (i.e. be in range of 0-255).

@blazoncek
Copy link
Collaborator

I think I found the issue. If you are using ESP32 disable double buffer and test again.

@mathojojo
Copy link

I will test again as soon as the issue is patched (double buffer disabled) :)

And i was curious about versions of NeoPixelBus :

  • 2.7.6 -> New Feature to support RGB with warmer white AND cooler white LEDs (RgbwwColor & GrbcwxFeature)
  • 2.7.7 -> Rgbww80Color (16 bits per color element, RGB with Warmer White and Cooler White)
  • 2.7.8 (last release) -> Rgbwww support

What version of NPB is wled FW1906_0_15 relying on ? And what is RGBwww ?

Thank you for the hard work, it's cool to see the live progress here !

@blazoncek
Copy link
Collaborator

I will test again as soon as the issue is patched (double buffer disabled) :)

Patched? There is no need to patch to test.

@deece
Copy link
Author

deece commented Mar 14, 2024

I think I found the issue. If you are using ESP32 disable double buffer and test again.

@blazoncek Good sleuthing. I disabled "Use global LED buffer:" in the config, and the strip behaves as expected, with "Calculate CCT from RGB" disabled.

@deece
Copy link
Author

deece commented Mar 14, 2024

I will test again as soon as the issue is patched (double buffer disabled) :)

And i was curious about versions of NeoPixelBus :

* 2.7.6 -> New Feature to support RGB with warmer white AND cooler white LEDs (RgbwwColor & GrbcwxFeature)

* 2.7.7 -> Rgbww80Color (16 bits per color element, RGB with Warmer White and Cooler White)

* 2.7.8 (last release) -> Rgbwww support

What version of NPB is wled FW1906_0_15 relying on ? And what is RGBwww ?

Thank you for the hard work, it's cool to see the live progress here !

From the original PR, the required patch is Makuna/NeoPixelBus@978b62f

@blazoncek
Copy link
Collaborator

@blazoncek Good sleuthing. I disabled "Use global LED buffer:" in the config, and the strip behaves as expected, with "Calculate CCT from RGB" disabled.

The problem is that in line 1218 of FX_fcn.cpp a call BusManager::setSegmentCCT(-1); is made before show() is called.
Unfortunately that breaks CCT as the CCT value is not stored in double buffer. I'll need to revise that.

If you'd move the offending line after the show() you'd still loose per segment CCT (which was @Aircoookie 's invention).

@blazoncek
Copy link
Collaborator

In short: until double buffer can handle CCT this will remain in POC state (draft).

@blazoncek blazoncek marked this pull request as draft March 14, 2024 20:37
@deece
Copy link
Author

deece commented Mar 14, 2024

ok, would you like me to work on that?

@blazoncek
Copy link
Collaborator

ok, would you like me to work on that?

If you feel comfortable, go ahead. I think it shouldn't be too difficult, but I may be wrong as it's been a while since I did buses.

@blazoncek
Copy link
Collaborator

blazoncek commented Mar 14, 2024

Yes, it's easy. I already have it done.
Will push tomorrow after a test.

@blazoncek
Copy link
Collaborator

It is a bit more involved than I first thought.
But I think I have it sorted out.
Unfortunately since I do not have FW1906 I cannot properly test.

@deece
Copy link
Author

deece commented Mar 15, 2024

I'm happy to test, just push or point me at a repo :)

@blazoncek
Copy link
Collaborator

blazoncek commented Mar 15, 2024

While I push modifications later in the evening, try this until then:

  • set ABL to a rather low amperage
  • create 2 segments (must not overlap)
  • set one segment to WW and the other to CW
  • maximize brightness to force ABL to kick in
  • observe strip output. does it preserve selected CCT on segments?

@mathojojo
Copy link

Hello, I just removed all my WLED directory, and git cloned deece's fork again (fw1906_0_15).
I could compile without any problem.

But I don't see any difference with my previuous tests. RGB is OK, but not CCT. Moving the white channel cursor makes the leds brightness increase or decrease as expected. But moving the White Balance cursor doesn't have any effect. Both White Leds are always staying at 50%-50%.

Or should I have switched to another branch ?

- additional fix in hasWhite() & setCCT() & hasCCT()
@blazoncek
Copy link
Collaborator

@deece here you go. It took a bit more time.
I also added a few more comments to explain what's happening.

@mathojojo
Copy link

Ok, don't pay any attention to my last message.... I recloned again, but this time using
git checkout c74db95c1430e2998eae99996c01f8b2de5dca9a
whitch is FW1906 and not FW1906_0_15 if I understand well.

And now, I can confirm that WW and CW seems to behave as expected.

@deece
Copy link
Author

deece commented Mar 18, 2024

@blazoncek With the latest changes, if the white balance slider is altered, no change is visible on the strip, and the slider jumps back to the middle when the mouse button is released.

This should be observable without a strip connected ;)

@blazoncek
Copy link
Collaborator

Slider fixed.

@Suxsem
Copy link

Suxsem commented Mar 18, 2024

Just here to says that I'm very grateful for your work. My entire living room is equipped with this type of strip and it will be only for you if I will be able to use it properly. Long live WLED and its contributors!

@blazoncek
Copy link
Collaborator

You can show support/appreciation by buying me a beer. 😉

@deece
Copy link
Author

deece commented Mar 18, 2024

Slider fixed.

Awesome, I've tested that and confirmed it works as expected, both with & without "global LED buffer".

I've verified that RGB effects work independently of the white channel, so an effect that leaves some LEDs off still shows the white channel at it's selected colour temperature.

Is there anything else you would like me to test?

@blazoncek blazoncek added this to the 0.15.0-alpha candidate milestone Mar 19, 2024
@blazoncek blazoncek linked an issue Mar 19, 2024 that may be closed by this pull request
@blazoncek
Copy link
Collaborator

@Robert-github-com do you have anything to add or can you test as well?

@deece you could add PWM CCT and test it alongside FW1906.

@blazoncek blazoncek marked this pull request as ready for review March 19, 2024 05:17
@deece
Copy link
Author

deece commented Mar 19, 2024

@Robert-github-com do you have anything to add or can you test as well?

@deece you could add PWM CCT and test it alongside FW1906.

Ha! I just ordered these a couple of days ago: https://a.aliexpress.com/_mLlqKbc

It will take a couple of weeks though. I think I have an H801 controller floating around somewhere...

@deece
Copy link
Author

deece commented Mar 20, 2024

@blazoncek I put a tester together on a breadboard and confirmed that PWM RGB+CCT, as well as RGBW works as expected, both with & without "global LED buffer".

@blazoncek blazoncek merged commit dab4dc3 into Aircoookie:0_15 Mar 20, 2024
3 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for FW1906 (introduced in NeoPixelBus 2.7.6)
4 participants