1
0
Fork 0

Unify RGB and RGBW commands (#7297)

* Fix unicode in comments

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Remove separate RGBW implementation for a unified function

* Set White to 0 in RGBW LEDs

This is just to get this working, later, proper brightness can be handled elsewhere.

* Use us instead of nanoseconds(?) since it renders correctly on web

* Remove RGBW function from arm/ws2812.h

* Remove RGBW function from arm/ws2812.c

* Formatting changes

* Add doc info
This commit is contained in:
Drashna Jael're 2019-11-09 07:51:39 -08:00 committed by Joel Challis
parent 78205e64a7
commit 60e4921378
8 changed files with 45 additions and 41 deletions

View file

@ -126,6 +126,9 @@ void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1) {
(*led1).r = r;
(*led1).g = g;
(*led1).b = b;
#ifdef RGBW
(*led1).w = 0;
#endif
}
void rgblight_check_config(void) {
@ -514,6 +517,9 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
led[i].r = r;
led[i].g = g;
led[i].b = b;
#ifdef RGBW
led[i].w = 0;
#endif
}
rgblight_set();
}
@ -526,6 +532,9 @@ void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) {
led[index].r = r;
led[index].g = g;
led[index].b = b;
#ifdef RGBW
led[index].w = 0;
#endif
rgblight_set();
}
@ -560,6 +569,9 @@ void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8
led[i].r = r;
led[i].g = g;
led[i].b = b;
#ifdef RGBW
led[i].w = 0;
#endif
}
rgblight_set();
wait_ms(1);
@ -595,6 +607,9 @@ void rgblight_set(void) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
# ifdef RGBW
led[i].w = 0;
# endif
}
}
# ifdef RGBLIGHT_LED_MAP
@ -606,11 +621,7 @@ void rgblight_set(void) {
# else
start_led = led + clipping_start_pos;
# endif
# ifdef RGBW
ws2812_setleds_rgbw(start_led, num_leds);
# else
ws2812_setleds(start_led, num_leds);
# endif
}
#endif
@ -908,6 +919,9 @@ void rgblight_effect_snake(animation_status_t *anim) {
ledp->r = 0;
ledp->g = 0;
ledp->b = 0;
# ifdef RGBW
ledp->w = 0;
# endif
for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {
k = pos + j * increment;
if (k > RGBLED_NUM) {
@ -965,6 +979,9 @@ void rgblight_effect_knight(animation_status_t *anim) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
# ifdef RGBW
led[i].w = 0;
# endif
}
// Determine which LEDs should be lit up
for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {
@ -976,6 +993,9 @@ void rgblight_effect_knight(animation_status_t *anim) {
led[cur].r = 0;
led[cur].g = 0;
led[cur].b = 0;
# ifdef RGBW
led[cur].w = 0;
# endif
}
}
rgblight_set();