shermp / Pico-ASHA

ASHA on a Pico
BSD 3-Clause "New" or "Revised" License
29 stars 1 forks source link

Runtime settings and USB serial control #8

Closed shermp closed 1 month ago

shermp commented 2 months ago

Some major quality-of-life features, and bits needed for a GUI companion app.

USB serial is always enabled. UART can be optionally enabled at runtime using the new runtime settings and serial commands.

Runtime settings include changing log level, toggling UART, disabling wait for USB connection, and enabling HCI dump (reset required). These settings are saved to flash and survive reset/power loss.

Commands can now be sent over USB serial to set the above settings, as well as list status, advertising reports, connected devices.

Device pairing is no longer automatic, the user interaction is required to pair devices using the command protocol. A GUI application will be developed to make this easy. Already paired devices will still connect automatically.

All device pairings can be cleared using the command protocol.

The command protocol is documented in doc/command_protocol.md. It is implemented using minified JSON.

Since the shift to using async_contex has been so successful, copy to RAM is no longer required and has been removed.

shermp commented 1 month ago

Some improvements have been made:

Pairing is back to automatic, but I have made some enhancements. A new setting has been added to store when a complete set (pair or single, depending if binaural or mono) of devices has been paired. When this is the case, all other devices will be ignored during scanning. This should reduce unintended pairings. A consequence of this is the removal of advertising reports from the command API.

A circular log buffer has been added. Logs are dumped when USB serial is connected. This removes the need to wait for USB serial on startup.