Skip to content

Commit 069a305

Browse files
Enzo Fresehubmartin
Enzo Frese
authored andcommitted
west: Fix project generator config modes
1 parent 8a75c5c commit 069a305

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

scripts/west_commands/project_generator/jinja_templates/CMakeLists.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ add_custom_command(
3838
add_custom_command(
3939
COMMAND west gen-codec -d ../codec/cbor-decoder.yaml -e ../codec/cbor-encoder.yaml -o ../src/app_codec.h
4040
OUTPUT ../src/app_codec.h
41-
DEPENDS ../codec/cbor-decoder.yaml ../codec/cbor-encoder.yaml
41+
DEPENDS ../codec/cbor-decoder.yaml
4242
)
4343

4444
{%- endif %}

scripts/west_commands/project_generator/jinja_templates/app_config_new_c.j2

+2-6
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,11 @@ const struct ctr_config_item items[] = {
142142

143143
{%- endfor %}
144144
{#- MODE LTE-LRW #}
145-
{%- if config_mode %}
146145

147-
#if defined(FEATURE_SUBSYSTEM_LTE) || defined(FEATURE_SUBSYSTEM_LRW)
148146
CTR_CONFIG_ITEM_ENUM("mode", m_config_interim.mode, ((const char*[]){ {%- for mode in array_mode %}"{{mode}}"{% if not loop.last %}, {% endif %}{% endfor -%} }), "Set communication mode", APP_CONFIG_MODE_{{config_mode[0]}}),
149-
#endif /* defined(FEATURE_SUBSYSTEM_LTE) || defined(FEATURE_SUBSYSTEM_LRW) */
150-
{%- endif %}
151147

152-
/* ### Preserved code "config" (begin) */
153-
/* ^^^ Preserved code "config" (end) */
148+
/* ### Preserved code "config" (begin) */
149+
/* ^^^ Preserved code "config" (end) */
154150

155151
};
156152
/* clang-format on */

scripts/west_commands/project_generator/jinja_templates/app_config_new_h.j2

+2-3
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,18 @@ extern "C" {
6464
{# White line #}
6565
{#- K1 #}
6666
{%- for feature in data['features'] %}
67-
{%- if feature == 'hardware_chester_k1' %}
67+
{%- if feature == 'hardware-chester-k1' %}
6868
#define APP_CONFIG_CHANNEL_COUNT 4
6969
{% endif %}
7070
{%- endfor %}
7171

7272
{#- MODE LTE-LRW #}
73-
{%- if config_mode %}
7473
enum app_config_mode {
7574
{%- for mode in array_mode %}
7675
APP_CONFIG_MODE_{{ mode | upper }} = {{loop.index0}},
7776
{%- endfor %}
7877
};
79-
{% endif -%}
78+
{# wline #}
8079

8180
{#- MODE ENUM #}
8281
{%- for parameter in data['parameters'] %}

scripts/west_commands/project_generator/jinja_templates/k_config.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ config CTR_MACHINE_PROBE
189189
{#- MB7066_A #}
190190
{%- if feature == 'hardware-chester-mb7066-a' %}
191191
# {{ feature | upper }}
192-
config SHIELD_CTR_A
192+
config SHIELD_CTR_MB7066_A
193193
bool "Enable SHIELD_CTR_MB7066_A"
194194
default y
195195

scripts/west_commands/project_generator/project_generator.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -446,14 +446,14 @@ def cbor(self):
446446
# Generate app_cbor.c
447447
self.generate_file(
448448
"src",
449-
"app_cbor_test.c",
449+
"app_cbor.c",
450450
"app_cbor_v2_c.j2",
451451
**merged_dict,
452452
)
453453
# Generate app_cbor.c
454454
self.generate_file(
455455
"src",
456-
"app_cbor_test.h",
456+
"app_cbor.h",
457457
"app_cbor_v2_h.j2",
458458
**merged_dict,
459459
)
@@ -473,7 +473,11 @@ def generate_cmake(self, data):
473473
for root, dirs, files in os.walk(src_dir):
474474
# Collect sources
475475
for file in files:
476-
if file.endswith(".c") or file == "msg_key.h" or file == "app_codec.h":
476+
if (
477+
file.endswith(".c")
478+
or file == "msg_key.h"
479+
or file == "app_codec.h"
480+
):
477481
file_path = os.path.relpath(os.path.join(root, file), src_dir)
478482
sources.append(file_path)
479483
# Render the template with data
@@ -533,8 +537,10 @@ def yaml_source(self, name, mode, ext):
533537
with open(yaml_dir, "r") as stream:
534538
data = yaml.safe_load(stream)
535539
return data
536-
except:
537-
log.wrn('The cbor-encoder.yaml file was not found in the project folder.')
540+
except:
541+
log.wrn(
542+
"The cbor-encoder.yaml file was not found in the project folder."
543+
)
538544
return None
539545

540546
except Exception as e:

0 commit comments

Comments
 (0)