aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/led_matrix/led_matrix.c55
-rw-r--r--quantum/led_matrix/led_matrix.h4
-rw-r--r--quantum/pointing_device/pointing_device.c42
-rw-r--r--quantum/pointing_device/pointing_device.h27
-rw-r--r--quantum/process_keycode/process_oneshot.c25
-rw-r--r--quantum/process_keycode/process_oneshot.h10
-rw-r--r--quantum/process_keycode/process_quantum.c76
-rw-r--r--quantum/process_keycode/process_quantum.h10
-rw-r--r--quantum/process_keycode/process_underglow.c5
-rw-r--r--quantum/quantum.c95
-rw-r--r--quantum/quantum.h1
-rw-r--r--quantum/rgb_matrix/rgb_matrix.c56
-rw-r--r--quantum/rgb_matrix/rgb_matrix.h4
13 files changed, 312 insertions, 98 deletions
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c
index 7a0e8a5ebb..9c8004cc17 100644
--- a/quantum/led_matrix/led_matrix.c
+++ b/quantum/led_matrix/led_matrix.c
@@ -107,7 +107,11 @@ void eeconfig_update_led_matrix_default(void) {
void eeconfig_debug_led_matrix(void) {
dprintf("led_matrix_eeconfig EEPROM\n");
dprintf("led_matrix_eeconfig.enable = %d\n", led_matrix_eeconfig.enable);
+#ifdef LED_MATRIX_MODE_NAME_ENABLE
+ dprintf("led_matrix_eeconfig.mode = %d (%s)\n", led_matrix_eeconfig.mode, led_matrix_get_mode_name(led_matrix_eeconfig.mode));
+#else
dprintf("led_matrix_eeconfig.mode = %d\n", led_matrix_eeconfig.mode);
+#endif // LED_MATRIX_MODE_NAME_ENABLE
dprintf("led_matrix_eeconfig.val = %d\n", led_matrix_eeconfig.val);
dprintf("led_matrix_eeconfig.speed = %d\n", led_matrix_eeconfig.speed);
dprintf("led_matrix_eeconfig.flags = %d\n", led_matrix_eeconfig.flags);
@@ -525,7 +529,11 @@ void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
}
led_task_state = STARTING;
eeconfig_flag_led_matrix(write_to_eeprom);
- dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.mode);
+#ifdef LED_MATRIX_MODE_NAME_ENABLE
+ dprintf("led matrix mode [%s]: %u (%s)\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", (unsigned)led_matrix_eeconfig.mode, led_matrix_get_mode_name(led_matrix_eeconfig.mode));
+#else
+ dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", (unsigned)led_matrix_eeconfig.mode);
+#endif // LED_MATRIX_MODE_NAME_ENABLE
}
void led_matrix_mode_noeeprom(uint8_t mode) {
led_matrix_mode_eeprom_helper(mode, false);
@@ -652,3 +660,48 @@ void led_matrix_set_flags(led_flags_t flags) {
void led_matrix_set_flags_noeeprom(led_flags_t flags) {
led_matrix_set_flags_eeprom_helper(flags, false);
}
+
+// LED Matrix naming
+#undef LED_MATRIX_EFFECT
+#ifdef LED_MATRIX_MODE_NAME_ENABLE
+const char *led_matrix_get_mode_name(uint8_t mode) {
+ switch (mode) {
+ case LED_MATRIX_NONE:
+ return "NONE";
+
+# define LED_MATRIX_EFFECT(name, ...) \
+ case LED_MATRIX_##name: \
+ return #name;
+# include "led_matrix_effects.inc"
+# undef LED_MATRIX_EFFECT
+
+# ifdef COMMUNITY_MODULES_ENABLE
+# define LED_MATRIX_EFFECT(name, ...) \
+ case LED_MATRIX_COMMUNITY_MODULE_##name: \
+ return #name;
+# include "led_matrix_community_modules.inc"
+# undef LED_MATRIX_EFFECT
+# endif // COMMUNITY_MODULES_ENABLE
+
+# if defined(LED_MATRIX_CUSTOM_KB) || defined(LED_MATRIX_CUSTOM_USER)
+# define LED_MATRIX_EFFECT(name, ...) \
+ case LED_MATRIX_CUSTOM_##name: \
+ return #name;
+
+# ifdef LED_MATRIX_CUSTOM_KB
+# include "led_matrix_kb.inc"
+# endif // LED_MATRIX_CUSTOM_KB
+
+# ifdef LED_MATRIX_CUSTOM_USER
+# include "led_matrix_user.inc"
+# endif // LED_MATRIX_CUSTOM_USER
+
+# undef LED_MATRIX_EFFECT
+# endif // LED_MATRIX_CUSTOM_KB || LED_MATRIX_CUSTOM_USER
+
+ default:
+ return "UNKNOWN";
+ }
+}
+# undef LED_MATRIX_EFFECT
+#endif // LED_MATRIX_MODE_NAME_ENABLE
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h
index 0dfe33ffab..9a49515ab2 100644
--- a/quantum/led_matrix/led_matrix.h
+++ b/quantum/led_matrix/led_matrix.h
@@ -184,6 +184,10 @@ led_flags_t led_matrix_get_flags(void);
void led_matrix_set_flags(led_flags_t flags);
void led_matrix_set_flags_noeeprom(led_flags_t flags);
+#ifdef LED_MATRIX_MODE_NAME_ENABLE
+const char *led_matrix_get_mode_name(uint8_t mode);
+#endif // LED_MATRIX_MODE_NAME_ENABLE
+
static inline bool led_matrix_check_finished_leds(uint8_t led_idx) {
#if defined(LED_MATRIX_SPLIT)
if (is_keyboard_left()) {
diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c
index 564c2d294c..fe88d5a1af 100644
--- a/quantum/pointing_device/pointing_device.c
+++ b/quantum/pointing_device/pointing_device.c
@@ -80,8 +80,10 @@ uint16_t pointing_device_get_shared_cpi(void) {
#endif // defined(SPLIT_POINTING_ENABLE)
-static report_mouse_t local_mouse_report = {};
-static bool pointing_device_force_send = false;
+static report_mouse_t local_mouse_report = {};
+static bool pointing_device_force_send = false;
+static pointing_device_status_t pointing_device_status = POINTING_DEVICE_STATUS_UNKNOWN;
+
#ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
static uint16_t hires_scroll_resolution;
#endif
@@ -90,7 +92,9 @@ static uint16_t hires_scroll_resolution;
#define POINTING_DEVICE_DRIVER(name) POINTING_DEVICE_DRIVER_CONCAT(name)
#ifdef POINTING_DEVICE_DRIVER_custom
-__attribute__((weak)) void pointing_device_driver_init(void) {}
+__attribute__((weak)) bool pointing_device_driver_init(void) {
+ return false;
+}
__attribute__((weak)) report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) {
return mouse_report;
}
@@ -179,7 +183,11 @@ __attribute__((weak)) void pointing_device_init(void) {
if ((POINTING_DEVICE_THIS_SIDE))
#endif
{
- pointing_device_driver->init();
+ if (pointing_device_driver->init()) {
+ pointing_device_status = POINTING_DEVICE_STATUS_SUCCESS;
+ } else {
+ pointing_device_status = POINTING_DEVICE_STATUS_INIT_FAILED;
+ }
#ifdef POINTING_DEVICE_MOTION_PIN
# ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
gpio_set_pin_input_high(POINTING_DEVICE_MOTION_PIN);
@@ -201,6 +209,28 @@ __attribute__((weak)) void pointing_device_init(void) {
}
/**
+ * @brief Gets status of pointing device
+ *
+ * Returns current pointing device status
+ * @return pointing_device_status_t
+ */
+__attribute__((weak)) pointing_device_status_t pointing_device_get_status(void) {
+#ifdef SPLIT_POINTING_ENABLE
+ // Assume target side is always good, split transaction checksum should stop additional reports being generated.
+ return POINTING_DEVICE_THIS_SIDE ? pointing_device_status : POINTING_DEVICE_STATUS_SUCCESS;
+#else
+ return pointing_device_status;
+#endif
+}
+
+/**
+ * @brief Sets status of pointing device
+ */
+void pointing_device_set_status(pointing_device_status_t status) {
+ pointing_device_status = status;
+}
+
+/**
* @brief Sends processed mouse report to host
*
* This sends the mouse report generated by pointing_device_task if changed since the last report. Once send zeros mouse report except buttons.
@@ -281,6 +311,10 @@ __attribute__((weak)) bool pointing_device_task(void) {
last_exec = timer_read32();
#endif
+ if (pointing_device_get_status() != POINTING_DEVICE_STATUS_SUCCESS) {
+ return false;
+ }
+
// Gather report info
#ifdef POINTING_DEVICE_MOTION_PIN
# if defined(SPLIT_POINTING_ENABLE)
diff --git a/quantum/pointing_device/pointing_device.h b/quantum/pointing_device/pointing_device.h
index e7a0819ed9..5dfb9ce196 100644
--- a/quantum/pointing_device/pointing_device.h
+++ b/quantum/pointing_device/pointing_device.h
@@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "report.h"
typedef struct {
- void (*init)(void);
+ bool (*init)(void);
report_mouse_t (*get_report)(report_mouse_t mouse_report);
void (*set_cpi)(uint16_t);
uint16_t (*get_cpi)(void);
@@ -75,7 +75,7 @@ typedef struct {
# include "drivers/sensors/pmw33xx_common.h"
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
#else
-void pointing_device_driver_init(void);
+bool pointing_device_driver_init(void);
report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report);
uint16_t pointing_device_driver_get_cpi(void);
void pointing_device_driver_set_cpi(uint16_t cpi);
@@ -92,6 +92,13 @@ typedef enum {
POINTING_DEVICE_BUTTON8,
} pointing_device_buttons_t;
+typedef enum {
+ POINTING_DEVICE_STATUS_UNKNOWN,
+ POINTING_DEVICE_STATUS_INIT_FAILED,
+ POINTING_DEVICE_STATUS_FAILED,
+ POINTING_DEVICE_STATUS_SUCCESS,
+} pointing_device_status_t;
+
#ifdef MOUSE_EXTENDED_REPORT
typedef int32_t xy_clamp_range_t;
#else
@@ -107,13 +114,15 @@ typedef int16_t hv_clamp_range_t;
#define CONSTRAIN_HID(amt) ((amt) < INT8_MIN ? INT8_MIN : ((amt) > INT8_MAX ? INT8_MAX : (amt)))
#define CONSTRAIN_HID_XY(amt) ((amt) < MOUSE_REPORT_XY_MIN ? MOUSE_REPORT_XY_MIN : ((amt) > MOUSE_REPORT_XY_MAX ? MOUSE_REPORT_XY_MAX : (amt)))
-void pointing_device_init(void);
-bool pointing_device_task(void);
-bool pointing_device_send(void);
-report_mouse_t pointing_device_get_report(void);
-void pointing_device_set_report(report_mouse_t mouse_report);
-uint16_t pointing_device_get_cpi(void);
-void pointing_device_set_cpi(uint16_t cpi);
+void pointing_device_init(void);
+bool pointing_device_task(void);
+bool pointing_device_send(void);
+report_mouse_t pointing_device_get_report(void);
+void pointing_device_set_report(report_mouse_t mouse_report);
+uint16_t pointing_device_get_cpi(void);
+void pointing_device_set_cpi(uint16_t cpi);
+pointing_device_status_t pointing_device_get_status(void);
+void pointing_device_set_status(pointing_device_status_t status);
void pointing_device_init_kb(void);
void pointing_device_init_user(void);
diff --git a/quantum/process_keycode/process_oneshot.c b/quantum/process_keycode/process_oneshot.c
new file mode 100644
index 0000000000..6c43da1011
--- /dev/null
+++ b/quantum/process_keycode/process_oneshot.c
@@ -0,0 +1,25 @@
+// Copyright 2025 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "process_oneshot.h"
+#include "action_util.h"
+
+bool process_oneshot(uint16_t keycode, keyrecord_t *record) {
+#ifndef NO_ACTION_ONESHOT
+ if (record->event.pressed) {
+ switch (keycode) {
+ case QK_ONE_SHOT_TOGGLE:
+ oneshot_toggle();
+ return false;
+ case QK_ONE_SHOT_ON:
+ oneshot_enable();
+ return false;
+ case QK_ONE_SHOT_OFF:
+ oneshot_disable();
+ return false;
+ }
+ }
+#endif
+
+ return true;
+}
diff --git a/quantum/process_keycode/process_oneshot.h b/quantum/process_keycode/process_oneshot.h
new file mode 100644
index 0000000000..11445b9b38
--- /dev/null
+++ b/quantum/process_keycode/process_oneshot.h
@@ -0,0 +1,10 @@
+// Copyright 2025 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "action.h"
+
+bool process_oneshot(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_quantum.c b/quantum/process_keycode/process_quantum.c
new file mode 100644
index 0000000000..703e00755b
--- /dev/null
+++ b/quantum/process_keycode/process_quantum.c
@@ -0,0 +1,76 @@
+// Copyright 2025 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "process_quantum.h"
+#include "quantum.h"
+
+#ifdef ENABLE_COMPILE_KEYCODE
+/** \brief Compiles the firmware, and adds the flash command based on keyboard bootloader
+ */
+static void send_make_command(void) {
+# ifdef NO_ACTION_ONESHOT
+ const uint8_t temp_mod = mod_config(get_mods());
+# else
+ const uint8_t temp_mod = mod_config(get_mods() | get_oneshot_mods());
+ clear_oneshot_mods();
+# endif
+ clear_mods();
+
+ SEND_STRING_DELAY("qmk", TAP_CODE_DELAY);
+ if (temp_mod & MOD_MASK_SHIFT) { // if shift is held, flash rather than compile
+ SEND_STRING_DELAY(" flash ", TAP_CODE_DELAY);
+ } else {
+ SEND_STRING_DELAY(" compile ", TAP_CODE_DELAY);
+ }
+# if defined(CONVERTER_ENABLED)
+ SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP " -e CONVERT_TO=" CONVERTER_TARGET SS_TAP(X_ENTER), TAP_CODE_DELAY);
+# else
+ SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP SS_TAP(X_ENTER), TAP_CODE_DELAY);
+# endif
+ if (temp_mod & MOD_MASK_SHIFT && temp_mod & MOD_MASK_CTRL) {
+ reset_keyboard();
+ }
+}
+#endif
+
+bool process_quantum(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ switch (keycode) {
+#ifndef NO_RESET
+ case QK_BOOTLOADER:
+ reset_keyboard();
+ return false;
+ case QK_REBOOT:
+ soft_reset_keyboard();
+ return false;
+#endif
+#ifndef NO_DEBUG
+ case QK_DEBUG_TOGGLE:
+ debug_enable ^= 1;
+ if (debug_enable) {
+ print("DEBUG: enabled.\n");
+ } else {
+ print("DEBUG: disabled.\n");
+ }
+ return false;
+#endif
+ case QK_CLEAR_EEPROM:
+#ifdef NO_RESET
+ eeconfig_init();
+#else
+ eeconfig_disable();
+ soft_reset_keyboard();
+#endif
+ return false;
+#ifdef ENABLE_COMPILE_KEYCODE
+ case QK_MAKE:
+ send_make_command();
+ return false;
+#endif
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
diff --git a/quantum/process_keycode/process_quantum.h b/quantum/process_keycode/process_quantum.h
new file mode 100644
index 0000000000..5c2462be01
--- /dev/null
+++ b/quantum/process_keycode/process_quantum.h
@@ -0,0 +1,10 @@
+// Copyright 2025 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "action.h"
+
+bool process_quantum(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_underglow.c b/quantum/process_keycode/process_underglow.c
index b8d8989ef3..78006ee099 100644
--- a/quantum/process_keycode/process_underglow.c
+++ b/quantum/process_keycode/process_underglow.c
@@ -200,6 +200,11 @@ bool process_underglow(uint16_t keycode, keyrecord_t *record) {
}
#endif
return false;
+#ifdef VELOCIKEY_ENABLE
+ case QK_VELOCIKEY_TOGGLE:
+ velocikey_toggle();
+ return false;
+#endif
}
}
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 0bb6ee0a91..cc20c7db2b 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -15,6 +15,7 @@
*/
#include "quantum.h"
+#include "process_quantum.h"
#ifdef BACKLIGHT_ENABLE
# include "process_backlight.h"
@@ -84,6 +85,10 @@
# include "process_layer_lock.h"
#endif
+#ifndef NO_ACTION_ONESHOT
+# include "process_oneshot.h"
+#endif
+
#ifdef AUDIO_ENABLE
# ifndef GOODBYE_SONG
# define GOODBYE_SONG SONG(GOODBYE_SOUND)
@@ -174,10 +179,6 @@ __attribute__((weak)) bool pre_process_record_user(uint16_t keycode, keyrecord_t
return true;
}
-__attribute__((weak)) bool process_action_kb(keyrecord_t *record) {
- return true;
-}
-
__attribute__((weak)) bool process_record_modules(uint16_t keycode, keyrecord_t *record) {
return true;
}
@@ -292,9 +293,10 @@ void post_process_record_quantum(keyrecord_t *record) {
post_process_record_kb(keycode, record);
}
-/* Core keycode function, hands off handling to other functions,
- then processes internal quantum keycodes, and then processes
- ACTIONs. */
+/** \brief Core keycode function
+ *
+ * Hands off handling to other quantum/process_keycode/ functions
+ */
bool process_record_quantum(keyrecord_t *record) {
uint16_t keycode = get_record_keycode(record, true);
@@ -439,85 +441,14 @@ bool process_record_quantum(keyrecord_t *record) {
#ifdef CONNECTION_ENABLE
process_connection(keycode, record) &&
#endif
- true)) {
- return false;
- }
-
- if (record->event.pressed) {
- switch (keycode) {
-#ifndef NO_RESET
- case QK_BOOTLOADER:
- reset_keyboard();
- return false;
- case QK_REBOOT:
- soft_reset_keyboard();
- return false;
-#endif
-#ifndef NO_DEBUG
- case QK_DEBUG_TOGGLE:
- debug_enable ^= 1;
- if (debug_enable) {
- print("DEBUG: enabled.\n");
- } else {
- print("DEBUG: disabled.\n");
- }
-#endif
- return false;
- case QK_CLEAR_EEPROM:
-#ifdef NO_RESET
- eeconfig_init();
-#else
- eeconfig_disable();
- soft_reset_keyboard();
-#endif
- return false;
-#ifdef VELOCIKEY_ENABLE
- case QK_VELOCIKEY_TOGGLE:
- velocikey_toggle();
- return false;
-#endif
#ifndef NO_ACTION_ONESHOT
- case QK_ONE_SHOT_TOGGLE:
- oneshot_toggle();
- break;
- case QK_ONE_SHOT_ON:
- oneshot_enable();
- break;
- case QK_ONE_SHOT_OFF:
- oneshot_disable();
- break;
-#endif
-#ifdef ENABLE_COMPILE_KEYCODE
- case QK_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
- {
-# ifdef NO_ACTION_ONESHOT
- const uint8_t temp_mod = mod_config(get_mods());
-# else
- const uint8_t temp_mod = mod_config(get_mods() | get_oneshot_mods());
- clear_oneshot_mods();
-# endif
- clear_mods();
-
- SEND_STRING_DELAY("qmk", TAP_CODE_DELAY);
- if (temp_mod & MOD_MASK_SHIFT) { // if shift is held, flash rather than compile
- SEND_STRING_DELAY(" flash ", TAP_CODE_DELAY);
- } else {
- SEND_STRING_DELAY(" compile ", TAP_CODE_DELAY);
- }
-# if defined(CONVERTER_ENABLED)
- SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP " -e CONVERT_TO=" CONVERTER_TARGET SS_TAP(X_ENTER), TAP_CODE_DELAY);
-# else
- SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP SS_TAP(X_ENTER), TAP_CODE_DELAY);
-# endif
- if (temp_mod & MOD_MASK_SHIFT && temp_mod & MOD_MASK_CTRL) {
- reset_keyboard();
- }
- }
+ process_oneshot(keycode, record) &&
#endif
- }
+ process_quantum(keycode, record))) {
+ return false;
}
- return process_action_kb(record);
+ return true;
}
void set_single_default_layer(uint8_t default_layer) {
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 3a994e9a03..0036cd784b 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -263,7 +263,6 @@ uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache);
bool pre_process_record_quantum(keyrecord_t *record);
bool pre_process_record_kb(uint16_t keycode, keyrecord_t *record);
bool pre_process_record_user(uint16_t keycode, keyrecord_t *record);
-bool process_action_kb(keyrecord_t *record);
bool process_record_kb(uint16_t keycode, keyrecord_t *record);
bool process_record_user(uint16_t keycode, keyrecord_t *record);
void post_process_record_kb(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 2679c48342..ab0aa17512 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -109,7 +109,11 @@ void eeconfig_update_rgb_matrix_default(void) {
void eeconfig_debug_rgb_matrix(void) {
dprintf("rgb_matrix_config EEPROM\n");
dprintf("rgb_matrix_config.enable = %d\n", rgb_matrix_config.enable);
+#ifdef RGB_MATRIX_MODE_NAME_ENABLE
+ dprintf("rgb_matrix_config.mode = %d (%s)\n", rgb_matrix_config.mode, rgb_matrix_get_mode_name(rgb_matrix_config.mode));
+#else
dprintf("rgb_matrix_config.mode = %d\n", rgb_matrix_config.mode);
+#endif // RGB_MATRIX_MODE_NAME_ENABLE
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);
@@ -560,7 +564,11 @@ void rgb_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
}
rgb_task_state = STARTING;
eeconfig_flag_rgb_matrix(write_to_eeprom);
- dprintf("rgb matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.mode);
+#ifdef RGB_MATRIX_MODE_NAME_ENABLE
+ dprintf("rgb matrix mode [%s]: %u (%s)\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", (unsigned)rgb_matrix_config.mode, rgb_matrix_get_mode_name(rgb_matrix_config.mode));
+#else
+ dprintf("rgb matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", (unsigned)rgb_matrix_config.mode);
+#endif // RGB_MATRIX_MODE_NAME_ENABLE
}
void rgb_matrix_mode_noeeprom(uint8_t mode) {
rgb_matrix_mode_eeprom_helper(mode, false);
@@ -738,3 +746,49 @@ void rgb_matrix_set_flags(led_flags_t flags) {
void rgb_matrix_set_flags_noeeprom(led_flags_t flags) {
rgb_matrix_set_flags_eeprom_helper(flags, false);
}
+
+//----------------------------------------------------------
+// RGB Matrix naming
+#undef RGB_MATRIX_EFFECT
+#ifdef RGB_MATRIX_MODE_NAME_ENABLE
+const char *rgb_matrix_get_mode_name(uint8_t mode) {
+ switch (mode) {
+ case RGB_MATRIX_NONE:
+ return "NONE";
+
+# define RGB_MATRIX_EFFECT(name, ...) \
+ case RGB_MATRIX_##name: \
+ return #name;
+# include "rgb_matrix_effects.inc"
+# undef RGB_MATRIX_EFFECT
+
+# ifdef COMMUNITY_MODULES_ENABLE
+# define RGB_MATRIX_EFFECT(name, ...) \
+ case RGB_MATRIX_COMMUNITY_MODULE_##name: \
+ return #name;
+# include "rgb_matrix_community_modules.inc"
+# undef RGB_MATRIX_EFFECT
+# endif // COMMUNITY_MODULES_ENABLE
+
+# if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER)
+# define RGB_MATRIX_EFFECT(name, ...) \
+ case RGB_MATRIX_CUSTOM_##name: \
+ return #name;
+
+# ifdef RGB_MATRIX_CUSTOM_KB
+# include "rgb_matrix_kb.inc"
+# endif // RGB_MATRIX_CUSTOM_KB
+
+# ifdef RGB_MATRIX_CUSTOM_USER
+# include "rgb_matrix_user.inc"
+# endif // RGB_MATRIX_CUSTOM_USER
+
+# undef RGB_MATRIX_EFFECT
+# endif // RGB_MATRIX_CUSTOM_KB || RGB_MATRIX_CUSTOM_USER
+
+ default:
+ return "UNKNOWN";
+ }
+}
+# undef RGB_MATRIX_EFFECT
+#endif // RGB_MATRIX_MODE_NAME_ENABLE
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index c6b302631e..a91dded4a8 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -220,6 +220,10 @@ void rgb_matrix_set_flags(led_flags_t flags);
void rgb_matrix_set_flags_noeeprom(led_flags_t flags);
void rgb_matrix_update_pwm_buffers(void);
+#ifdef RGB_MATRIX_MODE_NAME_ENABLE
+const char *rgb_matrix_get_mode_name(uint8_t mode);
+#endif // RGB_MATRIX_MODE_NAME_ENABLE
+
#ifndef RGBLIGHT_ENABLE
# define eeconfig_update_rgblight_current eeconfig_force_flush_rgb_matrix
# define rgblight_reload_from_eeprom rgb_matrix_reload_from_eeprom