mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-01 21:42:05 +00:00
quantum/rgblkght.c add animation sync for split keyboard
This commit is contained in:
parent
ea1c2e2415
commit
1d212db88c
@ -39,10 +39,12 @@
|
||||
#define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE
|
||||
#define RGBLIGHT_SPLIT_SET_CHANGE_HSVS rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_HSVS
|
||||
#define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_TIMER
|
||||
#define RGBLIGHT_SPLIT_ANIMATION_TICK rgblight_status.change_flags |= RGBLIGHT_STATUS_ANIMATION_TICK
|
||||
#else
|
||||
#define RGBLIGHT_SPLIT_SET_CHANGE_MODE
|
||||
#define RGBLIGHT_SPLIT_SET_CHANGE_HSVS
|
||||
#define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE
|
||||
#define RGBLIGHT_SPLIT_ANIMATION_TICK
|
||||
#endif
|
||||
|
||||
#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_ ## sym,
|
||||
@ -740,6 +742,9 @@ void rgblight_update_sync(rgblight_config_t *config, rgblight_status_t *status,
|
||||
rgblight_timer_disable();
|
||||
}
|
||||
}
|
||||
if (status->change_flags & RGBLIGHT_STATUS_ANIMATION_TICK) {
|
||||
animation_status.pos = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -858,8 +863,12 @@ void rgblight_task(void) {
|
||||
}
|
||||
#endif
|
||||
if (timer_elapsed(animation_status.last_timer) >= interval_time) {
|
||||
animation_status.last_timer += interval_time;
|
||||
effect_func(&animation_status);
|
||||
uint8_t old_pos = animation_status.pos;
|
||||
animation_status.last_timer += interval_time;
|
||||
effect_func(&animation_status);
|
||||
if ( animation_status.pos == 0 && old_pos != animation_status.pos ) {
|
||||
RGBLIGHT_SPLIT_ANIMATION_TICK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,7 @@ typedef struct _rgblight_status_t {
|
||||
#define RGBLIGHT_STATUS_CHANGE_MODE (1<<0)
|
||||
#define RGBLIGHT_STATUS_CHANGE_HSVS (1<<1)
|
||||
#define RGBLIGHT_STATUS_CHANGE_TIMER (1<<2)
|
||||
#define RGBLIGHT_STATUS_ANIMATION_TICK (1<<3)
|
||||
|
||||
extern rgblight_config_t rgblight_config;
|
||||
extern rgblight_status_t rgblight_status;
|
||||
|
Loading…
Reference in New Issue
Block a user