mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
fix: correct dual serial interface — routing, UI state, debug logging
- isConnected() returns true always (USB always available, mesh can send) - isBLEConnected() added to BaseSerialInterface for BLE-specific UI/buzzer state - MyMesh uses isBLEConnected() to update UITask connection indicator - Disable BLE_DEBUG_LOGGING in dual build (would corrupt USB stream) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2216,7 +2216,7 @@ void MyMesh::loop() {
|
||||
}
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
if (_ui) _ui->setHasConnection(_serial->isConnected());
|
||||
if (_ui) _ui->setHasConnection(_serial->isBLEConnected());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ public:
|
||||
virtual bool isEnabled() const = 0;
|
||||
|
||||
virtual bool isConnected() const = 0;
|
||||
// Returns true when a BLE companion app is connected. Default delegates to
|
||||
// isConnected(); override in dual-interface wrappers that always report
|
||||
// isConnected()=true but still need to distinguish BLE from USB state.
|
||||
virtual bool isBLEConnected() const { return isConnected(); }
|
||||
|
||||
virtual bool isWriteBusy() const = 0;
|
||||
virtual size_t writeFrame(const uint8_t src[], size_t len) = 0;
|
||||
|
||||
@@ -22,8 +22,10 @@ public:
|
||||
void disable() override { _ble.disable(); _usb.disable(); }
|
||||
bool isEnabled() const override { return _ble.isEnabled() || _usb.isEnabled(); }
|
||||
|
||||
// Reports BLE connection state (used for UI indicator and buzzer Auto mode)
|
||||
bool isConnected() const override { return _ble.isConnected(); }
|
||||
// Always true — USB is always available as fallback, so the mesh can send.
|
||||
bool isConnected() const override { return true; }
|
||||
// True only when a BLE companion app is paired and connected.
|
||||
bool isBLEConnected() const override { return _ble.isConnected(); }
|
||||
|
||||
bool isWriteBusy() const override {
|
||||
return _ble.isConnected() ? _ble.isWriteBusy() : _usb.isWriteBusy();
|
||||
|
||||
@@ -140,6 +140,7 @@ extra_scripts = post:create-uf2.py
|
||||
extends = WioTrackerL1CompanionBLE
|
||||
build_flags = ${WioTrackerL1CompanionBLE.build_flags}
|
||||
-D DUAL_SERIAL=1
|
||||
-U BLE_DEBUG_LOGGING
|
||||
|
||||
[env:WioTrackerL1_companion_radio_dual]
|
||||
extends = WioTrackerL1CompanionDual
|
||||
|
||||
Reference in New Issue
Block a user