diff --git a/builder/main.py b/builder/main.py index 7d2ba0d48..bb0b1e1bf 100644 --- a/builder/main.py +++ b/builder/main.py @@ -171,12 +171,31 @@ def _parse_partitions(env): def _update_max_upload_size(env): if not env.get("PARTITIONS_TABLE_CSV"): return - sizes = [ - _parse_size(p["size"]) for p in _parse_partitions(env) + sizes = { + p["subtype"]: _parse_size(p["size"]) for p in _parse_partitions(env) if p["type"] in ("0", "app") - ] - if sizes: - board.update("upload.maximum_size", max(sizes)) + } + + partitions = {p["name"]: p for p in _parse_partitions(env)} + + # User-specified partition name has the highest priority + custom_app_partition_name = board.get("build.app_partition_name", "") + if custom_app_partition_name: + selected_partition = partitions.get(custom_app_partition_name, {}) + if selected_partition: + board.update("upload.maximum_size", _parse_size(selected_partition["size"])) + return + else: + print( + "Warning! Selected partition `%s` is not available in the partition " \ + "table! Default partition will be used!" % custom_app_partition_name + ) + + for p in partitions.values(): + if p["type"] in ("0", "app") and p["subtype"] in ("ota_0"): + board.update("upload.maximum_size", _parse_size(p["size"])) + break + def _to_unix_slashes(path): diff --git a/platform.json b/platform.json index a3a952b9d..bab2a3793 100644 --- a/platform.json +++ b/platform.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/tasmota/platform-espressif32.git" }, - "version": "2024.05.10", + "version": "2024.05.11", "frameworks": { "arduino": { "script": "builder/frameworks/arduino.py" @@ -33,19 +33,19 @@ "type": "framework", "optional": true, "owner": "tasmota", - "version": "https://github.com/tasmota/arduino-esp32/releases/download/3.0.0.240510/framework-arduinoespressif32.zip" + "version": "https://github.com/tasmota/arduino-esp32/releases/download/3.0.0.240511/framework-arduinoespressif32.zip" }, "framework-arduino-solo1": { "type": "framework", "optional": true, "owner": "tasmota", - "version": "https://github.com/tasmota/arduino-esp32/releases/download/3.0.0.240510/framework-arduinoespressif32-solo1.zip" + "version": "https://github.com/tasmota/arduino-esp32/releases/download/3.0.0.240511/framework-arduinoespressif32-solo1.zip" }, "framework-arduino-ITEAD": { "type": "framework", "optional": true, "owner": "tasmota", - "version": "https://github.com/tasmota/arduino-esp32/releases/download/3.0.0.240510/framework-arduinoespressif32-ITEAD.zip" + "version": "https://github.com/tasmota/arduino-esp32/releases/download/3.0.0.240511/framework-arduinoespressif32-ITEAD.zip" }, "framework-espidf": { "type": "framework",