|
@@ -28,10 +28,6 @@
|
28
|
28
|
|
29
|
29
|
CaseLight caselight;
|
30
|
30
|
|
31
|
|
-#if CASE_LIGHT_IS_COLOR_LED
|
32
|
|
- #include "leds/leds.h"
|
33
|
|
-#endif
|
34
|
|
-
|
35
|
31
|
#if CASELIGHT_USES_BRIGHTNESS && !defined(CASE_LIGHT_DEFAULT_BRIGHTNESS)
|
36
|
32
|
#define CASE_LIGHT_DEFAULT_BRIGHTNESS 0 // For use on PWM pin as non-PWM just sets a default
|
37
|
33
|
#endif
|
|
@@ -43,13 +39,9 @@ CaseLight caselight;
|
43
|
39
|
bool CaseLight::on = CASE_LIGHT_DEFAULT_ON;
|
44
|
40
|
|
45
|
41
|
#if CASE_LIGHT_IS_COLOR_LED
|
46
|
|
- LEDColor CaseLight::color =
|
47
|
|
- #ifdef CASE_LIGHT_DEFAULT_COLOR
|
48
|
|
- CASE_LIGHT_DEFAULT_COLOR
|
49
|
|
- #else
|
50
|
|
- { 255, 255, 255, 255 }
|
51
|
|
- #endif
|
52
|
|
- ;
|
|
42
|
+ #include "leds/leds.h"
|
|
43
|
+ constexpr uint8_t init_case_light[] = CASE_LIGHT_DEFAULT_COLOR;
|
|
44
|
+ LEDColor CaseLight::color = { init_case_light[0], init_case_light[1], init_case_light[2], TERN_(HAS_WHITE_LED, init_case_light[3]) };
|
53
|
45
|
#endif
|
54
|
46
|
|
55
|
47
|
#ifndef INVERT_CASE_LIGHT
|
|
@@ -73,14 +65,12 @@ void CaseLight::update(const bool sflag) {
|
73
|
65
|
brightness = brightness_sav; // Restore last brightness for M355 S1
|
74
|
66
|
|
75
|
67
|
const uint8_t i = on ? brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
|
|
68
|
+ UNUSED(n10ct);
|
76
|
69
|
#endif
|
77
|
70
|
|
78
|
71
|
#if CASE_LIGHT_IS_COLOR_LED
|
79
|
72
|
|
80
|
|
- leds.set_color(
|
81
|
|
- MakeLEDColor(color.r, color.g, color.b, color.w, n10ct),
|
82
|
|
- false
|
83
|
|
- );
|
|
73
|
+ leds.set_color(MakeLEDColor(color.r, color.g, color.b, color.w, n10ct));
|
84
|
74
|
|
85
|
75
|
#else // !CASE_LIGHT_IS_COLOR_LED
|
86
|
76
|
|