Run Unit Tests / nrf52-companion-smoke (push) Canceled after 0s
Run Unit Tests / nrf52-sensor-smoke (push) Canceled after 0s
Run Unit Tests / esp32-sensor-smoke (push) Canceled after 0s
Run Unit Tests / management-reports (push) Canceled after 0s
Run Unit Tests / stm32-companion-smoke (push) Canceled after 0s
Run Unit Tests / bootloader-version (push) Canceled after 0s
Run Unit Tests / test (push) Canceled after 0s
Run Unit Tests / hosted-doc-links (push) Canceled after 0s
Build and deploy Docs site to GitHub Pages / github-pages (push) Canceled after 0s
local_build.sh wraps build.sh with the Hazelwood defaults (919.5 MHz / BW500 / SF10 / CR5, BLE PIN 123456, target radio preset, default settings profile), builds into out/<timestamp> so build.sh cannot wipe other files, and sets up the macOS GNU tool PATH. local_version.py labels firmware "hazelwood_<role> v<fork version> (core v<upstream>)" (companions version-first for the app's 19-character field). The version is the highest vX.Y.Z.W tag reachable from HEAD; commits not in upstream/keymindCascade add -hz.N and uncommitted edits add .dirty. platformio.local.ini adds Heltec_v3_companion_radio_full_nomqtt: the V3 Full Companion without the MQTT bridge, which otherwise fails the runtime RAM check (198 KB needed, 181 KB available), with the 100-contact limit build.sh applies only to the exact stock env name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C6JeNqcQRUMo2vt6vFBmhk
72 lines
2.6 KiB
Python
72 lines
2.6 KiB
Python
# Hazelwood PlatformIO pre-script (personal branch, not in the upstream fork). Injected by
|
|
# ./local_build.sh through PLATFORMIO_EXTRA_SCRIPTS; rewrites FIRMWARE_VERSION
|
|
# to the Hazelwood display label before PlatformIO parses the build flags.
|
|
#
|
|
# repeater/room/sensor: hazelwood_repeater v1.17.1.10 (core v1.17.1)
|
|
# companion: v1.17.1.10 hazelwood (core v1.17.1)
|
|
# with local code changes the version gains -hz.N and/or .dirty (local_build.sh)
|
|
#
|
|
# Companions keep the version first because the app's device-info frame
|
|
# carries only the first 19 characters (companion MyMesh.cpp strzcpy(..., 20)).
|
|
# LoRa OTA (EndF trailer, ota self, lora_ota.py) packs the first X.Y.Z[.W] in
|
|
# the string, so it sees v1.17.1.10; the local identifier is display-only.
|
|
#
|
|
# Observer targets are left untouched: their HTTP pull-OTA parses the commit
|
|
# hash after the last '-' of FIRMWARE_VERSION.
|
|
|
|
import os
|
|
import re
|
|
|
|
Import("env") # noqa: F821
|
|
|
|
version = os.environ.get("LOCAL_FW_VERSION", "").strip()
|
|
core = os.environ.get("LOCAL_FW_CORE_VERSION", "").strip()
|
|
name = os.environ.get("LOCAL_FW_NAME", "hazelwood").strip()
|
|
pioenv = env["PIOENV"].lower() # noqa: F821
|
|
|
|
ROLES = (
|
|
("companion_radio", "companion"),
|
|
("observer", None),
|
|
("room_server", "room_server"),
|
|
("repeater", "repeater"),
|
|
("sensor", "sensor"),
|
|
("kiss", "kiss_modem"),
|
|
)
|
|
|
|
|
|
def role_for(env_name):
|
|
for token, role in ROLES:
|
|
if token in env_name:
|
|
return role
|
|
return "firmware"
|
|
|
|
|
|
role = role_for(pioenv)
|
|
if version and core and role is not None:
|
|
if role == "companion":
|
|
label = f"{version} {name} (core v{core})"
|
|
else:
|
|
label = f"{name}_{role} {version} (core v{core})"
|
|
|
|
# Plain quotes: PlatformIO escapes them and SCons wraps the spaced value.
|
|
define = "-DFIRMWARE_VERSION='\"" + label + "\"'"
|
|
pattern = re.compile(r"""-D\s?FIRMWARE_VERSION=(?:'[^']*'|"[^"]*"|\S+)""")
|
|
flags = env.get("BUILD_FLAGS", []) # noqa: F821
|
|
if isinstance(flags, str):
|
|
flags = [flags]
|
|
replaced = False
|
|
new_flags = []
|
|
for flag in flags:
|
|
updated, count = pattern.subn(lambda _m: define, str(flag))
|
|
replaced = replaced or count > 0
|
|
new_flags.append(updated)
|
|
if not replaced:
|
|
new_flags.append(define)
|
|
env.Replace(BUILD_FLAGS=new_flags) # noqa: F821
|
|
# deduplicate_full_build_flags.py (ESP32 FULL) re-reads this overlay; keep
|
|
# it identical so the label is not treated as a foreign flag.
|
|
overlay = os.environ.get("PLATFORMIO_BUILD_FLAGS", "")
|
|
if overlay:
|
|
os.environ["PLATFORMIO_BUILD_FLAGS"] = pattern.sub(lambda _m: define, overlay)
|
|
print(f"Local firmware label: {label}")
|