This commit is contained in:
OneOfEleven 2023-09-24 00:06:10 +01:00
parent 8ae0b2cc67
commit 8b44428ea5
8 changed files with 114 additions and 126 deletions

View File

@ -89,9 +89,7 @@ OBJS += app/scanner.o
ifeq ($(ENABLE_UART),1)
OBJS += app/uart.o
endif
ifeq ($(ENABLE_AM_FIX),1)
OBJS += am_fix.o
endif
OBJS += am_fix.o
OBJS += audio.o
OBJS += bitmaps.o
OBJS += board.o

View File

@ -332,8 +332,8 @@ const uint8_t orig_pga = 6; // -3dB
}
#ifndef ENABLE_AM_FIX_TEST1
// -87dBm, any higher and the AM demodulator starts to saturate/clip (distort)
const uint16_t desired_rssi = (-87 + 160) * 2; // dBm to ADC sample
// -89dBm, any higher and the AM demodulator starts to saturate/clip (distort)
const uint16_t desired_rssi = (-89 + 160) * 2; // dBm to ADC sample
#endif
// sample the current RSSI level
uint16_t rssi = BK4819_GetRSSI(); // 9-bit value (0 .. 511)

View File

@ -2088,8 +2088,8 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gUpdateStatus = true;
}
// if (gF_LOCK && (Key == KEY_PTT || Key == KEY_SIDE2 || Key == KEY_SIDE1))
if (gF_LOCK && Key == KEY_PTT)
if (gF_LOCK && (Key == KEY_PTT || Key == KEY_SIDE2 || Key == KEY_SIDE1))
// if (gF_LOCK && Key == KEY_PTT)
return;
if (!bFlag)

View File

@ -289,13 +289,14 @@ void BK4819_SetAGC(uint8_t Value)
{
unsigned int i;
// REG_10 <15:0> 0x0038 Rx AGC Gain Table[0]. (Index Max->Min is 3,2,1,0,-1)
// REG_10
// <15:0> 0x0038 Rx AGC Gain Table[0]. (Index Max->Min is 3,2,1,0,-1)
//
// <9:8> = LNA Gain Short
// 3 = 0dB
// 2 = -11dB
// 1 = -16dB
// 0 = -19dB
// 3 = 0dB << original
// 2 = -24dB // was -11
// 1 = -30dB // was -16
// 0 = -33dB // was -19
//
// <7:5> = LNA Gain
// 7 = 0dB
@ -303,19 +304,19 @@ void BK4819_SetAGC(uint8_t Value)
// 5 = -4dB
// 4 = -6dB
// 3 = -9dB
// 2 = -14dB
// 2 = -14dB << original
// 1 = -19dB
// 0 = -24dB
//
// <4:3> = MIXER Gain
// 3 = 0dB
// 3 = 0dB << original
// 2 = -3dB
// 1 = -6dB
// 0 = -8dB
//
// <2:0> = PGA Gain
// 7 = 0dB
// 6 = -3dB
// 6 = -3dB << original
// 5 = -6dB
// 4 = -9dB
// 3 = -15dB
@ -323,12 +324,7 @@ void BK4819_SetAGC(uint8_t Value)
// 1 = -27dB
// 0 = -33dB
//
// LNA_SHORT .. 0dB
// LNA ........ 14dB
// MIXER ...... 0dB
// PGA ........ -3dB
//
BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (6u << 0)); // 000000 11 101 11 110
BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (6u << 0));
BK4819_WriteRegister(BK4819_REG_12, 0x037C); // 000000 11 011 11 100
BK4819_WriteRegister(BK4819_REG_11, 0x027B); // 000000 10 011 11 011

11
main.c
View File

