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
+5 -7
View File
@@ -140,15 +140,13 @@ static void ble_request_fast_conn_params(uint16_t handle) {
static void ble_optimize_link(uint16_t handle) {
int rc;
/*
* Do NOT request 2M PHY here. With ESP-NOW/WiFi coexistence the controller
* can assert in llc_phy_upd (e.g. "BLE assert llc_phy_upd.c …") and the
* host link dies — no further responses. Stay on default 1M.
*/
ble_request_fast_conn_params(handle);
rc = ble_gap_set_prefered_le_phy(handle, BLE_GAP_LE_PHY_2M_MASK,
BLE_GAP_LE_PHY_2M_MASK,
BLE_GAP_LE_PHY_CODED_ANY);
if (rc != 0) {
ESP_LOGW(TAG, "2M PHY request failed: %d", rc);
}
rc = ble_gap_set_data_len(handle, 251, 2120);
if (rc != 0) {
ESP_LOGW(TAG, "data len request failed: %d", rc);
+4 -2
View File
@@ -435,11 +435,13 @@ static void handle_accel_sample(const uint8_t mac[CLIENT_MAC_LEN],
esp_err_t err = client_registry_update_accel(
mac, sample->slave_id, (int16_t)sample->x, (int16_t)sample->y,
(int16_t)sample->z);
if (err == ESP_ERR_NOT_FOUND) {
if (err == ESP_ERR_NOT_FOUND || err == ESP_ERR_INVALID_STATE) {
// Unknown MAC, or stream already off (in-flight samples after disable).
return;
}
if (err != ESP_OK) {
ESP_LOGW(TAG, "accel sample id mismatch from %02x:…:%02x", mac[0], mac[5]);
ESP_LOGW(TAG, "accel sample id mismatch from %02x:…:%02x (slave_id=%lu)",
mac[0], mac[5], (unsigned long)sample->slave_id);
}
}