mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-11-24 16:17:22 +00:00
Two fail-safes in the tracking blocks force a loss of lock: the bit or secondary code synchronization time limit (bit_synchronization_time_limit_s), and the telemetry fault message sent by the telemetry decoders. Both did it by writing a large value into d_carrier_lock_fail_counter (300000 and 200000, respectively) and relying on the lock check to find it above max_carrier_lock_fail. When max_carrier_lock_fail is configured above those values, neither fail-safe drops the channel: unless the lock detectors drop it for other reasons, a channel that never achieves bit synchronization keeps tracking past the time limit, and a channel whose telemetry decoder reports a fault keeps tracking. Replace the magic counter values with a d_force_loss_of_lock flag. Both fail-safes set it, cn0_and_tracking_lock_status() declares the loss of lock when it is set, whatever the lock fail counters, and it is cleared when the loss of lock is declared and when a new tracking attempt starts. The loss-of-lock log line now says when the loss was forced, since the counter values no longer show it. The same change is applied to dll_pll_veml_tracking, dll_pll_veml_tracking_fpga and kf_tracking, the three blocks that used this pattern. Add two tests to trk_test that set max_carrier_lock_fail = 1000000 and check that a telemetry fault and the synchronization time limit still drop the channel. Signed-off-by: ObvMamut <obvmamut@proton.me>