Module radio_task

Module radio_task 

Source

Macrosยง

global_read ๐Ÿ”’
Read a global setting, propagating transport errors to trigger reconnect. Protocol/parse errors default to the provided fallback (non-fatal).

Enumsยง

EnterAprsError ๐Ÿ”’
Error type for the APRS session helper โ€” the radio is lost, reconnect required.
EnterDStarError ๐Ÿ”’
Error type for the D-STAR gateway session โ€” the radio is lost, reconnect required.
PollError ๐Ÿ”’
Distinguishes transport errors (connection lost) from protocol errors (parse failures). Transport errors break out of the poll loop to the reconnect path. Protocol errors are non-fatal โ€” the current poll cycle is skipped but the connection stays alive.

Constantsยง

POLL_INTERVAL ๐Ÿ”’
Poll interval for reading radio state. ~10 commands per cycle (FQ, SQ, MD, PC, RA, FS per band + globals). SM and BY are NOT polled โ€” they use AI push notifications instead.
RECONNECT_INTERVAL ๐Ÿ”’
Reconnect poll interval after disconnect.

Functionsยง

classify_error ๐Ÿ”’
discover_and_open ๐Ÿ”’
discover_and_open_transport ๐Ÿ”’
Open a transport on the calling thread (must be main for BT).
enter_aprs_session ๐Ÿ”’
Enter APRS mode, run the event loop, and return the radio on clean exit.
enter_dstar_session ๐Ÿ”’
Enter D-STAR gateway mode, run the event loop, and return the radio on clean exit.
freq_down ๐Ÿ”’
Step frequency down by reading current freq + step size, subtracting, and tuning. DW (frequency down) exists but does not echo the resulting frequency, so we compute it manually for accurate TUI display.
poll_band ๐Ÿ”’
Poll per-band state: frequency, squelch setting, mode, power, attenuator, step size.
poll_once ๐Ÿ”’
run_aprs_loop ๐Ÿ”’
Run the APRS event loop until ExitAprs is received or a transport error occurs.
run_dstar_loop ๐Ÿ”’
Run the D-STAR gateway event loop until ExitDStar is received or a transport error occurs.
spawn_with_transport ๐Ÿ”’
Spawn the radio communication task with a pre-opened transport.