From d49618a5ab0c8f6b5c561a8bce2cb38c5b226f2d Mon Sep 17 00:00:00 2001 From: GlassOnTin Date: Sun, 29 Mar 2026 11:58:55 +0100 Subject: [PATCH] Prevent beacon deep sleep on USB power, add beacon_gate to metrics Watch no longer enters deep sleep after beacon TX when on external power (charging or charged). This keeps the display, USB serial, and debug tools active during development. On battery only, the sleep/wake beacon cycle operates normally for power conservation. Added beacon_gate and hw_ready to metrics output for debugging beacon activation: gate 1=host active, 2=startup delay, 3=radio offline, 4=no GPS fix, 5=interval wait, 6=beacon sent. Verified: radio comes online with "RADIO" mode indicator and amber "---" LoRa complication when provisioned with GPS fix. Beacon mode activates after 15s no-host timeout. --- Gui.h | 6 ++++-- RNode_Firmware.ino | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Gui.h b/Gui.h index 892a7eb..622b046 100644 --- a/Gui.h +++ b/Gui.h @@ -919,11 +919,13 @@ static void gui_cmd_execute() { snprintf(buf, sizeof(buf), "{\"build\":\"%s %s\",\"loop\":%lu,\"radio\":%lu," "\"serial\":%lu,\"disp\":%lu,\"pmu\":%lu," - "\"gps\":%lu,\"bt\":%lu,\"imu\":%lu}\n", + "\"gps\":%lu,\"bt\":%lu,\"imu\":%lu," + "\"bcn_gate\":%d,\"hw_ready\":%d}\n", __DATE__, __TIME__, gui_loop_us_last, prof_radio_us, prof_serial_us, prof_display_us, prof_pmu_us, prof_gps_us, - prof_bt_us, prof_imu_us); + prof_bt_us, prof_imu_us, + beacon_gate, hw_ready ? 1 : 0); gui_loop_us_max = 0; Serial.write((uint8_t *)buf, strlen(buf)); Serial.flush(); diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index 05238c0..d2d0f3e 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -2073,10 +2073,12 @@ void loop() { #endif // Enter beacon sleep cycle when in standalone mode after beacon TX + // Don't sleep when on external power (USB) — keeps display and debug active #if BOARD_MODEL == BOARD_TWATCH_ULT if (beacon_mode_active && beacon_gate == 6 && + battery_state != BATTERY_STATE_CHARGING && + battery_state != BATTERY_STATE_CHARGED && (last_host_activity == 0 || (millis() - last_host_activity >= BEACON_NO_HOST_TIMEOUT_MS))) { - // Beacon was just sent and no host is connected — sleep until next interval sleep_now(); } #endif