Add software adaptive gain control, ported from dump1090-fa#35
Open
tytech039 wants to merge 2 commits into
Open
Add software adaptive gain control, ported from dump1090-fa#35tytech039 wants to merge 2 commits into
tytech039 wants to merge 2 commits into
Conversation
Port dump1090-fa's adaptive.c to dump978. Two independent modes, both off by default and available only with --sdr: * --adaptive-range: track the noise floor and hold the highest gain that still meets a target dynamic range * --adaptive-burst: back the gain off when loud, message-length, undecodable bursts indicate receiver overload The full set of dump1090-fa tuning options is exposed with the same defaults. Gain is stepped through a table built from the SoapySDR gain range (1dB steps if the device reports no step size). Magnitudes are fed from a new SampleConverter::ConvertMag16 output; decoded message extents are excluded from burst detection as in dump1090. All adaptive work runs on the SDR rx thread, serialized with readStream. adaptive.h/adaptive.cc retain dump1090's GPLv2+ license headers (copyright FlightAware in both projects); note that this differs from dump978's 2-clause BSD license.
dump1090 counts loud-window runs of 2..5 windows (80..200us) as candidate undecoded messages, matching Mode S frames of 64/120us. UAT downlink frames are 276/420 bits at 1.041667Mbps (~265us/~403us, ~7/~11 windows), so accept runs of 5..13 windows instead; runs shorter than that (e.g. DME pulses) or longer (ground uplink frames, continuous interference) are ignored. Also carry a decoded message's samples across the adaptive feed boundary so its remainder is fed as decoded rather than undecoded on the next call; with the wider run-length bounds, a clipped decoded message could otherwise be miscounted as an undecoded burst.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This ports dump1090-fa's adaptive gain feature (README.adaptive-gain.md,
adaptive.c) to dump978. Two independent modes, both off by default and available only with--sdr:--adaptive-range(dynamic range mode): tracks the noise floor and holds the highest gain that still meets a target dynamic range (default: 60% of the SDR's gain range in dB, ~30dB for an RTLSDR).--adaptive-burst(burst mode): backs the gain off when loud, message-length, undecodable bursts suggest receiver overload, and raises it again once things quieten down.Implementation notes
--adaptive-min-gain,--adaptive-max-gain,--adaptive-duty-cycle, and the per-mode knobs). Adaptive gain requires manual gain control and is rejected in combination with--sdr-auto-gain.SampleConverter::ConvertMag16output; decoded message extents are excluded from burst detection as in dump1090. All adaptive work runs on the SDR rx thread, serialized withreadStream.Licensing
adaptive.h/adaptive.cc/adaptive_tests.ccretain dump1090's GPLv2+ license headers (copyright FlightAware in both projects). Note this differs from dump978's 2-clause BSD license — happy to adjust if you'd prefer to relicense your own code under BSD here.Testing
adaptive_tests.cccovers the ported logic and runs undermake testalongsidefec_tests.