From 079fda30a6756cf770ad88e03be16c448d50f956 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Mon, 18 Nov 2024 22:23:37 +0100 Subject: [PATCH] fixup --gain -10 was broken while implementing autogain bad setting regardless, use 58 instead of -10 to set maximum gain on rtl-sdr --- sdr_rtlsdr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdr_rtlsdr.c b/sdr_rtlsdr.c index fb3bb470..18de7d2d 100644 --- a/sdr_rtlsdr.c +++ b/sdr_rtlsdr.c @@ -104,6 +104,10 @@ static int getClosestGainIndex(int target) { } void rtlsdrSetGain(char *reason) { + if (Modes.gain == MODES_AUTO_GAIN || Modes.gain >= 520) { + Modes.gain = MODES_RTL_AGC; + } + if (Modes.increaseGain || Modes.lowerGain) { int closest = getClosestGainIndex(Modes.gain); if (Modes.increaseGain) { @@ -137,8 +141,7 @@ void rtlsdrSetGain(char *reason) { if (Modes.gain < 0) { Modes.gain = 0; } - if (Modes.gain == MODES_AUTO_GAIN || Modes.gain >= 520) { - Modes.gain = MODES_RTL_AGC; + if (Modes.gain == MODES_RTL_AGC) { RTLSDR.tunerAgcEnabled = 1; if (!Modes.gainQuiet) {