Skip to content

Commit

Permalink
Ignore defaults.hjson values if already set (qmk#19511)
Browse files Browse the repository at this point in the history
* Ignore defaults.hjson values if already set

* Add warning when nothing is merged
  • Loading branch information
zvecr committed Jan 7, 2023
1 parent 403c7ee commit 974a1ea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 1 addition & 2 deletions keyboards/handwired/onekey/blackpill_f401_tinyuf2/info.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"keyboard_name": "Onekey Blackpill STM32F401 TinyUF2",
"processor": "STM32F401",
"development_board": "blackpill_f401",
"bootloader": "tinyuf2",
"board": "BLACKPILL_STM32_F401",
"matrix_pins": {
"cols": ["B0"],
"rows": ["A7"]
Expand Down
3 changes: 1 addition & 2 deletions keyboards/handwired/onekey/blackpill_f411_tinyuf2/info.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"keyboard_name": "Onekey Blackpill STM32F411 TinyUF2",
"processor": "STM32F411",
"development_board": "blackpill_f411",
"bootloader": "tinyuf2",
"board": "BLACKPILL_STM32_F411",
"matrix_pins": {
"cols": ["B0"],
"rows": ["A7"]
Expand Down
12 changes: 10 additions & 2 deletions lib/python/qmk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,16 @@ def _process_defaults(info_data):
for default_type in defaults_map.keys():
thing_map = defaults_map[default_type]
if default_type in info_data:
for key, value in thing_map.get(info_data[default_type], {}).items():
info_data[key] = value
merged_count = 0
thing_items = thing_map.get(info_data[default_type], {}).items()
for key, value in thing_items:
if key not in info_data:
info_data[key] = value
merged_count += 1

if merged_count == 0 and len(thing_items) > 0:
_log_warning(info_data, 'All defaults for \'%s\' were skipped, potential redundant config or misconfiguration detected' % (default_type))

return info_data


Expand Down

0 comments on commit 974a1ea

Please sign in to comment.