diff options
author | Joel Challis <[email protected]> | 2025-09-12 13:21:49 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2025-09-12 13:21:49 +0100 |
commit | d34cade5abe11da93a6f3d204b00278127299f8b (patch) | |
tree | a2d0129066543dad907affac81a17c3126a5b5e2 /lib/python/qmk/cli/generate/config_h.py | |
parent | cf58a8733d35bbfea2f54bd0175747ee63d9b2e3 (diff) | |
download | qmk_firmware-d34cade5abe11da93a6f3d204b00278127299f8b.tar.gz qmk_firmware-d34cade5abe11da93a6f3d204b00278127299f8b.zip |
Generate default encoder resolution for sparse config (#25247)
Diffstat (limited to 'lib/python/qmk/cli/generate/config_h.py')
-rwxr-xr-x | lib/python/qmk/cli/generate/config_h.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index d6d0299291..1ade452f95 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py @@ -125,11 +125,12 @@ def generate_encoder_config(encoder_json, config_h_lines, postfix=''): config_h_lines.append(generate_define(f'ENCODER_A_PINS{postfix}', f'{{ {", ".join(a_pads)} }}')) config_h_lines.append(generate_define(f'ENCODER_B_PINS{postfix}', f'{{ {", ".join(b_pads)} }}')) - if None in resolutions: - cli.log.debug(f"Unable to generate ENCODER_RESOLUTION{postfix} configuration") - elif len(resolutions) == 0: + if len(resolutions) == 0 or all(r is None for r in resolutions): cli.log.debug(f"Skipping ENCODER_RESOLUTION{postfix} configuration") - elif len(set(resolutions)) == 1: + return + + resolutions = [4 if r is None else r for r in resolutions] + if len(set(resolutions)) == 1: config_h_lines.append(generate_define(f'ENCODER_RESOLUTION{postfix}', resolutions[0])) else: config_h_lines.append(generate_define(f'ENCODER_RESOLUTIONS{postfix}', f'{{ {", ".join(map(str,resolutions))} }}')) |