Change DIM LEDs
This commit is contained in:
1 parent
a6b31fe5bf
commit
0d08b06656
2 files changed
+62
-48
No files matched your search
@@ -275,8 +275,9 @@ void setMirroredLED(int i, CRGB color) {
|
||||
// Returns the thermometer gradient color for logical position i.
|
||||
// i = START_LED (4) → blue (cold), i = BASE_LEDS-1 (59) → red (hot).
|
||||
CRGB getThermometerColor(int i) {
|
||||
uint8_t pos = (uint8_t)map(i, START_LED, BASE_LEDS - 1, 0, 255);
|
||||
return blend(CRGB(0, 0, 180), CRGB(180, 0, 0), pos);
|
||||
// Lower half → solid blue, upper half → solid red
|
||||
int midpoint = START_LED + ACTIVE_LEDS / 2; // LED 32
|
||||
return (i < midpoint) ? CRGB(0, 0, 180) : CRGB(180, 0, 0);
|
||||
}
|
||||
|
||||
// Renders the thermometer state onto the LED strips.
|
||||
@@ -291,13 +292,15 @@ void displayTemperature() {
|
||||
if (i < START_LED) {
|
||||
// Bottom 4 LEDs: always off
|
||||
color = CRGB::Black;
|
||||
} else if (i < activeEnd) {
|
||||
// Active (bright): blue→red gradient
|
||||
uint8_t pos = (uint8_t)map(i, START_LED, BASE_LEDS - 1, 0, 255);
|
||||
color = blend(CRGB(0, 0, 180), CRGB(180, 0, 0), pos);
|
||||
color.nscale8(BRIGHT_BRIGHTNESS);
|
||||
} else {
|
||||
// Inactive (dim): solid blue (lower half) or solid red (upper half)
|
||||
color = getThermometerColor(i);
|
||||
if (i < activeEnd) {
|
||||
color.nscale8(BRIGHT_BRIGHTNESS); // active (bright)
|
||||
} else {
|
||||
color.nscale8(DIM_BRIGHTNESS); // inactive (dim gradient still visible)
|
||||
}
|
||||
color.nscale8(DIM_BRIGHTNESS);
|
||||
}
|
||||
setMirroredLED(i, color);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user