refactor(ui): trail GPX — dump always, vary the confirm to reflect risk

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 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-26 07:55:56 +02:00
parent fb32df37c8
commit c290722633

View File

@@ -167,17 +167,17 @@ private:
void handleExport() { void handleExport() {
if (!Serial) { _task->showAlert("Connect USB first", 1200); return; } if (!Serial) { _task->showAlert("Connect USB first", 1200); return; }
// The companion app multiplexes BLE + USB on the same frame protocol. // The companion app multiplexes BLE + USB on the same frame protocol.
// When BLE is connected, USB-receive is ignored and we can safely push // When BLE is connected, USB-receive is ignored and the dump can't
// raw GPX bytes to USB. With BLE off the app would be on USB itself, // collide. Without a BLE link the app might be on USB itself, in
// so the dump would corrupt its incoming frames — refuse and tell the // which case the raw GPX would land mid-frame and confuse it — warn
// user how to make space. // the user but proceed (they may have no app attached at all).
if (!_task->hasConnection()) {
_task->showAlert("Connect BLE or disconnect app", 1500);
return;
}
size_t n = _store->exportGpx(Serial); size_t n = _store->exportGpx(Serial);
char alert[24]; char alert[28];
snprintf(alert, sizeof(alert), "GPX %u B over USB", (unsigned)n); 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); _task->showAlert(alert, 1500);
} }