|
@@ -70,10 +70,9 @@ if pioutil.is_pio_build():
|
70
|
70
|
feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep]
|
71
|
71
|
blab("[%s] lib_deps = %s" % (feature, dep), 3)
|
72
|
72
|
|
73
|
|
- def load_config():
|
|
73
|
+ def load_features():
|
74
|
74
|
blab("========== Gather [features] entries...")
|
75
|
|
- items = ProjectConfig().items('features')
|
76
|
|
- for key in items:
|
|
75
|
+ for key in ProjectConfig().items('features'):
|
77
|
76
|
feature = key[0].upper()
|
78
|
77
|
if not feature in FEATURE_CONFIG:
|
79
|
78
|
FEATURE_CONFIG[feature] = { 'lib_deps': [] }
|
|
@@ -81,8 +80,7 @@ if pioutil.is_pio_build():
|
81
|
80
|
|
82
|
81
|
# Add options matching custom_marlin.MY_OPTION to the pile
|
83
|
82
|
blab("========== Gather custom_marlin entries...")
|
84
|
|
- all_opts = env.GetProjectOptions()
|
85
|
|
- for n in all_opts:
|
|
83
|
+ for n in env.GetProjectOptions():
|
86
|
84
|
key = n[0]
|
87
|
85
|
mat = re.match(r'custom_marlin\.(.+)', key)
|
88
|
86
|
if mat:
|
|
@@ -127,10 +125,10 @@ if pioutil.is_pio_build():
|
127
|
125
|
set_env_field('lib_ignore', lib_ignore)
|
128
|
126
|
|
129
|
127
|
def apply_features_config():
|
130
|
|
- load_config()
|
|
128
|
+ load_features()
|
131
|
129
|
blab("========== Apply enabled features...")
|
132
|
130
|
for feature in FEATURE_CONFIG:
|
133
|
|
- if not env.MarlinFeatureIsEnabled(feature):
|
|
131
|
+ if not env.MarlinHas(feature):
|
134
|
132
|
continue
|
135
|
133
|
|
136
|
134
|
feat = FEATURE_CONFIG[feature]
|
|
@@ -212,7 +210,7 @@ if pioutil.is_pio_build():
|
212
|
210
|
#
|
213
|
211
|
# Return True if a matching feature is enabled
|
214
|
212
|
#
|
215
|
|
- def MarlinFeatureIsEnabled(env, feature):
|
|
213
|
+ def MarlinHas(env, feature):
|
216
|
214
|
load_marlin_features()
|
217
|
215
|
r = re.compile('^' + feature + '$')
|
218
|
216
|
found = list(filter(r.match, env['MARLIN_FEATURES']))
|
|
@@ -225,7 +223,7 @@ if pioutil.is_pio_build():
|
225
|
223
|
if val in [ '', '1', 'true' ]:
|
226
|
224
|
some_on = True
|
227
|
225
|
elif val in env['MARLIN_FEATURES']:
|
228
|
|
- some_on = env.MarlinFeatureIsEnabled(val)
|
|
226
|
+ some_on = env.MarlinHas(val)
|
229
|
227
|
|
230
|
228
|
return some_on
|
231
|
229
|
|
|
@@ -239,7 +237,7 @@ if pioutil.is_pio_build():
|
239
|
237
|
#
|
240
|
238
|
# Add a method for other PIO scripts to query enabled features
|
241
|
239
|
#
|
242
|
|
- env.AddMethod(MarlinFeatureIsEnabled)
|
|
240
|
+ env.AddMethod(MarlinHas)
|
243
|
241
|
|
244
|
242
|
#
|
245
|
243
|
# Add dependencies for enabled Marlin features
|