mirror of
https://github.com/misadeks/tetra-bluestation.git
synced 2026-10-23 18:02:21 +00:00
While the MS is unsynchronized the downlink demodulator stays in Mode::DlUnsynchronized and never yields a demodulated slot, so the SoapySDR rxtx_timeslot RX loop (while process_rx_block) spun until the MS camped on a cell. The MS run loop only checks the stop flag between rxtx_timeslot calls, so a Ctrl+C while not connected to a base station was deferred until a downlink appeared -- the process appeared to 'await connection' before exiting. Give RxTxDevSoapySdr a cooperative shutdown flag (the process-wide is_running, wired only in build_ms_stack) and break out of the RX loop when a shutdown is requested *and* the downlink is not synchronized. The break is gated on !dl_synchronized so a shutdown while camped is byte-identical to before: the loop still returns each slot on its own, letting MM transmit its U-ITSI DETACH during the bounded drain. No-op in BS mode (no flag installed). - soapy_dev.rs: run_flag field + set_run_flag(), stop_requested()/dl_synchronized() helpers, RxDsp::dl_synchronized(), DemodulatorChannel::is_synchronized(). - demodulator.rs: Demodulator::is_synchronized() (Mode::Dl). - main.rs: wire is_running into the MS PhyMs SDR device. - docs/MS_MODE.md: document the unconnected-shutdown behaviour. Build (bluestation-bs) clean; 312 lib + all integration tests pass. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>