RGBLight: Improve RGB Test animation (#24477)

This commit is contained in:
Ryan 2024-10-24 15:27:24 +11:00 committed by GitHub
parent 11db924a31
commit bb9625ba55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1342,29 +1342,13 @@ void rgblight_effect_christmas(animation_status_t *anim) {
__attribute__((weak)) const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024}; __attribute__((weak)) const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024};
void rgblight_effect_rgbtest(animation_status_t *anim) { void rgblight_effect_rgbtest(animation_status_t *anim) {
static uint8_t maxval = 0; uint8_t val = rgblight_get_val();
uint8_t g;
uint8_t r;
uint8_t b;
if (maxval == 0) { uint8_t r = anim->pos & 1 ? val : 0;
rgb_t rgb = hsv_to_rgb((hsv_t){0, 255, RGBLIGHT_LIMIT_VAL}); uint8_t g = anim->pos & 2 ? val : 0;
maxval = rgb.r; uint8_t b = anim->pos & 4 ? val : 0;
}
g = r = b = 0;
switch (anim->pos) {
case 0:
r = maxval;
break;
case 1:
g = maxval;
break;
case 2:
b = maxval;
break;
}
rgblight_setrgb(r, g, b); rgblight_setrgb(r, g, b);
anim->pos = (anim->pos + 1) % 3; anim->pos = (anim->pos + 1) % 8;
} }
#endif #endif