fix mode_base_table[] and snake effect

pull/5020/head
mtei 6 years ago
parent 1d212db88c
commit 9fff20ebb1

@ -64,6 +64,7 @@ static uint8_t static_effect_table [] = {
#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_ ## msym, #define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_ ## msym,
#define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_ ## msym, #define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_ ## msym,
static uint8_t mode_base_table [] = { static uint8_t mode_base_table [] = {
0, // RGBLIGHT_MODE_zero
#include "rgblight.h" #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) { if (rgblight_config.enable) {
rgblight_status.base_mode = mode_base_table[rgblight_config.mode]; rgblight_status.base_mode = mode_base_table[rgblight_config.mode];
#ifdef RGBLIGHT_USE_TIMER #ifdef RGBLIGHT_USE_TIMER
animation_status.pos = 0; animation_status.pos16 = 0;
#endif #endif
if (rgblight_config.mode == RGBLIGHT_MODE_STATIC_LIGHT) { if (rgblight_config.mode == RGBLIGHT_MODE_STATIC_LIGHT) {
// same static color // 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) { if (status->change_flags & RGBLIGHT_STATUS_ANIMATION_TICK) {
animation_status.pos = 0; animation_status.pos16 = 0;
} }
#endif #endif
} }

@ -265,7 +265,8 @@ typedef struct _animation_status_t {
uint16_t last_timer; uint16_t last_timer;
uint8_t delta; /* mode - base_mode */ uint8_t delta; /* mode - base_mode */
union { union {
uint16_t pos; uint16_t pos16;
uint8_t pos;
uint16_t current_hue; uint16_t current_hue;
uint16_t current_offset; uint16_t current_offset;
int8_t low_bound; int8_t low_bound;

Loading…
Cancel
Save