diff --git a/app/menu.c b/app/menu.c index e148521d5..a0f0dae40 100644 --- a/app/menu.c +++ b/app/menu.c @@ -496,13 +496,10 @@ void MENU_AcceptSetting(void) return; case MENU_MEM_NAME: - { // trailing trim - for (int i = 9; i >= 0; i--) - { - if (edit[i] != ' ' && edit[i] != '_' && edit[i] != 0x00 && edit[i] != 0xff) - break; - edit[i] = ' '; - } + for (int i = 9; i >= 0; i--) { + if (edit[i] != ' ' && edit[i] != '_' && edit[i] != 0x00 && edit[i] != 0xff) + break; + edit[i] = ' '; } // save the channel name @@ -521,7 +518,7 @@ void MENU_AcceptSetting(void) gEeprom.VOX_SWITCH = gSubMenuSelection != 0; if (gEeprom.VOX_SWITCH) gEeprom.VOX_LEVEL = gSubMenuSelection - 1; - BOARD_EEPROM_LoadCalibration(); + SETTINGS_LoadCalibration(); gFlagReconfigureVfos = true; gUpdateStatus = true; break; @@ -605,7 +602,7 @@ void MENU_AcceptSetting(void) case MENU_MIC: gEeprom.MIC_SENSITIVITY = gSubMenuSelection; - BOARD_EEPROM_LoadCalibration(); + SETTINGS_LoadCalibration(); gFlagReconfigureVfos = true; break; @@ -729,7 +726,7 @@ void MENU_AcceptSetting(void) return; case MENU_RESET: - BOARD_FactoryReset(gSubMenuSelection); + SETTINGS_FactoryReset(gSubMenuSelection); return; case MENU_350TX: @@ -1434,7 +1431,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) if (!RADIO_CheckValidChannel(gSubMenuSelection, false, 0)) return; - BOARD_fetchChannelName(edit, gSubMenuSelection); + SETTINGS_FetchChannelName(edit, gSubMenuSelection); // pad the channel name out with '_' edit_index = strlen(edit); diff --git a/app/uart.c b/app/uart.c index 24122b55c..14db25088 100644 --- a/app/uart.c +++ b/app/uart.c @@ -314,7 +314,7 @@ static void CMD_051D(const uint8_t *pBuffer) } if (bReloadEeprom) - BOARD_EEPROM_Init(); + SETTINGS_InitEEPROM(); } SendReply(&Reply, sizeof(Reply)); diff --git a/board.c b/board.c index 2cc712070..facaffc9f 100644 --- a/board.c +++ b/board.c @@ -16,7 +16,6 @@ #include -#include "app/dtmf.h" #ifdef ENABLE_FMRADIO #include "app/fm.h" #endif @@ -30,7 +29,7 @@ #ifdef ENABLE_FMRADIO #include "driver/bk1080.h" #endif -#include "driver/bk4819.h" + #include "driver/crc.h" #include "driver/eeprom.h" #include "driver/flash.h" @@ -44,16 +43,6 @@ #if defined(ENABLE_OVERLAY) #include "sram-overlay.h" #endif -#include "ui/menu.h" - -static const uint32_t gDefaultFrequencyTable[] = -{ - 14500000, // - 14550000, // - 43300000, // - 43320000, // - 43350000 // -}; #if defined(ENABLE_OVERLAY) void BOARD_FLASH_Init(void) @@ -511,390 +500,4 @@ void BOARD_Init(void) CRC_Init(); } -void BOARD_EEPROM_Init(void) -{ - unsigned int i; - uint8_t Data[16]; - - memset(Data, 0, sizeof(Data)); - - // 0E70..0E77 - EEPROM_ReadBuffer(0x0E70, Data, 8); - gEeprom.CHAN_1_CALL = IS_MR_CHANNEL(Data[0]) ? Data[0] : MR_CHANNEL_FIRST; - gEeprom.SQUELCH_LEVEL = (Data[1] < 10) ? Data[1] : 1; - gEeprom.TX_TIMEOUT_TIMER = (Data[2] < 11) ? Data[2] : 1; - #ifdef ENABLE_NOAA - gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false; - #endif - gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false; - #ifdef ENABLE_VOX - gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false; - gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1; - #endif - gEeprom.MIC_SENSITIVITY = (Data[7] < 5) ? Data[7] : 4; - - // 0E78..0E7F - EEPROM_ReadBuffer(0x0E78, Data, 8); - gEeprom.BACKLIGHT_MAX = (Data[0] & 0xF) <= 10 ? (Data[0] & 0xF) : 10; - gEeprom.BACKLIGHT_MIN = (Data[0] >> 4) < gEeprom.BACKLIGHT_MAX ? (Data[0] >> 4) : 0; -#ifdef ENABLE_BLMIN_TMP_OFF - gEeprom.BACKLIGHT_MIN_STAT = BLMIN_STAT_ON; -#endif - gEeprom.CHANNEL_DISPLAY_MODE = (Data[1] < 4) ? Data[1] : MDF_FREQUENCY; // 4 instead of 3 - extra display mode - gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF; - gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4; - gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A; - gEeprom.BACKLIGHT_TIME = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 3; - gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false; - gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true; - - // 0E80..0E87 - EEPROM_ReadBuffer(0x0E80, Data, 8); - gEeprom.ScreenChannel[0] = IS_VALID_CHANNEL(Data[0]) ? Data[0] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); - gEeprom.ScreenChannel[1] = IS_VALID_CHANNEL(Data[3]) ? Data[3] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); - gEeprom.MrChannel[0] = IS_MR_CHANNEL(Data[1]) ? Data[1] : MR_CHANNEL_FIRST; - gEeprom.MrChannel[1] = IS_MR_CHANNEL(Data[4]) ? Data[4] : MR_CHANNEL_FIRST; - gEeprom.FreqChannel[0] = IS_FREQ_CHANNEL(Data[2]) ? Data[2] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); - gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data[5]) ? Data[5] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); - #ifdef ENABLE_NOAA - gEeprom.NoaaChannel[0] = IS_NOAA_CHANNEL(Data[6]) ? Data[6] : NOAA_CHANNEL_FIRST; - gEeprom.NoaaChannel[1] = IS_NOAA_CHANNEL(Data[7]) ? Data[7] : NOAA_CHANNEL_FIRST; - #endif - -#ifdef ENABLE_FMRADIO - { // 0E88..0E8F - struct - { - uint16_t SelectedFrequency; - uint8_t SelectedChannel; - uint8_t IsMrMode; - uint8_t Padding[8]; - } __attribute__((packed)) FM; - - EEPROM_ReadBuffer(0x0E88, &FM, 8); - gEeprom.FM_LowerLimit = 760; - gEeprom.FM_UpperLimit = 1080; - if (FM.SelectedFrequency < gEeprom.FM_LowerLimit || FM.SelectedFrequency > gEeprom.FM_UpperLimit) - gEeprom.FM_SelectedFrequency = 960; - else - gEeprom.FM_SelectedFrequency = FM.SelectedFrequency; - - gEeprom.FM_SelectedChannel = FM.SelectedChannel; - gEeprom.FM_IsMrMode = (FM.IsMrMode < 2) ? FM.IsMrMode : false; - } - - // 0E40..0E67 - EEPROM_ReadBuffer(0x0E40, gFM_Channels, sizeof(gFM_Channels)); - FM_ConfigureChannelState(); -#endif - - // 0E90..0E97 - EEPROM_ReadBuffer(0x0E90, Data, 8); - gEeprom.BEEP_CONTROL = Data[0] & 1; - gEeprom.KEY_M_LONG_PRESS_ACTION = ((Data[0] >> 1) < ACTION_OPT_LEN) ? (Data[0] >> 1) : ACTION_OPT_NONE; - gEeprom.KEY_1_SHORT_PRESS_ACTION = (Data[1] < ACTION_OPT_LEN) ? Data[1] : ACTION_OPT_MONITOR; - gEeprom.KEY_1_LONG_PRESS_ACTION = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_FLASHLIGHT; - gEeprom.KEY_2_SHORT_PRESS_ACTION = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN; - gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE; - gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO; - gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false; - gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 4) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE; - - // 0E98..0E9F - EEPROM_ReadBuffer(0x0E98, Data, 8); - memmove(&gEeprom.POWER_ON_PASSWORD, Data, 4); - - // 0EA0..0EA7 - #ifdef ENABLE_VOICE - EEPROM_ReadBuffer(0x0EA0, Data, 8); - gEeprom.VOICE_PROMPT = (Data[0] < 3) ? Data[0] : VOICE_PROMPT_ENGLISH; - #endif - - // 0EA8..0EAF - EEPROM_ReadBuffer(0x0EA8, Data, 8); - #ifdef ENABLE_ALARM - gEeprom.ALARM_MODE = (Data[0] < 2) ? Data[0] : true; - #endif - gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF; - gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0; - gEeprom.TX_VFO = (Data[3] < 2) ? Data[3] : 0; - gEeprom.BATTERY_TYPE = (Data[4] < BATTERY_TYPE_UNKNOWN) ? Data[4] : BATTERY_TYPE_1600_MAH; - - // 0ED0..0ED7 - EEPROM_ReadBuffer(0x0ED0, Data, 8); - gEeprom.DTMF_SIDE_TONE = (Data[0] < 2) ? Data[0] : true; - -#ifdef ENABLE_DTMF_CALLING - gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*'; - gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#'; - gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0; - gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 5) ? Data[4] : 10; -#endif - gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300; - gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100; - gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100; - - // 0ED8..0EDF - EEPROM_ReadBuffer(0x0ED8, Data, 8); - gEeprom.DTMF_CODE_PERSIST_TIME = (Data[0] < 101) ? Data[0] * 10 : 100; - gEeprom.DTMF_CODE_INTERVAL_TIME = (Data[1] < 101) ? Data[1] * 10 : 100; -#ifdef ENABLE_DTMF_CALLING - gEeprom.PERMIT_REMOTE_KILL = (Data[2] < 2) ? Data[2] : true; - - // 0EE0..0EE7 - - EEPROM_ReadBuffer(0x0EE0, Data, 8); - if (DTMF_ValidateCodes((char *)Data, 8)) - memmove(gEeprom.ANI_DTMF_ID, Data, 8); - else - { - memset(gEeprom.ANI_DTMF_ID, 0, sizeof(gEeprom.ANI_DTMF_ID)); - strcpy(gEeprom.ANI_DTMF_ID, "123"); - } - - - // 0EE8..0EEF - EEPROM_ReadBuffer(0x0EE8, Data, 8); - if (DTMF_ValidateCodes((char *)Data, 8)) - memmove(gEeprom.KILL_CODE, Data, 8); - else - { - memset(gEeprom.KILL_CODE, 0, sizeof(gEeprom.KILL_CODE)); - strcpy(gEeprom.KILL_CODE, "ABCD9"); - } - - // 0EF0..0EF7 - EEPROM_ReadBuffer(0x0EF0, Data, 8); - if (DTMF_ValidateCodes((char *)Data, 8)) - memmove(gEeprom.REVIVE_CODE, Data, 8); - else - { - memset(gEeprom.REVIVE_CODE, 0, sizeof(gEeprom.REVIVE_CODE)); - strcpy(gEeprom.REVIVE_CODE, "9DCBA"); - } -#endif - - // 0EF8..0F07 - EEPROM_ReadBuffer(0x0EF8, Data, 16); - if (DTMF_ValidateCodes((char *)Data, 16)) - memmove(gEeprom.DTMF_UP_CODE, Data, 16); - else - { - memset(gEeprom.DTMF_UP_CODE, 0, sizeof(gEeprom.DTMF_UP_CODE)); - strcpy(gEeprom.DTMF_UP_CODE, "12345"); - } - - // 0F08..0F17 - EEPROM_ReadBuffer(0x0F08, Data, 16); - if (DTMF_ValidateCodes((char *)Data, 16)) - memmove(gEeprom.DTMF_DOWN_CODE, Data, 16); - else - { - memset(gEeprom.DTMF_DOWN_CODE, 0, sizeof(gEeprom.DTMF_DOWN_CODE)); - strcpy(gEeprom.DTMF_DOWN_CODE, "54321"); - } - - // 0F18..0F1F - EEPROM_ReadBuffer(0x0F18, Data, 8); -// gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false; - gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 3) ? Data[0] : false; // we now have 'all' channel scan option - for (i = 0; i < 2; i++) - { - const unsigned int j = 1 + (i * 3); - gEeprom.SCAN_LIST_ENABLED[i] = (Data[j + 0] < 2) ? Data[j] : false; - gEeprom.SCANLIST_PRIORITY_CH1[i] = Data[j + 1]; - gEeprom.SCANLIST_PRIORITY_CH2[i] = Data[j + 2]; - } - - // 0F40..0F47 - EEPROM_ReadBuffer(0x0F40, Data, 8); - gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF; - gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true -#ifdef ENABLE_DTMF_CALLING - gSetting_KILLED = (Data[2] < 2) ? Data[2] : false; -#endif - gSetting_200TX = (Data[3] < 2) ? Data[3] : false; - gSetting_500TX = (Data[4] < 2) ? Data[4] : false; - gSetting_350EN = (Data[5] < 2) ? Data[5] : true; - gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true; - //gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false; - gSetting_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false; - gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2; - #ifdef ENABLE_AUDIO_BAR - gSetting_mic_bar = (Data[7] & (1u << 4)) ? true : false; - #endif - #ifdef ENABLE_AM_FIX - gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false; - #endif - gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u; - - if (!gEeprom.VFO_OPEN) - { - gEeprom.ScreenChannel[0] = gEeprom.MrChannel[0]; - gEeprom.ScreenChannel[1] = gEeprom.MrChannel[1]; - } - - // 0D60..0E27 - EEPROM_ReadBuffer(0x0D60, gMR_ChannelAttributes, sizeof(gMR_ChannelAttributes)); - for(uint16_t i = 0; i < sizeof(gMR_ChannelAttributes); i++) { - ChannelAttributes_t *att = &gMR_ChannelAttributes[i]; - if(att->__val == 0xff){ - att->__val = 0; - att->band = 0xf; - } - } - - // 0F30..0F3F - EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey)); - bHasCustomAesKey = false; - for (i = 0; i < ARRAY_SIZE(gCustomAesKey); i++) - { - if (gCustomAesKey[i] != 0xFFFFFFFFu) - { - bHasCustomAesKey = true; - return; - } - } -} - -void BOARD_EEPROM_LoadCalibration(void) -{ -// uint8_t Mic; - - EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[3], 8); - memcpy(gEEPROM_RSSI_CALIB[4], gEEPROM_RSSI_CALIB[3], 8); - memcpy(gEEPROM_RSSI_CALIB[5], gEEPROM_RSSI_CALIB[3], 8); - memcpy(gEEPROM_RSSI_CALIB[6], gEEPROM_RSSI_CALIB[3], 8); - - EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[0], 8); - memcpy(gEEPROM_RSSI_CALIB[1], gEEPROM_RSSI_CALIB[0], 8); - memcpy(gEEPROM_RSSI_CALIB[2], gEEPROM_RSSI_CALIB[0], 8); - - EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12); - if (gBatteryCalibration[0] >= 5000) - { - gBatteryCalibration[0] = 1900; - gBatteryCalibration[1] = 2000; - } - gBatteryCalibration[5] = 2300; - #ifdef ENABLE_VOX - EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2); - EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2); - #endif - - //EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1); - //gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15; - gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY]; - - { - struct - { - int16_t BK4819_XtalFreqLow; - uint16_t EEPROM_1F8A; - uint16_t EEPROM_1F8C; - uint8_t VOLUME_GAIN; - uint8_t DAC_GAIN; - } __attribute__((packed)) Misc; - - // radio 1 .. 04 00 46 00 50 00 2C 0E - // radio 2 .. 05 00 46 00 50 00 2C 0E - EEPROM_ReadBuffer(0x1F88, &Misc, 8); - - gEeprom.BK4819_XTAL_FREQ_LOW = (Misc.BK4819_XtalFreqLow >= -1000 && Misc.BK4819_XtalFreqLow <= 1000) ? Misc.BK4819_XtalFreqLow : 0; - gEEPROM_1F8A = Misc.EEPROM_1F8A & 0x01FF; - gEEPROM_1F8C = Misc.EEPROM_1F8C & 0x01FF; - gEeprom.VOLUME_GAIN = (Misc.VOLUME_GAIN < 64) ? Misc.VOLUME_GAIN : 58; - gEeprom.DAC_GAIN = (Misc.DAC_GAIN < 16) ? Misc.DAC_GAIN : 8; - - BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW); -// BK4819_WriteRegister(BK4819_REG_3C, gEeprom.BK4819_XTAL_FREQ_HIGH); - } -} - -uint32_t BOARD_fetchChannelFrequency(const int channel) -{ - struct - { - uint32_t frequency; - uint32_t offset; - } __attribute__((packed)) info; - - EEPROM_ReadBuffer(channel * 16, &info, sizeof(info)); - - return info.frequency; -} - -void BOARD_fetchChannelName(char *s, const int channel) -{ - int i; - - if (s == NULL) - return; - - memset(s, 0, 11); // 's' had better be large enough ! - - if (channel < 0) - return; - - if (!RADIO_CheckValidChannel(channel, false, 0)) - return; - - - EEPROM_ReadBuffer(0x0F50 + (channel * 16), s + 0, 8); - EEPROM_ReadBuffer(0x0F58 + (channel * 16), s + 8, 2); - - for (i = 0; i < 10; i++) - if (s[i] < 32 || s[i] > 127) - break; // invalid char - - s[i--] = 0; // null term - - while (i >= 0 && s[i] == 32) // trim trailing spaces - s[i--] = 0; // null term -} - -void BOARD_FactoryReset(bool bIsAll) -{ - uint16_t i; - uint8_t Template[8]; - - memset(Template, 0xFF, sizeof(Template)); - - for (i = 0x0C80; i < 0x1E00; i += 8) - { - if ( - !(i >= 0x0EE0 && i < 0x0F18) && // ANI ID + DTMF codes - !(i >= 0x0F30 && i < 0x0F50) && // AES KEY + F LOCK + Scramble Enable - !(i >= 0x1C00 && i < 0x1E00) && // DTMF contacts - !(i >= 0x0EB0 && i < 0x0ED0) && // Welcome strings - !(i >= 0x0EA0 && i < 0x0EA8) && // Voice Prompt - (bIsAll || - ( - !(i >= 0x0D60 && i < 0x0E28) && // MR Channel Attributes - !(i >= 0x0F18 && i < 0x0F30) && // Scan List - !(i >= 0x0F50 && i < 0x1C00) && // MR Channel Names - !(i >= 0x0E40 && i < 0x0E70) && // FM Channels - !(i >= 0x0E88 && i < 0x0E90) // FM settings - )) - ) - { - EEPROM_WriteBuffer(i, Template); - } - } - - if (bIsAll) - { - RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, 43350000); - - // set the first few memory channels - for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++) - { - const uint32_t Frequency = gDefaultFrequencyTable[i]; - gRxVfo->freq_config_RX.Frequency = Frequency; - gRxVfo->freq_config_TX.Frequency = Frequency; - gRxVfo->Band = FREQUENCY_GetBand(Frequency); - SETTINGS_SaveChannel(MR_CHANNEL_FIRST + i, 0, gRxVfo, 2); - } - } -} diff --git a/board.h b/board.h index 4f854aa13..48b24747e 100644 --- a/board.h +++ b/board.h @@ -26,11 +26,6 @@ void BOARD_PORTCON_Init(void); void BOARD_ADC_Init(void); void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent); void BOARD_Init(void); -void BOARD_EEPROM_Init(void); -void BOARD_EEPROM_LoadCalibration(void); -uint32_t BOARD_fetchChannelFrequency(const int channel); -void BOARD_fetchChannelName(char *s, const int channel); -void BOARD_FactoryReset(bool bIsAll); #endif diff --git a/main.c b/main.c index c539c3a55..5938f475c 100644 --- a/main.c +++ b/main.c @@ -83,9 +83,9 @@ void Main(void) BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent); - BOARD_EEPROM_Init(); + SETTINGS_InitEEPROM(); - BOARD_EEPROM_LoadCalibration(); + SETTINGS_LoadCalibration(); RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD); diff --git a/settings.c b/settings.c index e1307b54b..8c5651764 100644 --- a/settings.c +++ b/settings.c @@ -16,16 +16,414 @@ #include +#include "app/dtmf.h" #ifdef ENABLE_FMRADIO #include "app/fm.h" #endif +#include "driver/bk4819.h" #include "driver/eeprom.h" #include "driver/uart.h" #include "misc.h" #include "settings.h" +#include "ui/menu.h" + +static const uint32_t gDefaultFrequencyTable[] = +{ + 14500000, // + 14550000, // + 43300000, // + 43320000, // + 43350000 // +}; EEPROM_Config_t gEeprom; +void SETTINGS_InitEEPROM(void) +{ + unsigned int i; + uint8_t Data[16]; + + memset(Data, 0, sizeof(Data)); + + // 0E70..0E77 + EEPROM_ReadBuffer(0x0E70, Data, 8); + gEeprom.CHAN_1_CALL = IS_MR_CHANNEL(Data[0]) ? Data[0] : MR_CHANNEL_FIRST; + gEeprom.SQUELCH_LEVEL = (Data[1] < 10) ? Data[1] : 1; + gEeprom.TX_TIMEOUT_TIMER = (Data[2] < 11) ? Data[2] : 1; + #ifdef ENABLE_NOAA + gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false; + #endif + gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false; + #ifdef ENABLE_VOX + gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false; + gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1; + #endif + gEeprom.MIC_SENSITIVITY = (Data[7] < 5) ? Data[7] : 4; + + // 0E78..0E7F + EEPROM_ReadBuffer(0x0E78, Data, 8); + gEeprom.BACKLIGHT_MAX = (Data[0] & 0xF) <= 10 ? (Data[0] & 0xF) : 10; + gEeprom.BACKLIGHT_MIN = (Data[0] >> 4) < gEeprom.BACKLIGHT_MAX ? (Data[0] >> 4) : 0; +#ifdef ENABLE_BLMIN_TMP_OFF + gEeprom.BACKLIGHT_MIN_STAT = BLMIN_STAT_ON; +#endif + gEeprom.CHANNEL_DISPLAY_MODE = (Data[1] < 4) ? Data[1] : MDF_FREQUENCY; // 4 instead of 3 - extra display mode + gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF; + gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4; + gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A; + gEeprom.BACKLIGHT_TIME = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 3; + gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false; + gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true; + + // 0E80..0E87 + EEPROM_ReadBuffer(0x0E80, Data, 8); + gEeprom.ScreenChannel[0] = IS_VALID_CHANNEL(Data[0]) ? Data[0] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); + gEeprom.ScreenChannel[1] = IS_VALID_CHANNEL(Data[3]) ? Data[3] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); + gEeprom.MrChannel[0] = IS_MR_CHANNEL(Data[1]) ? Data[1] : MR_CHANNEL_FIRST; + gEeprom.MrChannel[1] = IS_MR_CHANNEL(Data[4]) ? Data[4] : MR_CHANNEL_FIRST; + gEeprom.FreqChannel[0] = IS_FREQ_CHANNEL(Data[2]) ? Data[2] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); + gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data[5]) ? Data[5] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); + #ifdef ENABLE_NOAA + gEeprom.NoaaChannel[0] = IS_NOAA_CHANNEL(Data[6]) ? Data[6] : NOAA_CHANNEL_FIRST; + gEeprom.NoaaChannel[1] = IS_NOAA_CHANNEL(Data[7]) ? Data[7] : NOAA_CHANNEL_FIRST; + #endif + +#ifdef ENABLE_FMRADIO + { // 0E88..0E8F + struct + { + uint16_t SelectedFrequency; + uint8_t SelectedChannel; + uint8_t IsMrMode; + uint8_t Padding[8]; + } __attribute__((packed)) FM; + + EEPROM_ReadBuffer(0x0E88, &FM, 8); + gEeprom.FM_LowerLimit = 760; + gEeprom.FM_UpperLimit = 1080; + if (FM.SelectedFrequency < gEeprom.FM_LowerLimit || FM.SelectedFrequency > gEeprom.FM_UpperLimit) + gEeprom.FM_SelectedFrequency = 960; + else + gEeprom.FM_SelectedFrequency = FM.SelectedFrequency; + + gEeprom.FM_SelectedChannel = FM.SelectedChannel; + gEeprom.FM_IsMrMode = (FM.IsMrMode < 2) ? FM.IsMrMode : false; + } + + // 0E40..0E67 + EEPROM_ReadBuffer(0x0E40, gFM_Channels, sizeof(gFM_Channels)); + FM_ConfigureChannelState(); +#endif + + // 0E90..0E97 + EEPROM_ReadBuffer(0x0E90, Data, 8); + gEeprom.BEEP_CONTROL = Data[0] & 1; + gEeprom.KEY_M_LONG_PRESS_ACTION = ((Data[0] >> 1) < ACTION_OPT_LEN) ? (Data[0] >> 1) : ACTION_OPT_NONE; + gEeprom.KEY_1_SHORT_PRESS_ACTION = (Data[1] < ACTION_OPT_LEN) ? Data[1] : ACTION_OPT_MONITOR; + gEeprom.KEY_1_LONG_PRESS_ACTION = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_FLASHLIGHT; + gEeprom.KEY_2_SHORT_PRESS_ACTION = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN; + gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE; + gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO; + gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false; + gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 4) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE; + + // 0E98..0E9F + EEPROM_ReadBuffer(0x0E98, Data, 8); + memmove(&gEeprom.POWER_ON_PASSWORD, Data, 4); + + // 0EA0..0EA7 + #ifdef ENABLE_VOICE + EEPROM_ReadBuffer(0x0EA0, Data, 8); + gEeprom.VOICE_PROMPT = (Data[0] < 3) ? Data[0] : VOICE_PROMPT_ENGLISH; + #endif + + // 0EA8..0EAF + EEPROM_ReadBuffer(0x0EA8, Data, 8); + #ifdef ENABLE_ALARM + gEeprom.ALARM_MODE = (Data[0] < 2) ? Data[0] : true; + #endif + gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF; + gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0; + gEeprom.TX_VFO = (Data[3] < 2) ? Data[3] : 0; + gEeprom.BATTERY_TYPE = (Data[4] < BATTERY_TYPE_UNKNOWN) ? Data[4] : BATTERY_TYPE_1600_MAH; + + // 0ED0..0ED7 + EEPROM_ReadBuffer(0x0ED0, Data, 8); + gEeprom.DTMF_SIDE_TONE = (Data[0] < 2) ? Data[0] : true; + +#ifdef ENABLE_DTMF_CALLING + gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*'; + gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#'; + gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0; + gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 5) ? Data[4] : 10; +#endif + gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300; + gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100; + gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100; + + // 0ED8..0EDF + EEPROM_ReadBuffer(0x0ED8, Data, 8); + gEeprom.DTMF_CODE_PERSIST_TIME = (Data[0] < 101) ? Data[0] * 10 : 100; + gEeprom.DTMF_CODE_INTERVAL_TIME = (Data[1] < 101) ? Data[1] * 10 : 100; +#ifdef ENABLE_DTMF_CALLING + gEeprom.PERMIT_REMOTE_KILL = (Data[2] < 2) ? Data[2] : true; + + // 0EE0..0EE7 + + EEPROM_ReadBuffer(0x0EE0, Data, 8); + if (DTMF_ValidateCodes((char *)Data, 8)) + memmove(gEeprom.ANI_DTMF_ID, Data, 8); + else + { + memset(gEeprom.ANI_DTMF_ID, 0, sizeof(gEeprom.ANI_DTMF_ID)); + strcpy(gEeprom.ANI_DTMF_ID, "123"); + } + + + // 0EE8..0EEF + EEPROM_ReadBuffer(0x0EE8, Data, 8); + if (DTMF_ValidateCodes((char *)Data, 8)) + memmove(gEeprom.KILL_CODE, Data, 8); + else + { + memset(gEeprom.KILL_CODE, 0, sizeof(gEeprom.KILL_CODE)); + strcpy(gEeprom.KILL_CODE, "ABCD9"); + } + + // 0EF0..0EF7 + EEPROM_ReadBuffer(0x0EF0, Data, 8); + if (DTMF_ValidateCodes((char *)Data, 8)) + memmove(gEeprom.REVIVE_CODE, Data, 8); + else + { + memset(gEeprom.REVIVE_CODE, 0, sizeof(gEeprom.REVIVE_CODE)); + strcpy(gEeprom.REVIVE_CODE, "9DCBA"); + } +#endif + + // 0EF8..0F07 + EEPROM_ReadBuffer(0x0EF8, Data, 16); + if (DTMF_ValidateCodes((char *)Data, 16)) + memmove(gEeprom.DTMF_UP_CODE, Data, 16); + else + { + memset(gEeprom.DTMF_UP_CODE, 0, sizeof(gEeprom.DTMF_UP_CODE)); + strcpy(gEeprom.DTMF_UP_CODE, "12345"); + } + + // 0F08..0F17 + EEPROM_ReadBuffer(0x0F08, Data, 16); + if (DTMF_ValidateCodes((char *)Data, 16)) + memmove(gEeprom.DTMF_DOWN_CODE, Data, 16); + else + { + memset(gEeprom.DTMF_DOWN_CODE, 0, sizeof(gEeprom.DTMF_DOWN_CODE)); + strcpy(gEeprom.DTMF_DOWN_CODE, "54321"); + } + + // 0F18..0F1F + EEPROM_ReadBuffer(0x0F18, Data, 8); +// gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false; + gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 3) ? Data[0] : false; // we now have 'all' channel scan option + for (i = 0; i < 2; i++) + { + const unsigned int j = 1 + (i * 3); + gEeprom.SCAN_LIST_ENABLED[i] = (Data[j + 0] < 2) ? Data[j] : false; + gEeprom.SCANLIST_PRIORITY_CH1[i] = Data[j + 1]; + gEeprom.SCANLIST_PRIORITY_CH2[i] = Data[j + 2]; + } + + // 0F40..0F47 + EEPROM_ReadBuffer(0x0F40, Data, 8); + gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF; + gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true +#ifdef ENABLE_DTMF_CALLING + gSetting_KILLED = (Data[2] < 2) ? Data[2] : false; +#endif + gSetting_200TX = (Data[3] < 2) ? Data[3] : false; + gSetting_500TX = (Data[4] < 2) ? Data[4] : false; + gSetting_350EN = (Data[5] < 2) ? Data[5] : true; + gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true; + //gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false; + gSetting_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false; + gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2; + #ifdef ENABLE_AUDIO_BAR + gSetting_mic_bar = (Data[7] & (1u << 4)) ? true : false; + #endif + #ifdef ENABLE_AM_FIX + gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false; + #endif + gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u; + + if (!gEeprom.VFO_OPEN) + { + gEeprom.ScreenChannel[0] = gEeprom.MrChannel[0]; + gEeprom.ScreenChannel[1] = gEeprom.MrChannel[1]; + } + + // 0D60..0E27 + EEPROM_ReadBuffer(0x0D60, gMR_ChannelAttributes, sizeof(gMR_ChannelAttributes)); + for(uint16_t i = 0; i < sizeof(gMR_ChannelAttributes); i++) { + ChannelAttributes_t *att = &gMR_ChannelAttributes[i]; + if(att->__val == 0xff){ + att->__val = 0; + att->band = 0xf; + } + } + + // 0F30..0F3F + EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey)); + bHasCustomAesKey = false; + for (i = 0; i < ARRAY_SIZE(gCustomAesKey); i++) + { + if (gCustomAesKey[i] != 0xFFFFFFFFu) + { + bHasCustomAesKey = true; + return; + } + } +} + +void SETTINGS_LoadCalibration(void) +{ +// uint8_t Mic; + + EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[3], 8); + memcpy(gEEPROM_RSSI_CALIB[4], gEEPROM_RSSI_CALIB[3], 8); + memcpy(gEEPROM_RSSI_CALIB[5], gEEPROM_RSSI_CALIB[3], 8); + memcpy(gEEPROM_RSSI_CALIB[6], gEEPROM_RSSI_CALIB[3], 8); + + EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[0], 8); + memcpy(gEEPROM_RSSI_CALIB[1], gEEPROM_RSSI_CALIB[0], 8); + memcpy(gEEPROM_RSSI_CALIB[2], gEEPROM_RSSI_CALIB[0], 8); + + EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12); + if (gBatteryCalibration[0] >= 5000) + { + gBatteryCalibration[0] = 1900; + gBatteryCalibration[1] = 2000; + } + gBatteryCalibration[5] = 2300; + + #ifdef ENABLE_VOX + EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2); + EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2); + #endif + + //EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1); + //gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15; + gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY]; + + { + struct + { + int16_t BK4819_XtalFreqLow; + uint16_t EEPROM_1F8A; + uint16_t EEPROM_1F8C; + uint8_t VOLUME_GAIN; + uint8_t DAC_GAIN; + } __attribute__((packed)) Misc; + + // radio 1 .. 04 00 46 00 50 00 2C 0E + // radio 2 .. 05 00 46 00 50 00 2C 0E + EEPROM_ReadBuffer(0x1F88, &Misc, 8); + + gEeprom.BK4819_XTAL_FREQ_LOW = (Misc.BK4819_XtalFreqLow >= -1000 && Misc.BK4819_XtalFreqLow <= 1000) ? Misc.BK4819_XtalFreqLow : 0; + gEEPROM_1F8A = Misc.EEPROM_1F8A & 0x01FF; + gEEPROM_1F8C = Misc.EEPROM_1F8C & 0x01FF; + gEeprom.VOLUME_GAIN = (Misc.VOLUME_GAIN < 64) ? Misc.VOLUME_GAIN : 58; + gEeprom.DAC_GAIN = (Misc.DAC_GAIN < 16) ? Misc.DAC_GAIN : 8; + + BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW); +// BK4819_WriteRegister(BK4819_REG_3C, gEeprom.BK4819_XTAL_FREQ_HIGH); + } +} + +uint32_t SETTINGS_FetchChannelFrequency(const int channel) +{ + struct + { + uint32_t frequency; + uint32_t offset; + } __attribute__((packed)) info; + + EEPROM_ReadBuffer(channel * 16, &info, sizeof(info)); + + return info.frequency; +} + +void SETTINGS_FetchChannelName(char *s, const int channel) +{ + if (s == NULL) + return; + + memset(s, 0, 11); // 's' had better be large enough ! + + if (channel < 0) + return; + + if (!RADIO_CheckValidChannel(channel, false, 0)) + return; + + EEPROM_ReadBuffer(0x0F50 + (channel * 16), s + 0, 8); + EEPROM_ReadBuffer(0x0F58 + (channel * 16), s + 8, 2); + + int i; + for (i = 0; i < 10; i++) + if (s[i] < 32 || s[i] > 127) + break; // invalid char + + s[i--] = 0; // null term + + while (i >= 0 && s[i] == 32) // trim trailing spaces + s[i--] = 0; // null term +} + +void SETTINGS_FactoryReset(bool bIsAll) +{ + uint16_t i; + uint8_t Template[8]; + + memset(Template, 0xFF, sizeof(Template)); + + for (i = 0x0C80; i < 0x1E00; i += 8) + { + if ( + !(i >= 0x0EE0 && i < 0x0F18) && // ANI ID + DTMF codes + !(i >= 0x0F30 && i < 0x0F50) && // AES KEY + F LOCK + Scramble Enable + !(i >= 0x1C00 && i < 0x1E00) && // DTMF contacts + !(i >= 0x0EB0 && i < 0x0ED0) && // Welcome strings + !(i >= 0x0EA0 && i < 0x0EA8) && // Voice Prompt + (bIsAll || + ( + !(i >= 0x0D60 && i < 0x0E28) && // MR Channel Attributes + !(i >= 0x0F18 && i < 0x0F30) && // Scan List + !(i >= 0x0F50 && i < 0x1C00) && // MR Channel Names + !(i >= 0x0E40 && i < 0x0E70) && // FM Channels + !(i >= 0x0E88 && i < 0x0E90) // FM settings + )) + ) + { + EEPROM_WriteBuffer(i, Template); + } + } + + if (bIsAll) + { + RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, 43350000); + + // set the first few memory channels + for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++) + { + const uint32_t Frequency = gDefaultFrequencyTable[i]; + gRxVfo->freq_config_RX.Frequency = Frequency; + gRxVfo->freq_config_TX.Frequency = Frequency; + gRxVfo->Band = FREQUENCY_GetBand(Frequency); + SETTINGS_SaveChannel(MR_CHANNEL_FIRST + i, 0, gRxVfo, 2); + } + } +} + #ifdef ENABLE_FMRADIO void SETTINGS_SaveFM(void) { diff --git a/settings.h b/settings.h index a4d388f47..b167cc403 100644 --- a/settings.h +++ b/settings.h @@ -253,6 +253,11 @@ typedef struct { extern EEPROM_Config_t gEeprom; +void SETTINGS_InitEEPROM(void); +void SETTINGS_LoadCalibration(void); +uint32_t SETTINGS_FetchChannelFrequency(const int channel); +void SETTINGS_FetchChannelName(char *s, const int channel); +void SETTINGS_FactoryReset(bool bIsAll); #ifdef ENABLE_FMRADIO void SETTINGS_SaveFM(void); #endif diff --git a/ui/main.c b/ui/main.c index 6bff974f3..2b991c36c 100644 --- a/ui/main.c +++ b/ui/main.c @@ -526,7 +526,7 @@ void UI_DisplayMain(void) case MDF_NAME: // show the channel name case MDF_NAME_FREQ: // show the channel name and frequency - BOARD_fetchChannelName(String, gEeprom.ScreenChannel[vfo_num]); + SETTINGS_FetchChannelName(String, gEeprom.ScreenChannel[vfo_num]); if (String[0] == 0) { // no channel name, show the channel number instead sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1); diff --git a/ui/menu.c b/ui/menu.c index f149d211a..ef972e9b1 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -642,7 +642,7 @@ void UI_DisplayMenu(void) if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency - const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection); + const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection); sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000); UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8); } @@ -660,11 +660,11 @@ void UI_DisplayMenu(void) if (valid) { - const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection); + const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection); if (!gIsInSubMenu || edit_index < 0) { // show the channel name - BOARD_fetchChannelName(String, gSubMenuSelection); + SETTINGS_FetchChannelName(String, gSubMenuSelection); if (String[0] == 0) strcpy(String, "--"); UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8); @@ -912,7 +912,7 @@ void UI_DisplayMenu(void) UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8); // channel name - BOARD_fetchChannelName(String, gSubMenuSelection); + SETTINGS_FetchChannelName(String, gSubMenuSelection); if (String[0] == 0) strcpy(String, "--"); UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8); @@ -923,7 +923,7 @@ void UI_DisplayMenu(void) UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8); // channel name - BOARD_fetchChannelName(String, gSubMenuSelection); + SETTINGS_FetchChannelName(String, gSubMenuSelection); if (String[0] == 0) strcpy(String, "--"); UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 2); @@ -947,7 +947,7 @@ void UI_DisplayMenu(void) UI_MENU_GetCurrentMenuId() == MENU_1_CALL) { // display the channel name char s[11]; - BOARD_fetchChannelName(s, gSubMenuSelection); + SETTINGS_FetchChannelName(s, gSubMenuSelection); if (s[0] == 0) strcpy(s, "--"); UI_PrintString(s, menu_item_x1, menu_item_x2, 2, 8);