From c2907226332d46fa3034dc68ddfc12d248ac77b4 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Tue, 26 May 2026 07:55:56 +0200 Subject: [PATCH] =?UTF-8?q?refactor(ui):=20trail=20GPX=20=E2=80=94=20dump?= =?UTF-8?q?=20always,=20vary=20the=20confirm=20to=20reflect=20risk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Blocking the export when BLE isn't connected also blocked the no-app case (user attached only a terminal). Dump unconditionally and let the confirm alert tell the user what just happened: - BLE connected → "GPX N B (USB)" — USB receive is parked, no collision - BLE absent → "GPX N B - disc. app" — reminder that the same USB pipe the app would use just carried raw XML, so reconnect/restart the app if you had one running User can also reach the "no app, terminal-only" workflow naturally. Co-Authored-By: Claude Sonnet 4.6 --- examples/companion_radio/ui-new/TrailScreen.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/companion_radio/ui-new/TrailScreen.h b/examples/companion_radio/ui-new/TrailScreen.h index da71430c..87a34f5e 100644 --- a/examples/companion_radio/ui-new/TrailScreen.h +++ b/examples/companion_radio/ui-new/TrailScreen.h @@ -167,17 +167,17 @@ private: void handleExport() { if (!Serial) { _task->showAlert("Connect USB first", 1200); return; } // The companion app multiplexes BLE + USB on the same frame protocol. - // When BLE is connected, USB-receive is ignored and we can safely push - // raw GPX bytes to USB. With BLE off the app would be on USB itself, - // so the dump would corrupt its incoming frames — refuse and tell the - // user how to make space. - if (!_task->hasConnection()) { - _task->showAlert("Connect BLE or disconnect app", 1500); - return; - } + // When BLE is connected, USB-receive is ignored and the dump can't + // collide. Without a BLE link the app might be on USB itself, in + // which case the raw GPX would land mid-frame and confuse it — warn + // the user but proceed (they may have no app attached at all). size_t n = _store->exportGpx(Serial); - char alert[24]; - snprintf(alert, sizeof(alert), "GPX %u B over USB", (unsigned)n); + char alert[28]; + if (_task->hasConnection()) { + snprintf(alert, sizeof(alert), "GPX %u B (USB)", (unsigned)n); + } else { + snprintf(alert, sizeof(alert), "GPX %u B - disc. app", (unsigned)n); + } _task->showAlert(alert, 1500); }