summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtei <2170248+mtei@users.noreply.github.com>2018-10-18 18:30:48 +0200
committerDrashna Jaelre <drashna@live.com>2018-10-18 22:52:41 +0200
commitdb03b76910c486cd27c175ae85efeeaa183b1c98 (patch)
treedb2f07f78dc69f61a77bc27835272941890c9339
parent14bdd5ed2a808075130bac26fc72dcb9b158ae2c (diff)
downloadqmk_firmware-db03b76910c486cd27c175ae85efeeaa183b1c98.tar.gz
qmk_firmware-db03b76910c486cd27c175ae85efeeaa183b1c98.tar.xz
optimize rgblight_effect_alternating(void)
rgblight_effect_alternating (void) calls rgblight_sethsv_at () RGBLED_NUM times. As a result, rgblight_set () is called RGBLED_NUM + 1 times. This is wasteful processing.
-rw-r--r--quantum/rgblight.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 03f77cc80..94e9c0a3b 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -860,13 +860,13 @@ void rgblight_effect_alternating(void){
last_timer = timer_read();
for(int i = 0; i<RGBLED_NUM; i++){
- if(i<RGBLED_NUM/2 && pos){
- rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, i);
- }else if (i>=RGBLED_NUM/2 && !pos){
- rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, i);
- }else{
- rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, 0, i);
- }
+ if(i<RGBLED_NUM/2 && pos){
+ sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
+ }else if (i>=RGBLED_NUM/2 && !pos){
+ sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
+ }else{
+ sethsv(rgblight_config.hue, rgblight_config.sat, 0, (LED_TYPE *)&led[i]);
+ }
}
rgblight_set();
pos = (pos + 1) % 2;