1
0

Add {rgb|led}_matrix_get_mode_name(). (#25344)

This commit is contained in:
Nick Brassel
2025-06-07 22:56:58 +10:00
committed by GitHub
parent e3c8c23d91
commit 7808f8f56b
10 changed files with 164 additions and 96 deletions

View File

@@ -50,3 +50,5 @@
#ifndef STARTUP_SONG
# define STARTUP_SONG SONG(STARTUP_SOUND)
#endif // STARTUP_SONG
#define RGB_MATRIX_MODE_NAME_ENABLE

View File

@@ -30,55 +30,6 @@ static painter_image_handle_t lock_scrl_on;
static painter_image_handle_t lock_scrl_off;
static painter_font_handle_t thintel;
//----------------------------------------------------------
// RGB Matrix naming
#if defined(RGB_MATRIX_ENABLE)
# include <rgb_matrix.h>
# if defined(RGB_MATRIX_EFFECT)
# undef RGB_MATRIX_EFFECT
# endif // defined(RGB_MATRIX_EFFECT)
# define RGB_MATRIX_EFFECT(x) RGB_MATRIX_EFFECT_##x,
enum {
RGB_MATRIX_EFFECT_NONE,
# include "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
# if defined(COMMUNITY_MODULES_ENABLE) && __has_include("rgb_matrix_community_modules.inc")
# include "rgb_matrix_community_modules.inc"
# endif
# undef RGB_MATRIX_EFFECT
};
# define RGB_MATRIX_EFFECT(x) \
case RGB_MATRIX_EFFECT_##x: \
return #x;
const char *rgb_matrix_name(uint8_t effect) {
switch (effect) {
case RGB_MATRIX_EFFECT_NONE:
return "NONE";
# include "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
# if defined(COMMUNITY_MODULES_ENABLE) && __has_include("rgb_matrix_community_modules.inc")
# include "rgb_matrix_community_modules.inc"
# endif
# undef RGB_MATRIX_EFFECT
default:
return "UNKNOWN";
}
}
#endif // defined(RGB_MATRIX_ENABLE)
//----------------------------------------------------------
// UI Initialisation
void keyboard_post_init_display(void) {
@@ -163,7 +114,7 @@ void draw_ui_user(bool force_redraw) {
if (hue_redraw || rgb_effect_redraw) {
static int max_rgb_xpos = 0;
xpos = 16;
snprintf(buf, sizeof(buf), "rgb: %s", rgb_matrix_name(curr_effect));
snprintf(buf, sizeof(buf), "rgb: %s", rgb_matrix_get_mode_name(curr_effect));
for (int i = 5; i < sizeof(buf); ++i) {
if (buf[i] == 0)