@ -98,16 +98,11 @@ void Main(void)
BATTERY_GetReadings(false);
{ // count the number of menu list items
unsigned int hidden = 0;
// count the number of menu list items
gMenuListCount = 0;
while (MenuList[gMenuListCount].name[0] != '\0')
if (MenuList[++gMenuListCount].hidden != 0)
hidden++;
// disable the items marked hidden
gMenuListCount -= 8;
//gMenuListCount -= hidden;
}
gMenuListCount++;
gMenuListCount -= 8; // disable the last 'n' items
if (!gChargingWithTypeC && !gBatteryDisplayLevel)
{

View File

@ -491,7 +491,7 @@ void UI_DisplayMain(void)
if (center_line_is_free)
{ // we're free to use the middle empty line for something
#ifdef ENABLE_AM_FIX_SHOW_DATA
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].IsAM)
{
switch (gCurrentFunction)

136
ui/menu.c
View File

@ -37,95 +37,95 @@
const t_menu_item MenuList[] =
{
// name, hidden, voice ID, menu ID
// name, voice ID, menu ID
{"SQL", 0, VOICE_ID_SQUELCH, MENU_SQL },
{"STEP", 0, VOICE_ID_FREQUENCY_STEP, MENU_STEP },
{"T-PWR", 0, VOICE_ID_POWER, MENU_TXP }, // was "TXP"
{"R-DCS", 0, VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
{"R-CTCS", 0, VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
{"T-DCS", 0, VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
{"T-CTCS", 0, VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
{"T-DIR", 0, VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
{"T-OFFS", 0, VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
{"T-VFO", 0, VOICE_ID_INVALID, MENU_XB }, // was "WX"
{"T-TOUT", 0, VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
{"W/N", 0, VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
{"SCRAM", 0, VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
{"BUSYCL", 0, VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
{"CH-SAV", 0, VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
{"CH-DEL", 0, VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
{"CH-NAM", 0, VOICE_ID_INVALID, MENU_MEM_NAME },
{"CH-DIS", 0, VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
{"BATSAV", 0, VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
{"VOX", 0, VOICE_ID_VOX, MENU_VOX },
{"BACKLT", 0, VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
{"DUALRX", 0, VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
{"BEEP", 0, VOICE_ID_BEEP_PROMPT, MENU_BEEP },
{"SQL", VOICE_ID_SQUELCH, MENU_SQL },
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
{"T-PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
{"R-DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
{"R-CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
{"T-DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
{"T-CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
{"T-DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
{"T-OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
{"T-VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
{"T-TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
{"CH-SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
{"CH-DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
{"CH-NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
{"CH-DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
{"VOX", VOICE_ID_VOX, MENU_VOX },
{"BACKLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
#ifdef ENABLE_VOICE
{"VOICE", 0, VOICE_ID_VOICE_PROMPT, MENU_VOICE },
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
#endif
{"SC-REV", 0, VOICE_ID_INVALID, MENU_SC_REV },
{"KEYLOC", 0, VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
{"S-ADD1", 0, VOICE_ID_INVALID, MENU_S_ADD1 },
{"S-ADD2", 0, VOICE_ID_INVALID, MENU_S_ADD2 },
{"STE", 0, VOICE_ID_INVALID, MENU_STE },
{"RP-STE", 0, VOICE_ID_INVALID, MENU_RP_STE },
{"MIC", 0, VOICE_ID_INVALID, MENU_MIC },
{"SC-REV", VOICE_ID_INVALID, MENU_SC_REV },
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
{"S-ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
{"S-ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
{"STE", VOICE_ID_INVALID, MENU_STE },
{"RP-STE", VOICE_ID_INVALID, MENU_RP_STE },
{"MIC", VOICE_ID_INVALID, MENU_MIC },
#ifdef ENABLE_AUDIO_BAR
{"MICBAR", 0, VOICE_ID_INVALID, MENU_MIC_BAR },
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
#endif
#ifdef ENABLE_COMPANDER
{"COMPND", 0, VOICE_ID_INVALID, MENU_COMPAND },
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
#endif
{"1-CALL", 0, VOICE_ID_INVALID, MENU_1_CALL },
{"SLIST", 0, VOICE_ID_INVALID, MENU_S_LIST },
{"SLIST1", 0, VOICE_ID_INVALID, MENU_SLIST1 },
{"SLIST2", 0, VOICE_ID_INVALID, MENU_SLIST2 },
{"1-CALL", VOICE_ID_INVALID, MENU_1_CALL },
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
#ifdef ENABLE_ALARM
"AL-MOD", 0, VOICE_ID_INVALID, MENU_AL_MOD },
"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
#endif
{"ANI-ID", 0, VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"UPCODE", 0, VOICE_ID_INVALID, MENU_UPCODE },
{"DWCODE", 0, VOICE_ID_INVALID, MENU_DWCODE },
{"D-ST", 0, VOICE_ID_INVALID, MENU_D_ST },
{"D-RSP", 0, VOICE_ID_INVALID, MENU_D_RSP },
{"D-HOLD", 0, VOICE_ID_INVALID, MENU_D_HOLD },
{"D-PRE", 0, VOICE_ID_INVALID, MENU_D_PRE },
{"PTT-ID", 0, VOICE_ID_INVALID, MENU_PTT_ID },
{"D-DCD", 0, VOICE_ID_INVALID, MENU_D_DCD },
{"D-LIST", 0, VOICE_ID_INVALID, MENU_D_LIST },
{"D-LIVE", 0, VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
{"PONMSG", 0, VOICE_ID_INVALID, MENU_PONMSG },
{"ROGER", 0, VOICE_ID_INVALID, MENU_ROGER },
{"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"
{"ANI-ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
{"D-ST", VOICE_ID_INVALID, MENU_D_ST },
{"D-RSP", VOICE_ID_INVALID, MENU_D_RSP },
{"D-HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
{"D-PRE", VOICE_ID_INVALID, MENU_D_PRE },
{"PTT-ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D-DCD", VOICE_ID_INVALID, MENU_D_DCD },
{"D-LIST", VOICE_ID_INVALID, MENU_D_LIST },
{"D-LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
#ifdef ENABLE_AM_FIX
{"AM-FIX", 0, VOICE_ID_INVALID, MENU_AM_FIX },
{"AM-FIX", VOICE_ID_INVALID, MENU_AM_FIX },
#endif
#ifdef ENABLE_AM_FIX_TEST1
{"AM-FT1", 0, VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
{"AM-FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
#endif
#ifdef ENABLE_NOAA
{"NOAA-S", 0, VOICE_ID_INVALID, MENU_NOAA_S },
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
#endif
{"RESET", 0, VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
// hidden menu items from here on (center param set to '1')
// enabled if pressing both the PTT and upper side button at power-on
{"F-LOCK", 1, VOICE_ID_INVALID, MENU_F_LOCK },
{"TX-200", 1, VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
{"TX-350", 1, VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
{"TX-500", 1, VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
{"350-EN", 1, VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
{"SCR-EN", 1, VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"F-LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
{"TX-200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
{"TX-350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
{"TX-500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
{"350-EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
{"SCR-EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"TX-EN", 1, VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
{"F-CALI", 1, VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
{"TX-EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
{"F-CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
{"", 1, VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
};
const char gSubMenu_TXP[3][5] =

View File

@ -24,7 +24,6 @@
typedef struct {
const char name[7]; // menu display only has room for 6 characters
uint8_t hidden;
VOICE_ID_t voice_id;
uint8_t menu_id;
} t_menu_item;