From 8af67edb6b64d3a924a559f26b68f97b93546792 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:44:10 +0100 Subject: [PATCH] Install latest stable Arduino core version (#59) * Update platform.json * Fetch stable release from GH API / Arduino package json * use get * Update platform.py * use matching Arduino libs to release * silence debug prints --- platform.json | 6 +++--- platform.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/platform.json b/platform.json index e7acba6..8762a55 100644 --- a/platform.json +++ b/platform.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/pioarduino/platform-espressif32.git" }, - "version": "51.03.07", + "version": "51.03.0x-stable", "frameworks": { "arduino": { "script": "builder/frameworks/arduino.py" @@ -33,13 +33,13 @@ "type": "framework", "optional": true, "owner": "espressif", - "version": "https://github.com/espressif/arduino-esp32/releases/download/3.0.7/esp32-3.0.7.zip" + "version": "" }, "framework-arduinoespressif32-libs": { "type": "framework", "optional": true, "owner": "espressif", - "version": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-632e0c2a.zip" + "version": "" }, "framework-espidf": { "type": "framework", diff --git a/platform.py b/platform.py index 4767ca3..3a3e514 100644 --- a/platform.py +++ b/platform.py @@ -45,6 +45,18 @@ class Espressif32Platform(PlatformBase): if "arduino" in frameworks: self.packages["framework-arduinoespressif32"]["optional"] = False self.packages["framework-arduinoespressif32-libs"]["optional"] = False + # use latest stable release Arduino core + ARDUINO_CORE_API_URL = "https://api.github.com/repos/espressif/Arduino-esp32/releases/latest" + api_data = requests.get(ARDUINO_CORE_API_URL, timeout=10).json() + zipball = api_data.get("zipball_url") + tag = api_data.get("tag_name") + # print("Latest release Arduino core URL:", zipball) + self.packages["framework-arduinoespressif32"]["version"] = zipball + # use corresponding espressif Arduino libs to release + URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/" + tag + "/package/package_esp32_index.template.json" + packjdata = requests.get(URL, timeout=10).json() + dyn_lib_url = packjdata['packages'][0]['tools'][0]['systems'][0]['url'] + self.packages["framework-arduinoespressif32-libs"]["version"] = dyn_lib_url if "buildfs" in targets: filesystem = variables.get("board_build.filesystem", "littlefs")