colorKtoRGB optimization and bugfix

* bug: logf(temp-10) result becomes NaN when kelvin < 1200
* bug (RISC-V only): parameter of Bus::setCCT must be signed, to avoid undefined behaviour
* minor optimization by replacing constrain() with min(max())
This commit is contained in:
Frank
2025-10-20 21:53:37 +02:00
parent 8067f1f70c
commit 6e8ab94ee9
2 changed files with 18 additions and 6 deletions

View File

@@ -175,7 +175,7 @@ class Bus {
_type == TYPE_ANALOG_2CH || _type == TYPE_ANALOG_5CH) return true;
return false;
}
static void setCCT(uint16_t cct) {
static void setCCT(int16_t cct) { // WLEDMM bugfix: parameter must be signed, otherwise "-1" becomes 65535 --> undefined behaviour on RISC-V
_cct = cct;
}
static void setCCTBlend(uint8_t b) {