Skip to content

Commit

Permalink
Allow only col or row pins for *_right extraction. (qmk#17590)
Browse files Browse the repository at this point in the history
  • Loading branch information
daskygit committed Jul 8, 2022
1 parent e724801 commit 06310e8
Showing 1 changed file with 9 additions and 29 deletions.
38 changes: 9 additions & 29 deletions lib/python/qmk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def _extract_split_right_pins(info_data, config_c):
unused_pins = unused_pin_text.replace('{', '').replace('}', '').strip() if isinstance(unused_pin_text, str) else None
direct_pins = config_c.get('DIRECT_PINS_RIGHT', '').replace(' ', '')[1:-1]

if row_pins and col_pins:
if row_pins or col_pins or direct_pins or unused_pins:
if info_data.get('split', {}).get('matrix_pins', {}).get('right') in info_data:
_log_warning(info_data, 'Right hand matrix data is specified in both info.json and config.h, the config.h values win.')

Expand All @@ -331,37 +331,17 @@ def _extract_split_right_pins(info_data, config_c):
if 'right' not in info_data['split']['matrix_pins']:
info_data['split']['matrix_pins']['right'] = {}

info_data['split']['matrix_pins']['right'] = {
'cols': _extract_pins(col_pins),
'rows': _extract_pins(row_pins),
}

if direct_pins:
if info_data.get('split', {}).get('matrix_pins', {}).get('right', {}):
_log_warning(info_data, 'Right hand matrix data is specified in both info.json and config.h, the config.h values win.')

if 'split' not in info_data:
info_data['split'] = {}
if col_pins:
info_data['split']['matrix_pins']['right']['cols'] = _extract_pins(col_pins)

if 'matrix_pins' not in info_data['split']:
info_data['split']['matrix_pins'] = {}
if row_pins:
info_data['split']['matrix_pins']['right']['rows'] = _extract_pins(row_pins)

if 'right' not in info_data['split']['matrix_pins']:
info_data['split']['matrix_pins']['right'] = {}

info_data['split']['matrix_pins']['right']['direct'] = _extract_direct_matrix(direct_pins)

if unused_pins:
if 'split' not in info_data:
info_data['split'] = {}

if 'matrix_pins' not in info_data['split']:
info_data['split']['matrix_pins'] = {}

if 'right' not in info_data['split']['matrix_pins']:
info_data['split']['matrix_pins']['right'] = {}
if direct_pins:
info_data['split']['matrix_pins']['right']['direct'] = _extract_direct_matrix(direct_pins)

info_data['split']['matrix_pins']['right']['unused'] = _extract_pins(unused_pins)
if unused_pins:
info_data['split']['matrix_pins']['right']['unused'] = _extract_pins(unused_pins)


def _extract_matrix_info(info_data, config_c):
Expand Down

0 comments on commit 06310e8

Please sign in to comment.