mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
fix(ui): trail GPX export — guard against USB-app collision
The Wio L1 DualSerialInterface multiplexes BLE + USB on the same frame protocol: when BLE is connected, the USB receive path is ignored, so we can safely push raw GPX bytes to USB without confusing the companion app. When BLE is *not* connected the app is talking over USB itself — the dump would land mid-frame and the app would parse garbage. Block the export when hasConnection() (BLE link to the app) is false and show "Connect BLE or disconnect app". When it's true the dump runs and the confirm alert reads "GPX N B over USB" so the user knows which pipe to read from. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -165,11 +165,20 @@ private:
|
||||
_task->showAlert(ok ? "Trail loaded" : "Load failed", 800);
|
||||
}
|
||||
void handleExport() {
|
||||
if (!Serial) { _task->showAlert("Connect USB first", 1000); return; }
|
||||
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;
|
||||
}
|
||||
size_t n = _store->exportGpx(Serial);
|
||||
char alert[24];
|
||||
snprintf(alert, sizeof(alert), "GPX %u B sent", (unsigned)n);
|
||||
_task->showAlert(alert, 1200);
|
||||
snprintf(alert, sizeof(alert), "GPX %u B over USB", (unsigned)n);
|
||||
_task->showAlert(alert, 1500);
|
||||
}
|
||||
|
||||
static constexpr const char* TRAIL_FILE = "/trail";
|
||||
|
||||
Reference in New Issue
Block a user