Skip to content

Commit 9e07afd

Browse files
authored
[Web Flasher] Fix generated web flasher manifest JSON
Since we split the Display and Climate builds into an A/B version, we also need to split those in the selection. Also the web flasher had a problem with an empty `chipVariant` field which was added for supporting 2 versions of the ESP32-P4. This caused all ESP32 builds to fail to start flashing.
1 parent d9de062 commit 9e07afd

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

tools/pio/generate_web_flasher_manifest.py

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,13 @@ def parse_filename(file, version, variant, file_suffix):
143143

144144
if 'NotSet' in sub_group:
145145
if 'climate_' in variant:
146-
group = 'Climate'
146+
variant_split = variant.split('_')
147+
group = 'Climate {}'.format(variant_split[1])
147148
elif 'energy_' in variant:
148149
group = 'Energy'
149150
elif 'display_' in variant:
150-
group = 'Display'
151+
variant_split = variant.split('_')
152+
group = 'Display {}'.format(variant_split[1])
151153
elif 'neopixel_' in variant:
152154
group = 'NeoPixel'
153155
elif 'normal_' in variant:
@@ -158,7 +160,7 @@ def parse_filename(file, version, variant, file_suffix):
158160
group = 'Custom'
159161
elif 'collection' in variant:
160162
variant_split = variant.split('_')
161-
group = 'Collection{}'.format(variant_split[1])
163+
group = 'Collection {}'.format(variant_split[1])
162164
# Select based on "4M1M" here to keep any occasional "4M2M" build
163165
# separated in another group
164166
if '_4M1M' in variant:
@@ -174,7 +176,7 @@ def parse_filename(file, version, variant, file_suffix):
174176
specials.append(flash_size)
175177
if '_PSRAM' in variant:
176178
specials.append('PSRAM')
177-
if 'LittleFS' in variant:
179+
if 'LittleFS' in variant and 'ESP32' not in variant:
178180
specials.append('LittleFS')
179181
if '_IRExt' in variant:
180182
specials.append('IRExt')
@@ -220,11 +222,6 @@ def parse_filename(file, version, variant, file_suffix):
220222
# Thus make a separate group for the solo1
221223
main_group = '4M Flash ESP32-solo1'
222224

223-
if 'ESP32' in variant:
224-
main_group += ' ESP32'
225-
else:
226-
main_group += ' ESP8266'
227-
228225
if ".factory.bin" in file_suffix or 'ESP32' not in file:
229226
#print('{:10s}: {:34s}\t{:10s} {} / {}'.format(state, sub_group, chipFamily, version, file))
230227

@@ -244,24 +241,40 @@ def parse_filename(file, version, variant, file_suffix):
244241
manifest['new_install_prompt_erase'] = True
245242
manifest['build_flags'] = build_flags
246243
parts = dict([('path', file), ('offset', 0)])
247-
if add_improv:
248-
builds = dict([('chipFamily', chipFamily), ('chipVariant', chipVariant), ('improv', False), ('parts', [parts])])
244+
if not chipVariant:
245+
if add_improv:
246+
builds = dict([('chipFamily', chipFamily), ('improv', True), ('parts', [parts])])
247+
else:
248+
builds = dict([('chipFamily', chipFamily), ('parts', [parts])])
249249
else:
250-
builds = dict([('chipFamily', chipFamily), ('chipVariant', chipVariant), ('parts', [parts])])
250+
if add_improv:
251+
builds = dict([('chipFamily', chipFamily), ('chipVariant', chipVariant), ('improv', False), ('parts', [parts])])
252+
else:
253+
builds = dict([('chipFamily', chipFamily), ('chipVariant', chipVariant), ('parts', [parts])])
251254
manifest['builds'] = [builds]
252255
manifest_binfiles[main_group][sub_group] = manifest
253256
else:
254257
parts = dict([('path', file), ('offset', 0)])
255-
if add_improv:
256-
builds = dict([('chipFamily', chipFamily), ('chipVariant', chipVariant), ('improv', False), ('parts', [parts])])
258+
if not chipVariant:
259+
if add_improv:
260+
builds = dict([('chipFamily', chipFamily), ('improv', True), ('parts', [parts])])
261+
else:
262+
builds = dict([('chipFamily', chipFamily), ('parts', [parts])])
257263
else:
258-
builds = dict([('chipFamily', chipFamily), ('chipVariant', chipVariant), ('parts', [parts])])
264+
if add_improv:
265+
builds = dict([('chipFamily', chipFamily), ('chipVariant', chipVariant), ('improv', False), ('parts', [parts])])
266+
else:
267+
builds = dict([('chipFamily', chipFamily), ('chipVariant', chipVariant), ('parts', [parts])])
268+
259269
manifest_binfiles[main_group][sub_group]['builds'].append(builds)
260270
manifest_binfiles[main_group][sub_group]['families'].append(chipFamily)
261271

262272
display_string = create_display_text(description, version, manifest_binfiles[main_group][sub_group]['families'])
263273
manifest_binfiles[main_group][sub_group]['displaytext'] = display_string
264-
manifest_binfiles[main_group][sub_group]['manifestfilename'] = '{}{}'.format(sub_group, manifest_suff)
274+
if 'ESP8266' in main_group:
275+
manifest_binfiles[main_group][sub_group]['manifestfilename'] = '{}_ESP8266{}'.format(sub_group, manifest_suff)
276+
else:
277+
manifest_binfiles[main_group][sub_group]['manifestfilename'] = '{}{}'.format(sub_group, manifest_suff)
265278

266279

267280

@@ -305,15 +318,6 @@ def generate_manifest_files(bin_folder, output_prefix):
305318
'Custom Misc',
306319
'Misc']
307320

308-
main_group_list_littlefs = []
309-
main_group_list_spiffs = []
310-
for main_group in main_group_list:
311-
main_group_list_littlefs.append("{} {}".format(main_group, 'ESP32'))
312-
main_group_list_spiffs.append("{} {}".format(main_group, 'ESP8266'))
313-
314-
main_group_list_littlefs.extend(main_group_list_spiffs)
315-
main_group_list = main_group_list_littlefs
316-
317321

318322
for main_group in main_group_list:
319323
if main_group in manifest_binfiles:
@@ -379,7 +383,7 @@ def generate_manifest_files(bin_folder, output_prefix):
379383
' </style>\n',
380384
' <script\n',
381385
' type="module"\n',
382-
' src="https://unpkg.com/tasmota-esp-web-tools@8.1.14/dist/web/install-button.js?module"\n',
386+
' src="https://unpkg.com/tasmota-esp-web-tools@10.0.3/dist/web/install-button.js?module"\n',
383387
' ></script>\n',
384388
' </head>\n',
385389
' <body>\n',

0 commit comments

Comments
 (0)