Add no audio agc

pull/139/head
erikkaashoek 10 months ago
parent 1e9c1874b8
commit aa78ccc1cd

@ -880,6 +880,7 @@ typedef struct config {
#endif #endif
#ifdef TINYSA4 #ifdef TINYSA4
uint8_t hide_21MHz; uint8_t hide_21MHz;
uint8_t no_audio_agc;
#endif #endif
float sweep_voltage; float sweep_voltage;
float switch_offset; float switch_offset;

@ -4446,11 +4446,11 @@ again: // Spur redu
#endif #endif
else if (get_sweep_frequency(ST_SPAN)<50000000 || max2871) { // When scanning less then 50MHz else if (get_sweep_frequency(ST_SPAN)<50000000 || max2871) { // When scanning less then 50MHz
if (actual_rbw_x10 <= 3000) { if (actual_rbw_x10 <= 3000) {
freq_t shift = (max2871 ? 700000 : 0); freq_t shift = (max2871 ? 0 : 0);
freq_t tf= ((lf - shift + actual_rbw_x10*1000) / TXCO_DIV3) * TXCO_DIV3; freq_t tf= ((lf - shift + actual_rbw_x10*1000) / TXCO_DIV3) * TXCO_DIV3;
if (tf + shift + actual_rbw_x10*1000 >= lf && tf + shift < lf + actual_rbw_x10*1000) // 10MHz if (tf + shift + actual_rbw_x10*1000 >= lf && tf + shift < lf + actual_rbw_x10*1000) // 10MHz
if (max2871) if (max2871)
ADF4351_R_counter(3); // To avoid PLL Loop shoulders at multiple of 10MHz ADF4351_R_counter(1);
else else
ADF4351_R_counter(-4); // To avoid PLL Loop shoulders at multiple of 10MHz ADF4351_R_counter(-4); // To avoid PLL Loop shoulders at multiple of 10MHz
else { else {

@ -2136,6 +2136,9 @@ void SI4432_Listen(int s)
// SI4463_WAIT_CTS; // Wait for CTS // SI4463_WAIT_CTS; // Wait for CTS
do { do {
uint8_t v = Si446x_readRSSI(); uint8_t v = Si446x_readRSSI();
if (config.no_audio_agc) {
DAC->DHR12R1 = v << 4; // Use DAC: CH1 and put 12 bit right aligned value
} else {
if (max < v) // Peak if (max < v) // Peak
max = v; max = v;
if (count > 1000) { // Decay if (count > 1000) { // Decay
@ -2145,6 +2148,7 @@ void SI4432_Listen(int s)
count++; count++;
v = max - v; v = max - v;
DAC->DHR12R1 = dBm_to_volt[v] << 4; // Use DAC: CH1 and put 12 bit right aligned value DAC->DHR12R1 = dBm_to_volt[v] << 4; // Use DAC: CH1 and put 12 bit right aligned value
}
} while(operation_requested == OP_NONE); } while(operation_requested == OP_NONE);
count = 0; count = 0;
// dacPutChannelX(&DACD2, 0, 0); // dacPutChannelX(&DACD2, 0, 0);

16
ui.c

@ -2782,6 +2782,21 @@ static UI_FUNCTION_ADV_CALLBACK(menu_linear_averaging_acb)
ui_mode_normal(); ui_mode_normal();
} }
static UI_FUNCTION_ADV_CALLBACK(menu_audio_agc_acb)
{
(void)data;
(void)item;
if (b){
b->icon = config.no_audio_agc ? BUTTON_ICON_NOCHECK : BUTTON_ICON_CHECK;
return;
}
config.no_audio_agc = ! config.no_audio_agc;
dirty = true;
config_save();
// menu_move_back();
ui_mode_normal();
}
#endif #endif
@ -4941,6 +4956,7 @@ static const menuitem_t menu_settings[] =
{ MT_ADV_CALLBACK,0, "PROGRESS\nBAR", menu_progress_bar_acb}, { MT_ADV_CALLBACK,0, "PROGRESS\nBAR", menu_progress_bar_acb},
{ MT_ADV_CALLBACK, 0, "DIRECT\nMODE", menu_direct_acb}, { MT_ADV_CALLBACK, 0, "DIRECT\nMODE", menu_direct_acb},
{ MT_ADV_CALLBACK, 0, "LINEAR\nAVERAGING", menu_linear_averaging_acb}, { MT_ADV_CALLBACK, 0, "LINEAR\nAVERAGING", menu_linear_averaging_acb},
{ MT_ADV_CALLBACK, 0, "AUDIO\nAGC", menu_audio_agc_acb},
#ifdef __HARMONIC__ #ifdef __HARMONIC__
{ MT_SUBMENU ,0, "HARMONIC", menu_harmonic}, { MT_SUBMENU ,0, "HARMONIC", menu_harmonic},
#endif #endif

Loading…
Cancel
Save

Powered by TurnKey Linux.