mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-27 22:01:26 +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_RESET_AES_KEY := 0
|
||||
ENABLE_BIG_FREQ := 0
|
||||
ENABLE_SHOW_FREQS_CHAN := 1
|
||||
ENABLE_SHOW_FREQS_CHAN := 0
|
||||
# smaa bolf 580 B
|
||||
ENABLE_SMALL_BOLD := 1
|
||||
# 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_tx.frequency = Frequency;
|
||||
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
|
||||
RADIO_ConfigureSquelch(g_rx_vfo);
|
||||
// RADIO_ConfigureTXPower(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);
|
||||
#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);
|
||||
|
||||
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
|
||||
|
||||
if (g_scan_next_channel <= USER_CHANNEL_LAST)
|
||||
{ // we were channel hopping
|
||||
{ // we were channel scanning
|
||||
|
||||
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;
|
||||
|
||||
RADIO_configure_channel(g_rx_vfo_num, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
RADIO_ConfigureSquelch(g_rx_vfo);
|
||||
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);
|
||||
|
||||
RADIO_ApplyOffset(g_rx_vfo, false);
|
||||
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
|
||||
RADIO_ConfigureSquelch(g_rx_vfo);
|
||||
RADIO_setup_registers(true);
|
||||
}
|
||||
|
||||
@ -634,7 +638,7 @@ void APP_stop_scan(void)
|
||||
if (g_rx_vfo->channel_save > USER_CHANNEL_LAST)
|
||||
{ // frequency mode
|
||||
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);
|
||||
return;
|
||||
}
|
||||
@ -688,8 +692,7 @@ static void APP_next_freq(void)
|
||||
// original slower method
|
||||
|
||||
RADIO_ApplyOffset(g_tx_vfo, false);
|
||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
||||
|
||||
// RADIO_ConfigureSquelch(g_tx_vfo);
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
#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);
|
||||
|
||||
RADIO_ApplyOffset(g_tx_vfo, false);
|
||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
||||
// RADIO_ConfigureSquelch(g_tx_vfo);
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
//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;
|
||||
|
||||
RADIO_configure_channel(g_rx_vfo_num, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
g_update_display = true;
|
||||
@ -1731,6 +1733,7 @@ void APP_process_transmit(void)
|
||||
g_alarm_state = ALARM_STATE_ALARM;
|
||||
|
||||
RADIO_enable_CxCSS_tail();
|
||||
RADIO_ConfigureTXPower(g_tx_vfo);
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, false); // PA off
|
||||
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_ApplyOffset(g_tx_vfo, false);
|
||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
||||
|
||||
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||
// RADIO_ConfigureTXPower(g_tx_vfo);
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
// 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;
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("key0 %u\r\n", Key);
|
||||
// UART_printf("key0 %u\r\n", Key);
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
#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
|
||||
|
||||
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);
|
||||
|
||||
#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
|
||||
|
||||
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
|
||||
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
|
||||
RADIO_ApplyOffset(g_tx_vfo, false);
|
||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
||||
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||
// RADIO_ConfigureTXPower(g_tx_vfo);
|
||||
|
||||
// original slow method
|
||||
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
|
||||
|
||||
RADIO_ApplyOffset(g_tx_vfo, false);
|
||||
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
||||
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||
// RADIO_ConfigureTXPower(g_tx_vfo);
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
@ -398,11 +398,13 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_SQL:
|
||||
g_eeprom.config.setting.squelch_level = g_sub_menu_selection;
|
||||
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||
g_vfo_configure_mode = VFO_CONFIGURE;
|
||||
break;
|
||||
|
||||
case MENU_CHAN_SQL:
|
||||
g_tx_vfo->channel.squelch_level = g_sub_menu_selection;
|
||||
RADIO_ConfigureSquelch(g_tx_vfo);
|
||||
g_request_save_channel = 1;
|
||||
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;
|
||||
}
|
||||
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)
|
||||
|
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
|
||||
const freq_scan_range_table_t FREQ_SCAN_RANGE_TABLE[] =
|
||||
{
|
||||
{ 2696500, 2785600, 1000},
|
||||
{ 2760125, 2800000, 1000},
|
||||
{ 2696500, 2785600, 1000},
|
||||
{ 2600000, 2800000, 1000},
|
||||
{ 2800000, 2970000, 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},
|
||||
{43000000, 44000000, 1250},
|
||||
{44600625, 44619376, 1250},
|
||||
// {42000000, 45000000, 1500},
|
||||
{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.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;
|
||||
|
||||
|
99
radio.c
99
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))
|
||||
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)
|
||||
@ -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;
|
||||
}
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(p_vfo);
|
||||
RADIO_ConfigureSquelch(p_vfo);
|
||||
// RADIO_ConfigureTXPower(p_vfo);
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
AM_fix_reset(VFO);
|
||||
@ -406,11 +408,8 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
||||
}
|
||||
#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;
|
||||
|
||||
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
||||
@ -529,55 +528,51 @@ 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_close_glitch_thresh = (glitch_close > 255) ? 255 : (glitch_close < 0) ? 0 : glitch_close;
|
||||
}
|
||||
}
|
||||
|
||||
// *******************************
|
||||
// output power
|
||||
void RADIO_ConfigureTXPower(vfo_info_t *p_vfo)
|
||||
{
|
||||
// my calibration data
|
||||
//
|
||||
// 1ED0 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 50 MHz
|
||||
// 1EE0 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 108 MHz
|
||||
// 1EF0 5F 5F 5F 69 69 69 91 91 8F FF FF FF FF FF FF FF .. 137 MHz
|
||||
// 1F00 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 174 MHz
|
||||
// 1F10 5A 5A 5A 64 64 64 82 82 82 FF FF FF FF FF FF FF .. 350 MHz
|
||||
// 1F20 5A 5A 5A 64 64 64 8F 91 8A FF FF FF FF FF FF FF .. 400 MHz
|
||||
// 1F30 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 470 MHz
|
||||
|
||||
{
|
||||
// my calibration data
|
||||
//
|
||||
// 1ED0 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 50 MHz
|
||||
// 1EE0 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 108 MHz
|
||||
// 1EF0 5F 5F 5F 69 69 69 91 91 8F FF FF FF FF FF FF FF .. 137 MHz
|
||||
// 1F00 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 174 MHz
|
||||
// 1F10 5A 5A 5A 64 64 64 82 82 82 FF FF FF FF FF FF FF .. 350 MHz
|
||||
// 1F20 5A 5A 5A 64 64 64 8F 91 8A FF FF FF FF FF FF FF .. 400 MHz
|
||||
// 1F30 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 470 MHz
|
||||
uint8_t tx_power[3];
|
||||
const unsigned int band = (unsigned int)FREQUENCY_GetBand(p_vfo->p_tx->frequency);
|
||||
|
||||
uint8_t tx_power[3];
|
||||
const unsigned int band = (unsigned int)FREQUENCY_GetBand(p_vfo->p_tx->frequency);
|
||||
// EEPROM_ReadBuffer(0x1ED0 + (band * 16) + (p_vfo->output_power * 3), tx_power, 3);
|
||||
memcpy(&tx_power, &g_eeprom.calib.tx_band_power[band].level[p_vfo->channel.tx_power], 3);
|
||||
|
||||
// EEPROM_ReadBuffer(0x1ED0 + (band * 16) + (p_vfo->output_power * 3), tx_power, 3);
|
||||
memcpy(&tx_power, &g_eeprom.calib.tx_band_power[band].level[p_vfo->channel.tx_power], 3);
|
||||
#ifdef ENABLE_REDUCE_LOW_MID_TX_POWER
|
||||
// make low and mid even lower
|
||||
if (p_vfo->channel.tx_power == OUTPUT_POWER_LOW)
|
||||
{
|
||||
tx_power[0] /= 5; //tx_power[0] /= 8;
|
||||
tx_power[1] /= 5; //tx_power[1] /= 8;
|
||||
tx_power[2] /= 5; //tx_power[2] /= 8; get more low power
|
||||
}
|
||||
else
|
||||
if (p_vfo->channel.tx_power == OUTPUT_POWER_MID)
|
||||
{
|
||||
tx_power[0] /= 3; //tx_power[0] /= 5;
|
||||
tx_power[1] /= 3; //tx_power[1] /= 5;
|
||||
tx_power[2] /= 3; //tx_power[2] /= 5; get more low power
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_REDUCE_LOW_MID_TX_POWER
|
||||
// make low and mid even lower
|
||||
if (p_vfo->channel.tx_power == OUTPUT_POWER_LOW)
|
||||
{
|
||||
tx_power[0] /= 5; //tx_power[0] /= 8;
|
||||
tx_power[1] /= 5; //tx_power[1] /= 8;
|
||||
tx_power[2] /= 5; //tx_power[2] /= 8; get more low power
|
||||
}
|
||||
else
|
||||
if (p_vfo->channel.tx_power == OUTPUT_POWER_MID)
|
||||
{
|
||||
tx_power[0] /= 3; //tx_power[0] /= 5;
|
||||
tx_power[1] /= 3; //tx_power[1] /= 5;
|
||||
tx_power[2] /= 3; //tx_power[2] /= 5; get more low power
|
||||
}
|
||||
#endif
|
||||
|
||||
p_vfo->txp_calculated_setting = FREQUENCY_CalculateOutputPower(
|
||||
tx_power[0],
|
||||
tx_power[1],
|
||||
tx_power[2],
|
||||
FREQ_BAND_TABLE[band].lower,
|
||||
(FREQ_BAND_TABLE[band].lower + FREQ_BAND_TABLE[band].upper) / 2,
|
||||
FREQ_BAND_TABLE[band].upper,
|
||||
p_vfo->p_tx->frequency);
|
||||
}
|
||||
|
||||
// *******************************
|
||||
p_vfo->txp_calculated_setting = FREQUENCY_CalculateOutputPower(
|
||||
tx_power[0],
|
||||
tx_power[1],
|
||||
tx_power[2],
|
||||
FREQ_BAND_TABLE[band].lower,
|
||||
(FREQ_BAND_TABLE[band].lower + FREQ_BAND_TABLE[band].upper) / 2,
|
||||
FREQ_BAND_TABLE[band].upper,
|
||||
p_vfo->p_tx->frequency);
|
||||
}
|
||||
|
||||
void RADIO_ApplyOffset(vfo_info_t *p_vfo, const bool set_pees)
|
||||
@ -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_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_PrepareTransmit();
|
||||
RADIO_ConfigureTXPower(g_current_vfo);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, true); // PA on
|
||||
if (g_current_display_screen != DISPLAY_AIRCOPY)
|
||||
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
|
||||
void RADIO_enable_vox(unsigned int level);
|
||||
#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_select_vfos(void);
|
||||
void RADIO_setup_registers(bool switch_to_function_foreground);
|
||||
|
@ -60,7 +60,7 @@ void UI_DisplayAircopy(void)
|
||||
const unsigned int x = 16;
|
||||
|
||||
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
|
||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||
@ -80,7 +80,7 @@ void UI_DisplayAircopy(void)
|
||||
}
|
||||
else
|
||||
{ // 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;
|
||||
NUMBER_ToDigits(freq * 10000, str);
|
||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||
UI_DisplayFrequency(str, 30, 4, false, true);
|
||||
UI_DisplayFrequencyBig(str, 30, 4, false, true, 6);
|
||||
#else
|
||||
UI_DisplayFrequency(str, 23, 4, false, true);
|
||||
UI_DisplayFrequencyBig(str, 23, 4, false, true, 6);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{ // 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
|
||||
|
61
ui/helper.c
61
ui/helper.c
@ -71,7 +71,7 @@ void UI_GenerateChannelStringEx(char *pString, const char *prefix, const uint8_t
|
||||
|
||||
void UI_PrintString(const char *str, unsigned int x, const unsigned int end, const unsigned int line, const unsigned int width)
|
||||
{
|
||||
const unsigned int length = strlen(str);
|
||||
const unsigned int length = strlen(str);
|
||||
const unsigned int font_size = ARRAY_SIZE(g_font_big);
|
||||
uint8_t *f_buf1 = g_frame_buffer[line + 0];
|
||||
uint8_t *f_buf2 = g_frame_buffer[line + 1];
|
||||
@ -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;
|
||||
uint8_t *pFb0 = g_frame_buffer[Y] + X;
|
||||
uint8_t *pFb1 = pFb0 + 128;
|
||||
uint8_t *pFb1 = pFb0 + LCD_WIDTH;
|
||||
bool bCanDisplay = false;
|
||||
unsigned int len = 6;
|
||||
unsigned int i = 0;
|
||||
|
||||
// MHz
|
||||
@ -240,19 +239,22 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
|
||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||
|
||||
#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[len - 1] == 0)
|
||||
len--;
|
||||
if (pDigits[length - 1] == 0)
|
||||
{
|
||||
length--;
|
||||
if (pDigits[length - 1] == 0)
|
||||
length--;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// kHz
|
||||
while (i < len)
|
||||
// fractions
|
||||
while (i < length)
|
||||
{
|
||||
const unsigned int Digit = pDigits[i++];
|
||||
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)
|
||||
{
|
||||
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);
|
||||
#endif
|
||||
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_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);
|
||||
|
||||
// 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
|
||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||
@ -625,9 +625,10 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
else
|
||||
if (g_input_box_index > 0 && IS_FREQ_CHANNEL(scrn_chan) && g_eeprom.config.setting.tx_vfo_num == vfo_num)
|
||||
{ // user entering a frequency
|
||||
UI_DisplayFrequency(g_input_box, 32, line, true, false);
|
||||
|
||||
{ // user is entering a frequency
|
||||
// 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;
|
||||
}
|
||||
else
|
||||
@ -643,7 +644,7 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
|
||||
if (scrn_chan <= USER_CHANNEL_LAST)
|
||||
{ // it's a channel
|
||||
{ // a user channel
|
||||
|
||||
switch (g_eeprom.config.setting.channel_display_mode)
|
||||
{
|
||||
@ -674,8 +675,9 @@ void UI_DisplayMain(void)
|
||||
|
||||
SETTINGS_fetch_channel_name(str, scrn_chan);
|
||||
if (str[0] == 0)
|
||||
{ // no channel name available, channel number instead
|
||||
sprintf(str, "CH-%03u", 1 + scrn_chan);
|
||||
{ // no channel name, use channel number
|
||||
// sprintf(str, "CH-%03u", 1 + scrn_chan);
|
||||
sprintf(str, "CH-%u", 1 + scrn_chan);
|
||||
}
|
||||
|
||||
if (g_eeprom.config.setting.channel_display_mode == MDF_NAME)
|
||||
@ -693,7 +695,8 @@ void UI_DisplayMain(void)
|
||||
#endif
|
||||
|
||||
// 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
|
||||
NUMBER_trim_trailing_zeros(str);
|
||||
#endif
|
||||
@ -714,7 +717,8 @@ void UI_DisplayMain(void)
|
||||
const unsigned int chan = g_vfo_info[vfo_num].freq_in_channel;
|
||||
#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
|
||||
NUMBER_trim_trailing_zeros(str);
|
||||
#endif
|
||||
@ -731,10 +735,11 @@ void UI_DisplayMain(void)
|
||||
UI_PrintStringSmall(str, x + 4, 0, line + 0);
|
||||
#endif
|
||||
|
||||
// name
|
||||
// channel name, if not then channel number
|
||||
SETTINGS_fetch_channel_name(str, chan);
|
||||
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);
|
||||
}
|
||||
else
|
||||
@ -803,7 +808,7 @@ void UI_DisplayMain(void)
|
||||
#else
|
||||
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 = SETTINGS_find_channel(frequency); // currently way to slow
|
||||
// const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // was way to slow
|
||||
|
||||
strcpy(str, " ");
|
||||
|
||||
@ -852,21 +857,20 @@ void UI_DisplayMain(void)
|
||||
|
||||
str[0] = '\0';
|
||||
if (g_vfo_info[vfo_num].channel.mod_mode != MOD_MODE_FM)
|
||||
{
|
||||
//strcpy(str, g_sub_menu_mod_mode[g_vfo_info[vfo_num].channel.mod_mode]);
|
||||
{ // show the modulation 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_DSB: strcpy(str, "DS"); break;
|
||||
default: strcpy(str, "??"); break;
|
||||
}
|
||||
}
|
||||
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 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))
|
||||
strcpy(str, code_list[code_type]);
|
||||
}
|
||||
@ -903,12 +907,9 @@ void UI_DisplayMain(void)
|
||||
UI_PrintStringSmall("R", 62, 0, line + 2);
|
||||
|
||||
{ // show the narrow band symbol
|
||||
str[0] = '\0';
|
||||
strcpy(str, " ");
|
||||
if (g_vfo_info[vfo_num].channel.channel_bandwidth == BANDWIDTH_NARROW)
|
||||
{
|
||||
str[0] = 'N';
|
||||
str[1] = '\0';
|
||||
}
|
||||
UI_PrintStringSmall(str, 70, 0, line + 2);
|
||||
}
|
||||
|
||||
@ -919,7 +920,6 @@ void UI_DisplayMain(void)
|
||||
#else
|
||||
if (g_vfo_info[vfo_num].channel.dtmf_decoding_enable)
|
||||
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);
|
||||
#endif
|
||||
|
||||
@ -928,6 +928,8 @@ void UI_DisplayMain(void)
|
||||
UI_PrintStringSmall("SCR", 106, 0, line + 2);
|
||||
}
|
||||
|
||||
// *************************************************
|
||||
|
||||
if (g_center_line == CENTER_LINE_NONE &&
|
||||
g_current_display_screen == DISPLAY_MAIN &&
|
||||
g_dtmf_call_state == DTMF_CALL_STATE_NONE)
|
||||
|
@ -558,8 +558,8 @@ void UI_DisplayMenu(void)
|
||||
strcpy(str, "USE\nMAIN SQL");
|
||||
else
|
||||
sprintf(str, "%d", g_sub_menu_selection);
|
||||
// g_tx_vfo->squelch_level = g_sub_menu_selection;
|
||||
// RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
||||
//g_tx_vfo->squelch_level = g_sub_menu_selection;
|
||||
//RADIO_ConfigureSquelch(g_tx_vfo);
|
||||
channel_setting = true;
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user