From be9b9dd8d418504d254d4ef6253bcae89ccee0a8 Mon Sep 17 00:00:00 2001 From: dreamer Date: Sat, 23 Dec 2023 11:16:56 +0100 Subject: [PATCH] allow display config from json --- src/json2daisy/json2daisy.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/json2daisy/json2daisy.py b/src/json2daisy/json2daisy.py index 131eb04..66b295c 100644 --- a/src/json2daisy/json2daisy.py +++ b/src/json2daisy/json2daisy.py @@ -193,12 +193,10 @@ def generate_header(board_description_dict: dict) -> 'tuple[str, dict]': target['aliases'] = {} if 'display' in target: - # apply defaults - target['display'] = { - 'driver': "daisy::SSD130x4WireSpi128x64Driver", - 'config': [], - 'dim': [128, 64] - } + # apply defaults if not present in config + target['display']['driver'] = target['display'].get('driver', "daisy::SSD130x4WireSpi128x64Driver") + target['display']['config'] = target['display'].get('config', []) + target['display']['dim'] = target['display'].get('dim', [128, 64]) target['defines']['OOPSY_TARGET_HAS_OLED'] = 1 target['defines']['OOPSY_OLED_DISPLAY_WIDTH'] = target['display']['dim'][0]