Closed lynes1 closed 3 years ago
So i found out how to fix it, but i had to overwrite the lib by going into the file node_modules\magic-home\lib\EffectInterface.js
and adding the function at line 107:
setColorAndWarmWhite(red, green, blue, warmWhite) {
red = clamp(red, 0, 255);
green = clamp(green, 0, 255);
blue = clamp(blue, 0, 255);
let mask = (this._options.apply_masks) ? 0xF0 : 0;
let cmd_buf;
if (this._options.cold_white_support) {
cmd_buf = Buffer.from([ 0x31, red, green, blue, warmWhite, 0, mask, 0x0f ]);
} else {
cmd_buf = Buffer.from([ 0x31, red, green, blue, warmWhite, mask, 0x0f ]);
}
this._sendCommand(cmd_buf);
}
I hope you will patch this soon so i dont have to edit the file each time i install the package new
Yes you are correct, changing the warm white value (and also the cold white value by extension) is currently not supported in the EffectInterface
. The EffectInterface
is actually missing quite a lot of additions that have been made to the main Control
class, since I was under the assumption that no one was actually using it. I even thought about removing it entirely, but since you're telling me that you actually do use it, I'm now thinking about completely reworking the internals and finally adding all those missing features. Give me a few days, I will work on it once I find the time.
Thank you.
Okay, I started work on this now. I haven't written any documentation yet, but if you want to play around with it already, you can take a look at example/async_effect_test.js.
Basically, the new system uses async-await to make the control flow and synchronization much easier. You still provide an interval function which gets called repeatedly, but you can specify the entire effect in one "line" instead of using variables to keep track of where you are.
I'm probably going to finish this in the next couple of days (more testing and documentation), but the code should work and be feature complete right now, so let me know what you think in case you get around to it.
Version 2.7.0 is now live with the new AsyncEffectInterface.
Not only does this now have all the features of the main Control class, the interface is also much nicer to work with, because you can do everything asynchronously.
I want to change the amount of the warm light on my Ledstrip while using effectMode, but i getting the following error. Even though
this.setColor(r,g,b)
works flawlessly.Also the normal Mode works flawlessly with
this.setColorAndWarmWhite(r,g,b)