Added alternating led underglow pattern (#3498)
* added alternating led pattern * added alternating with rgblight_config values * removed my commentsdaktil_thumb_popravljen
parent
f1513c3ad2
commit
595f3cbe5b
|
@ -247,7 +247,7 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
|
||||||
rgblight_timer_disable();
|
rgblight_timer_disable();
|
||||||
#endif
|
#endif
|
||||||
} else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) ||
|
} else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) ||
|
||||||
rgblight_config.mode == 35 ) {
|
rgblight_config.mode == 35 || rgblight_config.mode == 36) {
|
||||||
// MODE 2-5, breathing
|
// MODE 2-5, breathing
|
||||||
// MODE 6-8, rainbow mood
|
// MODE 6-8, rainbow mood
|
||||||
// MODE 9-14, rainbow swirl
|
// MODE 9-14, rainbow swirl
|
||||||
|
@ -255,6 +255,7 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
|
||||||
// MODE 21-23, knight
|
// MODE 21-23, knight
|
||||||
// MODE 24, xmas
|
// MODE 24, xmas
|
||||||
// MODE 35 RGB test
|
// MODE 35 RGB test
|
||||||
|
// MODE 36, alterating
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ANIMATIONS
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
rgblight_timer_enable();
|
rgblight_timer_enable();
|
||||||
|
@ -591,6 +592,8 @@ void rgblight_task(void) {
|
||||||
} else if (rgblight_config.mode == 35) {
|
} else if (rgblight_config.mode == 35) {
|
||||||
// mode = 35, RGB test
|
// mode = 35, RGB test
|
||||||
rgblight_effect_rgbtest();
|
rgblight_effect_rgbtest();
|
||||||
|
} else if (rgblight_config.mode == 36){
|
||||||
|
rgblight_effect_alternating();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -772,4 +775,25 @@ void rgblight_effect_rgbtest(void) {
|
||||||
pos = (pos + 1) % 3;
|
pos = (pos + 1) % 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rgblight_effect_alternating(void){
|
||||||
|
static uint16_t last_timer = 0;
|
||||||
|
static uint16_t pos = 0;
|
||||||
|
if (timer_elapsed(last_timer) < 500) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rgblight_set();
|
||||||
|
pos = (pos + 1) % 2;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* RGBLIGHT_ANIMATIONS */
|
#endif /* RGBLIGHT_ANIMATIONS */
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#define RGBLIGHT_H
|
#define RGBLIGHT_H
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ANIMATIONS
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
#define RGBLIGHT_MODES 35
|
#define RGBLIGHT_MODES 36
|
||||||
#else
|
#else
|
||||||
#define RGBLIGHT_MODES 1
|
#define RGBLIGHT_MODES 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -166,5 +166,6 @@ void rgblight_effect_snake(uint8_t interval);
|
||||||
void rgblight_effect_knight(uint8_t interval);
|
void rgblight_effect_knight(uint8_t interval);
|
||||||
void rgblight_effect_christmas(void);
|
void rgblight_effect_christmas(void);
|
||||||
void rgblight_effect_rgbtest(void);
|
void rgblight_effect_rgbtest(void);
|
||||||
|
void rgblight_effect_alternating(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue