mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-23 05:11:24 +00:00
fix(ble,usb): three bugs from BLE audit
1. USB takeover opcode mismatch ZephyrCompanionUSB.cpp checked payload[0] == 0x03 with a comment claiming CMD_APP_START, but CMD_APP_START is 0x01 (0x03 is CMD_SEND_CHANNEL_TXT_MSG). The USB handshake silently dropped the companion app's first frame on every connection; the app appeared broken over USB until the user happened to send a channel message. 2. CMD_SET_ADVERT_NAME didn't propagate to BLE adv data Name changes were persisted to prefs but the advertising payload and GATT device name kept the old value until reboot. Added zephcore_ble_update_name() and called it from the handler. 3. No advertising-health watchdog If bt_le_adv_start() ever failed transiently (HCI timeout, controller pacing), the device would silently stop advertising and stay undiscoverable until reboot. Added an adv_running flag and a 5s watchdog in the companion housekeeping handler that nudges adv back on if it stops outside a connection. Tracks Arduino nrf52's equivalent 10s watchdog.
This commit is contained in:
1 parent
78f0c1c840
commit
d7e420bf2f
5 files changed
+82
-2
No files matched your search
@@ -1899,6 +1899,8 @@ bool CompanionMesh::handleProtocolFrame(const uint8_t *data, size_t len)
|
||||
memcpy(prefs.node_name, &data[1], nlen);
|
||||
prefs.node_name[nlen] = '\0';
|
||||
_store->savePrefs(prefs);
|
||||
/* Push the new name to BLE so scanners see it without a reboot. */
|
||||
zephcore_ble_update_name(prefs.node_name);
|
||||
}
|
||||
sendPacketOk();
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user