|
@@ -69,6 +69,44 @@ void LEDLights::setup() {
|
69
|
69
|
#if ENABLED(RGBW_LED)
|
70
|
70
|
if (PWM_PIN(RGB_LED_W_PIN)) SET_PWM(RGB_LED_W_PIN); else SET_OUTPUT(RGB_LED_W_PIN);
|
71
|
71
|
#endif
|
|
72
|
+
|
|
73
|
+ #if ENABLED(RGB_STARTUP_TEST)
|
|
74
|
+ int8_t led_pin_count = 0;
|
|
75
|
+ if (PWM_PIN(RGB_LED_R_PIN) && PWM_PIN(RGB_LED_G_PIN) && PWM_PIN(RGB_LED_B_PIN)) led_pin_count = 3;
|
|
76
|
+ #if ENABLED(RGBW_LED)
|
|
77
|
+ if (PWM_PIN(RGB_LED_W_PIN) && led_pin_count) led_pin_count++;
|
|
78
|
+ #endif
|
|
79
|
+ // Startup animation
|
|
80
|
+ if (led_pin_count) {
|
|
81
|
+ // blackout
|
|
82
|
+ if (PWM_PIN(RGB_LED_R_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_R_PIN), 0); else WRITE(RGB_LED_R_PIN, LOW);
|
|
83
|
+ if (PWM_PIN(RGB_LED_G_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_G_PIN), 0); else WRITE(RGB_LED_G_PIN, LOW);
|
|
84
|
+ if (PWM_PIN(RGB_LED_B_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_B_PIN), 0); else WRITE(RGB_LED_B_PIN, LOW);
|
|
85
|
+ #if ENABLED(RGBW_LED)
|
|
86
|
+ if (PWM_PIN(RGB_LED_W_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_W_PIN), 0);
|
|
87
|
+ else WRITE(RGB_LED_W_PIN, LOW);
|
|
88
|
+ #endif
|
|
89
|
+ delay(200);
|
|
90
|
+
|
|
91
|
+ LOOP_L_N(i, led_pin_count) {
|
|
92
|
+ LOOP_LE_N(b, 200) {
|
|
93
|
+ const uint16_t led_pwm = b <= 100 ? b : 200 - b;
|
|
94
|
+ if (i == 0 && PWM_PIN(RGB_LED_R_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_R_PIN), led_pwm); else WRITE(RGB_LED_R_PIN, b < 100 ? HIGH : LOW);
|
|
95
|
+ if (i == 1 && PWM_PIN(RGB_LED_G_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_G_PIN), led_pwm); else WRITE(RGB_LED_G_PIN, b < 100 ? HIGH : LOW);
|
|
96
|
+ if (i == 2 && PWM_PIN(RGB_LED_B_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_B_PIN), led_pwm); else WRITE(RGB_LED_B_PIN, b < 100 ? HIGH : LOW);
|
|
97
|
+ #if ENABLED(RGBW_LED)
|
|
98
|
+ if (i == 3){
|
|
99
|
+ if (PWM_PIN(RGB_LED_W_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_W_PIN), led_pwm);
|
|
100
|
+ else WRITE(RGB_LED_W_PIN, b < 100 ? HIGH : LOW);
|
|
101
|
+ delay(RGB_STARTUP_TEST_INNER_MS);//More slowing for ending
|
|
102
|
+ }
|
|
103
|
+ #endif
|
|
104
|
+ delay(RGB_STARTUP_TEST_INNER_MS);
|
|
105
|
+ }
|
|
106
|
+ }
|
|
107
|
+ delay(500);
|
|
108
|
+ }
|
|
109
|
+ #endif // RGB_STARTUP_TEST
|
72
|
110
|
#endif
|
73
|
111
|
TERN_(NEOPIXEL_LED, neo.init());
|
74
|
112
|
TERN_(PCA9533, PCA9533_init());
|