Harden BLE host link and expose latency tools in the dashboard.

Add BLE RTT/stream tests and live tick median in the UI, fix concurrent WebSocket writes and late BATTERY replies, and skip 2M PHY updates that assert under ESP-NOW coexistence.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-23 23:27:39 +02:00
co-authored by Cursor
parent aa67edfe94
commit af20635047
14 changed files with 893 additions and 293 deletions
+25 -2
View File
@@ -33,6 +33,7 @@ type managedHost struct {
sp *serialPort
ble *bleLink
otaActive bool
pausePoll bool // true while BLE latency tests run (pollers yield)
uartPort string // remembered UART port for reconnect
}
@@ -291,10 +292,32 @@ func (m *managedHost) exchangePayloadPoll(payload []byte, cmdName string) ([]byt
return m.exchangePayloadMode(true, payload, cmdName, readTimeout)
}
func (m *managedHost) beginPausePoll() bool {
m.mu.Lock()
defer m.mu.Unlock()
if m.otaActive || m.pausePoll {
return false
}
m.pausePoll = true
return true
}
func (m *managedHost) endPausePoll() {
m.mu.Lock()
m.pausePoll = false
m.mu.Unlock()
}
func (m *managedHost) PollPaused() bool {
m.mu.Lock()
defer m.mu.Unlock()
return m.pausePoll || m.otaActive
}
func (m *managedHost) exchangePayloadMode(poll bool, payload []byte, cmdName string, timeout time.Duration) ([]byte, error) {
m.mu.Lock()
defer m.mu.Unlock()
if m.otaActive {
if m.otaActive || (poll && m.pausePoll) {
return nil, errHostBusy
}
switch m.transport {
@@ -302,7 +325,7 @@ func (m *managedHost) exchangePayloadMode(poll bool, payload []byte, cmdName str
if m.ble == nil {
return nil, fmt.Errorf("BLE not connected")
}
resp, err := m.ble.exchangePayload(payload, cmdName)
resp, err := m.ble.exchangePayloadTimeout(payload, cmdName, timeout)
if err != nil {
m.invalidateLocked(err)
}