From b94c0f62ba8ae2e7b9f028b8bc3c5b089a0621ad Mon Sep 17 00:00:00 2001 From: RobVanProd Date: Tue, 11 Aug 2026 20:15:03 -0400 Subject: [PATCH] Expose the audio terminal deferral counter #221 added terminalAudioDeferrals to the uplink telemetry but never exported it, so the counter that shows the End-terminal hold engaging was unreadable from the robot. During that PR's physical qualification /debug returned nothing for it, and the evidence could only state the narrower claim: the audio_count_mismatch failure did not recur, and terminal delivery was never harmed. Distinguishing "the hold worked" from "the race did not happen to trigger" needs the counter. Export it in /debug alongside the existing terminal retry and timeout counters, and on the serial status line with them. Telemetry only; no behaviour change. pio test -e native_logic: 316/316. Co-Authored-By: Claude Opus 5 --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index f3e6a34..05f5464 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6288,6 +6288,8 @@ void printRuntimeStatus() { Serial.print(uplink.terminalRetries); Serial.print(F(" bridge_uplink_terminal_timeouts=")); Serial.print(uplink.terminalTimeouts); + Serial.print(F(" bridge_uplink_terminal_audio_deferrals=")); + Serial.print(uplink.terminalAudioDeferrals); Serial.print(F(" bridge_uplink_cancel_frames=")); Serial.print(uplink.cancelFramesQueued); #if STACKCHAN_HAS_MWW_WAKE_PROBE && STACKCHAN_ENABLE_BRIDGE_AUDIO_UPLINK && STACKCHAN_MWW_WAKE_DRIVES_AUDIO_UPLINK @@ -8522,6 +8524,12 @@ void serveBridgeLeanStatusJson(WiFiClient& client, static_cast(uplink.terminalRetries)); append(",\"bridge_uplink_terminal_timeouts\":%lu", static_cast(uplink.terminalTimeouts)); + // End terminals held back because PCM this turn already counted was still owed + // to the socket. Without this the hold that keeps utterance_end from + // overtaking its own audio is invisible from the robot, so qualification can + // only observe the absence of the failure rather than the fix engaging. + append(",\"bridge_uplink_terminal_audio_deferrals\":%lu", + static_cast(uplink.terminalAudioDeferrals)); append(",\"bridge_uplink_cancel_frames\":%lu", static_cast(uplink.cancelFramesQueued)); append(",\"bridge_network_write_deferrals\":%lu",