X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=quantum%2Frgb_matrix.c;h=f170cfc1b7504fa15d94a932c6f5dafa760c2241;hb=e2dfb787da2a2ba88e0e074b396a2b988e10eccf;hp=0728e2431fe63bcf036eec6d7e8fd2472765d8cd;hpb=c98247e3dd2958bd2d8969dc75170e7e2757b895;p=qmk_firmware.git diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 0728e2431..f170cfc1b 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -26,24 +26,37 @@ #include "lib/lib8tion/lib8tion.h" -#include "rgb_matrix_animations/solid_color_anim.h" -#include "rgb_matrix_animations/alpha_mods_anim.h" -#include "rgb_matrix_animations/dual_beacon_anim.h" -#include "rgb_matrix_animations/gradient_up_down_anim.h" -#include "rgb_matrix_animations/raindrops_anim.h" -#include "rgb_matrix_animations/cycle_all_anim.h" -#include "rgb_matrix_animations/cycle_left_right_anim.h" -#include "rgb_matrix_animations/cycle_up_down_anim.h" -#include "rgb_matrix_animations/rainbow_beacon_anim.h" -#include "rgb_matrix_animations/rainbow_pinwheels_anim.h" -#include "rgb_matrix_animations/rainbow_moving_chevron_anim.h" -#include "rgb_matrix_animations/jellybean_raindrops_anim.h" -#include "rgb_matrix_animations/digital_rain_anim.h" -#include "rgb_matrix_animations/solid_reactive_simple_anim.h" -#include "rgb_matrix_animations/solid_reactive_anim.h" -#include "rgb_matrix_animations/splash_anim.h" -#include "rgb_matrix_animations/solid_splash_anim.h" -#include "rgb_matrix_animations/breathing_anim.h" +#ifndef RGB_MATRIX_CENTER + const point_t k_rgb_matrix_center = { 112, 32 }; +#else + const point_t k_rgb_matrix_center = RGB_MATRIX_CENTER; +#endif + +// Generic effect runners +#include "rgb_matrix_runners/effect_runner_dx_dy_dist.h" +#include "rgb_matrix_runners/effect_runner_dx_dy.h" +#include "rgb_matrix_runners/effect_runner_i.h" +#include "rgb_matrix_runners/effect_runner_sin_cos_i.h" +#include "rgb_matrix_runners/effect_runner_reactive.h" +#include "rgb_matrix_runners/effect_runner_reactive_splash.h" + +// ------------------------------------------ +// -----Begin rgb effect includes macros----- +#define RGB_MATRIX_EFFECT(name) +#define RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "rgb_matrix_animations/rgb_matrix_effects.inc" +#ifdef RGB_MATRIX_CUSTOM_KB + #include "rgb_matrix_kb.inc" +#endif +#ifdef RGB_MATRIX_CUSTOM_USER + #include "rgb_matrix_user.inc" +#endif + +#undef RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#undef RGB_MATRIX_EFFECT +// -----End rgb effect includes macros------- +// ------------------------------------------ #ifndef RGB_DISABLE_AFTER_TIMEOUT #define RGB_DISABLE_AFTER_TIMEOUT 0 @@ -53,10 +66,6 @@ #define RGB_DISABLE_WHEN_USB_SUSPENDED false #endif -#ifndef EECONFIG_RGB_MATRIX - #define EECONFIG_RGB_MATRIX EECONFIG_RGBLIGHT -#endif - #if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX #undef RGB_MATRIX_MAXIMUM_BRIGHTNESS #define RGB_MATRIX_MAXIMUM_BRIGHTNESS UINT8_MAX @@ -78,6 +87,15 @@ #define RGB_MATRIX_SPD_STEP 16 #endif +#if !defined(RGB_MATRIX_STARTUP_MODE) + #ifndef DISABLE_RGB_MATRIX_CYCLE_ALL + #define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT + #else + // fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace + #define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR + #endif +#endif + bool g_suspend_state = false; rgb_config_t rgb_matrix_config; @@ -85,54 +103,53 @@ rgb_config_t rgb_matrix_config; rgb_counters_t g_rgb_counters; static uint32_t rgb_counters_buffer; +#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS +uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}}; +#endif + #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED last_hit_t g_last_hit_tracker; static last_hit_t last_hit_buffer; #endif // RGB_MATRIX_KEYREACTIVE_ENABLED -uint32_t eeconfig_read_rgb_matrix(void) { - return eeprom_read_dword(EECONFIG_RGB_MATRIX); +void eeconfig_read_rgb_matrix(void) { + eeprom_read_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); } -void eeconfig_update_rgb_matrix(uint32_t val) { - eeprom_update_dword(EECONFIG_RGB_MATRIX, val); +void eeconfig_update_rgb_matrix(void) { + eeprom_update_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); } void eeconfig_update_rgb_matrix_default(void) { dprintf("eeconfig_update_rgb_matrix_default\n"); rgb_matrix_config.enable = 1; -#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL - rgb_matrix_config.mode = RGB_MATRIX_CYCLE_LEFT_RIGHT; -#else - // fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace - rgb_matrix_config.mode = RGB_MATRIX_SOLID_COLOR; -#endif - rgb_matrix_config.hue = 0; - rgb_matrix_config.sat = UINT8_MAX; - rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS; + rgb_matrix_config.mode = RGB_MATRIX_STARTUP_MODE; + rgb_matrix_config.hsv = (HSV){ 0, UINT8_MAX, RGB_MATRIX_MAXIMUM_BRIGHTNESS }; rgb_matrix_config.speed = UINT8_MAX / 2; - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + eeconfig_update_rgb_matrix(); } void eeconfig_debug_rgb_matrix(void) { dprintf("rgb_matrix_config eprom\n"); dprintf("rgb_matrix_config.enable = %d\n", rgb_matrix_config.enable); dprintf("rgb_matrix_config.mode = %d\n", rgb_matrix_config.mode); - dprintf("rgb_matrix_config.hue = %d\n", rgb_matrix_config.hue); - dprintf("rgb_matrix_config.sat = %d\n", rgb_matrix_config.sat); - dprintf("rgb_matrix_config.val = %d\n", rgb_matrix_config.val); + dprintf("rgb_matrix_config.hsv.h = %d\n", rgb_matrix_config.hsv.h); + dprintf("rgb_matrix_config.hsv.s = %d\n", rgb_matrix_config.hsv.s); + dprintf("rgb_matrix_config.hsv.v = %d\n", rgb_matrix_config.hsv.v); dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed); } +__attribute__ ((weak)) +uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { + return 0; +} + uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) { - // TODO: This is kinda expensive, fix this soonish - uint8_t led_count = 0; - for (uint8_t i = 0; i < DRIVER_LED_TOTAL && led_count < LED_HITS_TO_REMEMBER; i++) { - matrix_co_t matrix_co = g_rgb_leds[i].matrix_co; - if (row == matrix_co.row && column == matrix_co.col) { - led_i[led_count] = i; - led_count++; - } + uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i); + uint8_t led_index = g_led_config.matrix_co[row][column]; + if (led_index != NO_LED) { + led_i[led_count] = led_index; + led_count++; } return led_count; } @@ -176,13 +193,20 @@ bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { for(uint8_t i = 0; i < led_count; i++) { uint8_t index = last_hit_buffer.count; - last_hit_buffer.x[index] = g_rgb_leds[led[i]].point.x; - last_hit_buffer.y[index] = g_rgb_leds[led[i]].point.y; + last_hit_buffer.x[index] = g_led_config.point[led[i]].x; + last_hit_buffer.y[index] = g_led_config.point[led[i]].y; last_hit_buffer.index[index] = led[i]; last_hit_buffer.tick[index] = 0; last_hit_buffer.count++; } #endif // RGB_MATRIX_KEYREACTIVE_ENABLED + +#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) + if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) { + process_rgb_matrix_typing_heatmap(record); + } +#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) + return true; } @@ -225,7 +249,7 @@ static bool rgb_matrix_none(effect_params_t* params) { static uint8_t rgb_last_enable = UINT8_MAX; static uint8_t rgb_last_effect = UINT8_MAX; -static effect_params_t rgb_effect_params = { 0, 0 }; +static effect_params_t rgb_effect_params = { 0, 0xFF }; static rgb_task_states rgb_task_state = SYNCING; static void rgb_task_timers(void) { @@ -284,106 +308,30 @@ static void rgb_task_render(uint8_t effect) { rendering = rgb_matrix_none(&rgb_effect_params); break; - case RGB_MATRIX_SOLID_COLOR: - rendering = rgb_matrix_solid_color(&rgb_effect_params); // Max 1ms Avg 0ms - break; -#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS - case RGB_MATRIX_ALPHAS_MODS: - rendering = rgb_matrix_alphas_mods(&rgb_effect_params); // Max 2ms Avg 1ms - break; -#endif // DISABLE_RGB_MATRIX_ALPHAS_MODS -#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN - case RGB_MATRIX_GRADIENT_UP_DOWN: - rendering = rgb_matrix_gradient_up_down(&rgb_effect_params); // Max 4ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN -#ifndef DISABLE_RGB_MATRIX_BREATHING - case RGB_MATRIX_BREATHING: - rendering = rgb_matrix_breathing(&rgb_effect_params); // Max 1ms Avg 0ms - break; -#endif // DISABLE_RGB_MATRIX_BREATHING -#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL - case RGB_MATRIX_CYCLE_ALL: - rendering = rgb_matrix_cycle_all(&rgb_effect_params); // Max 4ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_CYCLE_ALL -#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT - case RGB_MATRIX_CYCLE_LEFT_RIGHT: - rendering = rgb_matrix_cycle_left_right(&rgb_effect_params); // Max 4ms Avg 3ms +// --------------------------------------------- +// -----Begin rgb effect switch case macros----- +#define RGB_MATRIX_EFFECT(name, ...) \ + case RGB_MATRIX_##name: \ + rendering = name(&rgb_effect_params); \ break; -#endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN - case RGB_MATRIX_CYCLE_UP_DOWN: - rendering = rgb_matrix_cycle_up_down(&rgb_effect_params); // Max 4ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN -#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON - case RGB_MATRIX_RAINBOW_MOVING_CHEVRON: - rendering = rgb_matrix_rainbow_moving_chevron(&rgb_effect_params); // Max 4ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON - case RGB_MATRIX_DUAL_BEACON: - rendering = rgb_matrix_dual_beacon(&rgb_effect_params); // Max 4ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_DUAL_BEACON -#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON - case RGB_MATRIX_RAINBOW_BEACON: - rendering = rgb_matrix_rainbow_beacon(&rgb_effect_params); // Max 4ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON -#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS - case RGB_MATRIX_RAINBOW_PINWHEELS: - rendering = rgb_matrix_rainbow_pinwheels(&rgb_effect_params); // Max 4ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS -#ifndef DISABLE_RGB_MATRIX_RAINDROPS - case RGB_MATRIX_RAINDROPS: - rendering = rgb_matrix_raindrops(&rgb_effect_params); // Max 1ms Avg 0ms - break; -#endif // DISABLE_RGB_MATRIX_RAINDROPS -#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS - case RGB_MATRIX_JELLYBEAN_RAINDROPS: - rendering = rgb_matrix_jellybean_raindrops(&rgb_effect_params); // Max 1ms Avg 0ms - break; -#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN - case RGB_MATRIX_DIGITAL_RAIN: - rendering = rgb_matrix_digital_rain(&rgb_effect_params); // Max 9ms Avg 8ms | this is expensive, fix it - break; -#endif // DISABLE_RGB_MATRIX_DIGITAL_RAIN -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE - case RGB_MATRIX_SOLID_REACTIVE_SIMPLE: - rendering = rgb_matrix_solid_reactive_simple(&rgb_effect_params);// Max 4ms Avg 3ms +#include "rgb_matrix_animations/rgb_matrix_effects.inc" +#undef RGB_MATRIX_EFFECT + +#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER) + #define RGB_MATRIX_EFFECT(name, ...) \ + case RGB_MATRIX_CUSTOM_##name: \ + rendering = name(&rgb_effect_params); \ break; + #ifdef RGB_MATRIX_CUSTOM_KB + #include "rgb_matrix_kb.inc" + #endif + #ifdef RGB_MATRIX_CUSTOM_USER + #include "rgb_matrix_user.inc" + #endif + #undef RGB_MATRIX_EFFECT #endif -#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE - case RGB_MATRIX_SOLID_REACTIVE: - rendering = rgb_matrix_solid_reactive(&rgb_effect_params); // Max 4ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE -#ifndef DISABLE_RGB_MATRIX_SPLASH - case RGB_MATRIX_SPLASH: - rendering = rgb_matrix_splash(&rgb_effect_params); // Max 5ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_SPLASH -#ifndef DISABLE_RGB_MATRIX_MULTISPLASH - case RGB_MATRIX_MULTISPLASH: - rendering = rgb_matrix_multisplash(&rgb_effect_params); // Max 10ms Avg 5ms - break; -#endif // DISABLE_RGB_MATRIX_MULTISPLASH -#ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH - case RGB_MATRIX_SOLID_SPLASH: - rendering = rgb_matrix_solid_splash(&rgb_effect_params); // Max 5ms Avg 3ms - break; -#endif // DISABLE_RGB_MATRIX_SOLID_SPLASH -#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH - case RGB_MATRIX_SOLID_MULTISPLASH: - rendering = rgb_matrix_solid_multisplash(&rgb_effect_params); // Max 10ms Avg 5ms - break; -#endif // DISABLE_RGB_MATRIX_SOLID_MULTISPLASH -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +// -----End rgb effect switch case macros------- +// --------------------------------------------- // Factory default magic value case UINT8_MAX: { @@ -479,12 +427,10 @@ void rgb_matrix_init(void) { eeconfig_update_rgb_matrix_default(); } - rgb_matrix_config.raw = eeconfig_read_rgb_matrix(); - rgb_matrix_config.speed = UINT8_MAX / 2; //EECONFIG needs to be increased to support this + eeconfig_read_rgb_matrix(); if (!rgb_matrix_config.mode) { dprintf("rgb_matrix_init_drivers rgb_matrix_config.mode = 0. Write default values to EEPROM.\n"); eeconfig_update_rgb_matrix_default(); - rgb_matrix_config.raw = eeconfig_read_rgb_matrix(); } eeconfig_debug_rgb_matrix(); // display current eeprom values } @@ -495,28 +441,30 @@ void rgb_matrix_set_suspend_state(bool state) { void rgb_matrix_toggle(void) { rgb_matrix_config.enable ^= 1; - if (!rgb_matrix_config.enable) { - rgb_task_state = STARTING; - } - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + rgb_task_state = STARTING; + eeconfig_update_rgb_matrix(); } void rgb_matrix_enable(void) { - rgb_matrix_config.enable = 1; - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + rgb_matrix_enable_noeeprom(); + eeconfig_update_rgb_matrix(); } void rgb_matrix_enable_noeeprom(void) { - rgb_matrix_config.enable = 1; + if (!rgb_matrix_config.enable) + rgb_task_state = STARTING; + rgb_matrix_config.enable = 1; } void rgb_matrix_disable(void) { - rgb_matrix_config.enable = 0; - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + rgb_matrix_disable_noeeprom(); + eeconfig_update_rgb_matrix(); } void rgb_matrix_disable_noeeprom(void) { - rgb_matrix_config.enable = 0; + if (rgb_matrix_config.enable) + rgb_task_state = STARTING; + rgb_matrix_config.enable = 0; } void rgb_matrix_step(void) { @@ -524,7 +472,7 @@ void rgb_matrix_step(void) { if (rgb_matrix_config.mode >= RGB_MATRIX_EFFECT_MAX) rgb_matrix_config.mode = 1; rgb_task_state = STARTING; - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + eeconfig_update_rgb_matrix(); } void rgb_matrix_step_reverse(void) { @@ -532,55 +480,63 @@ void rgb_matrix_step_reverse(void) { if (rgb_matrix_config.mode < 1) rgb_matrix_config.mode = RGB_MATRIX_EFFECT_MAX - 1; rgb_task_state = STARTING; - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + eeconfig_update_rgb_matrix(); } void rgb_matrix_increase_hue(void) { - rgb_matrix_config.hue += RGB_MATRIX_HUE_STEP; - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + rgb_matrix_config.hsv.h += RGB_MATRIX_HUE_STEP; + eeconfig_update_rgb_matrix(); } void rgb_matrix_decrease_hue(void) { - rgb_matrix_config.hue -= RGB_MATRIX_HUE_STEP; - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + rgb_matrix_config.hsv.h -= RGB_MATRIX_HUE_STEP; + eeconfig_update_rgb_matrix(); } void rgb_matrix_increase_sat(void) { - rgb_matrix_config.sat = qadd8(rgb_matrix_config.sat, RGB_MATRIX_SAT_STEP); - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + rgb_matrix_config.hsv.s = qadd8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP); + eeconfig_update_rgb_matrix(); } void rgb_matrix_decrease_sat(void) { - rgb_matrix_config.sat = qsub8(rgb_matrix_config.sat, RGB_MATRIX_SAT_STEP); - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + rgb_matrix_config.hsv.s = qsub8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP); + eeconfig_update_rgb_matrix(); } void rgb_matrix_increase_val(void) { - rgb_matrix_config.val = qadd8(rgb_matrix_config.val, RGB_MATRIX_VAL_STEP); - if (rgb_matrix_config.val > RGB_MATRIX_MAXIMUM_BRIGHTNESS) - rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS; - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + rgb_matrix_config.hsv.v = qadd8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP); + if (rgb_matrix_config.hsv.v > RGB_MATRIX_MAXIMUM_BRIGHTNESS) + rgb_matrix_config.hsv.v = RGB_MATRIX_MAXIMUM_BRIGHTNESS; + eeconfig_update_rgb_matrix(); } void rgb_matrix_decrease_val(void) { - rgb_matrix_config.val = qsub8(rgb_matrix_config.val, RGB_MATRIX_VAL_STEP); - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + rgb_matrix_config.hsv.v = qsub8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP); + eeconfig_update_rgb_matrix(); } void rgb_matrix_increase_speed(void) { rgb_matrix_config.speed = qadd8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP); - eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this + eeconfig_update_rgb_matrix(); } void rgb_matrix_decrease_speed(void) { rgb_matrix_config.speed = qsub8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP); - eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this + eeconfig_update_rgb_matrix(); +} + +led_flags_t rgb_matrix_get_flags(void) { + return rgb_effect_params.flags; +} + +void rgb_matrix_set_flags(led_flags_t flags) { + rgb_effect_params.flags = flags; } void rgb_matrix_mode(uint8_t mode) { rgb_matrix_config.mode = mode; rgb_task_state = STARTING; - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + eeconfig_update_rgb_matrix(); } void rgb_matrix_mode_noeeprom(uint8_t mode) { @@ -593,13 +549,13 @@ uint8_t rgb_matrix_get_mode(void) { void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { rgb_matrix_sethsv_noeeprom(hue, sat, val); - eeconfig_update_rgb_matrix(rgb_matrix_config.raw); + eeconfig_update_rgb_matrix(); } void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { - rgb_matrix_config.hue = hue; - rgb_matrix_config.sat = sat; - rgb_matrix_config.val = val; - if (rgb_matrix_config.val > RGB_MATRIX_MAXIMUM_BRIGHTNESS) - rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS; + rgb_matrix_config.hsv.h = hue; + rgb_matrix_config.hsv.s = sat; + rgb_matrix_config.hsv.v = val; + if (rgb_matrix_config.hsv.v > RGB_MATRIX_MAXIMUM_BRIGHTNESS) + rgb_matrix_config.hsv.v = RGB_MATRIX_MAXIMUM_BRIGHTNESS; }