diff options
| author | Ryan <fauxpark@gmail.com> | 2024-10-24 15:27:24 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-24 15:27:24 +1100 |
| commit | bb9625ba550dbe3bbd2967f488c4ee92815637f0 (patch) | |
| tree | 9275276b7ba40626a4e97658c92ca210b5a5f29e /quantum | |
| parent | 11db924a31de6f075fd9d9fc54bb0ab89fe7ad50 (diff) | |
RGBLight: Improve RGB Test animation (#24477)
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/rgblight/rgblight.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index 6426ccf2c8..ddccc9bae3 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c | |||
| @@ -1342,29 +1342,13 @@ void rgblight_effect_christmas(animation_status_t *anim) { | |||
| 1342 | __attribute__((weak)) const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024}; | 1342 | __attribute__((weak)) const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024}; |
| 1343 | 1343 | ||
| 1344 | void rgblight_effect_rgbtest(animation_status_t *anim) { | 1344 | void rgblight_effect_rgbtest(animation_status_t *anim) { |
| 1345 | static uint8_t maxval = 0; | 1345 | uint8_t val = rgblight_get_val(); |
| 1346 | uint8_t g; | 1346 | |
| 1347 | uint8_t r; | 1347 | uint8_t r = anim->pos & 1 ? val : 0; |
| 1348 | uint8_t b; | 1348 | uint8_t g = anim->pos & 2 ? val : 0; |
| 1349 | 1349 | uint8_t b = anim->pos & 4 ? val : 0; | |
| 1350 | if (maxval == 0) { | ||
| 1351 | rgb_t rgb = hsv_to_rgb((hsv_t){0, 255, RGBLIGHT_LIMIT_VAL}); | ||
| 1352 | maxval = rgb.r; | ||
| 1353 | } | ||
| 1354 | g = r = b = 0; | ||
| 1355 | switch (anim->pos) { | ||
| 1356 | case 0: | ||
| 1357 | r = maxval; | ||
| 1358 | break; | ||
| 1359 | case 1: | ||
| 1360 | g = maxval; | ||
| 1361 | break; | ||
| 1362 | case 2: | ||
| 1363 | b = maxval; | ||
| 1364 | break; | ||
| 1365 | } | ||
| 1366 | rgblight_setrgb(r, g, b); | 1350 | rgblight_setrgb(r, g, b); |
| 1367 | anim->pos = (anim->pos + 1) % 3; | 1351 | anim->pos = (anim->pos + 1) % 8; |
| 1368 | } | 1352 | } |
| 1369 | #endif | 1353 | #endif |
| 1370 | 1354 | ||
