From 1d0b4c8d38794dc019ecb224f2992b4ddfa70839 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Fri, 10 Feb 2023 21:10:14 +0000 Subject: Tidy up use of keycode range helpers (#19756) --- lib/python/qmk/cli/generate/keycodes.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/python/qmk/cli') diff --git a/lib/python/qmk/cli/generate/keycodes.py b/lib/python/qmk/cli/generate/keycodes.py index 2ed84cd589..f5c646e0ea 100644 --- a/lib/python/qmk/cli/generate/keycodes.py +++ b/lib/python/qmk/cli/generate/keycodes.py @@ -8,6 +8,14 @@ from qmk.path import normpath from qmk.keycodes import load_spec +def _translate_group(group): + """Fix up any issues with badly chosen values + """ + if group == 'modifiers': + return 'modifier' + return group + + def _render_key(key): width = 7 if 'S(' in key: @@ -82,7 +90,7 @@ def _generate_helpers(lines, keycodes): for group, codes in temp.items(): lo = keycodes["keycodes"][f'0x{codes[0]:04X}']['key'] hi = keycodes["keycodes"][f'0x{codes[1]:04X}']['key'] - lines.append(f'#define IS_{ group.upper() }_KEYCODE(code) ((code) >= {lo} && (code) <= {hi})') + lines.append(f'#define IS_{ _translate_group(group).upper() }_KEYCODE(code) ((code) >= {lo} && (code) <= {hi})') def _generate_aliases(lines, keycodes): -- cgit v1.2.3