diff --git a/rx888.c b/rx888.c index db2bbf8..137ce50 100644 --- a/rx888.c +++ b/rx888.c @@ -424,13 +424,15 @@ static void *agc_rx888(void *arg){ if(frontend->rf_agc && (new_dBFS > AGC_upper_limit || new_dBFS < AGC_lower_limit)){ float const target_level = (AGC_upper_limit + AGC_lower_limit)/2; float const new_gain = frontend->rf_gain - (new_dBFS - target_level); - if(Verbose) - fprintf(stdout,"Front end gain change from %.1f dB to %.1f dB\n",frontend->rf_gain,new_gain); - rx888_set_gain(sdr,new_gain,false); - // Change averaged value to speed convergence - frontend->if_power *= dB2power(target_level - new_dBFS); - // Unlatch high water mark - frontend->if_power_max = 0; + if(new_gain > 34){ // Don't try to go above max gain + if(Verbose) + fprintf(stdout,"Front end gain change from %.1f dB to %.1f dB\n",frontend->rf_gain,new_gain); + rx888_set_gain(sdr,new_gain,false); + // Change averaged value to speed convergence + frontend->if_power *= dB2power(target_level - new_dBFS); + // Unlatch high water mark + frontend->if_power_max = 0; + } } } return NULL;