mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
fix channel name edit menu function
This commit is contained in:
parent
e55690fe65
commit
6f2fb9c7d6
4
Makefile
4
Makefile
@ -49,7 +49,6 @@ ENABLE_SMALL_BOLD := 1
|
||||
ENABLE_SMALLEST_FONT := 0
|
||||
# trim trailing 44 B
|
||||
ENABLE_TRIM_TRAILING_ZEROS := 0
|
||||
ENABLE_KEEP_MEM_NAME := 1
|
||||
ENABLE_WIDE_RX := 1
|
||||
ENABLE_TX_WHEN_AM := 0
|
||||
# Freq calibration 188 B
|
||||
@ -377,9 +376,6 @@ endif
|
||||
ifeq ($(ENABLE_RESET_AES_KEY),1)
|
||||
CFLAGS += -DENABLE_RESET_AES_KEY
|
||||
endif
|
||||
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
|
||||
CFLAGS += -DENABLE_KEEP_MEM_NAME
|
||||
endif
|
||||
ifeq ($(ENABLE_WIDE_RX),1)
|
||||
CFLAGS += -DENABLE_WIDE_RX
|
||||
endif
|
||||
|
@ -67,7 +67,6 @@ ENABLE_BIG_FREQ := 0 big font frequencies (like original
|
||||
ENABLE_SHOW_FREQS_CHAN := 1 show the channel name under the frequency if the frequency is found in a channel
|
||||
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
|
||||
ENABLE_TRIM_TRAILING_ZEROS := 1 trim away any trailing zeros on frequencies
|
||||
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
|
||||
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-end/PA not designed for full range)
|
||||
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
|
||||
ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu
|
||||
|
17
app/menu.c
17
app/menu.c
@ -523,20 +523,25 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_MEM_NAME:
|
||||
{ // trailing trim
|
||||
int i;
|
||||
{
|
||||
const unsigned int chan = g_sub_menu_selection;
|
||||
t_channel_name *chan_name = &g_eeprom.config.channel_name[chan];
|
||||
int i;
|
||||
|
||||
// trailing trim
|
||||
for (i = 9; i >= 0; i--)
|
||||
{
|
||||
if (g_edit[i] != ' ' && g_edit[i] != '_' && g_edit[i] != 0x00 && g_edit[i] != 0xff)
|
||||
break;
|
||||
g_edit[i] = ' ';
|
||||
}
|
||||
|
||||
// save the channel name
|
||||
memset(chan_name, 0, sizeof(t_channel_name));
|
||||
memcpy(chan_name->name, g_edit, sizeof(chan_name->name));
|
||||
SETTINGS_save_chan_name(chan);
|
||||
}
|
||||
|
||||
// save the channel name
|
||||
memset(&g_tx_vfo->channel_name, 0, sizeof(g_tx_vfo->channel_name));
|
||||
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);
|
||||
g_flag_reconfigure_vfos = true;
|
||||
return;
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
59
settings.c
59
settings.c
@ -487,35 +487,36 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, v
|
||||
|
||||
if (channel <= USER_CHANNEL_LAST)
|
||||
{ // user channel, it has a channel name
|
||||
const unsigned int eeprom_addr = 0x0F50 + (channel * 16);
|
||||
|
||||
memset(&g_eeprom.config.channel_name[channel], (p_vfo != NULL) ? 0x00 : 0xff, sizeof(g_eeprom.config.channel_name[channel]));
|
||||
|
||||
#ifndef ENABLE_KEEP_MEM_NAME
|
||||
SETTINGS_save_chan_name(channel);
|
||||
|
||||
// clear/reset the channel name
|
||||
EEPROM_WriteBuffer8(eeprom_addr + 0, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 0);
|
||||
EEPROM_WriteBuffer8(eeprom_addr + 8, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 8);
|
||||
if (p_vfo != NULL)
|
||||
memcpy(g_eeprom.config.channel_name[channel].name, p_vfo->channel_name.name, sizeof(g_eeprom.config.channel_name[channel].name));
|
||||
|
||||
#else
|
||||
|
||||
if (p_vfo != NULL)
|
||||
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)
|
||||
{ // save the channel name
|
||||
|
||||
EEPROM_WriteBuffer8(eeprom_addr + 0, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 0);
|
||||
EEPROM_WriteBuffer8(eeprom_addr + 8, ((uint8_t *)&g_eeprom.config.channel_name[channel]) + 8);
|
||||
}
|
||||
|
||||
#endif
|
||||
// save the channel name
|
||||
if (mode >= 3 || p_vfo == NULL)
|
||||
SETTINGS_save_chan_name(channel);
|
||||
}
|
||||
}
|
||||
|
||||
void SETTINGS_save_chan_name(const unsigned int channel)
|
||||
{
|
||||
const unsigned int eeprom_offset = (unsigned int)(((uint8_t *)&g_eeprom.config.channel_name) - ((uint8_t *)&g_eeprom));
|
||||
const unsigned int eeprom_addr = eeprom_offset + (channel * 16);
|
||||
const t_channel_name *chan_name = &g_eeprom.config.channel_name[channel];
|
||||
|
||||
if (!IS_USER_CHANNEL(channel))
|
||||
return;
|
||||
|
||||
EEPROM_WriteBuffer8(eeprom_addr + 0, ((uint8_t *)chan_name) + 0);
|
||||
EEPROM_WriteBuffer8(eeprom_addr + 8, ((uint8_t *)chan_name) + 8);
|
||||
}
|
||||
|
||||
void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_t *p_vfo)
|
||||
{
|
||||
const unsigned int index = channel & ~7u; // eeprom writes are always 8 bytes in length
|
||||
const unsigned int eeprom_offset = (unsigned int)(((uint8_t *)&g_eeprom.config.channel_attributes) - ((uint8_t *)&g_eeprom));
|
||||
const unsigned int index = channel & ~7u; // eeprom writes are always 8 bytes in length
|
||||
|
||||
if (!IS_USER_CHANNEL(channel) && !IS_FREQ_CHANNEL(channel))
|
||||
return;
|
||||
@ -523,19 +524,17 @@ void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_
|
||||
if (p_vfo != NULL)
|
||||
{ // channel attributes
|
||||
g_eeprom.config.channel_attributes[channel] = p_vfo->channel_attributes;
|
||||
EEPROM_WriteBuffer8(0x0D60 + index, &g_eeprom.config.channel_attributes[index]);
|
||||
EEPROM_WriteBuffer8(eeprom_offset + index, &g_eeprom.config.channel_attributes[index]);
|
||||
}
|
||||
else
|
||||
if (channel <= USER_CHANNEL_LAST)
|
||||
{ // user channel
|
||||
g_eeprom.config.channel_attributes[channel].attributes = 0xff;
|
||||
EEPROM_WriteBuffer8(0x0D60 + index, &g_eeprom.config.channel_attributes[index]);
|
||||
EEPROM_WriteBuffer8(eeprom_offset + index, &g_eeprom.config.channel_attributes[index]);
|
||||
}
|
||||
|
||||
if (channel <= USER_CHANNEL_LAST)
|
||||
{ // user memory channel
|
||||
const unsigned int index = channel * 16;
|
||||
|
||||
if (p_vfo != NULL)
|
||||
{
|
||||
memset(&g_eeprom.config.channel_name[channel], 0, sizeof(g_eeprom.config.channel_name[channel]));
|
||||
@ -545,17 +544,7 @@ void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_
|
||||
{
|
||||
memset(&g_eeprom.config.channel_name[channel], 0xff, sizeof(g_eeprom.config.channel_name[channel]));
|
||||
}
|
||||
|
||||
// #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
// {
|
||||
// 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);
|
||||
SETTINGS_save_chan_name(channel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -578,6 +578,7 @@ void SETTINGS_write_eeprom_config(void);
|
||||
void SETTINGS_save_vfo_indices(void);
|
||||
void SETTINGS_save(void);
|
||||
void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, vfo_info_t *p_vfo, const unsigned int mode);
|
||||
void SETTINGS_save_chan_name(const unsigned int channel);
|
||||
void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_t *p_vfo);
|
||||
|
||||
unsigned int SETTINGS_find_channel(const uint32_t frequency);
|
||||
|
45
ui/main.c
45
ui/main.c
@ -403,18 +403,20 @@ void UI_DisplayMain(void)
|
||||
#if !defined(ENABLE_BIG_FREQ) && defined(ENABLE_SMALLEST_FONT)
|
||||
const unsigned int smallest_char_spacing = ARRAY_SIZE(g_font3x5[0]) + 1;
|
||||
#endif
|
||||
const unsigned int line0 = 0; // text screen line
|
||||
const unsigned int line1 = 4;
|
||||
const unsigned int line0 = 0; // text screen line
|
||||
const unsigned int line1 = 4;
|
||||
char str[22];
|
||||
unsigned int vfo_num;
|
||||
int vfo_num;
|
||||
int single_vfo = -1;
|
||||
int channel = g_eeprom.config.setting.tx_vfo_num;
|
||||
|
||||
g_center_line = CENTER_LINE_NONE;
|
||||
|
||||
// #ifdef SINGLE_VFO_CHAN
|
||||
// const bool single_vfo = (g_eeprom.config.setting.dual_watch == DUAL_WATCH_OFF && g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? true : false;
|
||||
// #else
|
||||
const bool single_vfo = false;
|
||||
// #endif
|
||||
if (g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF && g_rx_vfo_is_active)
|
||||
channel = g_rx_vfo_num; // we're currently monitoring the other VFO
|
||||
|
||||
if (g_eeprom.config.setting.dual_watch == DUAL_WATCH_OFF && g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF)
|
||||
single_vfo = g_eeprom.config.setting.tx_vfo_num;
|
||||
|
||||
// clear the screen
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
@ -425,6 +427,7 @@ void UI_DisplayMain(void)
|
||||
UI_PrintString("UART", 0, LCD_WIDTH, 1, 8);
|
||||
UI_PrintString("CONFIG COMMS", 0, LCD_WIDTH, 3, 8);
|
||||
ST7565_BlitFullScreen();
|
||||
g_center_line = CENTER_LINE_IN_USE;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -443,25 +446,13 @@ void UI_DisplayMain(void)
|
||||
{
|
||||
const unsigned int scrn_chan = g_eeprom.config.setting.indices.vfo[vfo_num].screen;
|
||||
const unsigned int line = (vfo_num == 0) ? line0 : line1;
|
||||
unsigned int channel = g_eeprom.config.setting.tx_vfo_num;
|
||||
// unsigned int tx_channel = (g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? g_rx_vfo_num : g_eeprom.config.setting.tx_vfo_num;
|
||||
const bool same_vfo = (channel == vfo_num) ? true : false;
|
||||
uint8_t *p_line0 = g_frame_buffer[line + 0];
|
||||
uint8_t *p_line1 = g_frame_buffer[line + 1];
|
||||
unsigned int mode = 0;
|
||||
unsigned int state;
|
||||
|
||||
if (single_vfo)
|
||||
{ // we're in single VFO mode - screen is dedicated to just one VFO
|
||||
|
||||
if (!same_vfo)
|
||||
continue; // skip the unused vfo
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF && g_rx_vfo_is_active)
|
||||
channel = g_rx_vfo_num; // we're currently monitoring the other VFO
|
||||
if (single_vfo >= 0 && single_vfo != vfo_num)
|
||||
continue; // we're in single VFO mode - screen is dedicated to just one VFO
|
||||
|
||||
if (channel != vfo_num)
|
||||
{
|
||||
@ -528,16 +519,16 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
|
||||
// highlight the selected/used VFO with a marker
|
||||
if (!single_vfo && same_vfo)
|
||||
memcpy(p_line0 + 0, BITMAP_VFO_DEFAULT, sizeof(BITMAP_VFO_DEFAULT));
|
||||
else
|
||||
// if (single_vfo < 0 && channel == vfo_num)
|
||||
// memcpy(p_line0 + 0, BITMAP_VFO_DEFAULT, sizeof(BITMAP_VFO_DEFAULT));
|
||||
// else
|
||||
if (g_eeprom.config.setting.cross_vfo != CROSS_BAND_OFF)
|
||||
memcpy(p_line0 + 0, BITMAP_VFO_NOT_DEFAULT, sizeof(BITMAP_VFO_NOT_DEFAULT));
|
||||
}
|
||||
else
|
||||
if (!single_vfo)
|
||||
if (single_vfo < 0)
|
||||
{ // highlight the selected/used VFO with a marker
|
||||
if (same_vfo)
|
||||
if (channel == vfo_num)
|
||||
memcpy(p_line0 + 0, BITMAP_VFO_DEFAULT, sizeof(BITMAP_VFO_DEFAULT));
|
||||
else
|
||||
//if (g_eeprom.config.setting.cross_vfo != CROSS_BAND_OFF)
|
||||
|
Loading…
x
Reference in New Issue
Block a user