From 9fff20ebb1946ffa816e3e7e4afcd1106293ac4c Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Sun, 10 Mar 2019 18:52:08 +0900 Subject: [PATCH] fix mode_base_table[] and snake effect --- quantum/rgblight.c | 5 +++-- quantum/rgblight.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/quantum/rgblight.c b/quantum/rgblight.c index b14c464b586..2de6b00df0d 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -64,6 +64,7 @@ static uint8_t static_effect_table [] = { #define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_ ## msym, #define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_ ## msym, static uint8_t mode_base_table [] = { + 0, // RGBLIGHT_MODE_zero #include "rgblight.h" }; @@ -538,7 +539,7 @@ void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool if (rgblight_config.enable) { rgblight_status.base_mode = mode_base_table[rgblight_config.mode]; #ifdef RGBLIGHT_USE_TIMER - animation_status.pos = 0; + animation_status.pos16 = 0; #endif if (rgblight_config.mode == RGBLIGHT_MODE_STATIC_LIGHT) { // same static color @@ -743,7 +744,7 @@ void rgblight_update_sync(rgblight_config_t *config, rgblight_status_t *status, } } if (status->change_flags & RGBLIGHT_STATUS_ANIMATION_TICK) { - animation_status.pos = 0; + animation_status.pos16 = 0; } #endif } diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 41f082f8c69..4414bf169c5 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -265,7 +265,8 @@ typedef struct _animation_status_t { uint16_t last_timer; uint8_t delta; /* mode - base_mode */ union { - uint16_t pos; + uint16_t pos16; + uint8_t pos; uint16_t current_hue; uint16_t current_offset; int8_t low_bound;