Enable LoRa OTA for full and companion builds
This commit is contained in:
1 parent
c8052e90c2
commit
3a7101556f
6 files changed
+366
-41
No files matched your search
@@ -0,0 +1,38 @@
|
||||
Import("env")
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def parse_flash_size(value):
|
||||
text = str(value).strip().upper()
|
||||
multipliers = {"KB": 1024, "MB": 1024 * 1024}
|
||||
for suffix, multiplier in multipliers.items():
|
||||
if text.endswith(suffix):
|
||||
return int(text[: -len(suffix)]) * multiplier
|
||||
return int(text, 0)
|
||||
|
||||
|
||||
if os.environ.get("MESHCORE_ESP32_FULL_BUILD") == "1":
|
||||
board = env.BoardConfig()
|
||||
flash_size = parse_flash_size(board.get("upload.flash_size", "4MB"))
|
||||
|
||||
if flash_size >= 16 * 1024 * 1024:
|
||||
partitions = "default_16MB.csv"
|
||||
elif flash_size >= 8 * 1024 * 1024:
|
||||
partitions = "default_8MB.csv"
|
||||
elif flash_size >= 4 * 1024 * 1024:
|
||||
partitions = "variants/dual_ota_full_4MB.csv"
|
||||
else:
|
||||
partitions = None
|
||||
|
||||
if partitions:
|
||||
board.update("build.partitions", partitions)
|
||||
print(
|
||||
"ESP32 FULL build: using %s for %s flash"
|
||||
% (partitions, board.get("upload.flash_size", "4MB"))
|
||||
)
|
||||
else:
|
||||
print(
|
||||
"ESP32 FULL build: retaining target partition table for %s flash"
|
||||
% board.get("upload.flash_size", "unknown")
|
||||
)
|
||||
@@ -16,11 +16,12 @@ def has_define(name):
|
||||
|
||||
build_flags = str(env.get("BUILD_FLAGS", "")) + " " + os.environ.get("PLATFORMIO_BUILD_FLAGS", "")
|
||||
pio_env = env.subst("$PIOENV").lower()
|
||||
full_build = os.environ.get("MESHCORE_ESP32_FULL_BUILD") == "1"
|
||||
|
||||
if (has_define("PORTABLE_ESP32_NANO_LIBC") or
|
||||
"PORTABLE_ESP32_NANO_LIBC" in build_flags or
|
||||
os.environ.get("MESHCORE_PORTABLE_NANO_LIBC") == "1" or
|
||||
"observer_mqtt" in pio_env or "bridge_espnow" in pio_env):
|
||||
(not full_build and ("observer_mqtt" in pio_env or "bridge_espnow" in pio_env))):
|
||||
# newlib-nano provides the same C ABI with a substantially smaller printf
|
||||
# implementation. These profiles omit display, GPS, external sensors, and
|
||||
# the general CLI paths that require floating-point printf.
|
||||
|
||||
Reference in new issue
Block a user