Minor tweaks.

This commit is contained in:
Blaz Kristan
2024-06-30 10:44:25 +02:00
parent b8b11880b0
commit 693bf4816b
7 changed files with 25 additions and 23 deletions

View File

@@ -208,13 +208,13 @@ CRGBPalette16 generateRandomPalette(void) //generate fully random palette
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
{
float h = ((float)hue)/65535.0f;
float h = ((float)hue)/10922.5f; // hue*6/65535
float s = ((float)sat)/255.0f;
int i = floorf(h*6);
float f = h * 6.0f - i;
int i = int(h);
float f = h - i;
int p = int(255.0f * (1.0f-s));
int q = int(255.0f * (1.0f-f*s));
int t = int(255.0f * (1.0f-(1.0f-f)*s));
int q = int(255.0f * (1.0f-s*f));
int t = int(255.0f * (1.0f-s*(1.0f-f)));
p = constrain(p, 0, 255);
q = constrain(q, 0, 255);
t = constrain(t, 0, 255);