diff --git a/Makefile b/Makefile index 86f46b6..17fec9b 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ ENABLE_BOOT_BEEPS := 0 ENABLE_COMPANDER := 1 ENABLE_SHOW_CHARGE_LEVEL := 0 ENABLE_REVERSE_BAT_SYMBOL := 1 -ENABLE_AM_AGC_GAIN := 1 +ENABLE_AM_FIX := 1 ENABLE_AUDIO_BAR := 0 #ENABLE_SINGLE_VFO_CHAN := 1 #ENABLE_BAND_SCOPE := 1 @@ -197,8 +197,8 @@ endif ifeq ($(ENABLE_REVERSE_BAT_SYMBOL),1) CFLAGS += -DENABLE_REVERSE_BAT_SYMBOL endif -ifeq ($(ENABLE_AM_AGC_GAIN),1) - CFLAGS += -DENABLE_AM_AGC_GAIN +ifeq ($(ENABLE_AM_FIX),1) + CFLAGS += -DENABLE_AM_FIX endif ifeq ($(ENABLE_AUDIO_BAR),1) CFLAGS += -DENABLE_AUDIO_BAR diff --git a/app/app.c b/app/app.c index 7fbb68e..cd77ea8 100644 --- a/app/app.c +++ b/app/app.c @@ -1314,7 +1314,7 @@ void APP_CheckKeys(void) } } -#ifdef ENABLE_AM_AGC_GAIN +#ifdef ENABLE_AM_FIX void adjustAMFrontEnd10ms(void) { if (!gRxVfo->IsAM) @@ -1411,18 +1411,33 @@ void APP_CheckKeys(void) else if (new_lna < 7) new_lna++; + else + if (new_lna_short < 3) + new_lna_short++; } else if (avg_rssi > (desired_rssi + 4)) { // decrease gain + if (new_pga > 6) + new_pga--; + else + if (new_mixer > 3) + new_mixer--; + else + if (new_lna > 2) + new_lna--; + else + if (new_lna_short > 0) + new_lna_short++; + else if (new_pga > 0) new_pga--; else - if (new_mixer > 0) - new_mixer--; - else if (new_lna > 0) new_lna--; + else + if (new_mixer > 0) + new_mixer--; } } @@ -1448,7 +1463,7 @@ void APP_TimeSlice10ms(void) AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL); #endif - #ifdef ENABLE_AM_AGC_GAIN + #ifdef ENABLE_AM_FIX if (gSetting_AM_fix) adjustAMFrontEnd10ms(); #endif diff --git a/app/menu.c b/app/menu.c index feb1165..612c42b 100644 --- a/app/menu.c +++ b/app/menu.c @@ -186,7 +186,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax) case MENU_D_DCD: case MENU_D_LIVE_DEC: case MENU_AM: - #ifdef ENABLE_AM_AGC_GAIN + #ifdef ENABLE_AM_FIX case MENU_AM_FIX: #endif #ifdef ENABLE_NOAA @@ -609,7 +609,7 @@ void MENU_AcceptSetting(void) gRequestSaveChannel = 2; return; - #ifdef ENABLE_AM_AGC_GAIN + #ifdef ENABLE_AM_FIX case MENU_AM_FIX: gSetting_AM_fix = gSubMenuSelection; gVfoConfigureMode = VFO_CONFIGURE_RELOAD; @@ -987,7 +987,7 @@ void MENU_ShowCurrentSetting(void) gSubMenuSelection = gTxVfo->AM_CHANNEL_MODE; break; - #ifdef ENABLE_AM_AGC_GAIN + #ifdef ENABLE_AM_FIX case MENU_AM_FIX: gSubMenuSelection = gSetting_AM_fix; break; diff --git a/firmware b/firmware index b68641c..b9a8ca0 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index 297d7b2..29460af 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 73cee22..a4b3f7d 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/misc.c b/misc.c index 1ce5a83..a272073 100644 --- a/misc.c +++ b/misc.c @@ -69,7 +69,7 @@ bool gSetting_TX_EN; uint8_t gSetting_F_LOCK; bool gSetting_ScrambleEnable; -#ifdef ENABLE_AM_AGC_GAIN +#ifdef ENABLE_AM_FIX bool gSetting_AM_fix; #endif #ifdef ENABLE_AUDIO_BAR diff --git a/misc.h b/misc.h index 9ceff3d..0ce38b7 100644 --- a/misc.h +++ b/misc.h @@ -130,7 +130,7 @@ extern bool gSetting_TX_EN; extern uint8_t gSetting_F_LOCK; extern bool gSetting_ScrambleEnable; -#ifdef ENABLE_AM_AGC_GAIN +#ifdef ENABLE_AM_FIX extern bool gSetting_AM_fix; #endif #ifdef ENABLE_AUDIO_BAR diff --git a/settings.c b/settings.c index 8516af4..4953c3a 100644 --- a/settings.c +++ b/settings.c @@ -171,7 +171,7 @@ void SETTINGS_SaveSettings(void) #ifdef ENABLE_AUDIO_BAR if (!gSetting_mic_bar) State[7] &= ~(1u << 4); #endif - #ifdef ENABLE_AM_AGC_GAIN + #ifdef ENABLE_AM_FIX if (!gSetting_AM_fix) State[7] &= ~(1u << 5); #endif EEPROM_WriteBuffer(0x0F40, State); diff --git a/ui/menu.c b/ui/menu.c index b9e0d39..98adbc4 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -101,7 +101,7 @@ const t_menu_item MenuList[] = {"BATVOL", 0, VOICE_ID_INVALID, MENU_VOL }, // was "VOL" {"BATTXT", 0, VOICE_ID_INVALID, MENU_BAT_TXT }, {"MODE", 0, VOICE_ID_INVALID, MENU_AM }, // was "AM" -#ifdef ENABLE_AM_AGC_GAIN +#ifdef ENABLE_AM_FIX {"AM-FIX", 0, VOICE_ID_INVALID, MENU_AM_FIX }, #endif #ifdef ENABLE_NOAA @@ -419,7 +419,7 @@ void UI_DisplayMenu(void) strcpy(String, (gSubMenuSelection == 0) ? "FM" : "AM"); break; - #ifdef ENABLE_AM_AGC_GAIN + #ifdef ENABLE_AM_FIX case MENU_AM_FIX: strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "FIXED"); break; diff --git a/ui/menu.h b/ui/menu.h index e6859be..7d007a4 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -93,7 +93,7 @@ enum MENU_VOL, MENU_BAT_TXT, MENU_AM, - #ifdef ENABLE_AM_AGC_GAIN + #ifdef ENABLE_AM_FIX MENU_AM_FIX, #endif #ifdef ENABLE_NOAA