mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-29 06:41:25 +03:00
fix channel name bug
This commit is contained in:
parent
98a4cd9483
commit
8dfcbedf0b
2
Makefile
2
Makefile
@ -77,7 +77,7 @@ ENABLE_RX_SIGNAL_BAR := 1
|
|||||||
# Tx Audio Bar 300 B
|
# Tx Audio Bar 300 B
|
||||||
ENABLE_TX_AUDIO_BAR := 0
|
ENABLE_TX_AUDIO_BAR := 0
|
||||||
# Side Button Menu 300 B
|
# Side Button Menu 300 B
|
||||||
ENABLE_SIDE_BUTT_MENU := 0
|
ENABLE_SIDE_BUTT_MENU := 1
|
||||||
# Key Lock 400 B
|
# Key Lock 400 B
|
||||||
ENABLE_KEYLOCK := 0
|
ENABLE_KEYLOCK := 0
|
||||||
#ENABLE_PANADAPTER := 0
|
#ENABLE_PANADAPTER := 0
|
||||||
|
@ -538,7 +538,8 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_MEM_NAME:
|
case MENU_MEM_NAME:
|
||||||
{ // trailing trim
|
{ // trailing trim
|
||||||
for (int i = 9; i >= 0; i--)
|
int i;
|
||||||
|
for (i = 9; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (g_edit[i] != ' ' && g_edit[i] != '_' && g_edit[i] != 0x00 && g_edit[i] != 0xff)
|
if (g_edit[i] != ' ' && g_edit[i] != '_' && g_edit[i] != 0x00 && g_edit[i] != 0xff)
|
||||||
break;
|
break;
|
||||||
@ -547,8 +548,8 @@ void MENU_AcceptSetting(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save the channel name
|
// save the channel name
|
||||||
memset(g_tx_vfo->channel_name, 0, sizeof(g_tx_vfo->channel_name));
|
memset(&g_tx_vfo->channel_name, 0, sizeof(g_tx_vfo->channel_name));
|
||||||
memcpy(g_tx_vfo->channel_name, g_edit, 10);
|
memcpy(g_tx_vfo->channel_name.name, g_edit, sizeof(g_tx_vfo->channel_name.name));
|
||||||
SETTINGS_save_channel(g_sub_menu_selection, g_eeprom.config.setting.tx_vfo_num, g_tx_vfo, 3);
|
SETTINGS_save_channel(g_sub_menu_selection, g_eeprom.config.setting.tx_vfo_num, g_tx_vfo, 3);
|
||||||
g_flag_reconfigure_vfos = true;
|
g_flag_reconfigure_vfos = true;
|
||||||
return;
|
return;
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
10
radio.c
10
radio.c
@ -211,7 +211,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
|||||||
attributes = g_user_channel_attributes[channel];
|
attributes = g_user_channel_attributes[channel];
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
UART_printf("config chan 1 %u %u %u %u %u\r\n", channel, chan, attributes.band, attributes.scanlist1, attributes.scanlist2);
|
// UART_printf("config chan 1 %u %u %u %u %u\r\n", channel, chan, attributes.band, attributes.scanlist1, attributes.scanlist2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (attributes.attributes == 0xff)
|
if (attributes.attributes == 0xff)
|
||||||
@ -277,13 +277,13 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
|||||||
p_vfo->freq_config_tx.code = p_vfo->channel.tx_ctcss_cdcss_code;
|
p_vfo->freq_config_tx.code = p_vfo->channel.tx_ctcss_cdcss_code;
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
UART_printf("config chan 2 %u %u %u %u %u %uHz\r\n", channel, chan, p_vfo->channel_attributes.band, p_vfo->channel_attributes.scanlist1, p_vfo->channel_attributes.scanlist2, p_vfo->channel.frequency * 10);
|
// UART_printf("config chan 2 %u %u %u %u %u %uHz\r\n", channel, chan, p_vfo->channel_attributes.band, p_vfo->channel_attributes.scanlist1, p_vfo->channel_attributes.scanlist2, p_vfo->channel.frequency * 10);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
UART_printf("config chan 3 %u %u %u %u %uHz\r\n", channel, p_vfo->channel_attributes.band, p_vfo->channel_attributes.scanlist1, p_vfo->channel_attributes.scanlist2, p_vfo->channel.frequency * 10);
|
// UART_printf("config chan 3 %u %u %u %u %uHz\r\n", channel, p_vfo->channel_attributes.band, p_vfo->channel_attributes.scanlist1, p_vfo->channel_attributes.scanlist2, p_vfo->channel.frequency * 10);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,10 +333,10 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
|||||||
RADIO_ApplyOffset(p_vfo, true);
|
RADIO_ApplyOffset(p_vfo, true);
|
||||||
|
|
||||||
// channel name
|
// channel name
|
||||||
memset(p_vfo->channel_name, 0, sizeof(p_vfo->channel_name));
|
memset(&p_vfo->channel_name, 0, sizeof(p_vfo->channel_name));
|
||||||
if (channel <= USER_CHANNEL_LAST)
|
if (channel <= USER_CHANNEL_LAST)
|
||||||
// EEPROM_ReadBuffer(0x0F50 + (channel * 16), p_vfo->channel_name, 10); // only 10 bytes used
|
// EEPROM_ReadBuffer(0x0F50 + (channel * 16), p_vfo->channel_name, 10); // only 10 bytes used
|
||||||
memcpy(p_vfo->channel_name, &g_eeprom.config.channel_name[channel].name, sizeof(g_eeprom.config.channel_name[channel].name));
|
memcpy(p_vfo->channel_name.name, &g_eeprom.config.channel_name[channel].name, sizeof(p_vfo->channel_name.name));
|
||||||
|
|
||||||
if (p_vfo->channel.am_mode > 0)
|
if (p_vfo->channel.am_mode > 0)
|
||||||
{ // freq/chan is in AM mode
|
{ // freq/chan is in AM mode
|
||||||
|
36
settings.c
36
settings.c
@ -425,10 +425,11 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, v
|
|||||||
if (IS_USER_CHANNEL(channel))
|
if (IS_USER_CHANNEL(channel))
|
||||||
g_eeprom.config.channel_attributes[channel] = g_user_channel_attributes[channel];
|
g_eeprom.config.channel_attributes[channel] = g_user_channel_attributes[channel];
|
||||||
|
|
||||||
// memcpy(g_eeprom.config.channel_name[channel], p_vfo->channel_name, 16);
|
memset(&g_eeprom.config.channel_name[channel], 0, sizeof(g_eeprom.config.channel_name[channel]));
|
||||||
|
memcpy(g_eeprom.config.channel_name[channel].name, p_vfo->channel_name.name, sizeof(g_eeprom.config.channel_name[channel].name));
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
UART_printf("save chan %04X %3u %3u %u %u %uHz\r\n", eeprom_addr, chan, channel, vfo, mode, p_channel->frequency * 10);
|
// UART_printf("save chan %04X %3u %3u %u %u %uHz\r\n", eeprom_addr, chan, channel, vfo, mode, p_channel->frequency * 10);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -453,19 +454,19 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, v
|
|||||||
#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, g_eeprom.config.channel_name[channel] + 0);
|
EEPROM_WriteBuffer8(eeprom_addr + 0, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 0);
|
||||||
EEPROM_WriteBuffer8(eeprom_addr + 8, g_eeprom.config.channel_name[channel] + 8);
|
EEPROM_WriteBuffer8(eeprom_addr + 8, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 8);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (p_vfo != NULL)
|
if (p_vfo != NULL)
|
||||||
memcpy(&g_eeprom.config.channel_name[channel], p_vfo->channel_name, 10);
|
memcpy(g_eeprom.config.channel_name[channel].name, p_vfo->channel_name.name, sizeof(g_eeprom.config.channel_name[channel].name));
|
||||||
|
|
||||||
if (mode >= 3 || p_vfo == NULL)
|
if (mode >= 3 || p_vfo == NULL)
|
||||||
{ // save the channel name
|
{ // save the channel name
|
||||||
|
|
||||||
EEPROM_WriteBuffer8(eeprom_addr + 0, &g_eeprom.config.channel_name[channel] + 0);
|
EEPROM_WriteBuffer8(eeprom_addr + 0, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 0);
|
||||||
EEPROM_WriteBuffer8(eeprom_addr + 8, &g_eeprom.config.channel_name[channel] + 8);
|
EEPROM_WriteBuffer8(eeprom_addr + 8, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -474,7 +475,7 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, v
|
|||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
const unsigned int index = channel & ~7ul; // eeprom writes are always 8 bytes in length
|
const unsigned int index = channel & ~7u; // eeprom writes are always 8 bytes in length
|
||||||
|
|
||||||
if (channel >= ARRAY_SIZE(g_user_channel_attributes))
|
if (channel >= ARRAY_SIZE(g_user_channel_attributes))
|
||||||
return;
|
return;
|
||||||
@ -486,11 +487,10 @@ void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_
|
|||||||
{ // channel attributes
|
{ // channel attributes
|
||||||
|
|
||||||
t_channel_attrib attribs = p_vfo->channel_attributes;
|
t_channel_attrib attribs = p_vfo->channel_attributes;
|
||||||
attribs.unused = 3u;
|
|
||||||
g_user_channel_attributes[channel] = attribs; // remember new attributes
|
g_user_channel_attributes[channel] = attribs; // remember new attributes
|
||||||
g_eeprom.config.channel_attributes[channel] = attribs;
|
g_eeprom.config.channel_attributes[channel] = attribs;
|
||||||
|
|
||||||
EEPROM_WriteBuffer8(0x0D60 + index, g_user_channel_attributes + index);
|
EEPROM_WriteBuffer8(0x0D60 + index, &g_user_channel_attributes[index]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (channel <= USER_CHANNEL_LAST)
|
if (channel <= USER_CHANNEL_LAST)
|
||||||
@ -498,7 +498,7 @@ void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_
|
|||||||
g_user_channel_attributes[channel].attributes = 0xff;
|
g_user_channel_attributes[channel].attributes = 0xff;
|
||||||
g_eeprom.config.channel_attributes[channel].attributes = 0xff;
|
g_eeprom.config.channel_attributes[channel].attributes = 0xff;
|
||||||
|
|
||||||
EEPROM_WriteBuffer8(0x0D60 + index, g_user_channel_attributes + index);
|
EEPROM_WriteBuffer8(0x0D60 + index, &g_user_channel_attributes[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel <= USER_CHANNEL_LAST)
|
if (channel <= USER_CHANNEL_LAST)
|
||||||
@ -508,15 +508,23 @@ void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_
|
|||||||
if (p_vfo != NULL)
|
if (p_vfo != NULL)
|
||||||
{
|
{
|
||||||
memset(&g_eeprom.config.channel_name[channel], 0, sizeof(g_eeprom.config.channel_name[channel]));
|
memset(&g_eeprom.config.channel_name[channel], 0, sizeof(g_eeprom.config.channel_name[channel]));
|
||||||
memcpy(&g_eeprom.config.channel_name[channel], p_vfo->channel_name, 10);
|
memcpy(g_eeprom.config.channel_name[channel].name, p_vfo->channel_name.name, sizeof(g_eeprom.config.channel_name[channel].name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset(&g_eeprom.config.channel_name[channel], 0xff, sizeof(g_eeprom.config.channel_name[channel]));
|
memset(&g_eeprom.config.channel_name[channel], 0xff, sizeof(g_eeprom.config.channel_name[channel]));
|
||||||
}
|
}
|
||||||
|
|
||||||
EEPROM_WriteBuffer8(0x0F50 + 0 + index, &g_eeprom.config.channel_name[channel] + 0);
|
// #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
EEPROM_WriteBuffer8(0x0F50 + 8 + index, &g_eeprom.config.channel_name[channel] + 8);
|
// {
|
||||||
|
// char str[17] = {0};
|
||||||
|
// memcpy(str, &g_eeprom.config.channel_name[channel], 10);
|
||||||
|
// UART_printf("saved name %u %s\r\n", channel, str);
|
||||||
|
// }
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
EEPROM_WriteBuffer8(0x0F50 + 0 + index, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 0);
|
||||||
|
EEPROM_WriteBuffer8(0x0F50 + 8 + index, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +530,10 @@ typedef struct vfo_info_t
|
|||||||
|
|
||||||
t_channel_attrib channel_attributes;
|
t_channel_attrib channel_attributes;
|
||||||
|
|
||||||
char channel_name[16];
|
struct {
|
||||||
|
char name[10];
|
||||||
|
uint8_t unused[6];
|
||||||
|
} channel_name;
|
||||||
|
|
||||||
uint16_t step_freq;
|
uint16_t step_freq;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user