WLED
WLED copied to clipboard
Toggle and Brightness in same command won't toggle
What happened?
If you use brigthness and on=t, the LEDs will be off (turned on by brightness and turned of by toggle)
To Reproduce Bug
use this json command {"on":"t", "bri":128}
Expected Behavior
brightness is set to 128 LEDs on state is toggled, depending on their former power state
Install Method
Binary from WLED.me
What version of WLED?
WLED 0.13.0-b6 (2112080)
Which microcontroller/board are you seeing the problem on?
ESP32
Relevant log/trace output
No response
Anything else?
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Could you double check the version you are using . WLED 0.13.0-b6 is the sound reactive fork ?
Could you double check the version you are using . WLED 0.13.0-b6 is the sound reactive fork ?
The error is confirmed in source. The solution is something like this:
uint8_t tmpBri = bri;
getVal(root["bri"], &tmpBri);
if (root["on"].isNull()) {
if ((onBefore && tmpBri==0) || (!onBefore && tmpBri>0)) toggleOnOff();
bri = tmpBri;
} else {
bool on = root["on"] | onBefore;
if (on != onBefore || (root["on"].is<const char*>() && root["on"].as<const char*>()[0] == 't')) {
toggleOnOff();
// a hack is needed after toggleOnOf()
if (!root["bri"].isNull()) {
if (bri==0) briLast = tmpBri;
else bri = tmpBri;
}
}
}
We are trying to use an MCU for control as a simple smart switch without HA .But turning off received brightness will not work ( unit will not receive on /off ) . I am assuming that is the same case above as ON/OFF and brightness is joined
Fixed in #2737