diff --git a/quantum/rgblight.c b/quantum/rgblight.c index b403317f5fe..72bb4ac252b 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -158,6 +158,25 @@ void rgblight_check_config(void) { /* Overwrite with individual code of keyboard. */ __attribute__ ((weak)) void rgblight_update_hook(rgblight_config_t *config, rgblight_status_t *status, bool write_to_eeprom) { + static rgblight_config_t config_old = {}; + rgblight_status_t status_old = {}; + + if( config != NULL ) { + if( config_old.enable != config->enable || config_old.mode != config->mode ) { + rgblight_status.change_mode = 1; + } + if( config_old.hue != config->hue || config_old.sat != config->sat || + config_old.val != config->val || config_old.speed != config->speed ) { + rgblight_status.change_hsvs = 1; + } + config_old = *config; + } + if( status != NULL ) { + if( status_old.timer_enabled != status->timer_enabled ) { + rgblight_status.change_mode = 1; + } + status_old.timer_enabled = status->timer_enabled; + } } /* for split keyboard slave side */ @@ -510,13 +529,13 @@ void rgblight_decrease_val(void) { } void rgblight_increase_speed(void) { rgblight_config.speed = increment( rgblight_config.speed, 1, 0, 3 ); - rgblight_update_hook(NULL, &rgblight_status, false); + rgblight_update_hook(&rgblight_config, NULL, true); eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this } void rgblight_decrease_speed(void) { rgblight_config.speed = decrement( rgblight_config.speed, 1, 0, 3 ); - rgblight_update_hook(NULL, &rgblight_status, false); + rgblight_update_hook(&rgblight_config, NULL, true); eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this } diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 827bbef4729..0228ae4131c 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -165,6 +165,8 @@ typedef union { typedef struct _rgblight_status_t { bool timer_enabled; + bool change_mode; // change mode or enable + bool change_hsvs; // change hue, sat, val or speed // TODO: add animation syncronizing // (with integrate timer processing.) } rgblight_status_t;