mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
RSSI calibration data usage fixed
This commit is contained in:
parent
c115099704
commit
373f747824
2
Makefile
2
Makefile
@ -37,7 +37,7 @@ ENABLE_AM_FIX := 1
|
|||||||
ENABLE_AM_FIX_SHOW_DATA := 1
|
ENABLE_AM_FIX_SHOW_DATA := 1
|
||||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1
|
ENABLE_SQUELCH_MORE_SENSITIVE := 1
|
||||||
ENABLE_FASTER_CHANNEL_SCAN := 1
|
ENABLE_FASTER_CHANNEL_SCAN := 1
|
||||||
ENABLE_RSSI_BAR := 1
|
ENABLE_RSSI_BAR := 0
|
||||||
ENABLE_SHOW_TX_TIMEOUT := 0
|
ENABLE_SHOW_TX_TIMEOUT := 0
|
||||||
ENABLE_AUDIO_BAR := 1
|
ENABLE_AUDIO_BAR := 1
|
||||||
ENABLE_COPY_CHAN_TO_VFO := 1
|
ENABLE_COPY_CHAN_TO_VFO := 1
|
||||||
|
54
app/app.c
54
app/app.c
@ -215,12 +215,12 @@ static void APP_HandleIncoming(void)
|
|||||||
if (g_ctcss_lost && g_current_code_type == CODE_TYPE_CONTINUOUS_TONE)
|
if (g_ctcss_lost && g_current_code_type == CODE_TYPE_CONTINUOUS_TONE)
|
||||||
{
|
{
|
||||||
flag = true;
|
flag = true;
|
||||||
g_found_CTCSS = false;
|
g_found_ctcss = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_cdcss_lost && g_cdcss_code_type == CDCSS_POSITIVE_CODE && (g_current_code_type == CODE_TYPE_DIGITAL || g_current_code_type == CODE_TYPE_REVERSE_DIGITAL))
|
if (g_cdcss_lost && g_cdcss_code_type == CDCSS_POSITIVE_CODE && (g_current_code_type == CODE_TYPE_DIGITAL || g_current_code_type == CODE_TYPE_REVERSE_DIGITAL))
|
||||||
{
|
{
|
||||||
g_found_CDCSS = false;
|
g_found_cdcss = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!flag)
|
if (!flag)
|
||||||
@ -286,10 +286,10 @@ static void APP_HandleReceive(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CODE_TYPE_CONTINUOUS_TONE:
|
case CODE_TYPE_CONTINUOUS_TONE:
|
||||||
if (g_found_CTCSS && g_found_CTCSS_count_down_10ms == 0)
|
if (g_found_ctcss && g_found_ctcss_count_down_10ms == 0)
|
||||||
{
|
{
|
||||||
g_found_CTCSS = false;
|
g_found_ctcss = false;
|
||||||
g_found_CDCSS = false;
|
g_found_cdcss = false;
|
||||||
Mode = END_OF_RX_MODE_END;
|
Mode = END_OF_RX_MODE_END;
|
||||||
goto Skip;
|
goto Skip;
|
||||||
}
|
}
|
||||||
@ -297,10 +297,10 @@ static void APP_HandleReceive(void)
|
|||||||
|
|
||||||
case CODE_TYPE_DIGITAL:
|
case CODE_TYPE_DIGITAL:
|
||||||
case CODE_TYPE_REVERSE_DIGITAL:
|
case CODE_TYPE_REVERSE_DIGITAL:
|
||||||
if (g_found_CDCSS && g_found_CDCSS_count_down_10ms == 0)
|
if (g_found_cdcss && g_found_cdcss_count_down_10ms == 0)
|
||||||
{
|
{
|
||||||
g_found_CTCSS = false;
|
g_found_ctcss = false;
|
||||||
g_found_CDCSS = false;
|
g_found_cdcss = false;
|
||||||
Mode = END_OF_RX_MODE_END;
|
Mode = END_OF_RX_MODE_END;
|
||||||
goto Skip;
|
goto Skip;
|
||||||
}
|
}
|
||||||
@ -331,13 +331,13 @@ static void APP_HandleReceive(void)
|
|||||||
case CODE_TYPE_CONTINUOUS_TONE:
|
case CODE_TYPE_CONTINUOUS_TONE:
|
||||||
if (g_ctcss_lost)
|
if (g_ctcss_lost)
|
||||||
{
|
{
|
||||||
g_found_CTCSS = false;
|
g_found_ctcss = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!g_found_CTCSS)
|
if (!g_found_ctcss)
|
||||||
{
|
{
|
||||||
g_found_CTCSS = true;
|
g_found_ctcss = true;
|
||||||
g_found_CTCSS_count_down_10ms = 100; // 1 sec
|
g_found_ctcss_count_down_10ms = 100; // 1 sec
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_cxcss_tail_found)
|
if (g_cxcss_tail_found)
|
||||||
@ -351,13 +351,13 @@ static void APP_HandleReceive(void)
|
|||||||
case CODE_TYPE_REVERSE_DIGITAL:
|
case CODE_TYPE_REVERSE_DIGITAL:
|
||||||
if (g_cdcss_lost && g_cdcss_code_type == CDCSS_POSITIVE_CODE)
|
if (g_cdcss_lost && g_cdcss_code_type == CDCSS_POSITIVE_CODE)
|
||||||
{
|
{
|
||||||
g_found_CDCSS = false;
|
g_found_cdcss = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!g_found_CDCSS)
|
if (!g_found_cdcss)
|
||||||
{
|
{
|
||||||
g_found_CDCSS = true;
|
g_found_cdcss = true;
|
||||||
g_found_CDCSS_count_down_10ms = 100; // 1 sec
|
g_found_cdcss_count_down_10ms = 100; // 1 sec
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_cxcss_tail_found)
|
if (g_cxcss_tail_found)
|
||||||
@ -1571,23 +1571,23 @@ void APP_TimeSlice10ms(void)
|
|||||||
|
|
||||||
// ***********
|
// ***********
|
||||||
|
|
||||||
if (g_flag_SaveVfo)
|
if (g_flag_save_vfo)
|
||||||
{
|
{
|
||||||
SETTINGS_SaveVfoIndices();
|
SETTINGS_SaveVfoIndices();
|
||||||
g_flag_SaveVfo = false;
|
g_flag_save_vfo = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_flag_SaveSettings)
|
if (g_flag_save_settings)
|
||||||
{
|
{
|
||||||
SETTINGS_SaveSettings();
|
SETTINGS_SaveSettings();
|
||||||
g_flag_SaveSettings = false;
|
g_flag_save_settings = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (g_flag_SaveFM)
|
if (g_flag_save_fm)
|
||||||
{
|
{
|
||||||
SETTINGS_SaveFM();
|
SETTINGS_SaveFM();
|
||||||
g_flag_SaveFM = false;
|
g_flag_save_fm = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2709,14 +2709,14 @@ Skip:
|
|||||||
g_beep_to_play = BEEP_NONE;
|
g_beep_to_play = BEEP_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_flag_AcceptSetting)
|
if (g_flag_accept_setting)
|
||||||
{
|
{
|
||||||
g_menu_count_down = menu_timeout_500ms;
|
g_menu_count_down = menu_timeout_500ms;
|
||||||
|
|
||||||
MENU_AcceptSetting();
|
MENU_AcceptSetting();
|
||||||
|
|
||||||
g_flag_refresh_menu = true;
|
g_flag_refresh_menu = true;
|
||||||
g_flag_AcceptSetting = false;
|
g_flag_accept_setting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_search_flag_stop_scan)
|
if (g_search_flag_stop_scan)
|
||||||
@ -2730,7 +2730,7 @@ Skip:
|
|||||||
if (!key_held)
|
if (!key_held)
|
||||||
SETTINGS_SaveSettings();
|
SETTINGS_SaveSettings();
|
||||||
else
|
else
|
||||||
g_flag_SaveSettings = 1;
|
g_flag_save_settings = 1;
|
||||||
g_request_save_settings = false;
|
g_request_save_settings = false;
|
||||||
g_update_status = true;
|
g_update_status = true;
|
||||||
}
|
}
|
||||||
@ -2741,7 +2741,7 @@ Skip:
|
|||||||
if (!key_held)
|
if (!key_held)
|
||||||
SETTINGS_SaveFM();
|
SETTINGS_SaveFM();
|
||||||
else
|
else
|
||||||
g_flag_SaveFM = true;
|
g_flag_save_fm = true;
|
||||||
g_request_save_fm = false;
|
g_request_save_fm = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2751,7 +2751,7 @@ Skip:
|
|||||||
if (!key_held)
|
if (!key_held)
|
||||||
SETTINGS_SaveVfoIndices();
|
SETTINGS_SaveVfoIndices();
|
||||||
else
|
else
|
||||||
g_flag_SaveVfo = true;
|
g_flag_save_vfo = true;
|
||||||
g_request_save_vfo = false;
|
g_request_save_vfo = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
app/menu.c
18
app/menu.c
@ -531,7 +531,7 @@ void MENU_AcceptSetting(void)
|
|||||||
g_eeprom.vox_switch = g_sub_menu_selection != 0;
|
g_eeprom.vox_switch = g_sub_menu_selection != 0;
|
||||||
if (g_eeprom.vox_switch)
|
if (g_eeprom.vox_switch)
|
||||||
g_eeprom.vox_level = g_sub_menu_selection - 1;
|
g_eeprom.vox_level = g_sub_menu_selection - 1;
|
||||||
BOARD_EEPROM_LoadMoreSettings();
|
BOARD_EEPROM_LoadCalibration();
|
||||||
g_flag_reconfigure_vfos = true;
|
g_flag_reconfigure_vfos = true;
|
||||||
g_update_status = true;
|
g_update_status = true;
|
||||||
break;
|
break;
|
||||||
@ -623,7 +623,7 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_MIC:
|
case MENU_MIC:
|
||||||
g_eeprom.mic_sensitivity = g_sub_menu_selection;
|
g_eeprom.mic_sensitivity = g_sub_menu_selection;
|
||||||
BOARD_EEPROM_LoadMoreSettings();
|
BOARD_EEPROM_LoadCalibration();
|
||||||
g_flag_reconfigure_vfos = true;
|
g_flag_reconfigure_vfos = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1290,7 +1290,7 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
|
|
||||||
if (++g_edit_index >= 10)
|
if (++g_edit_index >= 10)
|
||||||
{ // exit edit
|
{ // exit edit
|
||||||
g_flag_AcceptSetting = false;
|
g_flag_accept_setting = false;
|
||||||
g_ask_for_confirmation = 1;
|
g_ask_for_confirmation = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1561,13 +1561,13 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
|||||||
// exit
|
// exit
|
||||||
if (memcmp(g_edit_original, g_edit, sizeof(g_edit_original)) == 0)
|
if (memcmp(g_edit_original, g_edit, sizeof(g_edit_original)) == 0)
|
||||||
{ // no change - drop it
|
{ // no change - drop it
|
||||||
g_flag_AcceptSetting = false;
|
g_flag_accept_setting = false;
|
||||||
g_is_in_sub_menu = false;
|
g_is_in_sub_menu = false;
|
||||||
g_ask_for_confirmation = 0;
|
g_ask_for_confirmation = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_flag_AcceptSetting = false;
|
g_flag_accept_setting = false;
|
||||||
g_ask_for_confirmation = 0;
|
g_ask_for_confirmation = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1609,14 +1609,14 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
g_flag_AcceptSetting = true;
|
g_flag_accept_setting = true;
|
||||||
g_is_in_sub_menu = false;
|
g_is_in_sub_menu = false;
|
||||||
g_ask_for_confirmation = 0;
|
g_ask_for_confirmation = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_flag_AcceptSetting = true;
|
g_flag_accept_setting = true;
|
||||||
g_is_in_sub_menu = false;
|
g_is_in_sub_menu = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1653,7 +1653,7 @@ static void MENU_Key_STAR(const bool key_pressed, const bool key_held)
|
|||||||
|
|
||||||
if (++g_edit_index >= 10)
|
if (++g_edit_index >= 10)
|
||||||
{ // exit edit
|
{ // exit edit
|
||||||
g_flag_AcceptSetting = false;
|
g_flag_accept_setting = false;
|
||||||
g_ask_for_confirmation = 1;
|
g_ask_for_confirmation = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1860,7 +1860,7 @@ void MENU_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
g_edit[g_edit_index] = ' ';
|
g_edit[g_edit_index] = ' ';
|
||||||
if (++g_edit_index >= 10)
|
if (++g_edit_index >= 10)
|
||||||
{ // exit edit
|
{ // exit edit
|
||||||
g_flag_AcceptSetting = false;
|
g_flag_accept_setting = false;
|
||||||
g_ask_for_confirmation = 1;
|
g_ask_for_confirmation = 1;
|
||||||
}
|
}
|
||||||
g_request_display_screen = DISPLAY_MENU;
|
g_request_display_screen = DISPLAY_MENU;
|
||||||
|
20
board.c
20
board.c
@ -777,18 +777,18 @@ void BOARD_EEPROM_load(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void BOARD_EEPROM_LoadMoreSettings(void)
|
void BOARD_EEPROM_LoadCalibration(void)
|
||||||
{
|
{
|
||||||
// uint8_t Mic;
|
// uint8_t Mic;
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1EC0, g_eeprom_1EC0_0, 8);
|
EEPROM_ReadBuffer(0x1EC0, g_eeprom_rssi_calib[3], 8);
|
||||||
memmove(g_eeprom_1EC0_1, g_eeprom_1EC0_0, 8);
|
memcpy(g_eeprom_rssi_calib[4], g_eeprom_rssi_calib[3], 8);
|
||||||
memmove(g_eeprom_1EC0_2, g_eeprom_1EC0_0, 8);
|
memcpy(g_eeprom_rssi_calib[5], g_eeprom_rssi_calib[3], 8);
|
||||||
memmove(g_eeprom_1EC0_3, g_eeprom_1EC0_0, 8);
|
memcpy(g_eeprom_rssi_calib[6], g_eeprom_rssi_calib[3], 8);
|
||||||
|
|
||||||
// 8 * 16-bit values
|
EEPROM_ReadBuffer(0x1EC8, g_eeprom_rssi_calib[0], 8);
|
||||||
EEPROM_ReadBuffer(0x1EC0, g_eeprom_rssi_calib[0], 8);
|
memcpy(g_eeprom_rssi_calib[1], g_eeprom_rssi_calib[0], 8);
|
||||||
EEPROM_ReadBuffer(0x1EC8, g_eeprom_rssi_calib[1], 8);
|
memcpy(g_eeprom_rssi_calib[2], g_eeprom_rssi_calib[0], 8);
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1F40, g_battery_calibration, 12);
|
EEPROM_ReadBuffer(0x1F40, g_battery_calibration, 12);
|
||||||
if (g_battery_calibration[0] >= 5000)
|
if (g_battery_calibration[0] >= 5000)
|
||||||
@ -822,8 +822,8 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
|||||||
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
|
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
|
||||||
|
|
||||||
g_eeprom.BK4819_xtal_freq_low = (Misc.BK4819_XtalFreqLow >= -1000 && Misc.BK4819_XtalFreqLow <= 1000) ? Misc.BK4819_XtalFreqLow : 0;
|
g_eeprom.BK4819_xtal_freq_low = (Misc.BK4819_XtalFreqLow >= -1000 && Misc.BK4819_XtalFreqLow <= 1000) ? Misc.BK4819_XtalFreqLow : 0;
|
||||||
g_eeprom_1F8A = Misc.EEPROM_1F8A & 0x01FF;
|
// g_eeprom_1F8A = Misc.EEPROM_1F8A & 0x01FF;
|
||||||
g_eeprom_1F8C = Misc.EEPROM_1F8C & 0x01FF;
|
// g_eeprom_1F8C = Misc.EEPROM_1F8C & 0x01FF;
|
||||||
g_eeprom.volume_gain = (Misc.volume_gain < 64) ? Misc.volume_gain : 58;
|
g_eeprom.volume_gain = (Misc.volume_gain < 64) ? Misc.volume_gain : 58;
|
||||||
g_eeprom.dac_gain = (Misc.dac_gain < 16) ? Misc.dac_gain : 8;
|
g_eeprom.dac_gain = (Misc.dac_gain < 16) ? Misc.dac_gain : 8;
|
||||||
|
|
||||||
|
2
board.h
2
board.h
@ -26,7 +26,7 @@ void BOARD_ADC_Init(void);
|
|||||||
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
||||||
void BOARD_Init(void);
|
void BOARD_Init(void);
|
||||||
void BOARD_EEPROM_load(void);
|
void BOARD_EEPROM_load(void);
|
||||||
void BOARD_EEPROM_LoadMoreSettings(void);
|
void BOARD_EEPROM_LoadCalibration(void);
|
||||||
uint32_t BOARD_fetchChannelFrequency(const int channel);
|
uint32_t BOARD_fetchChannelFrequency(const int channel);
|
||||||
unsigned int BOARD_fetchChannelStepSetting(const int channel);
|
unsigned int BOARD_fetchChannelStepSetting(const int channel);
|
||||||
void BOARD_fetchChannelName(char *s, const int channel);
|
void BOARD_fetchChannelName(char *s, const int channel);
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -70,10 +70,10 @@ void FUNCTION_Init(void)
|
|||||||
|
|
||||||
g_flag_tail_tone_elimination_complete = false;
|
g_flag_tail_tone_elimination_complete = false;
|
||||||
g_tail_tone_elimination_count_down_10ms = 0;
|
g_tail_tone_elimination_count_down_10ms = 0;
|
||||||
g_found_CTCSS = false;
|
g_found_ctcss = false;
|
||||||
g_found_CDCSS = false;
|
g_found_cdcss = false;
|
||||||
g_found_CTCSS_count_down_10ms = 0;
|
g_found_ctcss_count_down_10ms = 0;
|
||||||
g_found_CDCSS_count_down_10ms = 0;
|
g_found_cdcss_count_down_10ms = 0;
|
||||||
g_end_of_rx_detected_maybe = false;
|
g_end_of_rx_detected_maybe = false;
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
|
2
main.c
2
main.c
@ -92,7 +92,7 @@ void Main(void)
|
|||||||
|
|
||||||
BOARD_EEPROM_load();
|
BOARD_EEPROM_load();
|
||||||
|
|
||||||
BOARD_EEPROM_LoadMoreSettings();
|
BOARD_EEPROM_LoadCalibration();
|
||||||
|
|
||||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||||
|
40
misc.c
40
misc.c
@ -124,15 +124,10 @@ uint32_t g_custom_aes_key[4];
|
|||||||
bool g_has_custom_aes_key;
|
bool g_has_custom_aes_key;
|
||||||
uint32_t g_challenge[4];
|
uint32_t g_challenge[4];
|
||||||
|
|
||||||
uint8_t g_eeprom_1EC0_0[8];
|
uint16_t g_eeprom_rssi_calib[7][4];
|
||||||
uint8_t g_eeprom_1EC0_1[8];
|
|
||||||
uint8_t g_eeprom_1EC0_2[8];
|
|
||||||
uint8_t g_eeprom_1EC0_3[8];
|
|
||||||
|
|
||||||
uint16_t g_eeprom_rssi_calib[2][4];
|
//uint16_t g_eeprom_1F8A;
|
||||||
|
//uint16_t g_eeprom_1F8C;
|
||||||
uint16_t g_eeprom_1F8A;
|
|
||||||
uint16_t g_eeprom_1F8C;
|
|
||||||
|
|
||||||
uint8_t g_user_channel_attributes[FREQ_CHANNEL_LAST + 1];
|
uint8_t g_user_channel_attributes[FREQ_CHANNEL_LAST + 1];
|
||||||
|
|
||||||
@ -156,23 +151,18 @@ volatile bool g_tx_timeout_reached;
|
|||||||
|
|
||||||
volatile uint16_t g_tail_tone_elimination_count_down_10ms;
|
volatile uint16_t g_tail_tone_elimination_count_down_10ms;
|
||||||
|
|
||||||
bool g_scan_pause_mode;
|
|
||||||
volatile bool g_scan_schedule_scan_listen = true;
|
|
||||||
volatile uint16_t g_scan_pause_delay_in_10ms;
|
|
||||||
scan_state_dir_t g_scan_state_dir;
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
volatile uint16_t g_noaa_count_down_10ms;
|
volatile uint16_t g_noaa_count_down_10ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool g_enable_speaker;
|
bool g_enable_speaker;
|
||||||
uint8_t g_key_input_count_down = 0;
|
uint8_t g_key_input_count_down;
|
||||||
uint8_t g_key_lock_count_down_500ms;
|
uint8_t g_key_lock_count_down_500ms;
|
||||||
uint8_t g_rtte_count_down;
|
uint8_t g_rtte_count_down;
|
||||||
bool g_password_locked;
|
bool g_password_locked;
|
||||||
uint8_t g_update_status;
|
uint8_t g_update_status;
|
||||||
uint8_t g_found_CTCSS;
|
uint8_t g_found_ctcss;
|
||||||
uint8_t g_found_CDCSS;
|
uint8_t g_found_cdcss;
|
||||||
bool g_end_of_rx_detected_maybe;
|
bool g_end_of_rx_detected_maybe;
|
||||||
|
|
||||||
int16_t g_vfo_rssi[2];
|
int16_t g_vfo_rssi[2];
|
||||||
@ -197,14 +187,14 @@ bool g_request_save_settings;
|
|||||||
#endif
|
#endif
|
||||||
bool g_flag_prepare_tx;
|
bool g_flag_prepare_tx;
|
||||||
|
|
||||||
bool g_flag_AcceptSetting;
|
bool g_flag_accept_setting;
|
||||||
bool g_flag_refresh_menu;
|
bool g_flag_refresh_menu;
|
||||||
|
|
||||||
bool g_flag_SaveVfo;
|
bool g_flag_save_vfo;
|
||||||
bool g_flag_SaveSettings;
|
bool g_flag_save_settings;
|
||||||
bool g_flag_save_channel;
|
bool g_flag_save_channel;
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
bool g_flag_SaveFM;
|
bool g_flag_save_fm;
|
||||||
#endif
|
#endif
|
||||||
bool g_cdcss_lost;
|
bool g_cdcss_lost;
|
||||||
uint8_t g_cdcss_code_type;
|
uint8_t g_cdcss_code_type;
|
||||||
@ -217,8 +207,10 @@ bool g_cxcss_tail_found;
|
|||||||
uint16_t g_vox_pause_count_down;
|
uint16_t g_vox_pause_count_down;
|
||||||
#endif
|
#endif
|
||||||
bool g_squelch_lost;
|
bool g_squelch_lost;
|
||||||
|
|
||||||
uint8_t g_flash_light_state;
|
uint8_t g_flash_light_state;
|
||||||
volatile uint16_t g_flash_light_blink_counter;
|
volatile uint16_t g_flash_light_blink_counter;
|
||||||
|
|
||||||
bool g_flag_end_tx;
|
bool g_flag_end_tx;
|
||||||
uint16_t g_low_batteryCountdown;
|
uint16_t g_low_batteryCountdown;
|
||||||
reception_mode_t g_rx_reception_mode;
|
reception_mode_t g_rx_reception_mode;
|
||||||
@ -228,6 +220,10 @@ uint8_t g_scan_restore_channel;
|
|||||||
scan_next_chan_t g_scan_current_scan_list;
|
scan_next_chan_t g_scan_current_scan_list;
|
||||||
uint32_t g_scan_restore_frequency;
|
uint32_t g_scan_restore_frequency;
|
||||||
bool g_scan_keep_frequency;
|
bool g_scan_keep_frequency;
|
||||||
|
bool g_scan_pause_mode;
|
||||||
|
volatile bool g_scan_schedule_scan_listen = true;
|
||||||
|
volatile uint16_t g_scan_pause_delay_in_10ms;
|
||||||
|
scan_state_dir_t g_scan_state_dir;
|
||||||
|
|
||||||
bool g_rx_vfo_is_active;
|
bool g_rx_vfo_is_active;
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@ -247,8 +243,8 @@ bool g_update_display;
|
|||||||
bool g_unhide_hidden = false;
|
bool g_unhide_hidden = false;
|
||||||
|
|
||||||
volatile bool g_next_time_slice;
|
volatile bool g_next_time_slice;
|
||||||
volatile uint8_t g_found_CDCSS_count_down_10ms;
|
volatile uint8_t g_found_cdcss_count_down_10ms;
|
||||||
volatile uint8_t g_found_CTCSS_count_down_10ms;
|
volatile uint8_t g_found_ctcss_count_down_10ms;
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
volatile uint16_t g_vox_stop_count_down_10ms;
|
volatile uint16_t g_vox_stop_count_down_10ms;
|
||||||
#endif
|
#endif
|
||||||
|
38
misc.h
38
misc.h
@ -206,15 +206,11 @@ extern uint32_t g_custom_aes_key[4];
|
|||||||
extern bool g_has_custom_aes_key;
|
extern bool g_has_custom_aes_key;
|
||||||
extern uint32_t g_challenge[4];
|
extern uint32_t g_challenge[4];
|
||||||
|
|
||||||
extern uint8_t g_eeprom_1EC0_0[8];
|
extern uint16_t g_eeprom_rssi_calib[7][4];
|
||||||
extern uint8_t g_eeprom_1EC0_1[8];
|
//extern uint16_t g_eeprom_rssi_calib[2][4];
|
||||||
extern uint8_t g_eeprom_1EC0_2[8];
|
|
||||||
extern uint8_t g_eeprom_1EC0_3[8];
|
|
||||||
|
|
||||||
extern uint16_t g_eeprom_rssi_calib[2][4];
|
//extern uint16_t g_eeprom_1F8A;
|
||||||
|
//extern uint16_t g_eeprom_1F8C;
|
||||||
extern uint16_t g_eeprom_1F8A;
|
|
||||||
extern uint16_t g_eeprom_1F8C;
|
|
||||||
|
|
||||||
extern uint8_t g_user_channel_attributes[207];
|
extern uint8_t g_user_channel_attributes[207];
|
||||||
|
|
||||||
@ -238,11 +234,6 @@ extern volatile bool g_tx_timeout_reached;
|
|||||||
|
|
||||||
extern volatile uint16_t g_tail_tone_elimination_count_down_10ms;
|
extern volatile uint16_t g_tail_tone_elimination_count_down_10ms;
|
||||||
|
|
||||||
extern bool g_scan_pause_mode;
|
|
||||||
extern volatile bool g_scan_schedule_scan_listen;
|
|
||||||
extern volatile uint16_t g_scan_pause_delay_in_10ms;
|
|
||||||
extern scan_state_dir_t g_scan_state_dir;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
extern volatile uint16_t g_fm_play_count_down_10ms;
|
extern volatile uint16_t g_fm_play_count_down_10ms;
|
||||||
#endif
|
#endif
|
||||||
@ -255,8 +246,8 @@ extern uint8_t g_key_lock_count_down_500ms;
|
|||||||
extern uint8_t g_rtte_count_down;
|
extern uint8_t g_rtte_count_down;
|
||||||
extern bool g_password_locked;
|
extern bool g_password_locked;
|
||||||
extern uint8_t g_update_status;
|
extern uint8_t g_update_status;
|
||||||
extern uint8_t g_found_CTCSS;
|
extern uint8_t g_found_ctcss;
|
||||||
extern uint8_t g_found_CDCSS;
|
extern uint8_t g_found_cdcss;
|
||||||
extern bool g_end_of_rx_detected_maybe;
|
extern bool g_end_of_rx_detected_maybe;
|
||||||
|
|
||||||
extern int16_t g_vfo_rssi[2];
|
extern int16_t g_vfo_rssi[2];
|
||||||
@ -279,14 +270,14 @@ extern bool g_request_save_settings;
|
|||||||
#endif
|
#endif
|
||||||
extern bool g_flag_prepare_tx;
|
extern bool g_flag_prepare_tx;
|
||||||
|
|
||||||
extern bool g_flag_AcceptSetting; // accept menu setting
|
extern bool g_flag_accept_setting; // accept menu setting
|
||||||
extern bool g_flag_refresh_menu; // refresh menu display
|
extern bool g_flag_refresh_menu; // refresh menu display
|
||||||
|
|
||||||
extern bool g_flag_SaveVfo;
|
extern bool g_flag_save_vfo;
|
||||||
extern bool g_flag_SaveSettings;
|
extern bool g_flag_save_settings;
|
||||||
extern bool g_flag_save_channel;
|
extern bool g_flag_save_channel;
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
extern bool g_flag_SaveFM;
|
extern bool g_flag_save_fm;
|
||||||
#endif
|
#endif
|
||||||
extern bool g_cdcss_lost;
|
extern bool g_cdcss_lost;
|
||||||
extern uint8_t g_cdcss_code_type;
|
extern uint8_t g_cdcss_code_type;
|
||||||
@ -310,6 +301,11 @@ extern uint8_t g_scan_restore_channel;
|
|||||||
extern scan_next_chan_t g_scan_current_scan_list;
|
extern scan_next_chan_t g_scan_current_scan_list;
|
||||||
extern uint32_t g_scan_restore_frequency;
|
extern uint32_t g_scan_restore_frequency;
|
||||||
extern bool g_scan_keep_frequency;
|
extern bool g_scan_keep_frequency;
|
||||||
|
extern bool g_scan_pause_mode;
|
||||||
|
extern volatile bool g_scan_schedule_scan_listen;
|
||||||
|
extern volatile uint16_t g_scan_pause_delay_in_10ms;
|
||||||
|
extern scan_state_dir_t g_scan_state_dir;
|
||||||
|
|
||||||
|
|
||||||
extern bool g_rx_vfo_is_active;
|
extern bool g_rx_vfo_is_active;
|
||||||
extern uint8_t g_alarm_tone_counter;
|
extern uint8_t g_alarm_tone_counter;
|
||||||
@ -326,8 +322,8 @@ extern bool g_unhide_hidden;
|
|||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
extern uint8_t g_fm_channel_position;
|
extern uint8_t g_fm_channel_position;
|
||||||
#endif
|
#endif
|
||||||
extern volatile uint8_t g_found_CDCSS_count_down_10ms;
|
extern volatile uint8_t g_found_cdcss_count_down_10ms;
|
||||||
extern volatile uint8_t g_found_CTCSS_count_down_10ms;
|
extern volatile uint8_t g_found_ctcss_count_down_10ms;
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
extern volatile uint16_t g_vox_stop_count_down_10ms;
|
extern volatile uint16_t g_vox_stop_count_down_10ms;
|
||||||
#endif
|
#endif
|
||||||
|
3
radio.c
3
radio.c
@ -243,6 +243,9 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
{
|
{
|
||||||
uint8_t Tmp;
|
uint8_t Tmp;
|
||||||
uint8_t Data[8];
|
uint8_t Data[8];
|
||||||
|
// t_channel channel;
|
||||||
|
|
||||||
|
// EEPROM_ReadBuffer(Base, channel, sizeof(channel));
|
||||||
|
|
||||||
// ***************
|
// ***************
|
||||||
|
|
||||||
|
@ -68,9 +68,9 @@ void SystickHandler(void)
|
|||||||
DECREMENT(g_noaa_count_down_10ms);
|
DECREMENT(g_noaa_count_down_10ms);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECREMENT(g_found_CDCSS_count_down_10ms);
|
DECREMENT(g_found_cdcss_count_down_10ms);
|
||||||
|
|
||||||
DECREMENT(g_found_CTCSS_count_down_10ms);
|
DECREMENT(g_found_ctcss_count_down_10ms);
|
||||||
|
|
||||||
if (g_current_function == FUNCTION_FOREGROUND)
|
if (g_current_function == FUNCTION_FOREGROUND)
|
||||||
DECREMENT_AND_TRIGGER(g_battery_save_count_down_10ms, g_schedule_power_save);
|
DECREMENT_AND_TRIGGER(g_battery_save_count_down_10ms, g_schedule_power_save);
|
||||||
|
57
settings.h
57
settings.h
@ -116,6 +116,8 @@ typedef enum mdf_display_mode_e mdf_display_mode_t;
|
|||||||
|
|
||||||
// ************************************************
|
// ************************************************
|
||||||
|
|
||||||
|
// unused bits are all '0's if the channel is used,
|
||||||
|
// unless the channel is unused, in which case all 16 bytes are 0xff
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// [0]
|
// [0]
|
||||||
uint32_t frequency; //
|
uint32_t frequency; //
|
||||||
@ -126,29 +128,31 @@ typedef struct {
|
|||||||
// [9]
|
// [9]
|
||||||
uint8_t tx_ctcss_cdcss_code; //
|
uint8_t tx_ctcss_cdcss_code; //
|
||||||
// [10]
|
// [10]
|
||||||
uint8_t rx_ctcss_cdcss_type:4; //
|
uint8_t rx_ctcss_cdcss_type:2; //
|
||||||
uint8_t tx_ctcss_cdcss_type:4; //
|
uint8_t unused1:2;
|
||||||
|
uint8_t tx_ctcss_cdcss_type:2; //
|
||||||
|
uint8_t unused2:2;
|
||||||
// [11]
|
// [11]
|
||||||
uint8_t tx_offset_dir:2; //
|
uint8_t tx_offset_dir:2; //
|
||||||
uint8_t unused1:2;
|
uint8_t unused3:2;
|
||||||
uint8_t am_mode:1; //
|
uint8_t am_mode:1; //
|
||||||
uint8_t unused2:3;
|
uint8_t unused4:3;
|
||||||
// [12]
|
// [12]
|
||||||
uint8_t frequency_reverse:1; // reverse repeater
|
uint8_t frequency_reverse:1; // reverse repeater
|
||||||
uint8_t channel_bandwidth:1; // wide/narrow
|
uint8_t channel_bandwidth:1; // wide/narrow
|
||||||
uint8_t tx_power:2; // 0, 1 or 2 .. L, M or H
|
uint8_t tx_power:2; // 0, 1 or 2 .. L, M or H
|
||||||
uint8_t busy_channel_lockout:1; //
|
uint8_t busy_channel_lockout:1; //
|
||||||
uint8_t unused3:3;
|
uint8_t unused5:3;
|
||||||
// [13]
|
// [13]
|
||||||
uint8_t dtmf_decoding_enable:1; //
|
uint8_t dtmf_decoding_enable:1; //
|
||||||
uint8_t dtmf_ptt_id_tx_mode:3; //
|
uint8_t dtmf_ptt_id_tx_mode:3; //
|
||||||
uint8_t unused4:4;
|
uint8_t unused6:4;
|
||||||
// [14]
|
// [14]
|
||||||
uint8_t step_setting:3; //
|
uint8_t step_setting:3; //
|
||||||
uint8_t unused5:5;
|
uint8_t unused7:5;
|
||||||
// [15]
|
// [15]
|
||||||
uint8_t scrambler:4; //
|
uint8_t scrambler:4; //
|
||||||
uint8_t unused6:4;
|
uint8_t unused8:4;
|
||||||
} __attribute__((packed)) t_channel;
|
} __attribute__((packed)) t_channel;
|
||||||
|
|
||||||
// 512 bytes
|
// 512 bytes
|
||||||
@ -197,8 +201,8 @@ typedef struct {
|
|||||||
} __attribute__((packed)) vhf_squelch[6];
|
} __attribute__((packed)) vhf_squelch[6];
|
||||||
|
|
||||||
// 0x1EC0
|
// 0x1EC0
|
||||||
uint16_t unknown1[4];
|
uint16_t rssi_uhf[4];
|
||||||
uint16_t rssi[4];
|
uint16_t rssi_vhf[4];
|
||||||
|
|
||||||
// 0x1ED0
|
// 0x1ED0
|
||||||
struct
|
struct
|
||||||
@ -236,7 +240,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
// 0x0000
|
// 0x0000
|
||||||
t_channel channel[200];
|
t_channel channel[200]; // unused channels are set to all '0xff'
|
||||||
|
|
||||||
// 0x0C80
|
// 0x0C80
|
||||||
t_channel vfo[14];
|
t_channel vfo[14];
|
||||||
@ -434,12 +438,6 @@ typedef struct {
|
|||||||
uint8_t scan_list_priority_ch1[2];
|
uint8_t scan_list_priority_ch1[2];
|
||||||
uint8_t scan_list_priority_ch2[2];
|
uint8_t scan_list_priority_ch2[2];
|
||||||
|
|
||||||
uint8_t field29_0x26;
|
|
||||||
uint8_t field30_0x27;
|
|
||||||
|
|
||||||
uint8_t field37_0x32;
|
|
||||||
uint8_t field38_0x33;
|
|
||||||
|
|
||||||
bool auto_keypad_lock;
|
bool auto_keypad_lock;
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
@ -461,12 +459,6 @@ typedef struct {
|
|||||||
char dtmf_key_up_code[16];
|
char dtmf_key_up_code[16];
|
||||||
char dtmf_key_down_code[16];
|
char dtmf_key_down_code[16];
|
||||||
|
|
||||||
uint8_t field57_0x6c;
|
|
||||||
uint8_t field58_0x6d;
|
|
||||||
|
|
||||||
uint8_t field60_0x7e;
|
|
||||||
uint8_t field61_0x7f;
|
|
||||||
|
|
||||||
char dtmf_separate_code;
|
char dtmf_separate_code;
|
||||||
char dtmf_group_call_code;
|
char dtmf_group_call_code;
|
||||||
uint8_t dtmf_decode_response;
|
uint8_t dtmf_decode_response;
|
||||||
@ -489,11 +481,22 @@ typedef struct {
|
|||||||
uint16_t vox1_threshold;
|
uint16_t vox1_threshold;
|
||||||
uint16_t vox0_threshold;
|
uint16_t vox0_threshold;
|
||||||
|
|
||||||
uint8_t field77_0x95;
|
// uint8_t field29_0x26;
|
||||||
uint8_t field78_0x96;
|
// uint8_t field30_0x27;
|
||||||
uint8_t field79_0x97;
|
|
||||||
|
// uint8_t field37_0x32;
|
||||||
|
// uint8_t field38_0x33;
|
||||||
|
|
||||||
|
// uint8_t field57_0x6c;
|
||||||
|
// uint8_t field58_0x6d;
|
||||||
|
|
||||||
|
// uint8_t field60_0x7e;
|
||||||
|
// uint8_t field61_0x7f;
|
||||||
|
|
||||||
|
// uint8_t field77_0x95;
|
||||||
|
// uint8_t field78_0x96;
|
||||||
|
// uint8_t field79_0x97;
|
||||||
|
|
||||||
uint8_t _pad[1];
|
|
||||||
} eeprom_config_t;
|
} eeprom_config_t;
|
||||||
|
|
||||||
extern eeprom_config_t g_eeprom;
|
extern eeprom_config_t g_eeprom;
|
||||||
|
17
ui/main.c
17
ui/main.c
@ -311,22 +311,19 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
|||||||
|
|
||||||
// TODO: sort out all 8 values from the eeprom
|
// TODO: sort out all 8 values from the eeprom
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
// dBm -105 -100 -95 -90 -70 -65 -60 -55
|
const unsigned int band = g_rx_vfo->band;
|
||||||
// RSSI 110 120 130 140 180 190 200 210
|
|
||||||
// 0000C0 6E 00 78 00 82 00 8C 00 B4 00 BE 00 C8 00 D2 00
|
|
||||||
//
|
|
||||||
const unsigned int band = 1;
|
|
||||||
const int16_t level0 = g_eeprom_rssi_calib[band][0];
|
const int16_t level0 = g_eeprom_rssi_calib[band][0];
|
||||||
const int16_t level1 = g_eeprom_rssi_calib[band][1];
|
const int16_t level1 = g_eeprom_rssi_calib[band][1];
|
||||||
const int16_t level2 = g_eeprom_rssi_calib[band][2];
|
const int16_t level2 = g_eeprom_rssi_calib[band][2];
|
||||||
const int16_t level3 = g_eeprom_rssi_calib[band][3];
|
const int16_t level3 = g_eeprom_rssi_calib[band][3];
|
||||||
#else
|
#else
|
||||||
const int16_t level0 = (-115 + 160) * 2; // dB
|
const int16_t level0 = (-115 + 160) * 2; // -115dBm
|
||||||
const int16_t level1 = ( -89 + 160) * 2; // dB
|
const int16_t level1 = ( -89 + 160) * 2; // -89dBm
|
||||||
const int16_t level2 = ( -64 + 160) * 2; // dB
|
const int16_t level2 = ( -64 + 160) * 2; // -64dBm
|
||||||
const int16_t level3 = ( -39 + 160) * 2; // dB
|
const int16_t level3 = ( -39 + 160) * 2; // -39dBm
|
||||||
#endif
|
#endif
|
||||||
|
// create intermediate values (linear interpolation) to make better use of all the available RSSI bars
|
||||||
const int16_t level01 = (level0 + level1) / 2;
|
const int16_t level01 = (level0 + level1) / 2;
|
||||||
const int16_t level12 = (level1 + level2) / 2;
|
const int16_t level12 = (level1 + level2) / 2;
|
||||||
const int16_t level23 = (level2 + level3) / 2;
|
const int16_t level23 = (level2 + level3) / 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user