From 961f0b7b2de54f988daf4ce7b791f91a33e55612 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Wed, 22 Feb 2023 22:49:07 +0000 Subject: Reallocate SAFE_RANGE (#19909) --- keyboards/bastardkb/charybdis/charybdis.c | 2 +- keyboards/bastardkb/charybdis/charybdis.h | 1 - keyboards/bastardkb/charybdis/readme.md | 17 +---------------- keyboards/bastardkb/dilemma/dilemma.c | 2 +- keyboards/bastardkb/dilemma/dilemma.h | 1 - 5 files changed, 3 insertions(+), 20 deletions(-) (limited to 'keyboards/bastardkb') diff --git a/keyboards/bastardkb/charybdis/charybdis.c b/keyboards/bastardkb/charybdis/charybdis.c index 2000641f9a..c321af7aa9 100644 --- a/keyboards/bastardkb/charybdis/charybdis.c +++ b/keyboards/bastardkb/charybdis/charybdis.c @@ -304,7 +304,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { } # endif // !NO_CHARYBDIS_KEYCODES # endif // POINTING_DEVICE_ENABLE - if ((keycode >= POINTER_DEFAULT_DPI_FORWARD && keycode < CHARYBDIS_SAFE_RANGE) || IS_MOUSEKEY(keycode)) { + if (IS_QK_KB(keycode) || IS_MOUSEKEY(keycode)) { debug_charybdis_config_to_console(&g_charybdis_config); } return true; diff --git a/keyboards/bastardkb/charybdis/charybdis.h b/keyboards/bastardkb/charybdis/charybdis.h index 2e311a4aaf..06142aded2 100644 --- a/keyboards/bastardkb/charybdis/charybdis.h +++ b/keyboards/bastardkb/charybdis/charybdis.h @@ -43,7 +43,6 @@ enum charybdis_keycodes { SNIPING_MODE_TOGGLE, DRAGSCROLL_MODE, DRAGSCROLL_MODE_TOGGLE, - CHARYBDIS_SAFE_RANGE, }; # define DPI_MOD POINTER_DEFAULT_DPI_FORWARD diff --git a/keyboards/bastardkb/charybdis/readme.md b/keyboards/bastardkb/charybdis/readme.md index dd0fca0015..01eef250cd 100644 --- a/keyboards/bastardkb/charybdis/readme.md +++ b/keyboards/bastardkb/charybdis/readme.md @@ -121,7 +121,7 @@ The Charybdis firmware defines a number of keycodes to leverage its features, na ``` #ifndef NO_CHARYBDIS_KEYCODES enum charybdis_keycodes { - POINTER_DEFAULT_DPI_FORWARD = SAFE_RANGE, + POINTER_DEFAULT_DPI_FORWARD = QK_KB_0, POINTER_DEFAULT_DPI_REVERSE, POINTER_SNIPING_DPI_FORWARD, POINTER_SNIPING_DPI_REVERSE, @@ -129,7 +129,6 @@ enum charybdis_keycodes { SNIPING_MODE_TOGGLE, DRAGSCROLL_MODE, DRAGSCROLL_MODE_TOGGLE, - CHARYBDIS_SAFE_RANGE, }; #define DPI_MOD POINTER_DEFAULT_DPI_FORWARD @@ -143,20 +142,6 @@ enum charybdis_keycodes { #endif // !NO_CHARYBDIS_KEYCODES ``` -Users extending the keycode set themselves (either in their keymap, or in their userspace) must start at `CHARYBDIS_SAFE_RANGE` to avoid conflicts, _eg._: - -```c -enum userspace_keycodes { -#ifndef NO_CHARYBDIS_KEYCODES - MY_FIRST_KEYCODE = CHARYBDIS_SAFE_RANGE, -#else - MY_FIRST_KEYCODE = SAFE_RANGE, -#endif // !NO_CHARYBDIS_KEYCODES - MY_SECOND_KEYCODE, - … -}; -``` - To disable the custom keycodes, and reduce binary size, simply add a definition in `config.h`: ```c diff --git a/keyboards/bastardkb/dilemma/dilemma.c b/keyboards/bastardkb/dilemma/dilemma.c index b474a24e7f..5452f9e7f6 100644 --- a/keyboards/bastardkb/dilemma/dilemma.c +++ b/keyboards/bastardkb/dilemma/dilemma.c @@ -308,7 +308,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { # endif // !NO_DILEMMA_KEYCODES # endif // POINTING_DEVICE_ENABLE debug_dilemma_config_to_console(&g_dilemma_config); - if ((keycode >= POINTER_DEFAULT_DPI_FORWARD && keycode < DILEMMA_SAFE_RANGE) || IS_MOUSEKEY(keycode)) { + if (IS_QK_KB(keycode) || IS_MOUSEKEY(keycode)) { debug_dilemma_config_to_console(&g_dilemma_config); } return true; diff --git a/keyboards/bastardkb/dilemma/dilemma.h b/keyboards/bastardkb/dilemma/dilemma.h index 469986839d..f2c0784533 100644 --- a/keyboards/bastardkb/dilemma/dilemma.h +++ b/keyboards/bastardkb/dilemma/dilemma.h @@ -40,7 +40,6 @@ enum dilemma_keycodes { SNIPING_MODE_TOGGLE, DRAGSCROLL_MODE, DRAGSCROLL_MODE_TOGGLE, - DILEMMA_SAFE_RANGE, }; # define DPI_MOD POINTER_DEFAULT_DPI_FORWARD -- cgit v1.2.3