From 81d317aa8768fe53a6cca040297231278b06af64 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Fri, 8 Jul 2022 22:48:48 +0100 Subject: Fix rgbkb/sol/rev2 build issues (#17601) --- lib/python/qmk/c_parse.py | 3 +++ lib/python/qmk/cli/generate/config_h.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/python/qmk') diff --git a/lib/python/qmk/c_parse.py b/lib/python/qmk/c_parse.py index 4b49b8d4e9..c14eb490fa 100644 --- a/lib/python/qmk/c_parse.py +++ b/lib/python/qmk/c_parse.py @@ -258,6 +258,9 @@ def _parse_led_config(file, matrix_cols, matrix_rows): position_raw.append(_coerce_led_token(_type, value)) if section == 3 and bracket_count == 2: flags.append(_coerce_led_token(_type, value)) + elif _type in [Token.Comment.Preproc]: + # TODO: Promote to error + return None # Slightly better intrim format matrix = list(_get_chunks(matrix_raw, matrix_cols)) diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index 9d50368aba..b53f4ff335 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py @@ -152,9 +152,14 @@ def generate_encoder_config(encoder_json, config_h_lines, postfix=''): config_h_lines.append(f'# define ENCODERS_PAD_B{postfix} {{ { ", ".join(b_pads) } }}') config_h_lines.append(f'#endif // ENCODERS_PAD_B{postfix}') - config_h_lines.append(f'#ifndef ENCODER_RESOLUTIONS{postfix}') - config_h_lines.append(f'# define ENCODER_RESOLUTIONS{postfix} {{ { ", ".join(resolutions) } }}') - config_h_lines.append(f'#endif // ENCODER_RESOLUTIONS{postfix}') + if len(set(resolutions)) == 1: + config_h_lines.append(f'#ifndef ENCODER_RESOLUTION{postfix}') + config_h_lines.append(f'# define ENCODER_RESOLUTION{postfix} { resolutions[0] }') + config_h_lines.append(f'#endif // ENCODER_RESOLUTION{postfix}') + else: + config_h_lines.append(f'#ifndef ENCODER_RESOLUTIONS{postfix}') + config_h_lines.append(f'# define ENCODER_RESOLUTIONS{postfix} {{ { ", ".join(resolutions) } }}') + config_h_lines.append(f'#endif // ENCODER_RESOLUTIONS{postfix}') def generate_split_config(kb_info_json, config_h_lines): -- cgit v1.2.3