Give Full builds exclusive USB mOTA ownership

This commit is contained in:
mikecarper committed 2026-09-03 02:33:23 -07:00
1 parent 529a4fa3a3
commit 942df304ca
6 files changed
+49 -14

No files matched your search

+4
View File
@@ -433,6 +433,8 @@ for full_env in "${SUPPORTED_PIO_ENVS[@]}"; do
|| fail "$full_env Full Companion omitted its capability identity"
[[ "$PLATFORMIO_BUILD_FLAGS" == *"BLE_PIN_CODE=123456"* ]] \
|| fail "$full_env Full Companion omitted Bluetooth pairing"
[[ "$PLATFORMIO_BUILD_FLAGS" == *"COMPANION_FEATURE_USB_MOTA_SOURCE=1"* ]] \
|| fail "$full_env Full Companion left the serial folder source sharing the USB text parser"
case "${full_env,,}" in
sensecapindicator-espnow_companion_radio_full|\
sensecapindicator-lora_companion_radio_full)
@@ -1015,6 +1017,8 @@ declare_build_capability_contract \
expectations=" ${BUILD_EXPECTATIONS[*]} "
[[ "$expectations" == *"companion.direct_mqtt=mqtt.status"* ]] \
|| fail "MQTT-capable ESP32 Full contract omitted direct MQTT"
[[ "$expectations" == *"companion.usb_mota_source=ota folder on"* ]] \
|| fail "ESP32 Full contract omitted exclusive USB folder seeding"
PIO_ENV_PLATFORM_BY_NAME[RAK_3401_companion_radio_full]=NRF52_PLATFORM
BUILD_CAPABILITIES=()
+21
View File
@@ -8,6 +8,27 @@ root = Path(__file__).resolve().parents[1]
source = (root / "examples/companion_radio/MyMesh.cpp").read_text()
features = (root / "examples/companion_radio/CompanionFeatures.h").read_text()
# Every Full Companion which inherits OTA_FOLDER_SERIAL must put that shared
# byte stream under the exclusive mOTA owner. Otherwise the ASCII terminal can
# consume and echo a delayed lowercase `ms` host response between source
# transactions while valid uppercase `MS` requests continue.
assert re.search(
r"#if defined\(OTA_FOLDER_SERIAL\)\s*\\?\s*"
r"&& \(defined\(NRF52_PLATFORM\) \|\| defined\(ESP32_PLATFORM\)\)\s*"
r"#ifndef COMPANION_FEATURE_USB_MOTA_SOURCE\s+"
r"#define COMPANION_FEATURE_USB_MOTA_SOURCE 1",
features,
)
assert re.search(
r"#if COMPANION_FEATURE_USB_MOTA_SOURCE\s*\\?\s*"
r"&& !\(\(defined\(NRF52_PLATFORM\) \|\| defined\(ESP32_PLATFORM\)\)\s*\\?\s*"
r'&& defined\(OTA_FOLDER_SERIAL\).*?defined\(ENABLE_USB_INTERFACE\).*?'
r'defined\(ENABLE_OTA\)\)\s+'
r'#error "COMPANION_FEATURE_USB_MOTA_SOURCE requires a USB serial folder source"',
features,
re.DOTALL,
)
local_start = source.index("bool MyMesh::handleLocalControlCommand(")
local_end = source.index("\n#if COMPANION_FEATURE_TEMP_RADIO\nvoid MyMesh::serviceTempRadio()", local_start)
local = source[local_start:local_end]