diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-05-22 06:31:04 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-05-22 06:31:04 +0300 |
commit | 786e8078e4802748e7bb60920dffa862135ae946 (patch) | |
tree | d42ce78b9a58e43806b3c3d1ae8810c8f6af3cbf /src/home/pio | |
parent | 7706c3c37e2042d1b36744aae45c901f475c7c9c (diff) |
pio_ini.py: platformio.ini generation improvements
Diffstat (limited to 'src/home/pio')
-rw-r--r-- | src/home/pio/products.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/home/pio/products.py b/src/home/pio/products.py index 4cb3cf2..7649078 100644 --- a/src/home/pio/products.py +++ b/src/home/pio/products.py @@ -31,13 +31,17 @@ def get_products(): def platformio_ini(product_config: dict, target: str, - node_id: str, + # node_id: str, + build_specific_defines: dict, + build_specific_defines_enums: list[str], platform: str, framework: str = 'arduino', upload_port: str = '/dev/ttyUSB0', monitor_speed: int = 115200, debug=False, debug_network=False) -> str: + node_id = build_specific_defines['CONFIG_NODE_ID'] + # defines defines = { **product_config['common_defines'], @@ -60,6 +64,9 @@ def platformio_ini(product_config: dict, defines['DEBUG_ESP_SSL'] = True defines['DEBUG_ESP_PORT'] = 'Serial' build_type = 'debug' + if build_specific_defines: + for k, v in build_specific_defines.items(): + defines[k] = v defines = OrderedDict(sorted(defines.items(), key=lambda t: t[0])) # libs @@ -93,13 +100,15 @@ def platformio_ini(product_config: dict, if defines: for name, value in defines.items(): buf.write(f' -D{name}') + is_enum = name in build_specific_defines_enums if type(value) is not bool: buf.write('=') if type(value) is str: - buf.write('"\\"') + if not is_enum: + buf.write('"\\"') value = value.replace('"', '\\"') buf.write(f'{value}') - if type(value) is str: + if type(value) is str and not is_enum: buf.write('"\\"') buf.write('\n') buf.write(f' -I../common/include') |