mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-27 22:01:26 +03:00
Use memcpy() instead of memmove() when it's possible (two memmove call were kept).
Rename some variable named 'String' (to 'str') which is quite confusing.
This commit is contained in:
parent
024c4bb79d
commit
64f19b2d78
@ -122,7 +122,7 @@ bool DTMF_FindContact(const char *pContact, char *pResult)
|
||||
|
||||
if (j == 3)
|
||||
{
|
||||
memmove(pResult, Contact, 8);
|
||||
memcpy(pResult, Contact, 8);
|
||||
pResult[8] = 0;
|
||||
return true;
|
||||
}
|
||||
@ -354,8 +354,8 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
memset(g_dtmf_callee, 0, sizeof(g_dtmf_callee));
|
||||
memset(g_dtmf_caller, 0, sizeof(g_dtmf_caller));
|
||||
memmove(g_dtmf_callee, g_dtmf_rx + Offset + 0, 3);
|
||||
memmove(g_dtmf_caller, g_dtmf_rx + Offset + 4, 3);
|
||||
memcpy(g_dtmf_callee, g_dtmf_rx + Offset + 0, 3);
|
||||
memcpy(g_dtmf_caller, g_dtmf_rx + Offset + 4, 3);
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
|
@ -785,7 +785,7 @@ void MAIN_Key_STAR(bool key_pressed, bool key_held)
|
||||
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
||||
{ // start entering a DTMF string
|
||||
|
||||
memmove( g_dtmf_input_box, g_dtmf_string,
|
||||
memcpy( g_dtmf_input_box, g_dtmf_string,
|
||||
(sizeof(g_dtmf_input_box) <= (sizeof(g_dtmf_string) - 1)) ? sizeof(g_dtmf_input_box) : sizeof(g_dtmf_string) - 1);
|
||||
|
||||
g_dtmf_input_box_index = 0;
|
||||
|
@ -535,7 +535,7 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
// save the channel name
|
||||
memset(g_tx_vfo->name, 0, sizeof(g_tx_vfo->name));
|
||||
memmove(g_tx_vfo->name, g_edit, 10);
|
||||
memcpy(g_tx_vfo->name, g_edit, 10);
|
||||
SETTINGS_save_channel(g_sub_menu_selection, g_eeprom.tx_vfo, g_tx_vfo, 3);
|
||||
g_flag_reconfigure_vfos = true;
|
||||
return;
|
||||
@ -742,7 +742,7 @@ void MENU_AcceptSetting(void)
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
g_dtmf_input_mode = true;
|
||||
g_dtmf_input_box_index = 3;
|
||||
memmove(g_dtmf_input_box, g_dtmf_id, 4);
|
||||
memcpy(g_dtmf_input_box, g_dtmf_id, 4);
|
||||
g_request_display_screen = DISPLAY_INVALID;
|
||||
}
|
||||
return;
|
||||
@ -1624,7 +1624,7 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
g_edit_index = 0; // 'g_edit_index' is going to be used as the cursor position
|
||||
|
||||
// make a copy so we can test for change when exiting the menu item
|
||||
memmove(g_edit_original, g_edit, sizeof(g_edit_original));
|
||||
memcpy(g_edit_original, g_edit, sizeof(g_edit_original));
|
||||
|
||||
return;
|
||||
}
|
||||
|
12
app/uart.c
12
app/uart.c
@ -209,7 +209,7 @@ static void SendVersion(void)
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
reply.Header.ID = 0x0515;
|
||||
reply.Header.Size = sizeof(reply.Data);
|
||||
memmove(reply.Data.Version, Version_str, slen);
|
||||
memcpy(reply.Data.Version, Version_str, slen);
|
||||
reply.Data.has_custom_aes_key = g_has_custom_aes_key;
|
||||
reply.Data.password_locked = g_password_locked;
|
||||
reply.Data.Challenge[0] = g_challenge[0];
|
||||
@ -420,13 +420,13 @@ static void cmd_052D(const uint8_t *pBuffer)
|
||||
|
||||
if (!locked)
|
||||
{
|
||||
memmove((void *)&response, &pCmd->Response, sizeof(response)); // overcome strict compiler warning settings
|
||||
memcpy((void *)&response, &pCmd->Response, sizeof(response)); // overcome strict compiler warning settings
|
||||
locked = IsBadChallenge(g_custom_aes_key, g_challenge, response);
|
||||
}
|
||||
|
||||
if (!locked)
|
||||
{
|
||||
memmove((void *)&response, &pCmd->Response, sizeof(response)); // overcome strict compiler warning settings
|
||||
memcpy((void *)&response, &pCmd->Response, sizeof(response)); // overcome strict compiler warning settings
|
||||
locked = IsBadChallenge(g_default_aes_key, g_challenge, response);
|
||||
if (locked)
|
||||
try_count++;
|
||||
@ -546,11 +546,11 @@ bool UART_IsCommandAvailable(void)
|
||||
if (TailIndex < Index)
|
||||
{
|
||||
const uint16_t ChunkSize = sizeof(UART_DMA_Buffer) - Index;
|
||||
memmove(UART_Command.Buffer, UART_DMA_Buffer + Index, ChunkSize);
|
||||
memmove(UART_Command.Buffer + ChunkSize, UART_DMA_Buffer, TailIndex);
|
||||
memcpy(UART_Command.Buffer, UART_DMA_Buffer + Index, ChunkSize);
|
||||
memcpy(UART_Command.Buffer + ChunkSize, UART_DMA_Buffer, TailIndex);
|
||||
}
|
||||
else
|
||||
memmove(UART_Command.Buffer, UART_DMA_Buffer + Index, TailIndex - Index);
|
||||
memcpy(UART_Command.Buffer, UART_DMA_Buffer + Index, TailIndex - Index);
|
||||
|
||||
TailIndex = DMA_INDEX(TailIndex, 2);
|
||||
if (TailIndex < write_index)
|
||||
|
14
board.c
14
board.c
@ -605,7 +605,7 @@ void BOARD_EEPROM_load(void)
|
||||
|
||||
// 0E98..0E9F
|
||||
EEPROM_ReadBuffer(0x0E98, Data, 8);
|
||||
memmove(&g_eeprom.power_on_password, Data, 4);
|
||||
memcpy(&g_eeprom.power_on_password, Data, sizeof(g_eeprom.power_on_password));
|
||||
|
||||
// 0EA0..0EA7
|
||||
#ifdef ENABLE_VOICE
|
||||
@ -667,7 +667,7 @@ void BOARD_EEPROM_load(void)
|
||||
// 0EE0..0EE7
|
||||
EEPROM_ReadBuffer(0x0EE0, Data, 8);
|
||||
if (DTMF_ValidateCodes((char *)Data, 8))
|
||||
memmove(g_eeprom.ani_dtmf_id, Data, 8);
|
||||
memcpy(g_eeprom.ani_dtmf_id, Data, sizeof(g_eeprom.power_on_password));
|
||||
else
|
||||
{
|
||||
memset(g_eeprom.ani_dtmf_id, 0, sizeof(g_eeprom.ani_dtmf_id));
|
||||
@ -677,7 +677,7 @@ void BOARD_EEPROM_load(void)
|
||||
// 0EE8..0EEF
|
||||
EEPROM_ReadBuffer(0x0EE8, Data, 8);
|
||||
if (DTMF_ValidateCodes((char *)Data, 8))
|
||||
memmove(g_eeprom.kill_code, Data, 8);
|
||||
memcpy(g_eeprom.kill_code, Data, sizeof(g_eeprom.kill_code));
|
||||
else
|
||||
{
|
||||
memset(g_eeprom.kill_code, 0, sizeof(g_eeprom.kill_code));
|
||||
@ -687,7 +687,7 @@ void BOARD_EEPROM_load(void)
|
||||
// 0EF0..0EF7
|
||||
EEPROM_ReadBuffer(0x0EF0, Data, 8);
|
||||
if (DTMF_ValidateCodes((char *)Data, 8))
|
||||
memmove(g_eeprom.revive_code, Data, 8);
|
||||
memcpy(g_eeprom.revive_code, Data, sizeof(g_eeprom.revive_code));
|
||||
else
|
||||
{
|
||||
memset(g_eeprom.revive_code, 0, sizeof(g_eeprom.revive_code));
|
||||
@ -697,7 +697,7 @@ void BOARD_EEPROM_load(void)
|
||||
// 0EF8..0F07
|
||||
EEPROM_ReadBuffer(0x0EF8, Data, 16);
|
||||
if (DTMF_ValidateCodes((char *)Data, 16))
|
||||
memmove(g_eeprom.dtmf_key_up_code, Data, 16);
|
||||
memcpy(g_eeprom.dtmf_key_up_code, Data, sizeof(g_eeprom.dtmf_key_up_code));
|
||||
else
|
||||
{
|
||||
memset(g_eeprom.dtmf_key_up_code, 0, sizeof(g_eeprom.dtmf_key_up_code));
|
||||
@ -707,7 +707,7 @@ void BOARD_EEPROM_load(void)
|
||||
// 0F08..0F17
|
||||
EEPROM_ReadBuffer(0x0F08, Data, 16);
|
||||
if (DTMF_ValidateCodes((char *)Data, 16))
|
||||
memmove(g_eeprom.dtmf_key_down_code, Data, 16);
|
||||
memcpy(g_eeprom.dtmf_key_down_code, Data, sizeof(g_eeprom.dtmf_key_down_code));
|
||||
else
|
||||
{
|
||||
memset(g_eeprom.dtmf_key_down_code, 0, sizeof(g_eeprom.dtmf_key_down_code));
|
||||
@ -721,7 +721,7 @@ void BOARD_EEPROM_load(void)
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
const unsigned int j = 1 + (i * 3);
|
||||
g_eeprom.scan_list_enabled[i] = (Data[j + 0] < 2) ? Data[j] : false;
|
||||
g_eeprom.scan_list_enabled[i] = (Data[j + 0] < 2) ? Data[j] : false;
|
||||
g_eeprom.scan_list_priority_ch1[i] = Data[j + 1];
|
||||
g_eeprom.scan_list_priority_ch2[i] = Data[j + 2];
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, c
|
||||
EEPROM_WriteBuffer8(eeprom_addr + 8, name + 8);
|
||||
#else
|
||||
if (p_vfo != NULL)
|
||||
memmove(name, p_vfo->name, 10);
|
||||
memcpy(name, p_vfo->name, 10);
|
||||
if (mode >= 3 || p_vfo == NULL)
|
||||
{ // save the channel name
|
||||
EEPROM_WriteBuffer8(eeprom_addr + 0, name + 0);
|
||||
@ -468,7 +468,7 @@ void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_
|
||||
if (p_vfo != NULL)
|
||||
{
|
||||
memset(name, 0, sizeof(name));
|
||||
memmove(name, p_vfo->name, 10);
|
||||
memcpy(name, p_vfo->name, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ void UI_DrawBattery(uint8_t *bitmap, const unsigned int level, const unsigned in
|
||||
}
|
||||
else
|
||||
{
|
||||
memmove(bitmap, BITMAP_BATTERY_LEVEL, sizeof(BITMAP_BATTERY_LEVEL));
|
||||
memcpy(bitmap, BITMAP_BATTERY_LEVEL, sizeof(BITMAP_BATTERY_LEVEL));
|
||||
if (level > 1)
|
||||
{
|
||||
unsigned int i;
|
||||
|
28
ui/helper.c
28
ui/helper.c
@ -84,8 +84,8 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
|
||||
{
|
||||
const unsigned int index = pString[i] - ' ';
|
||||
const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||
memmove(g_frame_buffer[Line + 0] + ofs, &g_font_big[index][0], 8);
|
||||
memmove(g_frame_buffer[Line + 1] + ofs, &g_font_big[index][8], 7);
|
||||
memcpy(g_frame_buffer[Line + 0] + ofs, &g_font_big[index][0], 8);
|
||||
memcpy(g_frame_buffer[Line + 1] + ofs, &g_font_big[index][8], 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,7 @@ void UI_print_string(
|
||||
{
|
||||
const int c = (int)str[i] - ' ';
|
||||
if (c >= 0 && c < (int)font_size)
|
||||
memmove(f_buf + (char_pitch * i), font + (char_width * c), char_width);
|
||||
memcpy(f_buf + (char_pitch * i), font + (char_width * c), char_width);
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
|
||||
{
|
||||
const int c = (int)pString[i] - ' ';
|
||||
if (c >= 0 && c < (int)ARRAY_SIZE(g_font_small))
|
||||
memmove(buffer + (i * char_spacing) + 1, &g_font_small[c], char_width);
|
||||
memcpy(buffer + (i * char_spacing) + 1, &g_font_small[c], char_width);
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,8 +213,8 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
|
||||
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
|
||||
{
|
||||
bCanDisplay = true;
|
||||
memmove(pFb0, g_font_big_digits[Digit], char_width);
|
||||
memmove(pFb1, g_font_big_digits[Digit] + char_width, char_width);
|
||||
memcpy(pFb0, g_font_big_digits[Digit], char_width);
|
||||
memcpy(pFb1, g_font_big_digits[Digit] + char_width, char_width);
|
||||
}
|
||||
else
|
||||
if (flag)
|
||||
@ -235,8 +235,8 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
|
||||
while (i < 6)
|
||||
{
|
||||
const unsigned int Digit = pDigits[i++];
|
||||
memmove(pFb0, g_font_big_digits[Digit], char_width);
|
||||
memmove(pFb1, g_font_big_digits[Digit] + char_width, char_width);
|
||||
memcpy(pFb0, g_font_big_digits[Digit], char_width);
|
||||
memcpy(pFb1, g_font_big_digits[Digit] + char_width, char_width);
|
||||
pFb0 += char_width;
|
||||
pFb1 += char_width;
|
||||
}
|
||||
@ -257,10 +257,10 @@ void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bD
|
||||
if (bDisplayLeadingZero || bCanDisplay || c > 0)
|
||||
{
|
||||
#if 0
|
||||
memmove(pFb + 1, g_font_small_digits[c], char_width);
|
||||
memcpy(pFb + 1, g_font_small_digits[c], char_width);
|
||||
#else
|
||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
||||
memmove(pFb + 1, g_font_small[index], char_width);
|
||||
memcpy(pFb + 1, g_font_small[index], char_width);
|
||||
#endif
|
||||
pFb += spacing;
|
||||
bCanDisplay = true;
|
||||
@ -279,10 +279,10 @@ void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bD
|
||||
{
|
||||
const unsigned int c = pDigits[i++];
|
||||
#if 0
|
||||
memmove(pFb + 1, g_font_small_digits[c], char_width);
|
||||
memcpy(pFb + 1, g_font_small_digits[c], char_width);
|
||||
#else
|
||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
||||
memmove(pFb + 1, g_font_small[index], char_width);
|
||||
memcpy(pFb + 1, g_font_small[index], char_width);
|
||||
#endif
|
||||
pFb += spacing;
|
||||
}
|
||||
@ -303,10 +303,10 @@ void UI_Displaysmall_digits(const uint8_t size, const char *str, const uint8_t x
|
||||
if (display && c < 11)
|
||||
{
|
||||
#if 0
|
||||
memmove(g_frame_buffer[y] + xx, g_font_small_digits[c], char_width);
|
||||
memcpy(g_frame_buffer[y] + xx, g_font_small_digits[c], char_width);
|
||||
#else
|
||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
||||
memmove(g_frame_buffer[y] + xx + 1, g_font_small[index], char_width);
|
||||
memcpy(g_frame_buffer[y] + xx + 1, g_font_small[index], char_width);
|
||||
#endif
|
||||
xx += spacing;
|
||||
}
|
||||
|
168
ui/main.c
168
ui/main.c
@ -140,14 +140,14 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
switch (level)
|
||||
{
|
||||
default:
|
||||
case 7: memmove(p + 20, BITMAP_ANTENNA_LEVEL6, sizeof(BITMAP_ANTENNA_LEVEL6));
|
||||
case 6: memmove(p + 17, BITMAP_ANTENNA_LEVEL5, sizeof(BITMAP_ANTENNA_LEVEL5));
|
||||
case 5: memmove(p + 14, BITMAP_ANTENNA_LEVEL4, sizeof(BITMAP_ANTENNA_LEVEL4));
|
||||
case 4: memmove(p + 11, BITMAP_ANTENNA_LEVEL3, sizeof(BITMAP_ANTENNA_LEVEL3));
|
||||
case 3: memmove(p + 8, BITMAP_ANTENNA_LEVEL2, sizeof(BITMAP_ANTENNA_LEVEL2));
|
||||
case 2: memmove(p + 5, BITMAP_ANTENNA_LEVEL1, sizeof(BITMAP_ANTENNA_LEVEL1));
|
||||
case 1: memmove(p + 0, BITMAP_ANTENNA, sizeof(BITMAP_ANTENNA)); break;
|
||||
case 0: memset( p + 0, 0, sizeof(BITMAP_ANTENNA)); break;
|
||||
case 7: memcpy(p + 20, BITMAP_ANTENNA_LEVEL6, sizeof(BITMAP_ANTENNA_LEVEL6));
|
||||
case 6: memcpy(p + 17, BITMAP_ANTENNA_LEVEL5, sizeof(BITMAP_ANTENNA_LEVEL5));
|
||||
case 5: memcpy(p + 14, BITMAP_ANTENNA_LEVEL4, sizeof(BITMAP_ANTENNA_LEVEL4));
|
||||
case 4: memcpy(p + 11, BITMAP_ANTENNA_LEVEL3, sizeof(BITMAP_ANTENNA_LEVEL3));
|
||||
case 3: memcpy(p + 8, BITMAP_ANTENNA_LEVEL2, sizeof(BITMAP_ANTENNA_LEVEL2));
|
||||
case 2: memcpy(p + 5, BITMAP_ANTENNA_LEVEL1, sizeof(BITMAP_ANTENNA_LEVEL1));
|
||||
case 1: memcpy(p + 0, BITMAP_ANTENNA, sizeof(BITMAP_ANTENNA)); break;
|
||||
case 0: memset(p + 0, 0, sizeof(BITMAP_ANTENNA)); break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
@ -405,7 +405,7 @@ void UI_DisplayMain(void)
|
||||
#endif
|
||||
const unsigned int line0 = 0; // text screen line
|
||||
const unsigned int line1 = 4;
|
||||
char String[22];
|
||||
char str[22];
|
||||
unsigned int vfo_num;
|
||||
|
||||
center_line = CENTER_LINE_NONE;
|
||||
@ -474,29 +474,29 @@ void UI_DisplayMain(void)
|
||||
memset(contact, 0, sizeof(contact));
|
||||
if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT)
|
||||
{
|
||||
strcpy(String, (g_dtmf_state == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT RESP" : "CALL OUT");
|
||||
strcpy(str, (g_dtmf_state == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT RESP" : "CALL OUT");
|
||||
}
|
||||
else
|
||||
if (g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED || g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||
{
|
||||
const bool found = DTMF_FindContact(g_dtmf_caller, contact);
|
||||
contact[8] = 0;
|
||||
sprintf(String, "FROM %s", found ? contact : g_dtmf_caller);
|
||||
sprintf(str, "FROM %s", found ? contact : g_dtmf_caller);
|
||||
}
|
||||
else
|
||||
if (g_dtmf_is_tx)
|
||||
{
|
||||
strcpy(String, (g_dtmf_state == DTMF_STATE_TX_SUCC) ? "DTMF TX SUCC" : "DTMF TX");
|
||||
strcpy(str, (g_dtmf_state == DTMF_STATE_TX_SUCC) ? "DTMF TX SUCC" : "DTMF TX");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(String, ">%s", g_dtmf_input_box);
|
||||
sprintf(str, ">%s", g_dtmf_input_box);
|
||||
}
|
||||
String[16] = 0;
|
||||
UI_PrintString(String, 2, 0, 0 + (vfo_num * 3), 8);
|
||||
str[16] = 0;
|
||||
UI_PrintString(str, 2, 0, 0 + (vfo_num * 3), 8);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
memset(str, 0, sizeof(str));
|
||||
if (!g_dtmf_input_mode)
|
||||
{
|
||||
memset(contact, 0, sizeof(contact));
|
||||
@ -504,23 +504,23 @@ void UI_DisplayMain(void)
|
||||
{
|
||||
const bool found = DTMF_FindContact(g_dtmf_string, contact);
|
||||
contact[15] = 0;
|
||||
sprintf(String, ">%s", found ? contact : g_dtmf_string);
|
||||
sprintf(str, ">%s", found ? contact : g_dtmf_string);
|
||||
}
|
||||
else
|
||||
if (g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED || g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||
{
|
||||
const bool found = DTMF_FindContact(g_dtmf_callee, contact);
|
||||
contact[15] = 0;
|
||||
sprintf(String, ">%s", found ? contact : g_dtmf_callee);
|
||||
sprintf(str, ">%s", found ? contact : g_dtmf_callee);
|
||||
}
|
||||
else
|
||||
if (g_dtmf_is_tx)
|
||||
{
|
||||
sprintf(String, ">%s", g_dtmf_string);
|
||||
sprintf(str, ">%s", g_dtmf_string);
|
||||
}
|
||||
}
|
||||
String[16] = 0;
|
||||
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
||||
str[16] = 0;
|
||||
UI_PrintString(str, 2, 0, 2 + (vfo_num * 3), 8);
|
||||
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
continue;
|
||||
@ -528,19 +528,19 @@ void UI_DisplayMain(void)
|
||||
|
||||
// highlight the selected/used VFO with a marker
|
||||
if (!single_vfo && same_vfo)
|
||||
memmove(p_line0 + 0, BITMAP_VFO_DEFAULT, sizeof(BITMAP_VFO_DEFAULT));
|
||||
memcpy(p_line0 + 0, BITMAP_VFO_DEFAULT, sizeof(BITMAP_VFO_DEFAULT));
|
||||
else
|
||||
if (g_eeprom.cross_vfo_rx_tx != CROSS_BAND_OFF)
|
||||
memmove(p_line0 + 0, BITMAP_VFO_NOT_DEFAULT, sizeof(BITMAP_VFO_NOT_DEFAULT));
|
||||
memcpy(p_line0 + 0, BITMAP_VFO_NOT_DEFAULT, sizeof(BITMAP_VFO_NOT_DEFAULT));
|
||||
}
|
||||
else
|
||||
if (!single_vfo)
|
||||
{ // highlight the selected/used VFO with a marker
|
||||
if (same_vfo)
|
||||
memmove(p_line0 + 0, BITMAP_VFO_DEFAULT, sizeof(BITMAP_VFO_DEFAULT));
|
||||
memcpy(p_line0 + 0, BITMAP_VFO_DEFAULT, sizeof(BITMAP_VFO_DEFAULT));
|
||||
else
|
||||
//if (g_eeprom.cross_vfo_rx_tx != CROSS_BAND_OFF)
|
||||
memmove(p_line0 + 0, BITMAP_VFO_NOT_DEFAULT, sizeof(BITMAP_VFO_NOT_DEFAULT));
|
||||
memcpy(p_line0 + 0, BITMAP_VFO_NOT_DEFAULT, sizeof(BITMAP_VFO_NOT_DEFAULT));
|
||||
}
|
||||
|
||||
if (g_current_function == FUNCTION_TRANSMIT)
|
||||
@ -585,11 +585,11 @@ void UI_DisplayMain(void)
|
||||
const unsigned int x = 2;
|
||||
const bool inputting = (g_input_box_index == 0 || g_eeprom.tx_vfo != vfo_num) ? false : true;
|
||||
if (!inputting)
|
||||
NUMBER_ToDigits(g_eeprom.screen_channel[vfo_num] + 1, String); // show the memory channel number
|
||||
NUMBER_ToDigits(g_eeprom.screen_channel[vfo_num] + 1, str); // show the memory channel number
|
||||
else
|
||||
memmove(String + 5, g_input_box, 3); // show the input text
|
||||
memcpy(str + 5, g_input_box, 3); // show the input text
|
||||
UI_PrintStringSmall("M", x, 0, line + 1);
|
||||
UI_Displaysmall_digits(3, String + 5, x + 7, line + 1, inputting);
|
||||
UI_Displaysmall_digits(3, str + 5, x + 7, line + 1, inputting);
|
||||
}
|
||||
else
|
||||
if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]))
|
||||
@ -597,21 +597,21 @@ void UI_DisplayMain(void)
|
||||
// show the frequency band number
|
||||
const unsigned int x = 2; // was 14
|
||||
// sprintf(String, "FB%u", 1 + g_eeprom.screen_channel[vfo_num] - FREQ_CHANNEL_FIRST);
|
||||
sprintf(String, "VFO%u", 1 + g_eeprom.screen_channel[vfo_num] - FREQ_CHANNEL_FIRST);
|
||||
UI_PrintStringSmall(String, x, 0, line + 1);
|
||||
sprintf(str, "VFO%u", 1 + g_eeprom.screen_channel[vfo_num] - FREQ_CHANNEL_FIRST);
|
||||
UI_PrintStringSmall(str, x, 0, line + 1);
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
{
|
||||
if (g_input_box_index == 0 || g_eeprom.tx_vfo != vfo_num)
|
||||
{ // channel number
|
||||
sprintf(String, "N%u", 1 + g_eeprom.screen_channel[vfo_num] - NOAA_CHANNEL_FIRST);
|
||||
sprintf(str, "N%u", 1 + g_eeprom.screen_channel[vfo_num] - NOAA_CHANNEL_FIRST);
|
||||
}
|
||||
else
|
||||
{ // user entering channel number
|
||||
sprintf(String, "N%u%u", '0' + g_input_box[0], '0' + g_input_box[1]);
|
||||
sprintf(str, "N%u%u", '0' + g_input_box[0], '0' + g_input_box[1]);
|
||||
}
|
||||
UI_PrintStringSmall(String, 7, 0, line + 1);
|
||||
UI_PrintStringSmall(str, 7, 0, line + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -663,58 +663,58 @@ void UI_DisplayMain(void)
|
||||
case MDF_FREQUENCY: // just channel frequency
|
||||
|
||||
#ifdef ENABLE_BIG_FREQ
|
||||
NUMBER_ToDigits(frequency, String);
|
||||
NUMBER_ToDigits(frequency, str);
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, x, line, false, false);
|
||||
UI_DisplayFrequency(str, x, line, false, false);
|
||||
// show the remaining 2 small frequency digits
|
||||
UI_Displaysmall_digits(2, String + 6, x + 81, line + 1, true);
|
||||
UI_Displaysmall_digits(2, str + 6, x + 81, line + 1, true);
|
||||
#else
|
||||
// show the frequency in the main font
|
||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||
NUMBER_trim_trailing_zeros(String);
|
||||
NUMBER_trim_trailing_zeros(str);
|
||||
#endif
|
||||
UI_PrintString(String, x, 0, line, 8);
|
||||
UI_PrintString(str, x, 0, line, 8);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
case MDF_CHANNEL: // just channel number
|
||||
|
||||
sprintf(String, "CH-%03u", g_eeprom.screen_channel[vfo_num] + 1);
|
||||
UI_PrintString(String, x, 0, line, 8);
|
||||
sprintf(str, "CH-%03u", g_eeprom.screen_channel[vfo_num] + 1);
|
||||
UI_PrintString(str, x, 0, line, 8);
|
||||
|
||||
break;
|
||||
|
||||
case MDF_NAME: // channel name
|
||||
case MDF_NAME_FREQ: // channel name and frequency
|
||||
|
||||
BOARD_fetchChannelName(String, g_eeprom.screen_channel[vfo_num]);
|
||||
if (String[0] == 0)
|
||||
BOARD_fetchChannelName(str, g_eeprom.screen_channel[vfo_num]);
|
||||
if (str[0] == 0)
|
||||
{ // no channel name available, channel number instead
|
||||
sprintf(String, "CH-%03u", 1 + g_eeprom.screen_channel[vfo_num]);
|
||||
sprintf(str, "CH-%03u", 1 + g_eeprom.screen_channel[vfo_num]);
|
||||
}
|
||||
|
||||
if (g_eeprom.channel_display_mode == MDF_NAME)
|
||||
{ // just the name
|
||||
UI_PrintString(String, x + 4, 0, line, 8);
|
||||
UI_PrintString(str, x + 4, 0, line, 8);
|
||||
}
|
||||
else
|
||||
{ // name & frequency
|
||||
|
||||
// name
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
UI_PrintStringSmallBold(String, x + 4, 0, line);
|
||||
UI_PrintStringSmallBold(str, x + 4, 0, line);
|
||||
#else
|
||||
UI_PrintStringSmall(String, x + 4, 0, line);
|
||||
UI_PrintStringSmall(str, x + 4, 0, line);
|
||||
#endif
|
||||
|
||||
// frequency
|
||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||
NUMBER_trim_trailing_zeros(String);
|
||||
NUMBER_trim_trailing_zeros(str);
|
||||
#endif
|
||||
UI_PrintStringSmall(String, x + 4, 0, line + 1);
|
||||
UI_PrintStringSmall(str, x + 4, 0, line + 1);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -727,22 +727,22 @@ void UI_DisplayMain(void)
|
||||
{ // frequency mode
|
||||
#ifdef ENABLE_BIG_FREQ
|
||||
|
||||
NUMBER_ToDigits(frequency, String); // 8 digits
|
||||
NUMBER_ToDigits(frequency, str); // 8 digits
|
||||
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, x, line, false, false);
|
||||
UI_DisplayFrequency(str, x, line, false, false);
|
||||
|
||||
// show the remaining 2 small frequency digits
|
||||
UI_Displaysmall_digits(2, String + 6, x + 81, line + 1, true);
|
||||
UI_Displaysmall_digits(2, str + 6, x + 81, line + 1, true);
|
||||
|
||||
#else
|
||||
// show the frequency in the main font
|
||||
|
||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||
NUMBER_trim_trailing_zeros(String);
|
||||
NUMBER_trim_trailing_zeros(str);
|
||||
#endif
|
||||
UI_PrintString(String, x, 0, line, 8);
|
||||
UI_PrintString(str, x, 0, line, 8);
|
||||
|
||||
#endif
|
||||
}
|
||||
@ -758,11 +758,11 @@ void UI_DisplayMain(void)
|
||||
const uint8_t attributes = g_user_channel_attributes[g_eeprom.screen_channel[vfo_num]];
|
||||
|
||||
if (attributes & USER_CH_SCANLIST1)
|
||||
memmove(p_line0 + x, BITMAP_SCANLIST1, sizeof(BITMAP_SCANLIST1));
|
||||
memcpy(p_line0 + x, BITMAP_SCANLIST1, sizeof(BITMAP_SCANLIST1));
|
||||
x += sizeof(BITMAP_SCANLIST1);
|
||||
|
||||
if (attributes & USER_CH_SCANLIST2)
|
||||
memmove(p_line0 + x, BITMAP_SCANLIST2, sizeof(BITMAP_SCANLIST2));
|
||||
memcpy(p_line0 + x, BITMAP_SCANLIST2, sizeof(BITMAP_SCANLIST2));
|
||||
//x += sizeof(BITMAP_SCANLIST2);
|
||||
}
|
||||
|
||||
@ -779,8 +779,8 @@ void UI_DisplayMain(void)
|
||||
//g_eeprom.vfo_info[vfo_num].freq_in_channel = BOARD_find_channel(frequency);
|
||||
if (g_eeprom.vfo_info[vfo_num].freq_in_channel <= USER_CHANNEL_LAST)
|
||||
{ // the channel number that contains this VFO frequency
|
||||
sprintf(String, "%03u", 1 + g_eeprom.vfo_info[vfo_num].freq_in_channel);
|
||||
UI_PrintStringSmallest(String, x, (line + 0) * 8, false, true);
|
||||
sprintf(str, "%03u", 1 + g_eeprom.vfo_info[vfo_num].freq_in_channel);
|
||||
UI_PrintStringSmallest(str, x, (line + 0) * 8, false, true);
|
||||
}
|
||||
}
|
||||
x += smallest_char_spacing * 4;
|
||||
@ -821,10 +821,10 @@ void UI_DisplayMain(void)
|
||||
|
||||
// ************
|
||||
|
||||
String[0] = '\0';
|
||||
str[0] = '\0';
|
||||
if (g_eeprom.vfo_info[vfo_num].am_mode)
|
||||
{ // show the AM symbol
|
||||
strcpy(String, "AM");
|
||||
strcpy(str, "AM");
|
||||
}
|
||||
else
|
||||
{ // or show the CTCSS/DCS symbol
|
||||
@ -832,26 +832,26 @@ void UI_DisplayMain(void)
|
||||
const unsigned int code_type = pConfig->code_type;
|
||||
const char *code_list[] = {"", "CT", "DCS", "DCR"};
|
||||
if (code_type < ARRAY_SIZE(code_list))
|
||||
strcpy(String, code_list[code_type]);
|
||||
strcpy(str, code_list[code_type]);
|
||||
}
|
||||
UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, line + 1);
|
||||
UI_PrintStringSmall(str, LCD_WIDTH + 24, 0, line + 1);
|
||||
|
||||
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM)
|
||||
{ // show the TX power
|
||||
const char pwr_list[] = "LMH";
|
||||
const unsigned int i = g_eeprom.vfo_info[vfo_num].output_power;
|
||||
String[0] = (i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
|
||||
String[1] = '\0';
|
||||
UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, line + 1);
|
||||
str[0] = (i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
|
||||
str[1] = '\0';
|
||||
UI_PrintStringSmall(str, LCD_WIDTH + 46, 0, line + 1);
|
||||
}
|
||||
|
||||
if (g_eeprom.vfo_info[vfo_num].freq_config_rx.frequency != g_eeprom.vfo_info[vfo_num].freq_config_tx.frequency)
|
||||
{ // show the TX offset symbol
|
||||
const char dir_list[] = "\0+-";
|
||||
const unsigned int i = g_eeprom.vfo_info[vfo_num].tx_offset_freq_dir;
|
||||
String[0] = (i < sizeof(dir_list)) ? dir_list[i] : '?';
|
||||
String[1] = '\0';
|
||||
UI_PrintStringSmall(String, LCD_WIDTH + 54, 0, line + 1);
|
||||
str[0] = (i < sizeof(dir_list)) ? dir_list[i] : '?';
|
||||
str[1] = '\0';
|
||||
UI_PrintStringSmall(str, LCD_WIDTH + 54, 0, line + 1);
|
||||
}
|
||||
|
||||
// show the TX/RX reverse symbol
|
||||
@ -859,13 +859,13 @@ void UI_DisplayMain(void)
|
||||
UI_PrintStringSmall("R", LCD_WIDTH + 62, 0, line + 1);
|
||||
|
||||
{ // show the narrow band symbol
|
||||
String[0] = '\0';
|
||||
str[0] = '\0';
|
||||
if (g_eeprom.vfo_info[vfo_num].channel_bandwidth == BANDWIDTH_NARROW)
|
||||
{
|
||||
String[0] = 'N';
|
||||
String[1] = '\0';
|
||||
str[0] = 'N';
|
||||
str[1] = '\0';
|
||||
}
|
||||
UI_PrintStringSmall(String, LCD_WIDTH + 70, 0, line + 1);
|
||||
UI_PrintStringSmall(str, LCD_WIDTH + 70, 0, line + 1);
|
||||
}
|
||||
|
||||
// show the DTMF decoding symbol
|
||||
@ -917,8 +917,8 @@ void UI_DisplayMain(void)
|
||||
return;
|
||||
|
||||
center_line = CENTER_LINE_AM_FIX_DATA;
|
||||
AM_fix_print_data(g_eeprom.rx_vfo, String);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
AM_fix_print_data(g_eeprom.rx_vfo, str);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -946,9 +946,9 @@ void UI_DisplayMain(void)
|
||||
|
||||
center_line = CENTER_LINE_DTMF_DEC;
|
||||
|
||||
strcpy(String, "DTMF ");
|
||||
strcat(String, g_dtmf_rx_live + idx);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
strcpy(str, "DTMF ");
|
||||
strcat(str, g_dtmf_rx_live + idx);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
#else
|
||||
if (g_setting_live_dtmf_decoder && g_dtmf_rx_index > 0)
|
||||
@ -961,9 +961,9 @@ void UI_DisplayMain(void)
|
||||
|
||||
center_line = CENTER_LINE_DTMF_DEC;
|
||||
|
||||
strcpy(String, "DTMF ");
|
||||
strcat(String, g_dtmf_rx + idx);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
strcpy(str, "DTMF ");
|
||||
strcat(str, g_dtmf_rx + idx);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -976,10 +976,10 @@ void UI_DisplayMain(void)
|
||||
|
||||
center_line = CENTER_LINE_CHARGE_DATA;
|
||||
|
||||
sprintf(String, "Charge %u.%02uV %u%%",
|
||||
sprintf(str, "Charge %u.%02uV %u%%",
|
||||
g_battery_voltage_average / 100, g_battery_voltage_average % 100,
|
||||
BATTERY_VoltsToPercent(g_battery_voltage_average));
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
362
ui/menu.c
362
ui/menu.c
@ -452,7 +452,7 @@ void UI_DisplayMenu(void)
|
||||
const unsigned int sub_menu_x1 = (8 * menu_list_width) + 2; // start x corrd
|
||||
const unsigned int sub_menu_x2 = LCD_WIDTH - 1; // end x coord
|
||||
unsigned int i;
|
||||
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||
char str[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||
|
||||
// clear the screen buffer
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
@ -478,11 +478,11 @@ void UI_DisplayMenu(void)
|
||||
|
||||
// draw the little sub-menu triangle marker
|
||||
if (g_in_sub_menu)
|
||||
memmove(g_frame_buffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
memcpy(g_frame_buffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
|
||||
// draw the menu index number/count
|
||||
sprintf(String, "%2u.%u", 1 + g_menu_cursor, g_menu_list_count);
|
||||
UI_PrintStringSmall(String, 2, 0, 6);
|
||||
sprintf(str, "%2u.%u", 1 + g_menu_cursor, g_menu_list_count);
|
||||
UI_PrintStringSmall(str, 2, 0, 6);
|
||||
|
||||
#else
|
||||
{ // new menu layout .. experimental & unfinished
|
||||
@ -520,21 +520,21 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
|
||||
// draw the menu index number/count
|
||||
sprintf(String, "%2u.%u", 1 + g_menu_cursor, g_menu_list_count);
|
||||
UI_PrintStringSmall(String, 2, 0, 6);
|
||||
sprintf(str, "%2u.%u", 1 + g_menu_cursor, g_menu_list_count);
|
||||
UI_PrintStringSmall(str, 2, 0, 6);
|
||||
}
|
||||
else
|
||||
if (menu_index >= 0 && menu_index < (int)g_menu_list_count)
|
||||
{ // current menu item
|
||||
strcpy(String, g_menu_list[g_menu_list_sorted[menu_index]].name);
|
||||
UI_PrintString(String, 0, 0, 0, 8);
|
||||
strcpy(str, g_menu_list[g_menu_list_sorted[menu_index]].name);
|
||||
UI_PrintString(str, 0, 0, 0, 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// **************
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
memset(str, 0, sizeof(str));
|
||||
|
||||
bool already_printed = false;
|
||||
|
||||
@ -544,15 +544,15 @@ void UI_DisplayMenu(void)
|
||||
switch (g_menu_cursor)
|
||||
{
|
||||
case MENU_SQL:
|
||||
strcpy(String, "MAIN SQL\n");
|
||||
sprintf(String + strlen(String), "%d\n ", g_sub_menu_selection);
|
||||
strcpy(str, "MAIN SQL\n");
|
||||
sprintf(str + strlen(str), "%d\n ", g_sub_menu_selection);
|
||||
break;
|
||||
|
||||
case MENU_CHAN_SQL:
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcpy(String, "USE\nMAIN SQL");
|
||||
strcpy(str, "USE\nMAIN SQL");
|
||||
else
|
||||
sprintf(String, "%d", g_sub_menu_selection);
|
||||
sprintf(str, "%d", g_sub_menu_selection);
|
||||
// g_tx_vfo->squelch_level = g_sub_menu_selection;
|
||||
// RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
|
||||
break;
|
||||
@ -560,7 +560,7 @@ void UI_DisplayMenu(void)
|
||||
case MENU_MIC_GAIN:
|
||||
{ // display the mic gain in actual dB rather than just an index number
|
||||
const uint8_t mic = g_mic_gain_dB_2[g_sub_menu_selection];
|
||||
sprintf(String, "+%u.%udB", mic / 2, mic % 2);
|
||||
sprintf(str, "+%u.%udB", mic / 2, mic % 2);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -570,44 +570,44 @@ void UI_DisplayMenu(void)
|
||||
const uint32_t step = (uint32_t)STEP_FREQ_TABLE[step_freq_table_sorted[g_sub_menu_selection]] * 10;
|
||||
if (step < 1000)
|
||||
{ // Hz
|
||||
sprintf(String, "%uHz", step);
|
||||
sprintf(str, "%uHz", step);
|
||||
}
|
||||
else
|
||||
{ // kHz
|
||||
sprintf(String, "%u.%03u", step / 1000, step % 1000);
|
||||
NUMBER_trim_trailing_zeros(String);
|
||||
strcat(String, "kHz");
|
||||
sprintf(str, "%u.%03u", step / 1000, step % 1000);
|
||||
NUMBER_trim_trailing_zeros(str);
|
||||
strcat(str, "kHz");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_TX_POWER:
|
||||
strcpy(String, g_sub_menu_tx_power[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_tx_power[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_RX_CDCSS:
|
||||
case MENU_TX_CDCSS:
|
||||
strcpy(String, "CDCSS\n");
|
||||
strcpy(str, "CDCSS\n");
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcat(String, "OFF");
|
||||
strcat(str, "OFF");
|
||||
else
|
||||
if (g_sub_menu_selection < 105)
|
||||
sprintf(String + strlen(String), "D%03oN", DCS_OPTIONS[g_sub_menu_selection - 1]);
|
||||
sprintf(str + strlen(str), "D%03oN", DCS_OPTIONS[g_sub_menu_selection - 1]);
|
||||
else
|
||||
sprintf(String + strlen(String), "D%03oI", DCS_OPTIONS[g_sub_menu_selection - 105]);
|
||||
sprintf(str + strlen(str), "D%03oI", DCS_OPTIONS[g_sub_menu_selection - 105]);
|
||||
break;
|
||||
|
||||
case MENU_RX_CTCSS:
|
||||
case MENU_TX_CTCSS:
|
||||
{
|
||||
strcpy(String, "CTCSS\n");
|
||||
strcpy(str, "CTCSS\n");
|
||||
#if 1
|
||||
// set CTCSS as the user adjusts it
|
||||
unsigned int Code;
|
||||
freq_config_t *pConfig = (g_menu_cursor == MENU_RX_CTCSS) ? &g_tx_vfo->freq_config_rx : &g_tx_vfo->freq_config_tx;
|
||||
if (g_sub_menu_selection == 0)
|
||||
{
|
||||
strcat(String, "OFF");
|
||||
strcat(str, "OFF");
|
||||
|
||||
if (pConfig->code_type != CODE_TYPE_CONTINUOUS_TONE)
|
||||
break;
|
||||
@ -620,7 +620,7 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(String + strlen(String), "%u.%uHz", CTCSS_OPTIONS[g_sub_menu_selection - 1] / 10, CTCSS_OPTIONS[g_sub_menu_selection - 1] % 10);
|
||||
sprintf(str + strlen(str), "%u.%uHz", CTCSS_OPTIONS[g_sub_menu_selection - 1] / 10, CTCSS_OPTIONS[g_sub_menu_selection - 1] % 10);
|
||||
|
||||
pConfig->code_type = CODE_TYPE_CONTINUOUS_TONE;
|
||||
Code = g_sub_menu_selection - 1;
|
||||
@ -630,37 +630,37 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
#else
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcat(String, "OFF");
|
||||
strcat(str, "OFF");
|
||||
else
|
||||
sprintf(String + strlen(String), "%u.%uHz", CTCSS_OPTIONS[g_sub_menu_selection - 1] / 10, CTCSS_OPTIONS[g_sub_menu_selection - 1] % 10);
|
||||
sprintf(str + strlen(str), "%u.%uHz", CTCSS_OPTIONS[g_sub_menu_selection - 1] / 10, CTCSS_OPTIONS[g_sub_menu_selection - 1] % 10);
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_SHIFT_DIR:
|
||||
strcpy(String, g_sub_menu_shift_dir[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_shift_dir[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_OFFSET:
|
||||
if (!g_in_sub_menu || g_input_box_index == 0)
|
||||
{
|
||||
sprintf(String, "%d.%05u", g_sub_menu_selection / 100000, abs(g_sub_menu_selection) % 100000);
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, 1, 8);
|
||||
sprintf(str, "%d.%05u", g_sub_menu_selection / 100000, abs(g_sub_menu_selection) % 100000);
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 1, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
String[i + 0] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
String[3] = '.';
|
||||
str[i + 0] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
str[3] = '.';
|
||||
for (i = 3; i < 6; i++)
|
||||
String[i + 1] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
String[ 7] = '-';
|
||||
String[ 8] = '-';
|
||||
String[ 9] = 0;
|
||||
String[10] = 0;
|
||||
String[11] = 0;
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, 1, 8);
|
||||
str[i + 1] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
str[ 7] = '-';
|
||||
str[ 8] = '-';
|
||||
str[ 9] = 0;
|
||||
str[10] = 0;
|
||||
str[11] = 0;
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 1, 8);
|
||||
}
|
||||
|
||||
UI_PrintString("MHz", sub_menu_x1, sub_menu_x2, 3, 8);
|
||||
@ -669,12 +669,12 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_BANDWIDTH:
|
||||
strcpy(String, g_sub_menu_bandwidth[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_bandwidth[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_SCRAMBLER:
|
||||
strcpy(String, "INVERT\n");
|
||||
strcat(String, g_sub_menu_scrambler[g_sub_menu_selection]);
|
||||
strcpy(str, "INVERT\n");
|
||||
strcat(str, g_sub_menu_scrambler[g_sub_menu_selection]);
|
||||
|
||||
#if 1
|
||||
if (g_sub_menu_selection > 0 && g_setting_scramble_enable)
|
||||
@ -687,29 +687,29 @@ void UI_DisplayMenu(void)
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcpy(String, "OFF");
|
||||
strcpy(str, "OFF");
|
||||
else
|
||||
sprintf(String, "%d", g_sub_menu_selection);
|
||||
sprintf(str, "%d", g_sub_menu_selection);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_AUTO_BACKLITE:
|
||||
strcpy(String, "BACKLITE\n");
|
||||
strcat(String, g_sub_menu_backlight[g_sub_menu_selection]);
|
||||
strcpy(str, "BACKLITE\n");
|
||||
strcat(str, g_sub_menu_backlight[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_AUTO_BACKLITE_ON_TX_RX:
|
||||
strcpy(String, "BACKLITE\n");
|
||||
strcat(String, g_sub_menu_rx_tx[g_sub_menu_selection]);
|
||||
strcpy(str, "BACKLITE\n");
|
||||
strcat(str, g_sub_menu_rx_tx[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_MOD_MODE:
|
||||
strcpy(String, (g_sub_menu_selection == 0) ? "FM" : "AM");
|
||||
strcpy(str, (g_sub_menu_selection == 0) ? "FM" : "AM");
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
case MENU_AM_FIX_TEST1:
|
||||
strcpy(String, g_sub_menu_AM_FIX_test1[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_AM_FIX_test1[g_sub_menu_selection]);
|
||||
// g_setting_am_fix = g_sub_menu_selection;
|
||||
break;
|
||||
#endif
|
||||
@ -717,20 +717,20 @@ void UI_DisplayMenu(void)
|
||||
#ifdef ENABLE_KEYLOCK
|
||||
case MENU_AUTO_KEY_LOCK:
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcpy(String, "OFF");
|
||||
strcpy(str, "OFF");
|
||||
else
|
||||
sprintf(String, "%u secs", key_lock_timeout_500ms / 2);
|
||||
sprintf(str, "%u secs", key_lock_timeout_500ms / 2);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_COMPAND:
|
||||
strcpy(String, g_sub_menu_rx_tx[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_rx_tx[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_CONTRAST
|
||||
case MENU_CONTRAST:
|
||||
strcpy(String, "CONTRAST\n");
|
||||
sprintf(String + strlen(String), "%d", g_sub_menu_selection);
|
||||
strcpy(str, "CONTRAST\n");
|
||||
sprintf(str + strlen(str), "%d", g_sub_menu_selection);
|
||||
//g_setting_contrast = g_sub_menu_selection
|
||||
ST7565_SetContrast(g_sub_menu_selection);
|
||||
g_update_display = true;
|
||||
@ -748,70 +748,70 @@ void UI_DisplayMenu(void)
|
||||
#endif
|
||||
case MENU_S_ADD1:
|
||||
case MENU_S_ADD2:
|
||||
strcpy(String, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_BUSY_CHAN_LOCK:
|
||||
strcpy(String, "BSY CH TX\nLOCKOUT\n");
|
||||
strcat(String, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
strcpy(str, "BSY CH TX\nLOCKOUT\n");
|
||||
strcat(str, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_DTMF_DCD:
|
||||
case MENU_DTMF_LIVE_DEC:
|
||||
strcpy(String, "DTMF\nDECODE\n");
|
||||
strcat(String, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
strcpy(str, "DTMF\nDECODE\n");
|
||||
strcat(str, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_STE:
|
||||
strcpy(String, "SUB TAIL\nELIMIN\n");
|
||||
strcat(String, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
strcpy(str, "SUB TAIL\nELIMIN\n");
|
||||
strcat(str, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_BEEP:
|
||||
strcpy(String, "KEY BEEP\n");
|
||||
strcat(String + strlen(String), g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
strcpy(str, "KEY BEEP\n");
|
||||
strcat(str + strlen(str), g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_DTMF_ST:
|
||||
strcpy(String, "DTMF\nSIDETONE\n");
|
||||
strcat(String, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
strcpy(str, "DTMF\nSIDETONE\n");
|
||||
strcat(str, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_SCAN:
|
||||
strcpy(String, "SCAN\n");
|
||||
strcat(String, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
strcpy(str, "SCAN\n");
|
||||
strcat(str, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_350_EN:
|
||||
strcpy(String, "350~400\n");
|
||||
strcat(String, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
strcpy(str, "350~400\n");
|
||||
strcat(str, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_350_TX:
|
||||
strcpy(String, "TX\n350~400\n");
|
||||
strcat(String, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
strcpy(str, "TX\n350~400\n");
|
||||
strcat(str, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_174_TX:
|
||||
strcpy(String, "TX\n174~350\n");
|
||||
strcat(String, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
strcpy(str, "TX\n174~350\n");
|
||||
strcat(str, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_470_TX:
|
||||
strcpy(String, "TX\n470~600\n");
|
||||
strcat(String, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
strcpy(str, "TX\n470~600\n");
|
||||
strcat(str, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_SCRAMBLER_EN:
|
||||
strcpy(String, "SCRAMBLER\n");
|
||||
strcat(String, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
strcpy(str, "SCRAMBLER\n");
|
||||
strcat(str, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_TX_EN:
|
||||
strcpy(String, "TX\n");
|
||||
strcat(String, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
strcpy(str, "TX\n");
|
||||
strcat(str, g_sub_menu_dis_en[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_MEM_SAVE:
|
||||
@ -821,17 +821,17 @@ void UI_DisplayMenu(void)
|
||||
char s[11];
|
||||
const bool valid = RADIO_CheckValidChannel(g_sub_menu_selection, false, 0);
|
||||
|
||||
UI_GenerateChannelStringEx(String, valid ? "CH-" : "", g_sub_menu_selection);
|
||||
UI_GenerateChannelStringEx(str, valid ? "CH-" : "", g_sub_menu_selection);
|
||||
|
||||
// channel name
|
||||
BOARD_fetchChannelName(s, g_sub_menu_selection);
|
||||
strcat(String, "\n");
|
||||
strcat(String, (s[0] == 0) ? "--" : s);
|
||||
strcat(str, "\n");
|
||||
strcat(str, (s[0] == 0) ? "--" : s);
|
||||
|
||||
if (valid && !g_ask_for_confirmation)
|
||||
{ // show the frequency so that the user knows the channels frequency
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(g_sub_menu_selection);
|
||||
sprintf(String + strlen(String), "\n%u.%05u", frequency / 100000, frequency % 100000);
|
||||
sprintf(str + strlen(str), "\n%u.%05u", frequency / 100000, frequency % 100000);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -842,8 +842,8 @@ void UI_DisplayMenu(void)
|
||||
const bool valid = RADIO_CheckValidChannel(g_sub_menu_selection, false, 0);
|
||||
const unsigned int y = (!g_in_sub_menu || g_edit_index < 0) ? 1 : 0;
|
||||
|
||||
UI_GenerateChannelStringEx(String, valid ? "CH-" : "", g_sub_menu_selection);
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, y, 8);
|
||||
UI_GenerateChannelStringEx(str, valid ? "CH-" : "", g_sub_menu_selection);
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, y, 8);
|
||||
|
||||
if (valid)
|
||||
{
|
||||
@ -851,10 +851,10 @@ void UI_DisplayMenu(void)
|
||||
|
||||
if (!g_in_sub_menu || g_edit_index < 0)
|
||||
{ // show the channel name
|
||||
BOARD_fetchChannelName(String, g_sub_menu_selection);
|
||||
if (String[0] == 0)
|
||||
strcpy(String, "--");
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, y + 2, 8);
|
||||
BOARD_fetchChannelName(str, g_sub_menu_selection);
|
||||
if (str[0] == 0)
|
||||
strcpy(str, "--");
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, y + 2, 8);
|
||||
}
|
||||
else
|
||||
{ // show the channel name being edited
|
||||
@ -865,11 +865,11 @@ void UI_DisplayMenu(void)
|
||||
|
||||
if (!g_ask_for_confirmation)
|
||||
{ // show the frequency so that the user knows the channels frequency
|
||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
sprintf(str, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
if (!g_in_sub_menu || g_edit_index < 0)
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, y + 4, 8);
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, y + 4, 8);
|
||||
else
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, y + 5, 8);
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, y + 5, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@ -878,81 +878,81 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
|
||||
case MENU_BAT_SAVE:
|
||||
strcpy(String, g_sub_menu_bat_save[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_bat_save[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_DUAL_WATCH:
|
||||
// strcpy(String, g_sub_menu_dual_watch[g_sub_menu_selection]);
|
||||
strcpy(String, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_SCAN_HOLD:
|
||||
strcpy(String, "SCAN HOLD\n");
|
||||
sprintf(String + strlen(String), "%d.%d sec", g_sub_menu_selection / 2, 5 * (g_sub_menu_selection % 2));
|
||||
strcpy(str, "SCAN HOLD\n");
|
||||
sprintf(str + strlen(str), "%d.%d sec", g_sub_menu_selection / 2, 5 * (g_sub_menu_selection % 2));
|
||||
break;
|
||||
|
||||
case MENU_CROSS_VFO:
|
||||
strcpy(String, g_sub_menu_cross_vfo[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_cross_vfo[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_TX_TO:
|
||||
strcpy(String, g_sub_menu_tx_timeout[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_tx_timeout[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
case MENU_VOICE:
|
||||
strcpy(String, g_sub_menu_voice[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_voice[g_sub_menu_selection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_SCAN_CAR_RESUME:
|
||||
strcpy(String, "SCAN\nRESUME\n");
|
||||
strcat(String, g_sub_menu_scan_car_resume[g_sub_menu_selection]);
|
||||
strcpy(str, "SCAN\nRESUME\n");
|
||||
strcat(str, g_sub_menu_scan_car_resume[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_MEM_DISP:
|
||||
strcpy(String, g_sub_menu_mem_disp[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_mem_disp[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_RP_STE:
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcpy(String, "OFF");
|
||||
strcpy(str, "OFF");
|
||||
else
|
||||
sprintf(String, "%d*100ms", g_sub_menu_selection);
|
||||
sprintf(str, "%d*100ms", g_sub_menu_selection);
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
if (g_sub_menu_selection < 2)
|
||||
sprintf(String, "LIST%u", 1 + g_sub_menu_selection);
|
||||
sprintf(str, "LIST%u", 1 + g_sub_menu_selection);
|
||||
else
|
||||
strcpy(String, "ALL");
|
||||
strcpy(str, "ALL");
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
case MENU_ALARM_MODE:
|
||||
strcpy(String, "TX ALARM\n");
|
||||
sprintf(String + strlen(String), g_sub_menu_alarm_mode[g_sub_menu_selection]);
|
||||
strcpy(str, "TX ALARM\n");
|
||||
sprintf(str + strlen(str), g_sub_menu_alarm_mode[g_sub_menu_selection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ANI_ID:
|
||||
strcpy(String, "YOUR ID\n");
|
||||
strcat(String, g_eeprom.ani_dtmf_id);
|
||||
strcpy(str, "YOUR ID\n");
|
||||
strcat(str, g_eeprom.ani_dtmf_id);
|
||||
break;
|
||||
|
||||
case MENU_UP_CODE:
|
||||
strcpy(String, "PTT DTMF\nBEGIN\n");
|
||||
strcat(String, g_eeprom.dtmf_key_up_code);
|
||||
strcpy(str, "PTT DTMF\nBEGIN\n");
|
||||
strcat(str, g_eeprom.dtmf_key_up_code);
|
||||
break;
|
||||
|
||||
case MENU_DN_CODE:
|
||||
strcpy(String, "PTT DTMF\nEND\n");
|
||||
strcat(String, g_eeprom.dtmf_key_down_code);
|
||||
strcpy(str, "PTT DTMF\nEND\n");
|
||||
strcat(str, g_eeprom.dtmf_key_down_code);
|
||||
break;
|
||||
|
||||
case MENU_DTMF_RSP:
|
||||
strcpy(String, "DTMF\nRESPONSE\n");
|
||||
strcat(String, g_sub_menu_dtmf_rsp[g_sub_menu_selection]);
|
||||
strcpy(str, "DTMF\nRESPONSE\n");
|
||||
strcat(str, g_sub_menu_dtmf_rsp[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_DTMF_HOLD:
|
||||
@ -975,58 +975,58 @@ void UI_DisplayMenu(void)
|
||||
case 61: g_sub_menu_selection = 5; break;
|
||||
}
|
||||
|
||||
strcpy(String, "DTMF MSG\n");
|
||||
strcpy(str, "DTMF MSG\n");
|
||||
if (g_sub_menu_selection < DTMF_HOLD_MAX)
|
||||
sprintf(String + strlen(String), "%d sec", g_sub_menu_selection);
|
||||
sprintf(str + strlen(str), "%d sec", g_sub_menu_selection);
|
||||
else
|
||||
strcat(String, "STAY ON\nSCREEN"); // 60
|
||||
strcat(str, "STAY ON\nSCREEN"); // 60
|
||||
|
||||
break;
|
||||
|
||||
case MENU_DTMF_PRE:
|
||||
strcpy(String, "TX DTMF\nDELAY\n");
|
||||
strcpy(str, "TX DTMF\nDELAY\n");
|
||||
// sprintf(String + strlen(String), "%d*10ms", g_sub_menu_selection);
|
||||
sprintf(String + strlen(String), "%dms", 10 * g_sub_menu_selection);
|
||||
sprintf(str + strlen(str), "%dms", 10 * g_sub_menu_selection);
|
||||
break;
|
||||
|
||||
case MENU_PTT_ID:
|
||||
strcpy(String, (g_sub_menu_selection > 0) ? "TX ID\n" : "");
|
||||
strcat(String, g_sub_menu_ptt_id[g_sub_menu_selection]);
|
||||
strcpy(str, (g_sub_menu_selection > 0) ? "TX ID\n" : "");
|
||||
strcat(str, g_sub_menu_ptt_id[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
strcpy(String, g_sub_menu_bat_text[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_bat_text[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_DTMF_LIST:
|
||||
{
|
||||
char Contact[17];
|
||||
g_dtmf_is_contact_valid = DTMF_GetContact((int)g_sub_menu_selection - 1, Contact);
|
||||
strcpy(String, "DTMF\n");
|
||||
strcpy(str, "DTMF\n");
|
||||
if (!g_dtmf_is_contact_valid)
|
||||
{
|
||||
strcat(String, "NULL");
|
||||
strcat(str, "NULL");
|
||||
}
|
||||
else
|
||||
{
|
||||
memmove(String + strlen(String), Contact, 8);
|
||||
memcpy(str + strlen(str), Contact, 8);
|
||||
Contact[11] = 0;
|
||||
memmove(&g_dtmf_id, Contact + 8, 4);
|
||||
sprintf(String + strlen(String), "\nID:%s", Contact + 8);
|
||||
memcpy(&g_dtmf_id, Contact + 8, sizeof(g_dtmf_id));
|
||||
sprintf(str + strlen(str), "\nID:%s", Contact + 8);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_PON_MSG:
|
||||
strcpy(String, g_sub_menu_pwr_on_msg[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_pwr_on_msg[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_ROGER_MODE:
|
||||
strcpy(String, g_sub_menu_roger_mode[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_roger_mode[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_VOLTAGE:
|
||||
sprintf(String, "%u.%02uV\n%u%%\ncurr %u",
|
||||
sprintf(str, "%u.%02uV\n%u%%\ncurr %u",
|
||||
g_battery_voltage_average / 100, g_battery_voltage_average % 100,
|
||||
BATTERY_VoltsToPercent(g_battery_voltage_average),
|
||||
g_usb_current);
|
||||
@ -1037,7 +1037,7 @@ void UI_DisplayMenu(void)
|
||||
case MENU_SIDE1_LONG:
|
||||
case MENU_SIDE2_SHORT:
|
||||
case MENU_SIDE2_LONG:
|
||||
strcpy(String, g_sub_menu_side_butt[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_side_butt[g_sub_menu_selection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@ -1047,69 +1047,69 @@ void UI_DisplayMenu(void)
|
||||
unsigned int m = 0;
|
||||
unsigned int k = 0;
|
||||
i = 0;
|
||||
while (i < (sizeof(String) - 1) && k < slen)
|
||||
while (i < (sizeof(str) - 1) && k < slen)
|
||||
{
|
||||
const char c = Version_str[k++];
|
||||
if (c == ' ' || c == '-' || c == '_')
|
||||
{
|
||||
if (m >= 3)
|
||||
{
|
||||
String[i++] = '\n';
|
||||
str[i++] = '\n';
|
||||
m = 0;
|
||||
}
|
||||
else
|
||||
String[i++] = c;
|
||||
str[i++] = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
String[i++] = c;
|
||||
if (++m >= 9 && k < slen && i < (sizeof(String) - 1))
|
||||
str[i++] = c;
|
||||
if (++m >= 9 && k < slen && i < (sizeof(str) - 1))
|
||||
{
|
||||
if (m > 0)
|
||||
{
|
||||
m = 0;
|
||||
String[i++] = '\n';
|
||||
str[i++] = '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add the date and time
|
||||
strcat(String, "\n \n" __DATE__ "\n" __TIME__);
|
||||
strcat(str, "\n \n" __DATE__ "\n" __TIME__);
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_RESET:
|
||||
strcpy(String, g_sub_menu_reset[g_sub_menu_selection]);
|
||||
strcpy(str, g_sub_menu_reset[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_FREQ_LOCK:
|
||||
switch (g_sub_menu_selection)
|
||||
{
|
||||
case FREQ_LOCK_NORMAL:
|
||||
strcpy(String, "137~174\n400~470\n+ others");
|
||||
strcpy(str, "137~174\n400~470\n+ others");
|
||||
break;
|
||||
case FREQ_LOCK_FCC:
|
||||
strcpy(String, "FCC HAM\n144~148\n420~450");
|
||||
strcpy(str, "FCC HAM\n144~148\n420~450");
|
||||
break;
|
||||
case FREQ_LOCK_CE:
|
||||
strcpy(String, "CE HAM\n144~146\n430~440");
|
||||
strcpy(str, "CE HAM\n144~146\n430~440");
|
||||
break;
|
||||
case FREQ_LOCK_GB:
|
||||
strcpy(String, "GB HAM\n144~148\n430~440");
|
||||
strcpy(str, "GB HAM\n144~148\n430~440");
|
||||
break;
|
||||
case FREQ_LOCK_430:
|
||||
strcpy(String, "137~174\n400~430");
|
||||
strcpy(str, "137~174\n400~430");
|
||||
break;
|
||||
case FREQ_LOCK_438:
|
||||
strcpy(String, "137~174\n400~438");
|
||||
strcpy(str, "137~174\n400~438");
|
||||
break;
|
||||
case FREQ_LOCK_446:
|
||||
strcpy(String, "446.00625\n~\n446.19375");
|
||||
strcpy(str, "446.00625\n~\n446.19375");
|
||||
break;
|
||||
#ifdef ENABLE_TX_UNLOCK
|
||||
case FREQ_LOCK_TX_UNLOCK:
|
||||
sprintf(String, "UNLOCKED\n%u~%u", BX4819_BAND1.lower / 100000, BX4819_BAND2.upper / 100000);
|
||||
sprintf(str, "UNLOCKED\n%u~%u", BX4819_BAND1.lower / 100000, BX4819_BAND2.upper / 100000);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
@ -1123,7 +1123,7 @@ void UI_DisplayMenu(void)
|
||||
|
||||
writeXtalFreqCal(g_sub_menu_selection, false);
|
||||
|
||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||
sprintf(str, "%d\n%u.%06u\nMHz",
|
||||
g_sub_menu_selection,
|
||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
}
|
||||
@ -1134,9 +1134,9 @@ void UI_DisplayMenu(void)
|
||||
{
|
||||
const uint16_t vol = (uint32_t)g_battery_voltage_average * g_battery_calibration[3] / g_sub_menu_selection;
|
||||
if (!g_in_sub_menu)
|
||||
sprintf(String, "%u.%02uV\n%d", vol / 100, vol % 100, g_sub_menu_selection);
|
||||
sprintf(str, "%u.%02uV\n%d", vol / 100, vol % 100, g_sub_menu_selection);
|
||||
else
|
||||
sprintf(String, "%u.%02uV\n(%#4d)\n%#4d", vol / 100, vol % 100, g_battery_calibration[3], g_sub_menu_selection);
|
||||
sprintf(str, "%u.%02uV\n(%#4d)\n%#4d", vol / 100, vol % 100, g_battery_calibration[3], g_sub_menu_selection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1148,7 +1148,7 @@ void UI_DisplayMenu(void)
|
||||
|
||||
unsigned int y;
|
||||
unsigned int lines = 1;
|
||||
unsigned int len = strlen(String);
|
||||
unsigned int len = strlen(str);
|
||||
bool small = false;
|
||||
|
||||
if (len > 0)
|
||||
@ -1156,10 +1156,10 @@ void UI_DisplayMenu(void)
|
||||
// count number of lines
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (String[i] == '\n' && i < (len - 1))
|
||||
if (str[i] == '\n' && i < (len - 1))
|
||||
{ // found new line char
|
||||
lines++;
|
||||
String[i] = 0; // null terminate the line
|
||||
str[i] = 0; // null terminate the line
|
||||
}
|
||||
}
|
||||
|
||||
@ -1180,16 +1180,16 @@ void UI_DisplayMenu(void)
|
||||
for (i = 0; i < len && lines > 0; lines--)
|
||||
{
|
||||
if (small)
|
||||
UI_PrintStringSmall(String + i, sub_menu_x1, sub_menu_x2, y);
|
||||
UI_PrintStringSmall(str + i, sub_menu_x1, sub_menu_x2, y);
|
||||
else
|
||||
UI_PrintString(String + i, sub_menu_x1, sub_menu_x2, y, 8);
|
||||
UI_PrintString(str + i, sub_menu_x1, sub_menu_x2, y, 8);
|
||||
|
||||
// look for start of next line
|
||||
while (i < len && String[i] >= 32)
|
||||
while (i < len && str[i] >= 32)
|
||||
i++;
|
||||
|
||||
// hop over the null term char(s)
|
||||
while (i < len && String[i] < 32)
|
||||
while (i < len && str[i] < 32)
|
||||
i++;
|
||||
|
||||
y += small ? 1 : 2;
|
||||
@ -1203,43 +1203,43 @@ void UI_DisplayMenu(void)
|
||||
|
||||
// if (g_sub_menu_selection == 0xFF)
|
||||
if (g_sub_menu_selection < 0)
|
||||
strcpy(String, "NULL");
|
||||
strcpy(str, "NULL");
|
||||
else
|
||||
UI_GenerateChannelStringEx(String, "CH-", g_sub_menu_selection);
|
||||
UI_GenerateChannelStringEx(str, "CH-", g_sub_menu_selection);
|
||||
|
||||
// if (g_sub_menu_selection == 0xFF || !g_eeprom.scan_list_enabled[i])
|
||||
if (g_sub_menu_selection < 0 || !g_eeprom.scan_list_enabled[i])
|
||||
{
|
||||
// channel number
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, 0, 8);
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 0, 8);
|
||||
|
||||
// channel name
|
||||
BOARD_fetchChannelName(String, g_sub_menu_selection);
|
||||
if (String[0] == 0)
|
||||
strcpy(String, "--");
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, 2, 8);
|
||||
BOARD_fetchChannelName(str, g_sub_menu_selection);
|
||||
if (str[0] == 0)
|
||||
strcpy(str, "--");
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 2, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// channel number
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, 0, 8);
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 0, 8);
|
||||
|
||||
// channel name
|
||||
BOARD_fetchChannelName(String, g_sub_menu_selection);
|
||||
if (String[0] == 0)
|
||||
strcpy(String, "--");
|
||||
UI_PrintStringSmall(String, sub_menu_x1, sub_menu_x2, 2);
|
||||
BOARD_fetchChannelName(str, g_sub_menu_selection);
|
||||
if (str[0] == 0)
|
||||
strcpy(str, "--");
|
||||
UI_PrintStringSmall(str, sub_menu_x1, sub_menu_x2, 2);
|
||||
|
||||
if (IS_USER_CHANNEL(g_eeprom.scan_list_priority_ch1[i]))
|
||||
{
|
||||
sprintf(String, "PRI1:%u", g_eeprom.scan_list_priority_ch1[i] + 1);
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, 3, 8);
|
||||
sprintf(str, "PRI1:%u", g_eeprom.scan_list_priority_ch1[i] + 1);
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 3, 8);
|
||||
}
|
||||
|
||||
if (IS_USER_CHANNEL(g_eeprom.scan_list_priority_ch2[i]))
|
||||
{
|
||||
sprintf(String, "PRI2:%u", g_eeprom.scan_list_priority_ch2[i] + 1);
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, 5, 8);
|
||||
sprintf(str, "PRI2:%u", g_eeprom.scan_list_priority_ch2[i] + 1);
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 5, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1264,9 +1264,9 @@ void UI_DisplayMenu(void)
|
||||
if (g_in_sub_menu)
|
||||
{
|
||||
unsigned int Offset;
|
||||
NUMBER_ToDigits(g_sub_menu_selection, String);
|
||||
NUMBER_ToDigits(g_sub_menu_selection, str);
|
||||
Offset = (g_menu_cursor == MENU_DTMF_LIST) ? 2 : 3;
|
||||
UI_Displaysmall_digits(Offset, String + (8 - Offset), 105, 0, false);
|
||||
UI_Displaysmall_digits(Offset, str + (8 - Offset), 105, 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1275,8 +1275,8 @@ void UI_DisplayMenu(void)
|
||||
g_menu_cursor == MENU_MEM_NAME ||
|
||||
g_menu_cursor == MENU_MEM_DEL) && g_ask_for_confirmation)
|
||||
{ // display confirmation
|
||||
strcpy(String, (g_ask_for_confirmation == 1) ? "SURE?" : "WAIT!");
|
||||
UI_PrintString(String, sub_menu_x1, sub_menu_x2, 5, 8);
|
||||
strcpy(str, (g_ask_for_confirmation == 1) ? "SURE?" : "WAIT!");
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 5, 8);
|
||||
}
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
|
28
ui/status.c
28
ui/status.c
@ -49,7 +49,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// POWER-SAVE indicator
|
||||
if (g_current_function == FUNCTION_TRANSMIT)
|
||||
{
|
||||
memmove(line + x, BITMAP_TX, sizeof(BITMAP_TX));
|
||||
memcpy(line + x, BITMAP_TX, sizeof(BITMAP_TX));
|
||||
x1 = x + sizeof(BITMAP_TX);
|
||||
}
|
||||
else
|
||||
@ -57,13 +57,13 @@ void UI_DisplayStatus(const bool test_display)
|
||||
g_current_function == FUNCTION_MONITOR ||
|
||||
g_current_function == FUNCTION_NEW_RECEIVE)
|
||||
{
|
||||
memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX));
|
||||
memcpy(line + x, BITMAP_RX, sizeof(BITMAP_RX));
|
||||
x1 = x + sizeof(BITMAP_RX);
|
||||
}
|
||||
else
|
||||
if (g_current_function == FUNCTION_POWER_SAVE || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
|
||||
memcpy(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
|
||||
x1 = x + sizeof(BITMAP_POWERSAVE);
|
||||
}
|
||||
x += sizeof(BITMAP_POWERSAVE);
|
||||
@ -72,7 +72,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// NOASS SCAN indicator
|
||||
if (g_is_noaa_mode || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
memcpy(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
x1 = x + sizeof(BITMAP_NOAA);
|
||||
}
|
||||
x += sizeof(BITMAP_NOAA);
|
||||
@ -93,7 +93,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// FM indicator
|
||||
if (g_fm_radio_mode || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
memcpy(line + x, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
x1 = x + sizeof(BITMAP_FM);
|
||||
}
|
||||
else
|
||||
@ -125,7 +125,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// VOICE indicator
|
||||
if (g_eeprom.voice_prompt != VOICE_PROMPT_OFF || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_VOICE_PROMPT, sizeof(BITMAP_VOICE_PROMPT));
|
||||
memcpy(line + x, BITMAP_VOICE_PROMPT, sizeof(BITMAP_VOICE_PROMPT));
|
||||
x1 = x + sizeof(BITMAP_VOICE_PROMPT);
|
||||
}
|
||||
x += sizeof(BITMAP_VOICE_PROMPT);
|
||||
@ -143,11 +143,11 @@ void UI_DisplayStatus(const bool test_display)
|
||||
(g_current_function != FUNCTION_FOREGROUND && g_current_function != FUNCTION_POWER_SAVE) ||
|
||||
g_screen_to_display == DISPLAY_SEARCH)
|
||||
{
|
||||
memmove(line + x, BITMAP_TDR_HOLDING, sizeof(BITMAP_TDR_HOLDING));
|
||||
memcpy(line + x, BITMAP_TDR_HOLDING, sizeof(BITMAP_TDR_HOLDING));
|
||||
}
|
||||
else
|
||||
{
|
||||
memmove(line + x, BITMAP_TDR_RUNNING, sizeof(BITMAP_TDR_RUNNING));
|
||||
memcpy(line + x, BITMAP_TDR_RUNNING, sizeof(BITMAP_TDR_RUNNING));
|
||||
}
|
||||
x1 = x + sizeof(BITMAP_TDR_RUNNING);
|
||||
}
|
||||
@ -155,7 +155,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
|
||||
if (g_current_function == FUNCTION_MONITOR)
|
||||
{
|
||||
memmove(line + x, BITMAP_MONITOR, sizeof(BITMAP_MONITOR));
|
||||
memcpy(line + x, BITMAP_MONITOR, sizeof(BITMAP_MONITOR));
|
||||
x1 = x + sizeof(BITMAP_MONITOR);
|
||||
}
|
||||
x += sizeof(BITMAP_MONITOR);
|
||||
@ -163,7 +163,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// CROSS-VFO indicator
|
||||
if (g_eeprom.cross_vfo_rx_tx != CROSS_BAND_OFF || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB));
|
||||
memcpy(line + x, BITMAP_XB, sizeof(BITMAP_XB));
|
||||
x1 = x + sizeof(BITMAP_XB);
|
||||
}
|
||||
x += sizeof(BITMAP_XB);
|
||||
@ -172,7 +172,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// VOX indicator
|
||||
if (g_eeprom.vox_switch || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
memcpy(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
x1 = x + sizeof(BITMAP_VOX);
|
||||
}
|
||||
x += sizeof(BITMAP_VOX);
|
||||
@ -182,7 +182,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// KEY-LOCK indicator
|
||||
if (g_eeprom.key_lock || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_KEYLOCK, sizeof(BITMAP_KEYLOCK));
|
||||
memcpy(line + x, BITMAP_KEYLOCK, sizeof(BITMAP_KEYLOCK));
|
||||
x += sizeof(BITMAP_KEYLOCK);
|
||||
x1 = x;
|
||||
}
|
||||
@ -190,7 +190,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
#endif
|
||||
if (g_fkey_pressed)
|
||||
{
|
||||
memmove(line + x, BITMAP_F_KEY, sizeof(BITMAP_F_KEY));
|
||||
memcpy(line + x, BITMAP_F_KEY, sizeof(BITMAP_F_KEY));
|
||||
x += sizeof(BITMAP_F_KEY);
|
||||
x1 = x;
|
||||
}
|
||||
@ -236,7 +236,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
|
||||
// USB-C charge indicator
|
||||
if (g_charging_with_type_c || test_display)
|
||||
memmove(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
memcpy(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
x += sizeof(BITMAP_USB_C);
|
||||
|
||||
// BATTERY LEVEL indicator
|
||||
|
@ -81,7 +81,7 @@ void UI_DisplayWelcome(void)
|
||||
EEPROM_ReadBuffer(0x0EC0, str1, 16);
|
||||
}
|
||||
|
||||
memmove(str2, Version_str, slen);
|
||||
memcpy(str2, Version_str, slen);
|
||||
|
||||
UI_PrintString(str0, 0, LCD_WIDTH, 0, 10);
|
||||
UI_PrintString(str1, 0, LCD_WIDTH, 2, 10);
|
||||
|
Loading…
x
Reference in New Issue
Block a user