Unify companion BLE and WiFi setup flows

This commit is contained in:
mikecarper committed 2026-09-01 01:25:00 -07:00
1 parent fe62e18f8e
commit fcd1f8cc6c
36 files changed
+2205 -1890

No files matched your search

+4
View File
@@ -3511,6 +3511,10 @@ apply_companion_radio_full_profile() {
apply_radio_overrides() {
if [ -n "$RADIO_FREQ_OVERRIDE" ] && [ -n "$RADIO_BW_OVERRIDE" ] && [ -n "$RADIO_SF_OVERRIDE" ] && [ -n "$RADIO_CR_OVERRIDE" ]; then
export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DLORA_FREQ=${RADIO_FREQ_OVERRIDE} -DLORA_BW=${RADIO_BW_OVERRIDE} -DLORA_SF=${RADIO_SF_OVERRIDE} -DLORA_CR=${RADIO_CR_OVERRIDE}"
if [ "$RADIO_SETTING_TITLE" = "$USA_CASCADIA_RADIO_TITLE" ] \
|| is_usa_cascadia_radio_title "$RADIO_SETTING_TITLE"; then
export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DMESHCORE_USA_RADIO_PRESET=1"
fi
fi
}
@@ -76,5 +76,10 @@ public:
(void)degrees;
return false;
}
// Display implementations that surface an incoming BLE passkey request can
// override these hooks. The default keeps setup-screen routing compatible
// with older UIs that handle pairing only from their regular loop.
virtual void servicePairingState() {}
virtual bool isPairingPromptActive() const { return false; }
virtual void loop() = 0;
};
@@ -89,6 +89,11 @@
#error "COMPANION_FEATURE_DEDICATED_USB_LOGGING requires nRF52 dual-CDC USB"
#endif
#if defined(MESHCORE_REQUIRES_COMPANION_RADIO_FULL) \
&& !defined(COMPANION_RADIO_FULL)
#error "This target requires build.sh to apply the Full Companion profile"
#endif
#if defined(COMPANION_RADIO_FULL) && !defined(BLE_PIN_CODE)
#error "COMPANION_RADIO_FULL requires the Bluetooth Companion transport"
#endif
+5 -5
View File
@@ -2107,11 +2107,11 @@ void loop() {
#endif
#if defined(ESP32) && defined(WIFI_SSID) && defined(WITH_WEBCONFIG) \
&& UI_WIFI_SETUP_HOME_PAGE != 1
if (isCompanionWiFiEnabled() && (the_mesh.isWebConfigSetupActive()
#ifdef WITH_MQTT_BRIDGE
|| !the_mesh.isMQTTConfigured()
#endif
)) {
ui_task.servicePairingState();
if (ui_task.isPairingPromptActive()) {
ui_task.loop();
} else if (isCompanionWiFiEnabled()
&& the_mesh.isWebConfigSetupActive()) {
#if defined(TBEAM_1W) && defined(PIN_WIFI_BTN)
ui_task.serviceWiFiToggleButton();
#endif
+36 -13
View File
@@ -596,7 +596,9 @@ public:
pairing_value = expanded_home ? "LINKED" : "CONNECTED";
if (expanded_home) pairing_value_size = 3;
} else if (mesh::ui::shouldDisplayBluetoothPairingPin(
bluetooth_enabled, bluetooth_connected, bluetooth_pin)) {
bluetooth_enabled, bluetooth_connected, bluetooth_pin)
&& (!_task->isPairingPromptActive()
|| display.height() > 64)) {
pairing_label = expanded_home ? "PIN" : "BLUETOOTH PIN";
snprintf(pairing_pin, sizeof(pairing_pin), "%06u",
(unsigned int)bluetooth_pin);
@@ -645,7 +647,8 @@ public:
const uint32_t bluetooth_pin = the_mesh.getBLEPin();
const bool show_bluetooth_pin =
mesh::ui::shouldDisplayBluetoothPairingPin(
bluetooth_enabled, bluetooth_connected, bluetooth_pin);
bluetooth_enabled, bluetooth_connected, bluetooth_pin)
&& (!_task->isPairingPromptActive() || display.height() > 64);
const bool compact_pairing =
mesh::ui::usesCompactCompanionPairingLayout(
display.width(), display.height())
@@ -1567,6 +1570,21 @@ bool UITask::isPairingScreenActive() const {
static_cast<uint32_t>(millis()));
}
void UITask::renderPairingBanner() {
if (_display == NULL || !isPairingScreenActive()) return;
const uint32_t pairing_pin = the_mesh.getBLEPin();
if (pairing_pin == 0) return;
char prompt[24];
snprintf(prompt, sizeof(prompt), "PAIR PIN %06u",
(unsigned int)pairing_pin);
_display->setColor(UIColor::popup_bkg);
_display->fillRect(0, 0, _display->width(), 12);
_display->setColor(UIColor::popup_txt);
_display->setTextSize(1);
_display->drawTextCentered(_display->width() / 2, 2, prompt);
}
void UITask::showPairingPin() {
if (!isBluetoothEnabled()) return;
@@ -1604,6 +1622,20 @@ void UITask::finishPairingScreen(bool timed_out) {
}
}
void UITask::servicePairingState() {
if (_interfaceManager->takePairingRequest()) {
showPairingPin();
}
if (_pairing_screen_until != 0) {
const bool timed_out =
static_cast<int32_t>(millis() - _pairing_screen_until) >= 0;
if (!isPairingScreenActive()) {
finishPairingScreen(timed_out);
}
}
}
/*
hardware-agnostic pre-shutdown activity should be done here
*/
@@ -1643,17 +1675,7 @@ bool UITask::isButtonPressed() const {
void UITask::loop() {
serviceWiFiToggleButton();
if (_interfaceManager->takePairingRequest()) {
showPairingPin();
}
if (_pairing_screen_until != 0) {
const bool timed_out = static_cast<int32_t>(millis() - _pairing_screen_until) >= 0;
if (!isPairingScreenActive()) {
finishPairingScreen(timed_out);
}
}
servicePairingState();
char c = 0;
#if UI_HAS_JOYSTICK
@@ -1836,6 +1858,7 @@ void UITask::loop() {
if (millis() >= _next_refresh && curr) {
_display->startFrame();
int delay_millis = curr->render(*_display);
renderPairingBanner();
if (millis() < _alert_expiry) { // render alert popup
_display->setTextSize(1);
int y = _display->height() / 3;
+5
View File
@@ -95,6 +95,7 @@ class UITask : public AbstractUITask {
void setCurrScreen(UIScreen* c);
bool isPairingScreenActive() const;
void renderPairingBanner();
void showPairingPin();
void finishPairingScreen(bool timed_out);
@@ -111,6 +112,10 @@ public:
}
void begin(DisplayDriver* display, SensorManager* sensors, CompanionNodePrefs* node_prefs);
void serviceWiFiToggleButton();
void servicePairingState() override;
bool isPairingPromptActive() const override {
return isPairingScreenActive();
}
void gotoHomeScreen() { setCurrScreen(home); }
void showMessages();
+7 -2
View File
@@ -494,17 +494,22 @@ void UITask::finishPairingScreen(bool timed_out) {
}
}
void UITask::loop() {
void UITask::servicePairingState() {
if (_interfaceManager->takePairingRequest()) {
showPairingPin();
}
if (_pairing_screen_until != 0) {
const bool timed_out = static_cast<int32_t>(millis() - _pairing_screen_until) >= 0;
const bool timed_out =
static_cast<int32_t>(millis() - _pairing_screen_until) >= 0;
if (!isPairingScreenActive()) {
finishPairingScreen(timed_out);
}
}
}
void UITask::loop() {
servicePairingState();
#ifdef PIN_USER_BTN
if (_userButton) {
@@ -81,6 +81,10 @@ public:
return _display != NULL && _display->setRotationDegrees(degrees);
}
void clearMsgPreview();
void servicePairingState() override;
bool isPairingPromptActive() const override {
return isPairingScreenActive();
}
// from AbstractUITask
void msgRead(int msgcount) override;
+15 -10
View File
@@ -600,6 +600,20 @@ void UITask::finishPairingScreen(bool timed_out) {
}
}
void UITask::servicePairingState() {
if (_interfaceManager->takePairingRequest()) {
showPairingPin();
}
if (_pairing_screen_until != 0) {
const bool timed_out =
static_cast<int32_t>(millis() - _pairing_screen_until) >= 0;
if (!isPairingScreenActive()) {
finishPairingScreen(timed_out);
}
}
}
/*
hardware-agnostic pre-shutdown activity should be done here
*/
@@ -635,16 +649,7 @@ bool UITask::isButtonPressed() const {
}
void UITask::loop() {
if (_interfaceManager->takePairingRequest()) {
showPairingPin();
}
if (_pairing_screen_until != 0) {
const bool timed_out = static_cast<int32_t>(millis() - _pairing_screen_until) >= 0;
if (!isPairingScreenActive()) {
finishPairingScreen(timed_out);
}
}
servicePairingState();
char c = 0;
#if UI_HAS_JOYSTICK
@@ -96,6 +96,10 @@ public:
return _display != NULL && _display->setRotationDegrees(degrees);
}
bool isButtonPressed() const;
void servicePairingState() override;
bool isPairingPromptActive() const override {
return isPairingScreenActive();
}
bool isBuzzerQuiet() {
#ifdef PIN_BUZZER
+1
View File
@@ -198,6 +198,7 @@ class State:
"role": "Repeater", "board": "Heltec V3 (mock)",
"uptime_s": int(time.time() - self.start),
"runtime_slots": 6, "max_slots": 6, "active_slots": self.active_slots,
"mqtt": True, "radio_optional": True,
"wifi_psk64": True,
# Every ordinary repeater feature except an external FEM, plus
# radio RX power saving (bit 12) and device power saving (bit 13).
File diff suppressed because it is too large. Load diff
+7
View File
@@ -1645,6 +1645,13 @@ void WebConfigServer::handleStatus(AsyncWebServerRequest* req) {
doc["active_slots"] = 0;
#endif
doc["mqtt"] = has_mqtt;
#ifdef MESHCORE_USA_RADIO_PRESET
// USA-targeted images already carry the intended regional radio defaults,
// so first-boot setup may preserve them without forcing another selection.
doc["radio_optional"] = true;
#else
doc["radio_optional"] = false;
#endif
// The fixed-layout MQTTPrefs path remains limited to 63 characters.
// Standalone mesh-wifi NVS can also hold a standards-defined 64-hex PSK.
doc["wifi_psk64"] = (_mqtt_prefs == NULL || !_owns_wifi);
+28
View File
@@ -7,6 +7,8 @@ import unittest
ROOT = Path(__file__).resolve().parents[1]
POLICY = ROOT / "src" / "helpers" / "ui" / "BluetoothPairingUiPolicy.h"
ABSTRACT_UI = ROOT / "examples" / "companion_radio" / "AbstractUITask.h"
MAIN = ROOT / "examples" / "companion_radio" / "main.cpp"
UI_VARIANTS = (
ROOT / "examples" / "companion_radio" / "ui-new" / "UITask.cpp",
ROOT / "examples" / "companion_radio" / "ui-orig" / "UITask.cpp",
@@ -72,6 +74,8 @@ static_assert(mesh::ui::isBluetoothPairingPromptActive(
self.assertIn("shouldDisplayBluetoothPairingPin", source)
self.assertIn("isBluetoothPairingPromptActive", source)
self.assertIn("if (!isBluetoothEnabled()) return;", source)
self.assertIn("void UITask::servicePairingState()", source)
self.assertIn("servicePairingState();", source)
self.assertIn(
"if (!isPairingScreenActive()) {\n"
" finishPairingScreen(timed_out);",
@@ -83,6 +87,30 @@ static_assert(mesh::ui::isBluetoothPairingPromptActive(
self.assertIn("else if (show_bluetooth_pin) { // BT pin", full_ui)
self.assertIn("_pairing_screen_until = 0;", full_ui)
def test_incoming_pairing_overrides_setup_screen_with_top_pin(self):
abstract_ui = ABSTRACT_UI.read_text(encoding="utf-8")
self.assertIn("virtual void servicePairingState() {}", abstract_ui)
self.assertIn(
"virtual bool isPairingPromptActive() const { return false; }",
abstract_ui,
)
full_ui = UI_VARIANTS[0].read_text(encoding="utf-8")
self.assertIn("void UITask::servicePairingState()", full_ui)
self.assertIn("if (_interfaceManager->takePairingRequest())", full_ui)
self.assertIn('"PAIR PIN %06u"', full_ui)
self.assertIn("fillRect(0, 0, _display->width(), 12)", full_ui)
self.assertIn("renderPairingBanner();", full_ui)
main = MAIN.read_text(encoding="utf-8")
setup_route = main[main.index("void loop()") :]
self.assertIn("ui_task.servicePairingState();", setup_route)
self.assertIn("if (ui_task.isPairingPromptActive())", setup_route)
self.assertLess(
setup_route.index("if (ui_task.isPairingPromptActive())"),
setup_route.index("renderCompanionSetupDisplay();"),
)
if __name__ == "__main__":
unittest.main()
+44
View File
@@ -144,6 +144,20 @@ require("Heltec_T190_companion_radio_usb_ble_", "build_flags", "ENABLE_USB_INTER
require("Heltec_T190_companion_radio_usb_ble_", "build_flags", "BLE_PIN_CODE=123456")
require("heltec_v4_expansionkit_tft_companion_radio_full_femon", "platform", "platformio/espressif32@6.11.0")
require("heltec_v4_expansionkit_tft_companion_radio_full_femon", "build_flags", "ARDUINO_USB_MODE=1")
full_env_names = sorted(
section_name.removeprefix("env:")
for section_name in sections
if section_name.startswith("env:")
and "companion_radio_full" in section_name.lower()
)
if not full_env_names:
raise SystemExit("test_build_profiles: no concrete Full environments found")
for env_name in full_env_names:
require(
env_name,
"build_flags",
"MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1",
)
reject("heltec_v4_expansionkit_tft_companion_radio_full_femon", "build_flags", "ARDUINO_USB_MODE=0")
reject("heltec_v4_expansionkit_tft_companion_radio_full_femon", "platform", "55.03.311")
reject("heltec_v4_expansionkit_tft_companion_radio_full_femon", "platform_packages", "esp32-core-3.3.11")
@@ -370,6 +384,10 @@ for full_env in "${SUPPORTED_PIO_ENVS[@]}"; do
|| fail "$full_env Full Companion omitted its WiFi runtime overlay"
[[ "$PLATFORMIO_BUILD_FLAGS" == *"MESHCORE_EXPANDED_PARTITION_PROFILE=1"* ]] \
|| fail "$full_env Full Companion omitted its expanded runtime profile"
[[ "$PLATFORMIO_BUILD_FLAGS" == *"COMPANION_RADIO_FULL=1"* ]] \
|| fail "$full_env Full Companion omitted its capability identity"
[[ "$PLATFORMIO_BUILD_FLAGS" == *"BLE_PIN_CODE=123456"* ]] \
|| fail "$full_env Full Companion omitted Bluetooth pairing"
case "${full_env,,}" in
sensecapindicator-espnow_companion_radio_full|\
sensecapindicator-lora_companion_radio_full)
@@ -413,6 +431,32 @@ done
unset PLATFORMIO_BUILD_FLAGS PLATFORMIO_BUILD_UNFLAGS \
PLATFORMIO_BUILD_SRC_FILTER MESHCORE_ESP32_FULL_PARTITION_TABLE
# nRF52 Full targets use the same capability identity and pairing transport,
# plus both host-folder mOTA sources. Check every registered logical target so
# synthetic Full names that share a USB/BLE PlatformIO recipe stay protected.
for full_env in "${SUPPORTED_PIO_ENVS[@]}"; do
is_nrf52_companion_radio_full_target "$full_env" || continue
pio_env=$(get_pio_build_env "$full_env")
PLATFORMIO_BUILD_FLAGS=""
PLATFORMIO_BUILD_UNFLAGS=""
PLATFORMIO_BUILD_SRC_FILTER=""
BUILD_REDUCTIONS=()
apply_companion_radio_full_profile "$full_env" "$pio_env"
[[ "$PLATFORMIO_BUILD_FLAGS" == *"COMPANION_RADIO_FULL=1"* ]] \
|| 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" == *"ENABLE_OTA=1"* ]] \
|| fail "$full_env Full Companion omitted LoRa OTA seeding"
[[ "$PLATFORMIO_BUILD_FLAGS" == *"OTA_FOLDER_SERIAL=1"* ]] \
|| fail "$full_env Full Companion omitted USB folder seeding"
[[ "$PLATFORMIO_BUILD_FLAGS" == *"COMPANION_FEATURE_BLE_MOTA_SOURCE=1"* ]] \
|| fail "$full_env Full Companion omitted BLE folder seeding"
done
unset PLATFORMIO_BUILD_FLAGS PLATFORMIO_BUILD_UNFLAGS \
PLATFORMIO_BUILD_SRC_FILTER
# The bounded AsyncTCP task stack belongs to every ESP32 Full profile, including
# expanded non-Companion builds, but must not leak into ordinary or nRF52
# recipes.
+15
View File
@@ -81,4 +81,19 @@ assert re.search(
features,
)
# A PlatformIO environment whose name promises a Full image must not silently
# emit an ordinary WiFi/USB binary when invoked outside build.sh.
assert re.search(
r"#if defined\(MESHCORE_REQUIRES_COMPANION_RADIO_FULL\).*?"
r"&& !defined\(COMPANION_RADIO_FULL\).*?"
r'#error "This target requires build\.sh to apply the Full Companion profile"',
features,
re.DOTALL,
)
assert re.search(
r"#if defined\(COMPANION_RADIO_FULL\) && !defined\(BLE_PIN_CODE\)\s+"
r'#error "COMPANION_RADIO_FULL requires the Bluetooth Companion transport"',
features,
)
print("test_companion_terminal_profile: PASS")
+27 -2
View File
@@ -208,11 +208,13 @@ int main() {
self.assertIn('"not-configured"', main)
self.assertIn("companion_wifi_setup_requested", loop)
def test_wifi_qr_payload_is_standard_and_escaped(self):
def test_wifi_qr_payload_is_compact_and_escaped(self):
setup = WIFI_QR_PAYLOAD.read_text(encoding="utf-8")
self.assertIn("buildWiFiSetupQrPayload", setup)
self.assertIn('"WIFI:T:WPA;S:"', setup)
self.assertIn('"WIFI:T:nopass;S:"', setup)
# Omitting the optional open-network type keeps the setup payload in
# QR version 1 at low error correction on the 64-pixel OLED.
self.assertIn('"WIFI:S:"', setup)
self.assertIn('strchr("\\\\;,\\\":", *value)', setup)
self.assertIn('";P:"', setup)
self.assertIn('";;"', setup)
@@ -330,6 +332,7 @@ printf '%s\n' "$PLATFORMIO_BUILD_FLAGS"
"-DLORA_BW=62.5",
"-DLORA_SF=7",
"-DLORA_CR=5",
"-DMESHCORE_USA_RADIO_PRESET=1",
"-DCASCADE_PROFILE=1",
"-DDEFAULT_RX_DELAY_BASE=2.0f",
):
@@ -347,6 +350,28 @@ printf '%s\n' "$PLATFORMIO_BUILD_FLAGS"
build,
)
def test_non_usa_radio_does_not_enable_wizard_skip(self):
command = r'''
set -e
source "$1"
PLATFORMIO_BUILD_FLAGS=""
RADIO_SETTING_TITLE="Australia"
RADIO_FREQ_OVERRIDE=915.800
RADIO_BW_OVERRIDE=250
RADIO_SF_OVERRIDE=10
RADIO_CR_OVERRIDE=5
apply_radio_overrides
printf '%s\n' "$PLATFORMIO_BUILD_FLAGS"
'''
result = subprocess.run(
["bash", "-c", command, "test", str(BUILD)],
text=True,
capture_output=True,
check=False,
)
self.assertEqual(result.returncode, 0, result.stderr)
self.assertNotIn("-DMESHCORE_USA_RADIO_PRESET=1", result.stdout.split())
if __name__ == "__main__":
unittest.main()
+33
View File
@@ -22,6 +22,29 @@ class WebConfigUiTest(unittest.TestCase):
self.assertIn('btn.textContent=show?"Hide":"Show"', page)
self.assertIn('btn.setAttribute("aria-pressed",show?"true":"false")', page)
def test_setup_wizard_can_skip_mqtt_and_usa_radio(self):
page = SOURCE.read_text(encoding="utf-8")
self.assertIn('id="wz-radio-skip" onclick="wzSkipRadio()"', page)
self.assertIn('onclick="wzSkipMqtt()">Skip MQTT</button>', page)
self.assertIn("st.radioOptional=!!s.radio_optional", page)
radio_skip = page[page.index("function wzSkipRadio()"):
page.index("function wzUseMqtt()")]
self.assertIn("if(!st.radioOptional)return", radio_skip)
self.assertIn("delete st.dirty.radio", radio_skip)
self.assertIn("delete st.dirty.tx", radio_skip)
mqtt_skip = page[page.index("function wzSkipMqtt()"):
page.index("function popOut()")]
self.assertIn("st.skipMqtt=true", mqtt_skip)
self.assertIn("/^mqtt(?:\\.|[1-9]\\.)/", mqtt_skip)
self.assertIn("syncPacketFilters()", mqtt_skip)
save = page[page.index("function wizardSave()"):
page.index("/* ---------- reboot ---------- */")]
self.assertIn('if(!st.skipRadio&&$("#wz-rp").value==="")', save)
self.assertIn("if(st.hasMqtt&&!st.skipMqtt&&", save)
def test_generated_asset_contains_show_controls(self):
header = HEADER.read_text(encoding="utf-8")
length = int(re.search(r"WEBCONFIG_HTML_GZ_LEN = (\d+);", header).group(1))
@@ -34,6 +57,16 @@ class WebConfigUiTest(unittest.TestCase):
page = gzip.decompress(blob).decode("utf-8")
self.assertEqual(page.count('onclick="toggleWiFiPassword(this)"'), 2)
self.assertIn("function toggleWiFiPassword(btn)", page)
self.assertIn("function wzSkipRadio()", page)
self.assertIn("function wzSkipMqtt()", page)
def test_skipped_mqtt_does_not_pin_display_in_setup_mode(self):
main = (ROOT / "examples" / "companion_radio" / "main.cpp").read_text(
encoding="utf-8"
)
display_route = main[main.index("void loop()") : main.index("rtc_clock.tick();")]
self.assertIn("the_mesh.isWebConfigSetupActive()", display_route)
self.assertNotIn("isMQTTConfigured()", display_route)
if __name__ == "__main__":
+6
View File
@@ -198,6 +198,9 @@ lib_deps =
[env:heltec_rc32_without_display_companion_radio_full]
extends = env:heltec_rc32_without_display_companion_radio_wifi
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_rc32_without_display_companion_radio_wifi.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_rc32_without_display_sensor]
extends = Heltec_RC32
@@ -340,6 +343,9 @@ lib_deps =
[env:heltec_rc32_companion_radio_full]
extends = env:heltec_rc32_companion_radio_wifi
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_rc32_companion_radio_wifi.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_rc32_sensor]
extends = Heltec_RC32_with_display
@@ -419,6 +419,7 @@ extends = env:heltec_tracker_v2_companion_radio_wifi_femon
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_tracker_v2_companion_radio_wifi_femon.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_tracker_v2_companion_radio_wifi_femoff]
extends = env:heltec_tracker_v2_companion_radio_wifi_femon
+3
View File
@@ -379,6 +379,9 @@ lib_deps =
[env:Heltec_v3_companion_radio_full]
extends = env:Heltec_v3_companion_radio_wifi_mqtt
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:Heltec_v3_companion_radio_wifi_mqtt.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:Heltec_v3_sensor]
extends = Heltec_lora32_v3
+5
View File
@@ -567,12 +567,14 @@ extends = env:heltec_v4_companion_radio_wifi_mqtt_femon
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_v4_companion_radio_wifi_mqtt_femon.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_v4_3_companion_radio_full_femoff]
extends = env:heltec_v4_3_companion_radio_wifi_mqtt_femoff
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_v4_3_companion_radio_wifi_mqtt_femoff.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_v4_sensor]
extends = heltec_v4_oled
@@ -748,6 +750,7 @@ extends = env:heltec_v4_expansionkit_tft_companion_radio_ble_femon
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_v4_expansionkit_tft_companion_radio_ble_femon.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_v4_tft_companion_radio_wifi_femon]
extends = heltec_v4_tft
@@ -784,12 +787,14 @@ extends = env:heltec_v4_tft_companion_radio_wifi_femon
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_v4_tft_companion_radio_wifi_femon.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_v4_3_tft_companion_radio_full_femoff]
extends = env:heltec_v4_3_tft_companion_radio_wifi_femoff
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_v4_3_tft_companion_radio_wifi_femoff.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_v4_tft_sensor]
extends = heltec_v4_tft
+2
View File
@@ -284,6 +284,7 @@ extends = env:heltec_v4_r8_companion_radio_wifi
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_v4_r8_companion_radio_wifi.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_v4_r8_sensor]
extends = heltec_v4_r8_oled
@@ -531,6 +532,7 @@ extends = env:heltec_v4_r8_tft_companion_radio_wifi
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:heltec_v4_r8_tft_companion_radio_wifi.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:heltec_v4_r8_tft_sensor]
extends = heltec_v4_r8_tft
+1
View File
@@ -190,6 +190,7 @@ extends = env:LilyGo_TBeam_1W_companion_radio_wifi
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:LilyGo_TBeam_1W_companion_radio_wifi.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
; === LILYGO T-Beam 1W Repeater with ESPNow Bridge ===
[env:LilyGo_TBeam_1W_repeater_bridge_espnow]
+1
View File
@@ -196,6 +196,7 @@ extends = env:meshnology_w12_companion_radio_wifi
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:meshnology_w12_companion_radio_wifi.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:meshnology_w12_sensor]
extends = meshnology_w12
@@ -166,6 +166,7 @@ extends = env:nibble_screen_connect_companion_radio_wifi_
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:nibble_screen_connect_companion_radio_wifi_.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:nibble_screen_connect_kiss_modem_]
@@ -162,3 +162,4 @@ extends = env:nibble_zero_connect_companion_radio_wifi_
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:nibble_zero_connect_companion_radio_wifi_.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
+1
View File
@@ -300,6 +300,7 @@ build_flags =
; Keep the primary Wire bus at 9/40 and put external sensors on Wire1.
-D ENV_PIN_SDA=17
-D ENV_PIN_SCL=18
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:RAK_3112_sensor]
extends = rak3112
+1
View File
@@ -367,6 +367,7 @@ build_flags =
-D ETHERNET_ENABLED=1
-D ETHERNET_USE_RAK13800
-D ETHERNET_CLASS=RAK13800EthernetInterface
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
build_src_filter = ${env:RAK_4631_companion_radio_usb.build_src_filter}
+<helpers/ethernet/*.cpp>
+<helpers/ethernet/RAK13800/>
+1
View File
@@ -336,6 +336,7 @@ build_unflags =
${Station_G2.build_unflags}
build_flags =
${env:Station_G2_companion_radio_wifi.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:Station_G2_kiss_modem]
extends = Station_G2
+1
View File
@@ -161,6 +161,7 @@ extends = env:Station_G3_ESP32_companion_radio_wifi
board_build.flash_mode = ${esp32_s3_full.board_build.flash_mode}
build_flags =
${env:Station_G3_ESP32_companion_radio_wifi.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:Station_G3_ESP32_kiss_modem]
extends = Station_G3_ESP32
+1
View File
@@ -223,6 +223,7 @@ build_flags =
${env:ThinkNode_M2_companion_radio_wifi.build_flags}
-D SERIAL_TX=43
-D SERIAL_RX=44
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:ThinkNode_M2_kiss_modem]
extends = ThinkNode_M2
+1
View File
@@ -239,6 +239,7 @@ build_flags =
${env:ThinkNode_M5_companion_radio_wifi.build_flags}
-D SERIAL_TX=43
-D SERIAL_RX=44
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:ThinkNode_M5_kiss_modem]
extends = ThinkNode_M5
+1
View File
@@ -180,6 +180,7 @@ extends = env:ThinkNode_M7_companion_radio_wifi
build_flags =
${env:ThinkNode_M7_companion_radio_wifi.build_flags}
${ThinkNode_M7_ethernet.build_flags}
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
build_src_filter = ${env:ThinkNode_M7_companion_radio_wifi.build_src_filter}
${ThinkNode_M7_ethernet.build_src_filter}
lib_deps =
+1
View File
@@ -312,6 +312,7 @@ build_flags =
${env:Xiao_S3_WIO_companion_radio_wifi.build_flags}
-D SERIAL_TX=D6
-D SERIAL_RX=D7
-D MESHCORE_REQUIRES_COMPANION_RADIO_FULL=1
[env:Xiao_S3_WIO_sensor]
extends = Xiao_S3_WIO
+59 -8
View File
@@ -296,7 +296,8 @@ body.tab-cli{padding-bottom:0}
</div>
<div class="row">
<button class="btn sec" onclick="wzGo(1)">Back</button>
<button class="btn" style="flex:1" id="wz-radio-next" onclick="wzGo(3)">Next: MQTT</button>
<button class="btn sec hide" style="flex:1" id="wz-radio-skip" onclick="wzSkipRadio()">Skip radio</button>
<button class="btn" style="flex:1" id="wz-radio-next" onclick="wzUseRadio()">Next: MQTT</button>
</div>
</div>
@@ -320,7 +321,8 @@ body.tab-cli{padding-bottom:0}
</div>
<div class="row">
<button class="btn sec" onclick="wzGo(2)">Back</button>
<button class="btn" style="flex:1" onclick="wzGo(4)">Review</button>
<button class="btn sec" style="flex:1" onclick="wzSkipMqtt()">Skip MQTT</button>
<button class="btn" style="flex:1" onclick="wzUseMqtt()">Review</button>
</div>
</div>
@@ -615,7 +617,7 @@ body.tab-cli{padding-bottom:0}
<script>
"use strict";
var SENTINEL="********";
var st={mode:"",authed:false,hasMqtt:false,hasCli:false,wifiPsk64:false,passwordSupported:false,needsPassword:false,caps:0,cfg:null,orig:{},dirty:{},presets:[],nslots:0,statsTimer:0,hist:{heap:[],noise:[]},scanTarget:"",scanTimer:0};
var st={mode:"",authed:false,hasMqtt:false,hasCli:false,wifiPsk64:false,passwordSupported:false,needsPassword:false,radioOptional:false,skipRadio:false,skipMqtt:false,caps:0,cfg:null,orig:{},dirty:{},presets:[],nslots:0,statsTimer:0,hist:{heap:[],noise:[]},scanTarget:"",scanTimer:0};
function $(s){return document.querySelector(s)}
function $$(s){return Array.prototype.slice.call(document.querySelectorAll(s))}
@@ -695,6 +697,7 @@ function applyFeatures(){
? "Passphrases may be up to 63 characters; a 64-character key must be hexadecimal."
: "Passphrases may be up to 63 characters.";
});
$("#wz-radio-skip").classList.toggle("hide",!st.radioOptional);
if(!st.hasCli){
var cliTab=$('#tabs button[data-t="cli"]');if(cliTab)cliTab.remove();
$("#t-cli").classList.add("hide");
@@ -725,6 +728,7 @@ function boot(){
st.mode=s.mode;st.authed=s.auth;st.hasMqtt=!!s.mqtt;st.hasCli=!!s.cli;
st.wifiPsk64=!!s.wifi_psk64;
st.passwordSupported=!!s.password_supported;st.needsPassword=!!s.needs_password;
st.radioOptional=!!s.radio_optional;
st.needsSetup=!!s.needs_setup;st.caps=s.capabilities||0;
st.nslots=st.hasMqtt?(s.active_slots||s.runtime_slots||0):0;
if(s.max_cmds>0)CLI_MAX=s.max_cmds;
@@ -852,7 +856,7 @@ function radioCombo(){
}
function loadConfig(){
return api("/api/config").then(function(c){
st.cfg=c;st.orig={};st.dirty={};
st.cfg=c;st.orig={};st.dirty={};st.skipRadio=false;st.skipMqtt=false;
if(st.hasMqtt){buildSlots("#app-slots");buildSlots("#wz-slots")}
$$("[data-k]").forEach(function(el){
var k=el.dataset.k,v=cfgVal(k);
@@ -1398,6 +1402,7 @@ function wzRadioFill(){
sel.classList.remove("dirty");
}
function wzRadioSel(sel){
st.skipRadio=false;
var v=sel.value,combo;
if(v===""||v==="keep"){combo=st.orig.radio}
else{var p=RADIO_PRESETS[+v];combo=presetCombo(p)}
@@ -1421,6 +1426,7 @@ function wzGo(n){
$("#stp"+i).classList.toggle("on",i<=n);
});
if(n===3){
st.skipMqtt=false;
// Prefill observer name with the node name - only while still blank, so
// an existing config or a manual edit is never clobbered.
var o=$('#wz3 [data-k="mqtt.origin"]');
@@ -1430,6 +1436,49 @@ function wzGo(n){
if(n===4)buildReview();
window.scrollTo(0,0);
}
function wzUseRadio(){
st.skipRadio=false;
wzGo(3);
}
function wzSkipRadio(){
if(!st.radioOptional)return;
st.skipRadio=true;
delete st.dirty.radio;
delete st.dirty.tx;
$$("[data-rg]").forEach(function(el){
var idx={freq:0,bw:1,sf:2,cr:3}[el.dataset.rg];
el.value=st.orig.radio.split(",")[idx];el.classList.remove("dirty");
});
$("#wz-rp").value="keep";
$("#wz-rp").classList.remove("dirty");
$$('[data-k="tx"]').forEach(function(el){
setEl(el,st.orig.tx||"");el.classList.remove("dirty");
});
updateSaveBar();
wzGo(st.hasMqtt?3:4);
}
function wzUseMqtt(){
st.skipMqtt=false;
wzGo(4);
}
function wzSkipMqtt(){
st.skipMqtt=true;
Object.keys(st.dirty).forEach(function(k){
if(/^mqtt(?:\.|[1-9]\.)/.test(k))delete st.dirty[k];
});
$$('[data-k]').forEach(function(el){
if(/^mqtt(?:\.|[1-9]\.)/.test(el.dataset.k)){
setEl(el,st.orig[el.dataset.k]||"");el.classList.remove("dirty");
}
});
for(var i=1;i<=st.nslots;i++){
refreshSlotFields($("#app-slots"),i);
refreshSlotFields($("#wz-slots"),i);
}
syncPacketFilters();
updateSaveBar();
wzGo(4);
}
function popOut(){
// Tell the node to start answering OS captive probes with "success" so the
// sign-in sheet can be dismissed without dropping the WiFi, then walk the
@@ -1456,10 +1505,12 @@ function buildReview(){
if(d.name||st.orig.name)row("Node name",d.name||st.orig.name);
var rc=d.radio||st.orig.radio||"",rp=null;
RADIO_PRESETS.forEach(function(p){if(comboEq(presetCombo(p),rc))rp=p});
row("Radio",(rp?rp.t+" - ":"")+rc.split(",").join(" / ")+(d.radio?"":" (unchanged)"));
row("Radio",st.skipRadio?"Skipped (unchanged)":(rp?rp.t+" - ":"")+rc.split(",").join(" / ")+(d.radio?"":" (unchanged)"));
if(d.tx)row("TX power",d.tx+" dBm");
if(st.passwordSupported&&(st.needsPassword||eff("password")))row("Admin password",eff("password")?"set":"(not set)");
if(st.hasMqtt){
if(st.hasMqtt&&st.skipMqtt){
row("MQTT","Skipped (unchanged)");
}else if(st.hasMqtt){
row("Observer name",d["mqtt.origin"]||st.orig["mqtt.origin"]||"(not set)");
row("IATA",(d["mqtt.iata"]||st.orig["mqtt.iata"]||"(not set)").toUpperCase());
var own=d["mqtt.owner"]||st.orig["mqtt.owner"];
@@ -1477,10 +1528,10 @@ function buildReview(){
}
function wizardSave(){
if(!st.dirty["wifi.ssid"]&&!st.orig["wifi.ssid"]){$("#wz-err").textContent="Please set a WiFi network (step 1).";return}
if($("#wz-rp").value===""){$("#wz-err").textContent="Please choose a radio preset (step 2) - nodes ship with non-US defaults.";return}
if(!st.skipRadio&&$("#wz-rp").value===""){$("#wz-err").textContent="Please choose a radio preset (step 2) - nodes ship with non-US defaults.";return}
var pwdErr=adminPwdError(true);
if(pwdErr){$("#wz-err").textContent=pwdErr+" (step 2).";return}
if(st.hasMqtt&&!/^[A-Za-z]{3}$/.test(st.dirty["mqtt.iata"]||st.orig["mqtt.iata"]||"")){
if(st.hasMqtt&&!st.skipMqtt&&!/^[A-Za-z]{3}$/.test(st.dirty["mqtt.iata"]||st.orig["mqtt.iata"]||"")){
$("#wz-err").textContent="Please enter a 3-letter IATA region code (MQTT step).";return}
$("#wz-err").textContent="";
var b=$("#wz-save"),blabel=b.textContent;b.disabled=true;