From 066d445f215903671a40df5dfa989000fea480fe Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 6 Aug 2023 12:59:42 +0200 Subject: [PATCH] revert max_upload_size changes --- builder/main.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/builder/main.py b/builder/main.py index 2cb74dfaf..b01ca6b63 100644 --- a/builder/main.py +++ b/builder/main.py @@ -153,20 +153,12 @@ def _parse_partitions(env): def _update_max_upload_size(env): if not env.get("PARTITIONS_TABLE_CSV"): return - sizes = { - p["subtype"]: _parse_size(p["size"]) for p in _parse_partitions(env) + sizes = [ + _parse_size(p["size"]) for p in _parse_partitions(env) if p["type"] in ("0", "app") - } - - # One of the `factory` or `ota_0` partitions is used to determine available memory - # size. If both partitions are set, we should prefer the `factory`, but there are - # cases (e.g. Adafruit's `partitions-4MB-tinyuf2.csv`) that uses the `factory` - # partition for their UF2 bootloader. So let's use the first match - # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#subtype - for p in _parse_partitions(env): - if p["type"] in ("0", "app") and p["subtype"] in ("factory", "ota_0"): - board.update("upload.maximum_size", _parse_size(p["size"])) - break + ] + if sizes: + board.update("upload.maximum_size", max(sizes)) def _to_unix_slashes(path):