mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
Fixed channel delete
This commit is contained in:
parent
3bae9b5cdb
commit
7e707cf99e
33
app/menu.c
33
app/menu.c
@ -395,21 +395,20 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_CHAN_SQL:
|
case MENU_CHAN_SQL:
|
||||||
g_tx_vfo->squelch_level = g_sub_menu_selection;
|
g_tx_vfo->squelch_level = g_sub_menu_selection;
|
||||||
g_vfo_configure_mode = VFO_CONFIGURE;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
break;
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||||
|
return;
|
||||||
|
|
||||||
case MENU_STEP:
|
case MENU_STEP:
|
||||||
g_tx_vfo->step_setting = step_freq_table_sorted[g_sub_menu_selection];
|
g_tx_vfo->step_setting = step_freq_table_sorted[g_sub_menu_selection];
|
||||||
if (IS_FREQ_CHANNEL(g_tx_vfo->channel_save))
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
{
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||||
g_request_save_channel = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_TX_POWER:
|
case MENU_TX_POWER:
|
||||||
g_tx_vfo->output_power = g_sub_menu_selection;
|
g_tx_vfo->output_power = g_sub_menu_selection;
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_TX_CDCSS:
|
case MENU_TX_CDCSS:
|
||||||
@ -479,17 +478,17 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_SHIFT_DIR:
|
case MENU_SHIFT_DIR:
|
||||||
g_tx_vfo->tx_offset_freq_dir = g_sub_menu_selection;
|
g_tx_vfo->tx_offset_freq_dir = g_sub_menu_selection;
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_OFFSET:
|
case MENU_OFFSET:
|
||||||
g_tx_vfo->tx_offset_freq = g_sub_menu_selection;
|
g_tx_vfo->tx_offset_freq = g_sub_menu_selection;
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_BANDWIDTH:
|
case MENU_BANDWIDTH:
|
||||||
g_tx_vfo->channel_bandwidth = g_sub_menu_selection;
|
g_tx_vfo->channel_bandwidth = g_sub_menu_selection;
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_SCRAMBLER:
|
case MENU_SCRAMBLER:
|
||||||
@ -500,12 +499,12 @@ void MENU_AcceptSetting(void)
|
|||||||
else
|
else
|
||||||
BK4819_DisableScramble();
|
BK4819_DisableScramble();
|
||||||
#endif
|
#endif
|
||||||
g_request_save_channel= 1;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_BUSY_CHAN_LOCK:
|
case MENU_BUSY_CHAN_LOCK:
|
||||||
g_tx_vfo->busy_channel_lock = g_sub_menu_selection;
|
g_tx_vfo->busy_channel_lock = g_sub_menu_selection;
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_MEM_SAVE:
|
case MENU_MEM_SAVE:
|
||||||
@ -700,7 +699,6 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_PTT_ID:
|
case MENU_PTT_ID:
|
||||||
g_tx_vfo->dtmf_ptt_id_tx_mode = g_sub_menu_selection;
|
g_tx_vfo->dtmf_ptt_id_tx_mode = g_sub_menu_selection;
|
||||||
g_request_save_channel = 1;
|
|
||||||
if (g_tx_vfo->dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN ||
|
if (g_tx_vfo->dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN ||
|
||||||
g_tx_vfo->dtmf_ptt_id_tx_mode == PTT_ID_BOTH ||
|
g_tx_vfo->dtmf_ptt_id_tx_mode == PTT_ID_BOTH ||
|
||||||
g_tx_vfo->dtmf_ptt_id_tx_mode == PTT_ID_APOLLO)
|
g_tx_vfo->dtmf_ptt_id_tx_mode == PTT_ID_APOLLO)
|
||||||
@ -708,6 +706,7 @@ void MENU_AcceptSetting(void)
|
|||||||
g_eeprom.roger_mode = ROGER_MODE_OFF;
|
g_eeprom.roger_mode = ROGER_MODE_OFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
@ -717,7 +716,7 @@ void MENU_AcceptSetting(void)
|
|||||||
case MENU_DTMF_DCD:
|
case MENU_DTMF_DCD:
|
||||||
g_tx_vfo->dtmf_decoding_enable = g_sub_menu_selection;
|
g_tx_vfo->dtmf_decoding_enable = g_sub_menu_selection;
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_DTMF_LIVE_DEC:
|
case MENU_DTMF_LIVE_DEC:
|
||||||
@ -755,14 +754,14 @@ void MENU_AcceptSetting(void)
|
|||||||
g_tx_vfo->dtmf_ptt_id_tx_mode == PTT_ID_APOLLO)
|
g_tx_vfo->dtmf_ptt_id_tx_mode == PTT_ID_APOLLO)
|
||||||
{
|
{
|
||||||
g_tx_vfo->dtmf_ptt_id_tx_mode = PTT_ID_OFF; // // disable PTT ID tail
|
g_tx_vfo->dtmf_ptt_id_tx_mode = PTT_ID_OFF; // // disable PTT ID tail
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_MOD_MODE:
|
case MENU_MOD_MODE:
|
||||||
g_tx_vfo->am_mode = g_sub_menu_selection;
|
g_tx_vfo->am_mode = g_sub_menu_selection;
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = IS_FREQ_CHANNEL(g_tx_vfo->channel_save) ? 2 : 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
39
settings.c
39
settings.c
@ -347,7 +347,7 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, c
|
|||||||
unsigned int eeprom_addr = channel * 16;
|
unsigned int eeprom_addr = channel * 16;
|
||||||
t_channel m_channel;
|
t_channel m_channel;
|
||||||
|
|
||||||
if (p_vfo == NULL || IS_NOAA_CHANNEL(channel))
|
if (IS_NOAA_CHANNEL(channel))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mode < 2 && channel <= USER_CHANNEL_LAST)
|
if (mode < 2 && channel <= USER_CHANNEL_LAST)
|
||||||
@ -360,6 +360,10 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, c
|
|||||||
// UART_printf("sav_chan %04X %3u %u %u\r\n", eeprom_addr, channel, vfo, mode);
|
// UART_printf("sav_chan %04X %3u %u %u\r\n", eeprom_addr, channel, vfo, mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ****************
|
||||||
|
|
||||||
|
if (p_vfo != NULL)
|
||||||
|
{
|
||||||
memset(&m_channel, 0, sizeof(m_channel));
|
memset(&m_channel, 0, sizeof(m_channel));
|
||||||
m_channel.frequency = p_vfo->freq_config_rx.frequency;
|
m_channel.frequency = p_vfo->freq_config_rx.frequency;
|
||||||
m_channel.offset = p_vfo->tx_offset_freq;
|
m_channel.offset = p_vfo->tx_offset_freq;
|
||||||
@ -385,10 +389,18 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, c
|
|||||||
m_channel.step_setting = p_vfo->step_setting;
|
m_channel.step_setting = p_vfo->step_setting;
|
||||||
m_channel.scrambler = p_vfo->scrambling_type;
|
m_channel.scrambler = p_vfo->scrambling_type;
|
||||||
m_channel.squelch_level = 0;
|
m_channel.squelch_level = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (channel <= USER_CHANNEL_LAST)
|
||||||
|
{ // user channel
|
||||||
|
memset(&m_channel, 0xff, sizeof(m_channel));
|
||||||
|
}
|
||||||
|
|
||||||
EEPROM_WriteBuffer8(eeprom_addr + 0, (uint8_t *)(&m_channel) + 0);
|
EEPROM_WriteBuffer8(eeprom_addr + 0, (uint8_t *)(&m_channel) + 0);
|
||||||
EEPROM_WriteBuffer8(eeprom_addr + 8, (uint8_t *)(&m_channel) + 8);
|
EEPROM_WriteBuffer8(eeprom_addr + 8, (uint8_t *)(&m_channel) + 8);
|
||||||
|
|
||||||
|
// ****************
|
||||||
|
|
||||||
SETTINGS_save_chan_attribs_name(channel, p_vfo);
|
SETTINGS_save_chan_attribs_name(channel, p_vfo);
|
||||||
|
|
||||||
if (channel <= USER_CHANNEL_LAST)
|
if (channel <= USER_CHANNEL_LAST)
|
||||||
@ -396,16 +408,17 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, c
|
|||||||
const unsigned int eeprom_addr = 0x0F50 + (channel * 16);
|
const unsigned int eeprom_addr = 0x0F50 + (channel * 16);
|
||||||
uint8_t name[16];
|
uint8_t name[16];
|
||||||
|
|
||||||
memset(name, 0, sizeof(name));
|
memset(name, (p_vfo != NULL) ? 0x00 : 0xff, sizeof(name));
|
||||||
|
|
||||||
#ifndef ENABLE_KEEP_MEM_NAME
|
#ifndef ENABLE_KEEP_MEM_NAME
|
||||||
// clear/reset the channel name
|
// clear/reset the channel name
|
||||||
EEPROM_WriteBuffer8(eeprom_addr + 0, name + 0);
|
EEPROM_WriteBuffer8(eeprom_addr + 0, name + 0);
|
||||||
EEPROM_WriteBuffer8(eeprom_addr + 8, name + 8);
|
EEPROM_WriteBuffer8(eeprom_addr + 8, name + 8);
|
||||||
#else
|
#else
|
||||||
if (mode >= 3)
|
if (p_vfo != NULL)
|
||||||
{ // save the channel name
|
|
||||||
memmove(name, p_vfo->name, 10);
|
memmove(name, p_vfo->name, 10);
|
||||||
|
if (mode >= 3 || p_vfo == NULL)
|
||||||
|
{ // save the channel name
|
||||||
EEPROM_WriteBuffer8(eeprom_addr + 0, name + 0);
|
EEPROM_WriteBuffer8(eeprom_addr + 0, name + 0);
|
||||||
EEPROM_WriteBuffer8(eeprom_addr + 8, name + 8);
|
EEPROM_WriteBuffer8(eeprom_addr + 8, name + 8);
|
||||||
}
|
}
|
||||||
@ -415,12 +428,13 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, c
|
|||||||
|
|
||||||
void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_t *p_vfo)
|
void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_t *p_vfo)
|
||||||
{
|
{
|
||||||
if (p_vfo == NULL || channel >= ARRAY_SIZE(g_user_channel_attributes))
|
if (channel >= ARRAY_SIZE(g_user_channel_attributes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (IS_NOAA_CHANNEL(channel))
|
if (IS_NOAA_CHANNEL(channel))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (p_vfo != NULL)
|
||||||
{ // channel attributes
|
{ // channel attributes
|
||||||
|
|
||||||
const uint8_t attribs =
|
const uint8_t attribs =
|
||||||
@ -429,18 +443,31 @@ void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_
|
|||||||
((3u) << 4) |
|
((3u) << 4) |
|
||||||
((p_vfo->band & 7u) << 0);
|
((p_vfo->band & 7u) << 0);
|
||||||
|
|
||||||
const unsigned int index = channel & ~7u; // eeprom writes are always 8 bytes in length
|
const unsigned int index = channel & ~7ul; // eeprom writes are always 8 bytes in length
|
||||||
g_user_channel_attributes[channel] = attribs; // remember new attributes
|
g_user_channel_attributes[channel] = attribs; // remember new attributes
|
||||||
EEPROM_WriteBuffer8(0x0D60 + index, g_user_channel_attributes + index);
|
EEPROM_WriteBuffer8(0x0D60 + index, g_user_channel_attributes + index);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const unsigned int index = channel & ~7ul; // eeprom writes are always 8 bytes in length
|
||||||
|
g_user_channel_attributes[channel] = 0xff;
|
||||||
|
EEPROM_WriteBuffer8(0x0D60 + index, g_user_channel_attributes + index);
|
||||||
|
}
|
||||||
|
|
||||||
if (channel <= USER_CHANNEL_LAST)
|
if (channel <= USER_CHANNEL_LAST)
|
||||||
{ // user memory channel
|
{ // user memory channel
|
||||||
const unsigned int index = channel * 16;
|
const unsigned int index = channel * 16;
|
||||||
uint8_t name[16];
|
uint8_t name[16];
|
||||||
|
|
||||||
|
if (p_vfo != NULL)
|
||||||
|
{
|
||||||
memset(name, 0, sizeof(name));
|
memset(name, 0, sizeof(name));
|
||||||
memmove(name, p_vfo->name, 10);
|
memmove(name, p_vfo->name, 10);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset(name, 0xff, sizeof(name));
|
||||||
|
}
|
||||||
|
|
||||||
EEPROM_WriteBuffer8(0x0F50 + 0 + index, name + 0);
|
EEPROM_WriteBuffer8(0x0F50 + 0 + index, name + 0);
|
||||||
EEPROM_WriteBuffer8(0x0F50 + 8 + index, name + 8);
|
EEPROM_WriteBuffer8(0x0F50 + 8 + index, name + 8);
|
||||||
|
@ -547,7 +547,7 @@ void UI_DisplayMenu(void)
|
|||||||
if (g_sub_menu_selection == 0)
|
if (g_sub_menu_selection == 0)
|
||||||
strcpy(String, "USE\nMAIN SQL");
|
strcpy(String, "USE\nMAIN SQL");
|
||||||
else
|
else
|
||||||
sprintf(String, "%d\n ", g_sub_menu_selection);
|
sprintf(String, "\n ", g_sub_menu_selection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_MIC_GAIN:
|
case MENU_MIC_GAIN:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user