mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
.
This commit is contained in:
parent
5c17a33e3c
commit
b704e7efa3
2
Makefile
2
Makefile
@ -40,7 +40,7 @@ ENABLE_MDC1200_SIDE_BEEP := 1
|
|||||||
ENABLE_PWRON_PASSWORD := 0
|
ENABLE_PWRON_PASSWORD := 0
|
||||||
ENABLE_RESET_AES_KEY := 0
|
ENABLE_RESET_AES_KEY := 0
|
||||||
ENABLE_BIG_FREQ := 0
|
ENABLE_BIG_FREQ := 0
|
||||||
ENABLE_SHOW_FREQS_CHAN := 1
|
ENABLE_SHOW_FREQS_CHAN := 0
|
||||||
# smaa bolf 580 B
|
# smaa bolf 580 B
|
||||||
ENABLE_SMALL_BOLD := 1
|
ENABLE_SMALL_BOLD := 1
|
||||||
# smallest font 2 kB
|
# smallest font 2 kB
|
||||||
|
@ -705,7 +705,8 @@ static void AIRCOPY_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
|
|
||||||
g_rx_vfo->freq_config_rx.frequency = Frequency;
|
g_rx_vfo->freq_config_rx.frequency = Frequency;
|
||||||
g_rx_vfo->freq_config_tx.frequency = Frequency;
|
g_rx_vfo->freq_config_tx.frequency = Frequency;
|
||||||
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
|
RADIO_ConfigureSquelch(g_rx_vfo);
|
||||||
|
// RADIO_ConfigureTXPower(g_rx_vfo);
|
||||||
|
|
||||||
g_current_vfo = g_rx_vfo;
|
g_current_vfo = g_rx_vfo;
|
||||||
|
|
||||||
|
19
app/app.c
19
app/app.c
@ -563,6 +563,10 @@ bool APP_start_listening(void)
|
|||||||
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode);
|
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
|
UART_printf("mode %u\r\n", g_rx_vfo->channel.mod_mode);
|
||||||
|
#endif
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||||
|
|
||||||
if (g_current_display_screen != DISPLAY_MENU)
|
if (g_current_display_screen != DISPLAY_MENU)
|
||||||
@ -600,7 +604,7 @@ void APP_stop_scan(void)
|
|||||||
{ // revert to where we were when starting the scan
|
{ // revert to where we were when starting the scan
|
||||||
|
|
||||||
if (g_scan_next_channel <= USER_CHANNEL_LAST)
|
if (g_scan_next_channel <= USER_CHANNEL_LAST)
|
||||||
{ // we were channel hopping
|
{ // we were channel scanning
|
||||||
|
|
||||||
if (g_scan_restore_channel != 0xff)
|
if (g_scan_restore_channel != 0xff)
|
||||||
{
|
{
|
||||||
@ -608,7 +612,7 @@ void APP_stop_scan(void)
|
|||||||
g_eeprom.config.setting.indices.vfo[g_rx_vfo_num].screen = g_scan_restore_channel;
|
g_eeprom.config.setting.indices.vfo[g_rx_vfo_num].screen = g_scan_restore_channel;
|
||||||
|
|
||||||
RADIO_configure_channel(g_rx_vfo_num, VFO_CONFIGURE_RELOAD);
|
RADIO_configure_channel(g_rx_vfo_num, VFO_CONFIGURE_RELOAD);
|
||||||
|
RADIO_ConfigureSquelch(g_rx_vfo);
|
||||||
RADIO_setup_registers(true);
|
RADIO_setup_registers(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,7 +626,7 @@ void APP_stop_scan(void)
|
|||||||
g_rx_vfo->freq_in_channel = SETTINGS_find_channel(g_rx_vfo->freq_config_rx.frequency);
|
g_rx_vfo->freq_in_channel = SETTINGS_find_channel(g_rx_vfo->freq_config_rx.frequency);
|
||||||
|
|
||||||
RADIO_ApplyOffset(g_rx_vfo, false);
|
RADIO_ApplyOffset(g_rx_vfo, false);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
|
RADIO_ConfigureSquelch(g_rx_vfo);
|
||||||
RADIO_setup_registers(true);
|
RADIO_setup_registers(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +638,7 @@ void APP_stop_scan(void)
|
|||||||
if (g_rx_vfo->channel_save > USER_CHANNEL_LAST)
|
if (g_rx_vfo->channel_save > USER_CHANNEL_LAST)
|
||||||
{ // frequency mode
|
{ // frequency mode
|
||||||
RADIO_ApplyOffset(g_rx_vfo, false);
|
RADIO_ApplyOffset(g_rx_vfo, false);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
|
RADIO_ConfigureSquelch(g_rx_vfo);
|
||||||
SETTINGS_save_channel(g_rx_vfo->channel_save, g_rx_vfo_num, g_rx_vfo, 1);
|
SETTINGS_save_channel(g_rx_vfo->channel_save, g_rx_vfo_num, g_rx_vfo, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -688,8 +692,7 @@ static void APP_next_freq(void)
|
|||||||
// original slower method
|
// original slower method
|
||||||
|
|
||||||
RADIO_ApplyOffset(g_tx_vfo, false);
|
RADIO_ApplyOffset(g_tx_vfo, false);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
// RADIO_ConfigureSquelch(g_tx_vfo);
|
||||||
|
|
||||||
RADIO_setup_registers(true);
|
RADIO_setup_registers(true);
|
||||||
|
|
||||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||||
@ -705,7 +708,7 @@ static void APP_next_freq(void)
|
|||||||
BK4819_set_rf_filter_path(g_tx_vfo->freq_config_rx.frequency);
|
BK4819_set_rf_filter_path(g_tx_vfo->freq_config_rx.frequency);
|
||||||
|
|
||||||
RADIO_ApplyOffset(g_tx_vfo, false);
|
RADIO_ApplyOffset(g_tx_vfo, false);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
// RADIO_ConfigureSquelch(g_tx_vfo);
|
||||||
|
|
||||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||||
//g_scan_tick_10ms = 10; // 100ms
|
//g_scan_tick_10ms = 10; // 100ms
|
||||||
@ -811,7 +814,6 @@ static void APP_next_channel(void)
|
|||||||
g_eeprom.config.setting.indices.vfo[g_rx_vfo_num].screen = g_scan_next_channel;
|
g_eeprom.config.setting.indices.vfo[g_rx_vfo_num].screen = g_scan_next_channel;
|
||||||
|
|
||||||
RADIO_configure_channel(g_rx_vfo_num, VFO_CONFIGURE_RELOAD);
|
RADIO_configure_channel(g_rx_vfo_num, VFO_CONFIGURE_RELOAD);
|
||||||
|
|
||||||
RADIO_setup_registers(true);
|
RADIO_setup_registers(true);
|
||||||
|
|
||||||
g_update_display = true;
|
g_update_display = true;
|
||||||
@ -1731,6 +1733,7 @@ void APP_process_transmit(void)
|
|||||||
g_alarm_state = ALARM_STATE_ALARM;
|
g_alarm_state = ALARM_STATE_ALARM;
|
||||||
|
|
||||||
RADIO_enable_CxCSS_tail();
|
RADIO_enable_CxCSS_tail();
|
||||||
|
RADIO_ConfigureTXPower(g_tx_vfo);
|
||||||
BK4819_SetupPowerAmplifier(0, 0);
|
BK4819_SetupPowerAmplifier(0, 0);
|
||||||
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, false); // PA off
|
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, false); // PA off
|
||||||
BK4819_Enable_AfDac_DiscMode_TxDsp();
|
BK4819_Enable_AfDac_DiscMode_TxDsp();
|
||||||
|
20
app/main.c
20
app/main.c
@ -142,8 +142,8 @@ void toggle_chan_scanlist(void)
|
|||||||
|
|
||||||
RADIO_select_vfos();
|
RADIO_select_vfos();
|
||||||
RADIO_ApplyOffset(g_tx_vfo, false);
|
RADIO_ApplyOffset(g_tx_vfo, false);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||||
|
// RADIO_ConfigureTXPower(g_tx_vfo);
|
||||||
RADIO_setup_registers(true);
|
RADIO_setup_registers(true);
|
||||||
|
|
||||||
// find the first channel that contains this frequency
|
// find the first channel that contains this frequency
|
||||||
@ -459,7 +459,7 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
g_key_input_count_down = key_input_timeout_500ms;
|
g_key_input_count_down = key_input_timeout_500ms;
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
UART_printf("key0 %u\r\n", Key);
|
// UART_printf("key0 %u\r\n", Key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (key_held)
|
if (key_held)
|
||||||
@ -524,7 +524,7 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
const unsigned int chan = ((g_input_box[0] * 100) + (g_input_box[1] * 10) + g_input_box[2]) - 1;
|
const unsigned int chan = ((g_input_box[0] * 100) + (g_input_box[1] * 10) + g_input_box[2]) - 1;
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
UART_printf("key2 %u %u\r\n", chan, g_input_box_index);
|
// UART_printf("key2 %u %u\r\n", chan, g_input_box_index);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_input_box_index < 3)
|
if (g_input_box_index < 3)
|
||||||
@ -564,10 +564,12 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
NUMBER_Get(g_input_box, &freq);
|
NUMBER_Get(g_input_box, &freq);
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
UART_printf("key2 %u %u\r\n", freq, g_input_box_index);
|
// UART_printf("key3 %u %u\r\n", freq, g_input_box_index);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_input_box_index < 6)
|
// if (g_input_box_index < 6)
|
||||||
|
// if (g_input_box_index < 7)
|
||||||
|
if (g_input_box_index < 8)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
g_another_voice_id = (voice_id_t)Key;
|
g_another_voice_id = (voice_id_t)Key;
|
||||||
@ -1063,7 +1065,8 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
RADIO_ApplyOffset(g_tx_vfo, false);
|
RADIO_ApplyOffset(g_tx_vfo, false);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||||
|
// RADIO_ConfigureTXPower(g_tx_vfo);
|
||||||
|
|
||||||
// original slow method
|
// original slow method
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = 1;
|
||||||
@ -1088,7 +1091,8 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio
|
|||||||
BK4819_set_rf_filter_path(freq); // set the proper LNA/PA filter path
|
BK4819_set_rf_filter_path(freq); // set the proper LNA/PA filter path
|
||||||
|
|
||||||
RADIO_ApplyOffset(g_tx_vfo, false);
|
RADIO_ApplyOffset(g_tx_vfo, false);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||||
|
// RADIO_ConfigureTXPower(g_tx_vfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -398,11 +398,13 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_SQL:
|
case MENU_SQL:
|
||||||
g_eeprom.config.setting.squelch_level = g_sub_menu_selection;
|
g_eeprom.config.setting.squelch_level = g_sub_menu_selection;
|
||||||
|
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||||
g_vfo_configure_mode = VFO_CONFIGURE;
|
g_vfo_configure_mode = VFO_CONFIGURE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_CHAN_SQL:
|
case MENU_CHAN_SQL:
|
||||||
g_tx_vfo->channel.squelch_level = g_sub_menu_selection;
|
g_tx_vfo->channel.squelch_level = g_sub_menu_selection;
|
||||||
|
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
4
audio.c
4
audio.c
@ -88,10 +88,6 @@ void AUDIO_set_mod_mode(const mod_mode_t mode)
|
|||||||
case MOD_MODE_DSB: af_mode = BK4819_AF_BASEBAND1; break;
|
case MOD_MODE_DSB: af_mode = BK4819_AF_BASEBAND1; break;
|
||||||
}
|
}
|
||||||
BK4819_SetAF(af_mode);
|
BK4819_SetAF(af_mode);
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
|
||||||
UART_printf("mode %u\r\n", mode);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AUDIO_PlayBeep(beep_type_t Beep)
|
void AUDIO_PlayBeep(beep_type_t Beep)
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -202,8 +202,8 @@ uint32_t FREQUENCY_wrap_to_step_band(uint32_t freq, const uint32_t step_size, co
|
|||||||
#ifdef ENABLE_SCAN_RANGES
|
#ifdef ENABLE_SCAN_RANGES
|
||||||
const freq_scan_range_table_t FREQ_SCAN_RANGE_TABLE[] =
|
const freq_scan_range_table_t FREQ_SCAN_RANGE_TABLE[] =
|
||||||
{
|
{
|
||||||
{ 2696500, 2785600, 1000},
|
|
||||||
{ 2760125, 2800000, 1000},
|
{ 2760125, 2800000, 1000},
|
||||||
|
{ 2696500, 2785600, 1000},
|
||||||
{ 2600000, 2800000, 1000},
|
{ 2600000, 2800000, 1000},
|
||||||
{ 2800000, 2970000, 1000},
|
{ 2800000, 2970000, 1000},
|
||||||
{ 5000000, 5200000, 1000},
|
{ 5000000, 5200000, 1000},
|
||||||
@ -219,7 +219,6 @@ uint32_t FREQUENCY_wrap_to_step_band(uint32_t freq, const uint32_t step_size, co
|
|||||||
{24000000, 39000000, 2500},
|
{24000000, 39000000, 2500},
|
||||||
{43000000, 44000000, 1250},
|
{43000000, 44000000, 1250},
|
||||||
{44600625, 44619376, 1250},
|
{44600625, 44619376, 1250},
|
||||||
// {42000000, 45000000, 1500},
|
|
||||||
{44000000, 47000000, 1250}
|
{44000000, 47000000, 1250}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,7 +83,8 @@ void BOOT_ProcessMode(boot_mode_t Mode)
|
|||||||
g_rx_vfo->channel.channel_bandwidth = BANDWIDTH_WIDE;
|
g_rx_vfo->channel.channel_bandwidth = BANDWIDTH_WIDE;
|
||||||
g_rx_vfo->channel.tx_power = OUTPUT_POWER_LOW;
|
g_rx_vfo->channel.tx_power = OUTPUT_POWER_LOW;
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
|
RADIO_ConfigureSquelch(g_rx_vfo);
|
||||||
|
RADIO_ConfigureTXPower(g_rx_vfo);
|
||||||
|
|
||||||
g_current_vfo = g_rx_vfo;
|
g_current_vfo = g_rx_vfo;
|
||||||
|
|
||||||
|
23
radio.c
23
radio.c
@ -147,7 +147,8 @@ void RADIO_InitInfo(vfo_info_t *p_vfo, const uint8_t ChannelSave, const uint32_t
|
|||||||
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
||||||
p_vfo->channel.mod_mode = MOD_MODE_AM;
|
p_vfo->channel.mod_mode = MOD_MODE_AM;
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(p_vfo);
|
RADIO_ConfigureSquelch(p_vfo);
|
||||||
|
// RADIO_ConfigureTXPower(p_vfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIO_configure_channel(const unsigned int VFO, const unsigned int configure)
|
void RADIO_configure_channel(const unsigned int VFO, const unsigned int configure)
|
||||||
@ -347,7 +348,8 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
|||||||
p_vfo->freq_config_tx.code_type = CODE_TYPE_NONE;
|
p_vfo->freq_config_tx.code_type = CODE_TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(p_vfo);
|
RADIO_ConfigureSquelch(p_vfo);
|
||||||
|
// RADIO_ConfigureTXPower(p_vfo);
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
AM_fix_reset(VFO);
|
AM_fix_reset(VFO);
|
||||||
@ -406,11 +408,8 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *p_vfo)
|
void RADIO_ConfigureSquelch(vfo_info_t *p_vfo)
|
||||||
{
|
{
|
||||||
// *******************************
|
|
||||||
// squelch
|
|
||||||
|
|
||||||
const unsigned int squelch_level = (p_vfo->channel.squelch_level > 0) ? p_vfo->channel.squelch_level : g_eeprom.config.setting.squelch_level;
|
const unsigned int squelch_level = (p_vfo->channel.squelch_level > 0) ? p_vfo->channel.squelch_level : g_eeprom.config.setting.squelch_level;
|
||||||
|
|
||||||
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
||||||
@ -529,10 +528,9 @@ void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *p_vfo)
|
|||||||
p_vfo->squelch_open_glitch_thresh = (glitch_open > 255) ? 255 : (glitch_open < 0) ? 0 : glitch_open;
|
p_vfo->squelch_open_glitch_thresh = (glitch_open > 255) ? 255 : (glitch_open < 0) ? 0 : glitch_open;
|
||||||
p_vfo->squelch_close_glitch_thresh = (glitch_close > 255) ? 255 : (glitch_close < 0) ? 0 : glitch_close;
|
p_vfo->squelch_close_glitch_thresh = (glitch_close > 255) ? 255 : (glitch_close < 0) ? 0 : glitch_close;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// *******************************
|
void RADIO_ConfigureTXPower(vfo_info_t *p_vfo)
|
||||||
// output power
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// my calibration data
|
// my calibration data
|
||||||
//
|
//
|
||||||
@ -577,9 +575,6 @@ void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *p_vfo)
|
|||||||
p_vfo->p_tx->frequency);
|
p_vfo->p_tx->frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
// *******************************
|
|
||||||
}
|
|
||||||
|
|
||||||
void RADIO_ApplyOffset(vfo_info_t *p_vfo, const bool set_pees)
|
void RADIO_ApplyOffset(vfo_info_t *p_vfo, const bool set_pees)
|
||||||
{
|
{
|
||||||
uint32_t Frequency = p_vfo->freq_config_rx.frequency;
|
uint32_t Frequency = p_vfo->freq_config_rx.frequency;
|
||||||
@ -956,10 +951,10 @@ void RADIO_enableTX(const bool fsk_tx)
|
|||||||
|
|
||||||
BK4819_SetCompander((!fsk_tx && g_rx_vfo->channel.mod_mode == MOD_MODE_FM && (g_rx_vfo->channel.compand == 1 || g_rx_vfo->channel.compand >= 3)) ? g_rx_vfo->channel.compand : 0);
|
BK4819_SetCompander((!fsk_tx && g_rx_vfo->channel.mod_mode == MOD_MODE_FM && (g_rx_vfo->channel.compand == 1 || g_rx_vfo->channel.compand >= 3)) ? g_rx_vfo->channel.compand : 0);
|
||||||
|
|
||||||
BK4819_set_rf_frequency(g_current_vfo->p_tx->frequency, false);
|
BK4819_set_rf_frequency(g_current_vfo->p_tx->frequency, true);
|
||||||
BK4819_set_rf_filter_path(g_current_vfo->p_tx->frequency);
|
BK4819_set_rf_filter_path(g_current_vfo->p_tx->frequency);
|
||||||
|
|
||||||
BK4819_PrepareTransmit();
|
BK4819_PrepareTransmit();
|
||||||
|
RADIO_ConfigureTXPower(g_current_vfo);
|
||||||
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, true); // PA on
|
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, true); // PA on
|
||||||
if (g_current_display_screen != DISPLAY_AIRCOPY)
|
if (g_current_display_screen != DISPLAY_AIRCOPY)
|
||||||
BK4819_SetupPowerAmplifier(g_current_vfo->txp_calculated_setting, g_current_vfo->p_tx->frequency);
|
BK4819_SetupPowerAmplifier(g_current_vfo->txp_calculated_setting, g_current_vfo->p_tx->frequency);
|
||||||
|
3
radio.h
3
radio.h
@ -42,7 +42,8 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int conf
|
|||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
void RADIO_enable_vox(unsigned int level);
|
void RADIO_enable_vox(unsigned int level);
|
||||||
#endif
|
#endif
|
||||||
void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *p_vfo);
|
void RADIO_ConfigureSquelch(vfo_info_t *p_vfo);
|
||||||
|
void RADIO_ConfigureTXPower(vfo_info_t *p_vfo);
|
||||||
void RADIO_ApplyOffset(vfo_info_t *p_vfo, const bool set_pees);
|
void RADIO_ApplyOffset(vfo_info_t *p_vfo, const bool set_pees);
|
||||||
void RADIO_select_vfos(void);
|
void RADIO_select_vfos(void);
|
||||||
void RADIO_setup_registers(bool switch_to_function_foreground);
|
void RADIO_setup_registers(bool switch_to_function_foreground);
|
||||||
|
@ -60,7 +60,7 @@ void UI_DisplayAircopy(void)
|
|||||||
const unsigned int x = 16;
|
const unsigned int x = 16;
|
||||||
|
|
||||||
NUMBER_ToDigits(g_rx_vfo->freq_config_rx.frequency, str);
|
NUMBER_ToDigits(g_rx_vfo->freq_config_rx.frequency, str);
|
||||||
UI_DisplayFrequency(str, x, 2, 0, 0);
|
UI_DisplayFrequencyBig(str, x, 2, 0, 0, 6);
|
||||||
|
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||||
@ -80,7 +80,7 @@ void UI_DisplayAircopy(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // user is entering a new frequency
|
{ // user is entering a new frequency
|
||||||
UI_DisplayFrequency(g_input_box, 16, 2, 1, 0);
|
UI_DisplayFrequencyBig(g_input_box, 16, 2, 1, 0, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
// **********************************
|
// **********************************
|
||||||
|
@ -120,14 +120,14 @@ void UI_DisplayFM(void)
|
|||||||
const uint32_t freq = g_eeprom.config.setting.fm_radio.selected_frequency;
|
const uint32_t freq = g_eeprom.config.setting.fm_radio.selected_frequency;
|
||||||
NUMBER_ToDigits(freq * 10000, str);
|
NUMBER_ToDigits(freq * 10000, str);
|
||||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||||
UI_DisplayFrequency(str, 30, 4, false, true);
|
UI_DisplayFrequencyBig(str, 30, 4, false, true, 6);
|
||||||
#else
|
#else
|
||||||
UI_DisplayFrequency(str, 23, 4, false, true);
|
UI_DisplayFrequencyBig(str, 23, 4, false, true, 6);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // user is entering a frequency
|
{ // user is entering a frequency
|
||||||
UI_DisplayFrequency(g_input_box, 23, 4, true, false);
|
UI_DisplayFrequencyBig(g_input_box, 23, 4, true, false, 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
59
ui/helper.c
59
ui/helper.c
@ -205,13 +205,12 @@ void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag)
|
void UI_DisplayFrequencyBig(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag, unsigned int length)
|
||||||
{
|
{
|
||||||
const unsigned int char_width = 13;
|
const unsigned int char_width = 13;
|
||||||
uint8_t *pFb0 = g_frame_buffer[Y] + X;
|
uint8_t *pFb0 = g_frame_buffer[Y] + X;
|
||||||
uint8_t *pFb1 = pFb0 + 128;
|
uint8_t *pFb1 = pFb0 + LCD_WIDTH;
|
||||||
bool bCanDisplay = false;
|
bool bCanDisplay = false;
|
||||||
unsigned int len = 6;
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
// MHz
|
// MHz
|
||||||
@ -240,19 +239,22 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
|
|||||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||||
|
|
||||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||||
if (pDigits[len + 1] == 0 && pDigits[len + 2] == 0)
|
if (length == 6)
|
||||||
{
|
{
|
||||||
if (pDigits[len - 1] == 0)
|
if (pDigits[length + 1] == 0 && pDigits[length + 2] == 0)
|
||||||
{
|
{
|
||||||
len--;
|
if (pDigits[length - 1] == 0)
|
||||||
if (pDigits[len - 1] == 0)
|
{
|
||||||
len--;
|
length--;
|
||||||
|
if (pDigits[length - 1] == 0)
|
||||||
|
length--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// kHz
|
// fractions
|
||||||
while (i < len)
|
while (i < length)
|
||||||
{
|
{
|
||||||
const unsigned int Digit = pDigits[i++];
|
const unsigned int Digit = pDigits[i++];
|
||||||
memcpy(pFb0, g_font_big_digits[Digit], char_width);
|
memcpy(pFb0, g_font_big_digits[Digit], char_width);
|
||||||
@ -262,6 +264,43 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, unsigned int length)
|
||||||
|
{
|
||||||
|
char str[10];
|
||||||
|
bool bCanDisplay = false;
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int k = 0;
|
||||||
|
|
||||||
|
// MHz
|
||||||
|
while (i < 3)
|
||||||
|
{
|
||||||
|
const unsigned int Digit = pDigits[i++];
|
||||||
|
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
|
||||||
|
{
|
||||||
|
bCanDisplay = true;
|
||||||
|
str[k++] = (Digit < 10) ? '0' + Digit : '_';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// decimal point
|
||||||
|
str[k++] = '.';
|
||||||
|
|
||||||
|
// fractions
|
||||||
|
while (i < length)
|
||||||
|
{
|
||||||
|
const unsigned int Digit = pDigits[i++];
|
||||||
|
str[k++] = (Digit < 10) ? '0' + Digit : '_';
|
||||||
|
}
|
||||||
|
|
||||||
|
str[k] = '\0';
|
||||||
|
|
||||||
|
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||||
|
// NUMBER_trim_trailing_zeros(str);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UI_PrintString(str, X, 0, Y, 8);
|
||||||
|
}
|
||||||
|
|
||||||
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero)
|
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero)
|
||||||
{
|
{
|
||||||
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);
|
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);
|
||||||
|
@ -31,7 +31,8 @@ void UI_PrintStringSmall(const char *str, const unsigned int start, const unsign
|
|||||||
void UI_PrintStringSmallest(const void *pString, unsigned int x, const unsigned int y, const bool statusbar, const bool fill);
|
void UI_PrintStringSmallest(const void *pString, unsigned int x, const unsigned int y, const bool statusbar, const bool fill);
|
||||||
#endif
|
#endif
|
||||||
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer);
|
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer);
|
||||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag);
|
void UI_DisplayFrequencyBig(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag, unsigned int length);
|
||||||
|
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, unsigned int length);
|
||||||
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);
|
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);
|
||||||
void UI_Displaysmall_digits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros);
|
void UI_Displaysmall_digits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros);
|
||||||
|
|
||||||
|
48
ui/main.c
48
ui/main.c
@ -374,7 +374,7 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int
|
|||||||
NUMBER_ToDigits(frequency, str);
|
NUMBER_ToDigits(frequency, str);
|
||||||
|
|
||||||
// show the main large frequency digits
|
// show the main large frequency digits
|
||||||
UI_DisplayFrequency(str, x, line, false, false);
|
UI_DisplayFrequencyBig(str, x, line, false, false, 6);
|
||||||
|
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||||
@ -625,9 +625,10 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (g_input_box_index > 0 && IS_FREQ_CHANNEL(scrn_chan) && g_eeprom.config.setting.tx_vfo_num == vfo_num)
|
if (g_input_box_index > 0 && IS_FREQ_CHANNEL(scrn_chan) && g_eeprom.config.setting.tx_vfo_num == vfo_num)
|
||||||
{ // user entering a frequency
|
{ // user is entering a frequency
|
||||||
UI_DisplayFrequency(g_input_box, 32, line, true, false);
|
// UI_DisplayFrequencyBig(g_input_box, 32, line, true, false, 6);
|
||||||
|
// UI_DisplayFrequencyBig(g_input_box, 32, line, true, false, 7);
|
||||||
|
UI_DisplayFrequency(g_input_box, 32, line, true, 8);
|
||||||
// g_center_line = CENTER_LINE_IN_USE;
|
// g_center_line = CENTER_LINE_IN_USE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -643,7 +644,7 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (scrn_chan <= USER_CHANNEL_LAST)
|
if (scrn_chan <= USER_CHANNEL_LAST)
|
||||||
{ // it's a channel
|
{ // a user channel
|
||||||
|
|
||||||
switch (g_eeprom.config.setting.channel_display_mode)
|
switch (g_eeprom.config.setting.channel_display_mode)
|
||||||
{
|
{
|
||||||
@ -674,8 +675,9 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
SETTINGS_fetch_channel_name(str, scrn_chan);
|
SETTINGS_fetch_channel_name(str, scrn_chan);
|
||||||
if (str[0] == 0)
|
if (str[0] == 0)
|
||||||
{ // no channel name available, channel number instead
|
{ // no channel name, use channel number
|
||||||
sprintf(str, "CH-%03u", 1 + scrn_chan);
|
// sprintf(str, "CH-%03u", 1 + scrn_chan);
|
||||||
|
sprintf(str, "CH-%u", 1 + scrn_chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_eeprom.config.setting.channel_display_mode == MDF_NAME)
|
if (g_eeprom.config.setting.channel_display_mode == MDF_NAME)
|
||||||
@ -693,7 +695,8 @@ void UI_DisplayMain(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// frequency
|
// frequency
|
||||||
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
|
// sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||||
|
sprintf(str, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||||
NUMBER_trim_trailing_zeros(str);
|
NUMBER_trim_trailing_zeros(str);
|
||||||
#endif
|
#endif
|
||||||
@ -714,7 +717,8 @@ void UI_DisplayMain(void)
|
|||||||
const unsigned int chan = g_vfo_info[vfo_num].freq_in_channel;
|
const unsigned int chan = g_vfo_info[vfo_num].freq_in_channel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
|
// sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||||
|
sprintf(str, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||||
NUMBER_trim_trailing_zeros(str);
|
NUMBER_trim_trailing_zeros(str);
|
||||||
#endif
|
#endif
|
||||||
@ -731,10 +735,11 @@ void UI_DisplayMain(void)
|
|||||||
UI_PrintStringSmall(str, x + 4, 0, line + 0);
|
UI_PrintStringSmall(str, x + 4, 0, line + 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// name
|
// channel name, if not then channel number
|
||||||
SETTINGS_fetch_channel_name(str, chan);
|
SETTINGS_fetch_channel_name(str, chan);
|
||||||
if (str[0] == 0)
|
if (str[0] == 0)
|
||||||
sprintf(str, "CH-%03u", 1 + chan);
|
// sprintf(str, "CH-%03u", 1 + chan);
|
||||||
|
sprintf(str, "CH-%u", 1 + chan);
|
||||||
UI_PrintStringSmall(str, x + 4, 0, line + 1);
|
UI_PrintStringSmall(str, x + 4, 0, line + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -803,7 +808,7 @@ void UI_DisplayMain(void)
|
|||||||
#else
|
#else
|
||||||
const bool is_freq_chan = IS_FREQ_CHANNEL(scrn_chan);
|
const bool is_freq_chan = IS_FREQ_CHANNEL(scrn_chan);
|
||||||
const uint8_t freq_in_channel = g_vfo_info[vfo_num].freq_in_channel;
|
const uint8_t freq_in_channel = g_vfo_info[vfo_num].freq_in_channel;
|
||||||
// const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // currently way to slow
|
// const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // was way to slow
|
||||||
|
|
||||||
strcpy(str, " ");
|
strcpy(str, " ");
|
||||||
|
|
||||||
@ -852,21 +857,20 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
if (g_vfo_info[vfo_num].channel.mod_mode != MOD_MODE_FM)
|
if (g_vfo_info[vfo_num].channel.mod_mode != MOD_MODE_FM)
|
||||||
{
|
{ // show the modulation mode
|
||||||
//strcpy(str, g_sub_menu_mod_mode[g_vfo_info[vfo_num].channel.mod_mode]);
|
|
||||||
switch (g_vfo_info[vfo_num].channel.mod_mode)
|
switch (g_vfo_info[vfo_num].channel.mod_mode)
|
||||||
{
|
{
|
||||||
default:
|
// case MOD_MODE_FM: strcpy(str, "FM"); break;
|
||||||
case MOD_MODE_FM: strcpy(str, "FM"); break;
|
|
||||||
case MOD_MODE_AM: strcpy(str, "AM"); break;
|
case MOD_MODE_AM: strcpy(str, "AM"); break;
|
||||||
case MOD_MODE_DSB: strcpy(str, "DS"); break;
|
case MOD_MODE_DSB: strcpy(str, "DS"); break;
|
||||||
|
default: strcpy(str, "??"); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // or show the CTCSS/DCS symbol
|
{ // or show the CTCSS/DCS symbol (when in FM mode)
|
||||||
const freq_config_t *pConfig = (mode == 1) ? g_vfo_info[vfo_num].p_tx : g_vfo_info[vfo_num].p_rx;
|
const freq_config_t *pConfig = (mode == 1) ? g_vfo_info[vfo_num].p_tx : g_vfo_info[vfo_num].p_rx;
|
||||||
const unsigned int code_type = pConfig->code_type;
|
const unsigned int code_type = pConfig->code_type;
|
||||||
const char *code_list[] = {"", "CT", "DCS", "DCR"};
|
const char *code_list[] = {"", "CTC", "DCS", "DCR"};
|
||||||
if (code_type < ARRAY_SIZE(code_list))
|
if (code_type < ARRAY_SIZE(code_list))
|
||||||
strcpy(str, code_list[code_type]);
|
strcpy(str, code_list[code_type]);
|
||||||
}
|
}
|
||||||
@ -903,12 +907,9 @@ void UI_DisplayMain(void)
|
|||||||
UI_PrintStringSmall("R", 62, 0, line + 2);
|
UI_PrintStringSmall("R", 62, 0, line + 2);
|
||||||
|
|
||||||
{ // show the narrow band symbol
|
{ // show the narrow band symbol
|
||||||
str[0] = '\0';
|
strcpy(str, " ");
|
||||||
if (g_vfo_info[vfo_num].channel.channel_bandwidth == BANDWIDTH_NARROW)
|
if (g_vfo_info[vfo_num].channel.channel_bandwidth == BANDWIDTH_NARROW)
|
||||||
{
|
|
||||||
str[0] = 'N';
|
str[0] = 'N';
|
||||||
str[1] = '\0';
|
|
||||||
}
|
|
||||||
UI_PrintStringSmall(str, 70, 0, line + 2);
|
UI_PrintStringSmall(str, 70, 0, line + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,7 +920,6 @@ void UI_DisplayMain(void)
|
|||||||
#else
|
#else
|
||||||
if (g_vfo_info[vfo_num].channel.dtmf_decoding_enable)
|
if (g_vfo_info[vfo_num].channel.dtmf_decoding_enable)
|
||||||
UI_PrintStringSmall("DTMF", 78, 0, line + 2);
|
UI_PrintStringSmall("DTMF", 78, 0, line + 2);
|
||||||
//UI_PrintStringSmall4x5("DTMF", 78, 0, line + 2); // font table is currently wrong
|
|
||||||
//UI_PrintStringSmallest("DTMF", 78, (line + 2) * 8, false, true);
|
//UI_PrintStringSmallest("DTMF", 78, (line + 2) * 8, false, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -928,6 +928,8 @@ void UI_DisplayMain(void)
|
|||||||
UI_PrintStringSmall("SCR", 106, 0, line + 2);
|
UI_PrintStringSmall("SCR", 106, 0, line + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *************************************************
|
||||||
|
|
||||||
if (g_center_line == CENTER_LINE_NONE &&
|
if (g_center_line == CENTER_LINE_NONE &&
|
||||||
g_current_display_screen == DISPLAY_MAIN &&
|
g_current_display_screen == DISPLAY_MAIN &&
|
||||||
g_dtmf_call_state == DTMF_CALL_STATE_NONE)
|
g_dtmf_call_state == DTMF_CALL_STATE_NONE)
|
||||||
|
@ -559,7 +559,7 @@ void UI_DisplayMenu(void)
|
|||||||
else
|
else
|
||||||
sprintf(str, "%d", g_sub_menu_selection);
|
sprintf(str, "%d", g_sub_menu_selection);
|
||||||
//g_tx_vfo->squelch_level = g_sub_menu_selection;
|
//g_tx_vfo->squelch_level = g_sub_menu_selection;
|
||||||
// RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
//RADIO_ConfigureSquelch(g_tx_vfo);
|
||||||
channel_setting = true;
|
channel_setting = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user