mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 14:48:03 +03:00
Renamed lots more
This commit is contained in:
22
ui/aircopy.c
22
ui/aircopy.c
@ -31,32 +31,32 @@ void UI_DisplayAircopy(void)
|
||||
{
|
||||
char String[16];
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
|
||||
if (gAircopyState == AIRCOPY_READY)
|
||||
if (g_aircopy_state == AIRCOPY_READY)
|
||||
strcpy(String, "AIR COPY(RDY)");
|
||||
else
|
||||
if (gAircopyState == AIRCOPY_TRANSFER)
|
||||
if (g_aircopy_state == AIRCOPY_TRANSFER)
|
||||
strcpy(String, "AIR COPY");
|
||||
else
|
||||
strcpy(String, "AIR COPY(CMP)");
|
||||
UI_PrintString(String, 2, 127, 0, 8);
|
||||
|
||||
if (gInputBoxIndex == 0)
|
||||
if (g_input_box_index == 0)
|
||||
{
|
||||
NUMBER_ToDigits(gRxVfo->freq_config_rx.frequency, String);
|
||||
NUMBER_ToDigits(g_rx_vfo->freq_config_rx.frequency, String);
|
||||
UI_DisplayFrequency(String, 16, 2, 0, 0);
|
||||
UI_DisplaySmallDigits(2, String + 6, 97, 3, true);
|
||||
UI_Displaysmall_digits(2, String + 6, 97, 3, true);
|
||||
}
|
||||
else
|
||||
UI_DisplayFrequency(gInputBox, 16, 2, 1, 0);
|
||||
UI_DisplayFrequency(g_input_box, 16, 2, 1, 0);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gAirCopyIsSendMode == 0)
|
||||
sprintf(String, "RCV:%u E:%u", gAirCopyBlockNumber, gErrorsDuringAirCopy);
|
||||
if (g_air_copy_is_send_mode == 0)
|
||||
sprintf(String, "RCV:%u E:%u", g_air_copy_block_number, g_errors_during_air_copyy);
|
||||
else
|
||||
if (gAirCopyIsSendMode == 1)
|
||||
sprintf(String, "SND:%u", gAirCopyBlockNumber);
|
||||
if (g_air_copy_is_send_mode == 1)
|
||||
sprintf(String, "SND:%u", g_air_copy_block_number);
|
||||
UI_PrintString(String, 2, 127, 4, 8);
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
|
24
ui/fmradio.c
24
ui/fmradio.c
@ -33,31 +33,31 @@ void UI_DisplayFM(void)
|
||||
unsigned int i;
|
||||
char String[16];
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
strcpy(String, "FM");
|
||||
UI_PrintString(String, 0, 127, 0, 12);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gAskToSave)
|
||||
if (g_ask_to_save)
|
||||
{
|
||||
strcpy(String, "SAVE?");
|
||||
}
|
||||
else
|
||||
if (gAskToDelete)
|
||||
if (g_ask_to_delete)
|
||||
{
|
||||
strcpy(String, "DEL?");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gFM_ScanState == FM_SCAN_OFF)
|
||||
if (g_fm_scan_state == FM_SCAN_OFF)
|
||||
{
|
||||
if (!g_eeprom.fm_is_channel_mode)
|
||||
{
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
if (g_eeprom.fm_frequency_playing == gFM_Channels[i])
|
||||
if (g_eeprom.fm_frequency_playing == g_fm_channels[i])
|
||||
{
|
||||
sprintf(String, "VFO(CH%02u)", i + 1);
|
||||
break;
|
||||
@ -72,29 +72,29 @@ void UI_DisplayFM(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gFM_AutoScan)
|
||||
if (!g_fm_auto_scan)
|
||||
strcpy(String, "M-SCAN");
|
||||
else
|
||||
sprintf(String, "A-SCAN(%u)", gFM_ChannelPosition + 1);
|
||||
sprintf(String, "A-SCAN(%u)", g_fm_channel_position + 1);
|
||||
}
|
||||
}
|
||||
UI_PrintString(String, 0, 127, 2, 10);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gAskToSave || (g_eeprom.fm_is_channel_mode && gInputBoxIndex > 0))
|
||||
if (g_ask_to_save || (g_eeprom.fm_is_channel_mode && g_input_box_index > 0))
|
||||
{
|
||||
UI_GenerateChannelString(String, gFM_ChannelPosition);
|
||||
UI_GenerateChannelString(String, g_fm_channel_position);
|
||||
}
|
||||
else
|
||||
if (!gAskToDelete)
|
||||
if (!g_ask_to_delete)
|
||||
{
|
||||
if (gInputBoxIndex == 0)
|
||||
if (g_input_box_index == 0)
|
||||
{
|
||||
NUMBER_ToDigits(g_eeprom.fm_frequency_playing * 10000, String);
|
||||
UI_DisplayFrequency(String, 23, 4, false, true);
|
||||
}
|
||||
else
|
||||
UI_DisplayFrequency(gInputBox, 23, 4, true, false);
|
||||
UI_DisplayFrequency(g_input_box, 23, 4, true, false);
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
|
68
ui/helper.c
68
ui/helper.c
@ -30,7 +30,7 @@ void UI_GenerateChannelString(char *pString, const uint8_t Channel)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (gInputBoxIndex == 0)
|
||||
if (g_input_box_index == 0)
|
||||
{
|
||||
sprintf(pString, "CH-%02u", Channel + 1);
|
||||
return;
|
||||
@ -40,16 +40,16 @@ void UI_GenerateChannelString(char *pString, const uint8_t Channel)
|
||||
pString[1] = 'H';
|
||||
pString[2] = '-';
|
||||
for (i = 0; i < 2; i++)
|
||||
pString[i + 3] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
||||
pString[i + 3] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
}
|
||||
|
||||
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber)
|
||||
{
|
||||
if (gInputBoxIndex > 0)
|
||||
if (g_input_box_index > 0)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < 3; i++)
|
||||
pString[i] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
||||
pString[i] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
return;
|
||||
}
|
||||
|
||||
@ -76,8 +76,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(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 8);
|
||||
memmove(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][8], 7);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,16 +90,16 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
||||
if (End > Start)
|
||||
Start += (((End - Start) - (Length * 8)) + 1) / 2;
|
||||
|
||||
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
|
||||
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);
|
||||
const unsigned int char_spacing = char_width + 1;
|
||||
uint8_t *pFb = gFrameBuffer[Line] + Start;
|
||||
uint8_t *pFb = g_frame_buffer[Line] + Start;
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
if (pString[i] >= 32)
|
||||
{
|
||||
const unsigned int index = (unsigned int)pString[i] - 32;
|
||||
if (index < ARRAY_SIZE(gFontSmall))
|
||||
memmove(pFb + (i * char_spacing) + 1, &gFontSmall[index], char_width);
|
||||
if (index < ARRAY_SIZE(g_font_small))
|
||||
memmove(pFb + (i * char_spacing) + 1, &g_font_small[index], char_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,16 +113,16 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
||||
if (End > Start)
|
||||
Start += (((End - Start) - (Length * 8)) + 1) / 2;
|
||||
|
||||
const unsigned int char_width = ARRAY_SIZE(gFontSmallBold[0]);
|
||||
const unsigned int char_width = ARRAY_SIZE(g_font_small_bold[0]);
|
||||
const unsigned int char_spacing = char_width + 1;
|
||||
uint8_t *pFb = gFrameBuffer[Line] + Start;
|
||||
uint8_t *pFb = g_frame_buffer[Line] + Start;
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
if (pString[i] >= 32)
|
||||
{
|
||||
const unsigned int index = (unsigned int)pString[i] - 32;
|
||||
if (index < ARRAY_SIZE(gFontSmallBold))
|
||||
memmove(pFb + (i * char_spacing) + 1, &gFontSmallBold[index], char_width);
|
||||
if (index < ARRAY_SIZE(g_font_small_bold))
|
||||
memmove(pFb + (i * char_spacing) + 1, &g_font_small_bold[index], char_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -131,23 +131,23 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
||||
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
|
||||
{
|
||||
size_t i;
|
||||
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
|
||||
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);
|
||||
const unsigned int char_spacing = char_width + 1;
|
||||
for (i = 0; i < strlen(pString); i++)
|
||||
{
|
||||
if (pString[i] >= 32)
|
||||
{
|
||||
const unsigned int index = (unsigned int)pString[i] - 32;
|
||||
if (index < ARRAY_SIZE(gFontSmall))
|
||||
memmove(buffer + (i * char_spacing) + 1, &gFontSmall[index], char_width);
|
||||
if (index < ARRAY_SIZE(g_font_small))
|
||||
memmove(buffer + (i * char_spacing) + 1, &g_font_small[index], char_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag)
|
||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag)
|
||||
{
|
||||
const unsigned int char_width = 13;
|
||||
uint8_t *pFb0 = gFrameBuffer[Y] + X;
|
||||
uint8_t *pFb0 = g_frame_buffer[Y] + X;
|
||||
uint8_t *pFb1 = pFb0 + 128;
|
||||
bool bCanDisplay = false;
|
||||
unsigned int i = 0;
|
||||
@ -159,11 +159,11 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
|
||||
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
|
||||
{
|
||||
bCanDisplay = true;
|
||||
memmove(pFb0, gFontBigDigits[Digit], char_width);
|
||||
memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
|
||||
memmove(pFb0, g_font_big_digits[Digit], char_width);
|
||||
memmove(pFb1, g_font_big_digits[Digit] + char_width, char_width);
|
||||
}
|
||||
else
|
||||
if (bFlag)
|
||||
if (flag)
|
||||
{
|
||||
pFb0 -= 6;
|
||||
pFb1 -= 6;
|
||||
@ -181,8 +181,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, gFontBigDigits[Digit], char_width);
|
||||
memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
|
||||
memmove(pFb0, g_font_big_digits[Digit], char_width);
|
||||
memmove(pFb1, g_font_big_digits[Digit] + char_width, char_width);
|
||||
pFb0 += char_width;
|
||||
pFb1 += char_width;
|
||||
}
|
||||
@ -190,9 +190,9 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
|
||||
|
||||
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero)
|
||||
{
|
||||
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
|
||||
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);
|
||||
const unsigned int spacing = 1 + char_width;
|
||||
uint8_t *pFb = gFrameBuffer[Y] + X;
|
||||
uint8_t *pFb = g_frame_buffer[Y] + X;
|
||||
bool bCanDisplay = false;
|
||||
unsigned int i = 0;
|
||||
|
||||
@ -203,10 +203,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, gFontSmallDigits[c], char_width);
|
||||
memmove(pFb + 1, g_font_small_digits[c], char_width);
|
||||
#else
|
||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
||||
memmove(pFb + 1, gFontSmall[index], char_width);
|
||||
memmove(pFb + 1, g_font_small[index], char_width);
|
||||
#endif
|
||||
pFb += spacing;
|
||||
bCanDisplay = true;
|
||||
@ -225,18 +225,18 @@ 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, gFontSmallDigits[c], char_width);
|
||||
memmove(pFb + 1, g_font_small_digits[c], char_width);
|
||||
#else
|
||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
||||
memmove(pFb + 1, gFontSmall[index], char_width);
|
||||
memmove(pFb + 1, g_font_small[index], char_width);
|
||||
#endif
|
||||
pFb += spacing;
|
||||
}
|
||||
}
|
||||
|
||||
void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros)
|
||||
void UI_Displaysmall_digits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros)
|
||||
{
|
||||
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
|
||||
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);
|
||||
const unsigned int spacing = 1 + char_width;
|
||||
bool display = display_leading_zeros;
|
||||
unsigned int xx;
|
||||
@ -249,10 +249,10 @@ void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x,
|
||||
if (display && c < 11)
|
||||
{
|
||||
#if 0
|
||||
memmove(gFrameBuffer[y] + xx, gFontSmallDigits[c], char_width);
|
||||
memmove(g_frame_buffer[y] + xx, g_font_small_digits[c], char_width);
|
||||
#else
|
||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
||||
memmove(gFrameBuffer[y] + xx + 1, gFontSmall[index], char_width);
|
||||
memmove(g_frame_buffer[y] + xx + 1, g_font_small[index], char_width);
|
||||
#endif
|
||||
xx += spacing;
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
||||
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||
#endif
|
||||
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer);
|
||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag);
|
||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag);
|
||||
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);
|
||||
void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros);
|
||||
void UI_Displaysmall_digits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -18,18 +18,18 @@
|
||||
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
char gInputBox[8];
|
||||
uint8_t gInputBoxIndex;
|
||||
char g_input_box[8];
|
||||
uint8_t g_input_box_index;
|
||||
|
||||
void INPUTBOX_Append(const key_code_t Digit)
|
||||
{
|
||||
if (gInputBoxIndex >= sizeof(gInputBox))
|
||||
if (g_input_box_index >= sizeof(g_input_box))
|
||||
return;
|
||||
|
||||
if (gInputBoxIndex == 0)
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
if (g_input_box_index == 0)
|
||||
memset(g_input_box, 10, sizeof(g_input_box));
|
||||
|
||||
if (Digit >= KEY_0 && Digit != KEY_INVALID)
|
||||
gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0);
|
||||
g_input_box[g_input_box_index++] = (char)(Digit - KEY_0);
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
extern char gInputBox[8];
|
||||
extern uint8_t gInputBoxIndex;
|
||||
extern char g_input_box[8];
|
||||
extern uint8_t g_input_box_index;
|
||||
|
||||
void INPUTBOX_Append(const key_code_t Digit);
|
||||
|
||||
|
38
ui/lock.c
38
ui/lock.c
@ -34,13 +34,13 @@ static void Render(void)
|
||||
unsigned int i;
|
||||
char String[7];
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(g_status_line, 0, sizeof(g_status_line));
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
|
||||
strcpy(String, "LOCK");
|
||||
UI_PrintString(String, 0, 127, 1, 10);
|
||||
for (i = 0; i < 6; i++)
|
||||
String[i] = (gInputBox[i] == 10) ? '-' : '*';
|
||||
String[i] = (g_input_box[i] == 10) ? '-' : '*';
|
||||
String[6] = 0;
|
||||
UI_PrintString(String, 0, 127, 3, 12);
|
||||
|
||||
@ -51,19 +51,19 @@ static void Render(void)
|
||||
void UI_DisplayLock(void)
|
||||
{
|
||||
key_code_t Key;
|
||||
BEEP_Type_t Beep;
|
||||
beep_type_t Beep;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
g_update_display = true;
|
||||
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
memset(g_input_box, 10, sizeof(g_input_box));
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (!gNextTimeslice) {}
|
||||
while (!g_next_time_slice) {}
|
||||
|
||||
// TODO: Original code doesn't do the below, but is needed for proper key debounce
|
||||
|
||||
gNextTimeslice = false;
|
||||
g_next_time_slice = false;
|
||||
|
||||
Key = KEYBOARD_Poll();
|
||||
|
||||
@ -93,7 +93,7 @@ void UI_DisplayLock(void)
|
||||
case KEY_9:
|
||||
INPUTBOX_Append(Key - KEY_0);
|
||||
|
||||
if (gInputBoxIndex < 6) // 6 frequency digits
|
||||
if (g_input_box_index < 6) // 6 frequency digits
|
||||
{
|
||||
Beep = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
}
|
||||
@ -101,9 +101,9 @@ void UI_DisplayLock(void)
|
||||
{
|
||||
uint32_t Password;
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
g_input_box_index = 0;
|
||||
|
||||
NUMBER_Get(gInputBox, &Password);
|
||||
NUMBER_Get(g_input_box, &Password);
|
||||
|
||||
if ((g_eeprom.power_on_password * 100) == Password)
|
||||
{
|
||||
@ -111,21 +111,21 @@ void UI_DisplayLock(void)
|
||||
return;
|
||||
}
|
||||
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
memset(g_input_box, 10, sizeof(g_input_box));
|
||||
|
||||
Beep = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
|
||||
AUDIO_PlayBeep(Beep);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
g_update_display = true;
|
||||
break;
|
||||
|
||||
case KEY_EXIT:
|
||||
if (gInputBoxIndex > 0)
|
||||
if (g_input_box_index > 0)
|
||||
{
|
||||
gInputBox[--gInputBoxIndex] = 10;
|
||||
gUpdateDisplay = true;
|
||||
g_input_box[--g_input_box_index] = 10;
|
||||
g_update_display = true;
|
||||
}
|
||||
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
@ -135,7 +135,7 @@ void UI_DisplayLock(void)
|
||||
}
|
||||
}
|
||||
|
||||
gKeyBeingHeld = false;
|
||||
g_key_being_held = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -151,10 +151,10 @@ void UI_DisplayLock(void)
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
if (gUpdateDisplay)
|
||||
if (g_update_display)
|
||||
{
|
||||
Render();
|
||||
gUpdateDisplay = false;
|
||||
g_update_display = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
242
ui/main.c
242
ui/main.c
@ -50,7 +50,7 @@ center_line_t center_line = CENTER_LINE_NONE;
|
||||
{
|
||||
unsigned int timeout_secs = 0;
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
if (g_current_function != FUNCTION_TRANSMIT)
|
||||
return false;
|
||||
|
||||
if (center_line != CENTER_LINE_NONE && center_line != CENTER_LINE_TX_TIMEOUT)
|
||||
@ -59,12 +59,12 @@ center_line_t center_line = CENTER_LINE_NONE;
|
||||
if (g_eeprom.tx_timeout_timer == 0)
|
||||
timeout_secs = 30; // 30 sec
|
||||
else
|
||||
if (g_eeprom.tx_timeout_timer < (ARRAY_SIZE(gSubMenu_TOT) - 1))
|
||||
if (g_eeprom.tx_timeout_timer < (ARRAY_SIZE(g_sub_menu_TOT) - 1))
|
||||
timeout_secs = 60 * g_eeprom.tx_timeout_timer; // minutes
|
||||
else
|
||||
timeout_secs = 60 * 15; // 15 minutes
|
||||
|
||||
if (timeout_secs == 0 || gTxTimerCountdown_500ms == 0)
|
||||
if (timeout_secs == 0 || g_tx_timer_count_down_500ms == 0)
|
||||
return false;
|
||||
|
||||
{
|
||||
@ -72,11 +72,11 @@ center_line_t center_line = CENTER_LINE_NONE;
|
||||
const unsigned int txt_width = 7 * 6; // 6 text chars
|
||||
const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph
|
||||
const unsigned int bar_width = LCD_WIDTH - 1 - bar_x;
|
||||
const unsigned int secs = gTxTimerCountdown_500ms / 2;
|
||||
const unsigned int secs = g_tx_timer_count_down_500ms / 2;
|
||||
const unsigned int level = ((secs * bar_width) + (timeout_secs / 2)) / timeout_secs; // with rounding
|
||||
// const unsigned int level = (((timeout_secs - secs) * bar_width) + (timeout_secs / 2)) / timeout_secs; // with rounding
|
||||
const unsigned int len = (level <= bar_width) ? level : bar_width;
|
||||
uint8_t *p_line = gFrameBuffer[line];
|
||||
uint8_t *p_line = g_frame_buffer[line];
|
||||
unsigned int i;
|
||||
char s[16];
|
||||
|
||||
@ -112,13 +112,13 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
switch (level)
|
||||
{
|
||||
default:
|
||||
case 7: memmove(p + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
case 6: memmove(p + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||
case 5: memmove(p + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||
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));
|
||||
case 0: break;
|
||||
}
|
||||
|
||||
@ -147,22 +147,22 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
|
||||
void UI_DisplayAudioBar(void)
|
||||
{
|
||||
if (gSetting_mic_bar)
|
||||
if (g_setting_mic_bar)
|
||||
{
|
||||
const unsigned int line = 3;
|
||||
const unsigned int bar_x = 2;
|
||||
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
|
||||
unsigned int i;
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (g_current_function != FUNCTION_TRANSMIT ||
|
||||
g_screen_to_display != DISPLAY_MAIN ||
|
||||
g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
return; // screen is in use
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (gAlarmState != ALARM_STATE_OFF)
|
||||
if (g_alarm_state != ALARM_STATE_OFF)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@ -191,7 +191,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
|
||||
#endif
|
||||
|
||||
uint8_t *p_line = gFrameBuffer[line];
|
||||
uint8_t *p_line = g_frame_buffer[line];
|
||||
|
||||
memset(p_line, 0, LCD_WIDTH);
|
||||
|
||||
@ -205,7 +205,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
p_line[bar_x + i] = (i <= len) ? 0x7f : 0x41;
|
||||
#endif
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
if (g_current_function == FUNCTION_TRANSMIT)
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
}
|
||||
@ -235,17 +235,17 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
const unsigned int len = ((clamped_dBm - bar_min_dBm) * bar_width) / bar_range_dB;
|
||||
|
||||
const unsigned int line = 3;
|
||||
uint8_t *p_line = gFrameBuffer[line];
|
||||
uint8_t *p_line = g_frame_buffer[line];
|
||||
|
||||
char s[16];
|
||||
unsigned int i;
|
||||
|
||||
if (g_eeprom.key_lock && gKeypadLocked > 0)
|
||||
if (g_eeprom.key_lock && g_keypad_locked > 0)
|
||||
return; // display is in use
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (g_current_function == FUNCTION_TRANSMIT ||
|
||||
g_screen_to_display != DISPLAY_MAIN ||
|
||||
g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return; // display is in use
|
||||
|
||||
if (now)
|
||||
@ -290,9 +290,9 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
if (center_line != CENTER_LINE_RSSI)
|
||||
return;
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING)
|
||||
if (g_current_function == FUNCTION_RECEIVE ||
|
||||
g_current_function == FUNCTION_MONITOR ||
|
||||
g_current_function == FUNCTION_INCOMING)
|
||||
{
|
||||
UI_DisplayRSSIBar(rssi, true);
|
||||
}
|
||||
@ -303,7 +303,7 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
|
||||
// const int16_t dBm = (rssi / 2) - 160;
|
||||
const uint8_t Line = (vfo == 0) ? 3 : 7;
|
||||
uint8_t *p_line = gFrameBuffer[Line - 1];
|
||||
uint8_t *p_line = g_frame_buffer[Line - 1];
|
||||
|
||||
// TODO: sort out all 8 values from the eeprom
|
||||
|
||||
@ -313,10 +313,10 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
// 0000C0 6E 00 78 00 82 00 8C 00 B4 00 BE 00 C8 00 D2 00
|
||||
//
|
||||
const unsigned int band = 1;
|
||||
const int16_t level0 = g_eeprom_RSSI_CALIB[band][0];
|
||||
const int16_t level1 = g_eeprom_RSSI_CALIB[band][1];
|
||||
const int16_t level2 = g_eeprom_RSSI_CALIB[band][2];
|
||||
const int16_t level3 = g_eeprom_RSSI_CALIB[band][3];
|
||||
const int16_t level0 = g_eeprom_rssi_calib[band][0];
|
||||
const int16_t level1 = g_eeprom_rssi_calib[band][1];
|
||||
const int16_t level2 = g_eeprom_rssi_calib[band][2];
|
||||
const int16_t level3 = g_eeprom_rssi_calib[band][3];
|
||||
#else
|
||||
const int16_t level0 = (-115 + 160) * 2; // dB
|
||||
const int16_t level1 = ( -89 + 160) * 2; // dB
|
||||
@ -327,7 +327,7 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
const int16_t level12 = (level1 + level2) / 2;
|
||||
const int16_t level23 = (level2 + level3) / 2;
|
||||
|
||||
gVFO_RSSI[vfo] = rssi;
|
||||
g_vfo_rssi[vfo] = rssi;
|
||||
|
||||
uint8_t rssi_level = 0;
|
||||
|
||||
@ -345,20 +345,20 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
else
|
||||
if (rssi >= level0) rssi_level = 1;
|
||||
|
||||
if (gVFO_RSSI_bar_level[vfo] == rssi_level)
|
||||
if (g_vfo_rssi_bar_level[vfo] == rssi_level)
|
||||
return;
|
||||
|
||||
gVFO_RSSI_bar_level[vfo] = rssi_level;
|
||||
g_vfo_rssi_bar_level[vfo] = rssi_level;
|
||||
|
||||
// **********************************************************
|
||||
|
||||
if (g_eeprom.key_lock && gKeypadLocked > 0)
|
||||
if (g_eeprom.key_lock && g_keypad_locked > 0)
|
||||
return; // display is in use
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN)
|
||||
if (g_current_function == FUNCTION_TRANSMIT || g_screen_to_display != DISPLAY_MAIN)
|
||||
return; // display is in use
|
||||
|
||||
p_line = gFrameBuffer[Line - 1];
|
||||
p_line = g_frame_buffer[Line - 1];
|
||||
|
||||
memset(p_line, 0, 23);
|
||||
|
||||
@ -391,9 +391,9 @@ void UI_DisplayMain(void)
|
||||
// #endif
|
||||
|
||||
// clear the screen
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
|
||||
if (g_eeprom.key_lock && gKeypadLocked > 0)
|
||||
if (g_eeprom.key_lock && g_keypad_locked > 0)
|
||||
{ // tell user how to unlock the keyboard
|
||||
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
|
||||
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8);
|
||||
@ -407,8 +407,8 @@ void UI_DisplayMain(void)
|
||||
unsigned int channel = g_eeprom.tx_vfo;
|
||||
// unsigned int tx_channel = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_eeprom.rx_vfo : g_eeprom.tx_vfo;
|
||||
const bool same_vfo = (channel == vfo_num) ? true : false;
|
||||
uint8_t *p_line0 = gFrameBuffer[line + 0];
|
||||
uint8_t *p_line1 = gFrameBuffer[line + 1];
|
||||
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;
|
||||
|
||||
@ -421,46 +421,46 @@ void UI_DisplayMain(void)
|
||||
|
||||
}
|
||||
|
||||
if (g_eeprom.dual_watch != DUAL_WATCH_OFF && gRxVfoIsActive)
|
||||
if (g_eeprom.dual_watch != DUAL_WATCH_OFF && g_rx_vfo_is_active)
|
||||
channel = g_eeprom.rx_vfo; // we're currently monitoring the other VFO
|
||||
|
||||
if (channel != vfo_num)
|
||||
{
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
|
||||
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE || g_dtmf_is_tx || g_dtmf_input_mode)
|
||||
{ // show DTMF stuff
|
||||
|
||||
char Contact[16];
|
||||
|
||||
if (!gDTMF_InputMode)
|
||||
if (!g_dtmf_input_mode)
|
||||
{
|
||||
memset(Contact, 0, sizeof(Contact));
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
||||
strcpy(String, (gDTMF_State == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT");
|
||||
if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT)
|
||||
strcpy(String, (g_dtmf_state == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT");
|
||||
else
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||
sprintf(String, "CALL FRM:%s", (DTMF_FindContact(gDTMF_Caller, Contact)) ? Contact : gDTMF_Caller);
|
||||
if (g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED || g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||
sprintf(String, "CALL FRM:%s", (DTMF_FindContact(g_dtmf_caller, Contact)) ? Contact : g_dtmf_caller);
|
||||
else
|
||||
if (gDTMF_IsTx)
|
||||
strcpy(String, (gDTMF_State == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX");
|
||||
if (g_dtmf_is_tx)
|
||||
strcpy(String, (g_dtmf_state == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(String, ">%s", gDTMF_InputBox);
|
||||
sprintf(String, ">%s", g_dtmf_input_box);
|
||||
}
|
||||
UI_PrintString(String, 2, 0, 0 + (vfo_num * 3), 8);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
if (!gDTMF_InputMode)
|
||||
if (!g_dtmf_input_mode)
|
||||
{
|
||||
memset(Contact, 0, sizeof(Contact));
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
||||
sprintf(String, ">%s", (DTMF_FindContact(gDTMF_String, Contact)) ? Contact : gDTMF_String);
|
||||
if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT)
|
||||
sprintf(String, ">%s", (DTMF_FindContact(g_dtmf_string, Contact)) ? Contact : g_dtmf_string);
|
||||
else
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||
sprintf(String, ">%s", (DTMF_FindContact(gDTMF_Callee, Contact)) ? Contact : gDTMF_Callee);
|
||||
if (g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED || g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||
sprintf(String, ">%s", (DTMF_FindContact(g_dtmf_callee, Contact)) ? Contact : g_dtmf_callee);
|
||||
else
|
||||
if (gDTMF_IsTx)
|
||||
sprintf(String, ">%s", gDTMF_String);
|
||||
if (g_dtmf_is_tx)
|
||||
sprintf(String, ">%s", g_dtmf_string);
|
||||
}
|
||||
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
||||
|
||||
@ -470,26 +470,26 @@ 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));
|
||||
memmove(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_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
||||
memmove(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));
|
||||
memmove(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_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
||||
memmove(p_line0 + 0, BITMAP_VFO_NOT_DEFAULT, sizeof(BITMAP_VFO_NOT_DEFAULT));
|
||||
}
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
if (g_current_function == FUNCTION_TRANSMIT)
|
||||
{ // transmitting
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
if (gAlarmState == ALARM_STATE_ALARM)
|
||||
if (g_alarm_state == ALARM_STATE_ALARM)
|
||||
mode = 2;
|
||||
else
|
||||
#endif
|
||||
@ -509,9 +509,9 @@ void UI_DisplayMain(void)
|
||||
else
|
||||
{ // receiving .. show the RX symbol
|
||||
mode = 2;
|
||||
if ((gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING) &&
|
||||
if ((g_current_function == FUNCTION_RECEIVE ||
|
||||
g_current_function == FUNCTION_MONITOR ||
|
||||
g_current_function == FUNCTION_INCOMING) &&
|
||||
g_eeprom.rx_vfo == vfo_num)
|
||||
{
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
@ -525,13 +525,13 @@ void UI_DisplayMain(void)
|
||||
if (g_eeprom.screen_channel[vfo_num] <= USER_CHANNEL_LAST)
|
||||
{ // channel mode
|
||||
const unsigned int x = 2;
|
||||
const bool inputting = (gInputBoxIndex == 0 || g_eeprom.tx_vfo != vfo_num) ? false : true;
|
||||
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
|
||||
else
|
||||
memmove(String + 5, gInputBox, 3); // show the input text
|
||||
memmove(String + 5, g_input_box, 3); // show the input text
|
||||
UI_PrintStringSmall("M", x, 0, line + 1);
|
||||
UI_DisplaySmallDigits(3, String + 5, x + 7, line + 1, inputting);
|
||||
UI_Displaysmall_digits(3, String + 5, x + 7, line + 1, inputting);
|
||||
}
|
||||
else
|
||||
if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]))
|
||||
@ -545,13 +545,13 @@ void UI_DisplayMain(void)
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
{
|
||||
if (gInputBoxIndex == 0 || g_eeprom.tx_vfo != vfo_num)
|
||||
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);
|
||||
}
|
||||
else
|
||||
{ // user entering channel number
|
||||
sprintf(String, "N%u%u", '0' + gInputBox[0], '0' + gInputBox[1]);
|
||||
sprintf(String, "N%u%u", '0' + g_input_box[0], '0' + g_input_box[1]);
|
||||
}
|
||||
UI_PrintStringSmall(String, 7, 0, line + 1);
|
||||
}
|
||||
@ -559,10 +559,10 @@ void UI_DisplayMain(void)
|
||||
|
||||
// ************
|
||||
|
||||
state = VfoState[vfo_num];
|
||||
state = g_vfo_state[vfo_num];
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
|
||||
if (g_current_function == FUNCTION_TRANSMIT && g_alarm_state == ALARM_STATE_ALARM)
|
||||
{
|
||||
channel = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_eeprom.rx_vfo : g_eeprom.tx_vfo;
|
||||
if (channel == vfo_num)
|
||||
@ -577,34 +577,34 @@ void UI_DisplayMain(void)
|
||||
UI_PrintString(state_list[state], 31, 0, line, 8);
|
||||
}
|
||||
else
|
||||
if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]) && g_eeprom.tx_vfo == vfo_num)
|
||||
if (g_input_box_index > 0 && IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]) && g_eeprom.tx_vfo == vfo_num)
|
||||
{ // user entering a frequency
|
||||
UI_DisplayFrequency(gInputBox, 32, line, true, false);
|
||||
UI_DisplayFrequency(g_input_box, 32, line, true, false);
|
||||
|
||||
// center_line = CENTER_LINE_IN_USE;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t frequency = g_eeprom.VfoInfo[vfo_num].pRX->frequency;
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
uint32_t frequency = g_eeprom.vfo_info[vfo_num].pRX->frequency;
|
||||
if (g_current_function == FUNCTION_TRANSMIT)
|
||||
{ // transmitting
|
||||
channel = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_eeprom.rx_vfo : g_eeprom.tx_vfo;
|
||||
if (channel == vfo_num)
|
||||
frequency = g_eeprom.VfoInfo[vfo_num].pTX->frequency;
|
||||
frequency = g_eeprom.vfo_info[vfo_num].pTX->frequency;
|
||||
}
|
||||
|
||||
if (g_eeprom.screen_channel[vfo_num] <= USER_CHANNEL_LAST)
|
||||
{ // it's a channel
|
||||
|
||||
// show the channel symbols
|
||||
const uint8_t attributes = gUSER_ChannelAttributes[g_eeprom.screen_channel[vfo_num]];
|
||||
const uint8_t attributes = g_user_channel_attributes[g_eeprom.screen_channel[vfo_num]];
|
||||
if (attributes & USER_CH_SCANLIST1)
|
||||
memmove(p_line0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
|
||||
memmove(p_line0 + 113, BITMAP_SCANLIST1, sizeof(BITMAP_SCANLIST1));
|
||||
if (attributes & USER_CH_SCANLIST2)
|
||||
memmove(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
|
||||
memmove(p_line0 + 120, BITMAP_SCANLIST2, sizeof(BITMAP_SCANLIST2));
|
||||
#ifndef ENABLE_BIG_FREQ
|
||||
if ((attributes & USER_CH_COMPAND) > 0)
|
||||
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_COMPAND, sizeof(BITMAP_COMPAND));
|
||||
#else
|
||||
|
||||
// TODO: // find somewhere else to put the symbol
|
||||
@ -622,7 +622,7 @@ void UI_DisplayMain(void)
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 32, line, false, false);
|
||||
// show the remaining 2 small frequency digits
|
||||
UI_DisplaySmallDigits(2, String + 6, 113, line + 1, true);
|
||||
UI_Displaysmall_digits(2, String + 6, 113, line + 1, true);
|
||||
#else
|
||||
// show the frequency in the main font
|
||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
@ -673,7 +673,7 @@ void UI_DisplayMain(void)
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 32, line, false, false);
|
||||
// show the remaining 2 small frequency digits
|
||||
UI_DisplaySmallDigits(2, String + 6, 113, line + 1, true);
|
||||
UI_Displaysmall_digits(2, String + 6, 113, line + 1, true);
|
||||
#else
|
||||
// show the frequency in the main font
|
||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
@ -681,12 +681,12 @@ void UI_DisplayMain(void)
|
||||
#endif
|
||||
|
||||
// show the channel symbols
|
||||
const uint8_t attributes = gUSER_ChannelAttributes[g_eeprom.screen_channel[vfo_num]];
|
||||
const uint8_t attributes = g_user_channel_attributes[g_eeprom.screen_channel[vfo_num]];
|
||||
if ((attributes & USER_CH_COMPAND) > 0)
|
||||
#ifdef ENABLE_BIG_FREQ
|
||||
memmove(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
|
||||
memmove(p_line0 + 120, BITMAP_COMPAND, sizeof(BITMAP_COMPAND));
|
||||
#else
|
||||
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_COMPAND, sizeof(BITMAP_COMPAND));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -698,7 +698,7 @@ void UI_DisplayMain(void)
|
||||
|
||||
if (mode == 1)
|
||||
{ // TX power level
|
||||
switch (gRxVfo->output_power)
|
||||
switch (g_rx_vfo->output_power)
|
||||
{
|
||||
case OUTPUT_POWER_LOW: Level = 2; break;
|
||||
case OUTPUT_POWER_MID: Level = 4; break;
|
||||
@ -710,8 +710,8 @@ void UI_DisplayMain(void)
|
||||
{ // RX signal level
|
||||
#ifndef ENABLE_RSSI_BAR
|
||||
// bar graph
|
||||
if (gVFO_RSSI_bar_level[vfo_num] > 0)
|
||||
Level = gVFO_RSSI_bar_level[vfo_num];
|
||||
if (g_vfo_rssi_bar_level[vfo_num] > 0)
|
||||
Level = g_vfo_rssi_bar_level[vfo_num];
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -721,13 +721,13 @@ void UI_DisplayMain(void)
|
||||
// ************
|
||||
|
||||
String[0] = '\0';
|
||||
if (g_eeprom.VfoInfo[vfo_num].am_mode)
|
||||
if (g_eeprom.vfo_info[vfo_num].am_mode)
|
||||
{ // show the AM symbol
|
||||
strcpy(String, "AM");
|
||||
}
|
||||
else
|
||||
{ // or show the CTCSS/DCS symbol
|
||||
const FREQ_Config_t *pConfig = (mode == 1) ? g_eeprom.VfoInfo[vfo_num].pTX : g_eeprom.VfoInfo[vfo_num].pRX;
|
||||
const freq_config_t *pConfig = (mode == 1) ? g_eeprom.vfo_info[vfo_num].pTX : g_eeprom.vfo_info[vfo_num].pRX;
|
||||
const unsigned int code_type = pConfig->code_type;
|
||||
const char *code_list[] = {"", "CT", "DCS", "DCR"};
|
||||
if (code_type < ARRAY_SIZE(code_list))
|
||||
@ -738,28 +738,28 @@ void UI_DisplayMain(void)
|
||||
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM)
|
||||
{ // show the TX power
|
||||
const char pwr_list[] = "LMH";
|
||||
const unsigned int i = g_eeprom.VfoInfo[vfo_num].output_power;
|
||||
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);
|
||||
}
|
||||
|
||||
if (g_eeprom.VfoInfo[vfo_num].freq_config_rx.frequency != g_eeprom.VfoInfo[vfo_num].freq_config_tx.frequency)
|
||||
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.VfoInfo[vfo_num].tx_offset_freq_dir;
|
||||
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);
|
||||
}
|
||||
|
||||
// show the TX/RX reverse symbol
|
||||
if (g_eeprom.VfoInfo[vfo_num].frequency_reverse)
|
||||
if (g_eeprom.vfo_info[vfo_num].frequency_reverse)
|
||||
UI_PrintStringSmall("R", LCD_WIDTH + 62, 0, line + 1);
|
||||
|
||||
{ // show the narrow band symbol
|
||||
String[0] = '\0';
|
||||
if (g_eeprom.VfoInfo[vfo_num].channel_bandwidth == BANDWIDTH_NARROW)
|
||||
if (g_eeprom.vfo_info[vfo_num].channel_bandwidth == BANDWIDTH_NARROW)
|
||||
{
|
||||
String[0] = 'N';
|
||||
String[1] = '\0';
|
||||
@ -768,20 +768,20 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
|
||||
// show the DTMF decoding symbol
|
||||
if (g_eeprom.VfoInfo[vfo_num].DTMF_decoding_enable || gSetting_KILLED)
|
||||
if (g_eeprom.vfo_info[vfo_num].dtmf_decoding_enable || g_setting_killed)
|
||||
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1);
|
||||
|
||||
// show the audio scramble symbol
|
||||
if (g_eeprom.VfoInfo[vfo_num].scrambling_type > 0 && gSetting_ScrambleEnable)
|
||||
if (g_eeprom.vfo_info[vfo_num].scrambling_type > 0 && g_setting_scramble_enable)
|
||||
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, line + 1);
|
||||
}
|
||||
|
||||
if (center_line == CENTER_LINE_NONE)
|
||||
{ // we're free to use the middle line
|
||||
|
||||
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING);
|
||||
const bool rx = (g_current_function == FUNCTION_RECEIVE ||
|
||||
g_current_function == FUNCTION_MONITOR ||
|
||||
g_current_function == FUNCTION_INCOMING);
|
||||
|
||||
#ifdef ENABLE_SHOW_TX_TIMEOUT
|
||||
// show the TX timeout count down
|
||||
@ -794,7 +794,7 @@ void UI_DisplayMain(void)
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
// show the TX audio level
|
||||
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
if (g_setting_mic_bar && g_current_function == FUNCTION_TRANSMIT)
|
||||
{
|
||||
center_line = CENTER_LINE_AUDIO_BAR;
|
||||
UI_DisplayAudioBar();
|
||||
@ -804,9 +804,9 @@ void UI_DisplayMain(void)
|
||||
|
||||
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
|
||||
// show the AM-FIX debug data
|
||||
if (rx && g_eeprom.VfoInfo[g_eeprom.rx_vfo].am_mode && gSetting_AM_fix)
|
||||
if (rx && g_eeprom.vfo_info[g_eeprom.rx_vfo].am_mode && g_setting_am_fix)
|
||||
{
|
||||
if (gScreenToDisplay != DISPLAY_MAIN || gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (g_screen_to_display != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return;
|
||||
|
||||
center_line = CENTER_LINE_AM_FIX_DATA;
|
||||
@ -821,57 +821,57 @@ void UI_DisplayMain(void)
|
||||
if (rx)
|
||||
{
|
||||
center_line = CENTER_LINE_RSSI;
|
||||
UI_DisplayRSSIBar(gCurrentRSSI[g_eeprom.rx_vfo], false);
|
||||
UI_DisplayRSSIBar(g_current_rssi[g_eeprom.rx_vfo], false);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if (rx || gCurrentFunction == FUNCTION_FOREGROUND || gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
if (rx || g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_POWER_SAVE)
|
||||
{
|
||||
#if 1
|
||||
if (gSetting_live_DTMF_decoder && gDTMF_RX_live[0] != 0)
|
||||
if (g_setting_live_dtmf_decoder && g_dtmf_rx_live[0] != 0)
|
||||
{ // show live DTMF decode
|
||||
const unsigned int len = strlen(gDTMF_RX_live);
|
||||
const unsigned int len = strlen(g_dtmf_rx_live);
|
||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MAIN || gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (g_screen_to_display != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return;
|
||||
|
||||
center_line = CENTER_LINE_DTMF_DEC;
|
||||
|
||||
strcpy(String, "DTMF ");
|
||||
strcat(String, gDTMF_RX_live + idx);
|
||||
strcat(String, g_dtmf_rx_live + idx);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
}
|
||||
#else
|
||||
if (gSetting_live_DTMF_decoder && gDTMF_RX_index > 0)
|
||||
if (g_setting_live_dtmf_decoder && g_dtmf_rx_index > 0)
|
||||
{ // show live DTMF decode
|
||||
const unsigned int len = gDTMF_RX_index;
|
||||
const unsigned int len = g_dtmf_rx_index;
|
||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MAIN || gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (g_screen_to_display != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return;
|
||||
|
||||
center_line = CENTER_LINE_DTMF_DEC;
|
||||
|
||||
strcpy(String, "DTMF ");
|
||||
strcat(String, gDTMF_RX + idx);
|
||||
strcat(String, g_dtmf_rx + idx);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SHOW_CHARGE_LEVEL
|
||||
else
|
||||
if (gChargingWithTypeC)
|
||||
if (g_charging_with_type_c)
|
||||
{ // show the battery charge state
|
||||
if (gScreenToDisplay != DISPLAY_MAIN || gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (g_screen_to_display != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return;
|
||||
|
||||
center_line = CENTER_LINE_CHARGE_DATA;
|
||||
|
||||
sprintf(String, "Charge %u.%02uV %u%%",
|
||||
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
||||
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
g_battery_voltage_average / 100, g_battery_voltage_average % 100,
|
||||
BATTERY_VoltsToPercent(g_battery_voltage_average));
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
}
|
||||
#endif
|
||||
|
@ -17,7 +17,7 @@
|
||||
#ifndef UI_MAIN_H
|
||||
#define UI_MAIN_H
|
||||
|
||||
enum center_line_t {
|
||||
enum center_line_e {
|
||||
CENTER_LINE_NONE = 0,
|
||||
CENTER_LINE_IN_USE,
|
||||
CENTER_LINE_TX_TIMEOUT,
|
||||
@ -27,7 +27,7 @@ enum center_line_t {
|
||||
CENTER_LINE_DTMF_DEC,
|
||||
CENTER_LINE_CHARGE_DATA
|
||||
};
|
||||
typedef enum center_line_t center_line_t;
|
||||
typedef enum center_line_e center_line_t;
|
||||
|
||||
extern center_line_t center_line;
|
||||
|
||||
|
420
ui/menu.c
420
ui/menu.c
@ -41,7 +41,7 @@
|
||||
//
|
||||
// the order of entries in this list below is no longer important, no longer has to match the enum list
|
||||
|
||||
const t_menu_item MenuList[] =
|
||||
const t_menu_item g_menu_list[] =
|
||||
{
|
||||
// text, voice ID, menu ID
|
||||
|
||||
@ -53,9 +53,9 @@ const t_menu_item MenuList[] =
|
||||
{"RxCTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||
{"Tx DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||
{"TxCTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||
{"Tx DIR", voice_id_tX_OFFSET_FREQ_DIR, MENU_SFT_D }, // was "SFT_D"
|
||||
{"TxOFFS", voice_id_tX_OFFSET_FREQ, MENU_OFFSET }, // was "OFFSET"
|
||||
{"Tx TO", voice_id_tRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"Tx DIR", VOICE_ID_TX_OFFSET_FREQ_DIR, MENU_SFT_D }, // was "SFT_D"
|
||||
{"TxOFFS", VOICE_ID_TX_OFFSET_FREQ, MENU_OFFSET }, // was "OFFSET"
|
||||
{"Tx TO", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"Tx VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
||||
{"2nd RX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
||||
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||
@ -140,37 +140,37 @@ const t_menu_item MenuList[] =
|
||||
};
|
||||
|
||||
// number of hidden menu items at the end of the list - KEEP THIS UP-TO-DATE
|
||||
const unsigned int gHidden_menu_count = 9;
|
||||
const unsigned int g_hidden_menu_count = 9;
|
||||
|
||||
// ***************************************************************************************
|
||||
|
||||
const char gSubMenu_TXP[3][5] =
|
||||
const char g_sub_menu_txp[3][5] =
|
||||
{
|
||||
"LOW",
|
||||
"MID",
|
||||
"HIGH"
|
||||
};
|
||||
|
||||
const char gSubMenu_SFT_D[3][4] =
|
||||
const char g_sub_menu_shift_dir[3][4] =
|
||||
{
|
||||
"OFF",
|
||||
"+",
|
||||
"-"
|
||||
};
|
||||
|
||||
const char gSubMenu_W_N[2][7] =
|
||||
const char g_sub_menu_w_n[2][7] =
|
||||
{
|
||||
"WIDE",
|
||||
"NARROW"
|
||||
};
|
||||
|
||||
const char gSubMenu_OFF_ON[2][4] =
|
||||
const char g_sub_menu_off_on[2][4] =
|
||||
{
|
||||
"OFF",
|
||||
"ON"
|
||||
};
|
||||
|
||||
const char gSubMenu_SAVE[5][4] =
|
||||
const char g_sub_menu_SAVE[5][4] =
|
||||
{
|
||||
"OFF",
|
||||
"1:1",
|
||||
@ -179,7 +179,7 @@ const char gSubMenu_SAVE[5][4] =
|
||||
"1:4"
|
||||
};
|
||||
|
||||
const char gSubMenu_TOT[11][7] =
|
||||
const char g_sub_menu_TOT[11][7] =
|
||||
{
|
||||
"30 sec",
|
||||
"1 min",
|
||||
@ -194,14 +194,14 @@ const char gSubMenu_TOT[11][7] =
|
||||
"15 min"
|
||||
};
|
||||
|
||||
const char gSubMenu_TDR[3][10] =
|
||||
const char g_sub_menu_tdr[3][10] =
|
||||
{
|
||||
"OFF",
|
||||
"LOWER\nVFO",
|
||||
"UPPER\nVFO",
|
||||
};
|
||||
|
||||
const char gSubMenu_XB[3][10] =
|
||||
const char g_sub_menu_xb[3][10] =
|
||||
{
|
||||
"RX\nVFO",
|
||||
"UPPER\nVFO",
|
||||
@ -209,7 +209,7 @@ const char gSubMenu_XB[3][10] =
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
const char gSubMenu_VOICE[3][4] =
|
||||
const char g_sub_menu_voice[3][4] =
|
||||
{
|
||||
"OFF",
|
||||
"CHI",
|
||||
@ -217,14 +217,14 @@ const char gSubMenu_XB[3][10] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_SC_REV[3][13] =
|
||||
const char g_sub_menu_sc_rev[3][13] =
|
||||
{
|
||||
"TIME",
|
||||
"CARRIER",
|
||||
"SEARCH"
|
||||
};
|
||||
|
||||
const char gSubMenu_MDF[4][15] =
|
||||
const char g_sub_menu_mdf[4][15] =
|
||||
{
|
||||
"FREQ",
|
||||
"CHANNEL\nNUMBER",
|
||||
@ -233,14 +233,14 @@ const char gSubMenu_MDF[4][15] =
|
||||
};
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
const char gSubMenu_AL_MOD[2][5] =
|
||||
const char g_sub_menu_AL_MOD[2][5] =
|
||||
{
|
||||
"SITE",
|
||||
"TONE"
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_D_RSP[4][11] =
|
||||
const char g_sub_menu_D_RSP[4][11] =
|
||||
{
|
||||
"DO\nNOTHING",
|
||||
"RING",
|
||||
@ -248,7 +248,7 @@ const char gSubMenu_D_RSP[4][11] =
|
||||
"BOTH"
|
||||
};
|
||||
|
||||
const char gSubMenu_PTT_ID[5][15] =
|
||||
const char g_sub_menu_PTT_ID[5][15] =
|
||||
{
|
||||
"OFF",
|
||||
"KEY\nUP",
|
||||
@ -257,7 +257,7 @@ const char gSubMenu_PTT_ID[5][15] =
|
||||
"APOLLO\nQUINDAR"
|
||||
};
|
||||
|
||||
const char gSubMenu_PONMSG[4][8] =
|
||||
const char g_sub_menu_pwr_on_msg[4][8] =
|
||||
{
|
||||
"FULL",
|
||||
"MESSAGE",
|
||||
@ -265,20 +265,20 @@ const char gSubMenu_PONMSG[4][8] =
|
||||
"NONE"
|
||||
};
|
||||
|
||||
const char gSubMenu_ROGER[3][9] =
|
||||
const char g_sub_menu_roger_mode[3][9] =
|
||||
{
|
||||
"OFF",
|
||||
"ROGER",
|
||||
"MDC\n1200"
|
||||
};
|
||||
|
||||
const char gSubMenu_RESET[2][4] =
|
||||
const char g_sub_menu_RESET[2][4] =
|
||||
{
|
||||
"VFO",
|
||||
"ALL"
|
||||
};
|
||||
|
||||
const char gSubMenu_F_LOCK[6][4] =
|
||||
const char g_sub_menu_f_lock[6][4] =
|
||||
{
|
||||
"OFF",
|
||||
"FCC",
|
||||
@ -288,7 +288,7 @@ const char gSubMenu_F_LOCK[6][4] =
|
||||
"438"
|
||||
};
|
||||
|
||||
const char gSubMenu_backlight[8][7] =
|
||||
const char g_sub_menu_backlight[8][7] =
|
||||
{
|
||||
"OFF",
|
||||
"5 sec",
|
||||
@ -300,7 +300,7 @@ const char gSubMenu_backlight[8][7] =
|
||||
"ON"
|
||||
};
|
||||
|
||||
const char gSubMenu_RX_TX[4][6] =
|
||||
const char g_sub_menu_rx_tx[4][6] =
|
||||
{
|
||||
"OFF",
|
||||
"TX",
|
||||
@ -309,7 +309,7 @@ const char gSubMenu_RX_TX[4][6] =
|
||||
};
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
const char gSubMenu_AM_fix_test1[4][8] =
|
||||
const char g_sub_menu_AM_fix_test1[4][8] =
|
||||
{
|
||||
"LNA-S 0",
|
||||
"LNA-S 1",
|
||||
@ -318,14 +318,14 @@ const char gSubMenu_RX_TX[4][6] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_BAT_TXT[3][8] =
|
||||
const char g_sub_menu_BAT_TXT[3][8] =
|
||||
{
|
||||
"NONE",
|
||||
"VOLTAGE",
|
||||
"PERCENT"
|
||||
};
|
||||
|
||||
const char gSubMenu_SCRAMBLER[11][7] =
|
||||
const char g_sub_menu_SCRAMBLER[11][7] =
|
||||
{
|
||||
"OFF",
|
||||
"2600Hz",
|
||||
@ -340,8 +340,8 @@ const char gSubMenu_SCRAMBLER[11][7] =
|
||||
"3500Hz"
|
||||
};
|
||||
|
||||
const char gSubMenu_SIDE_BUTT[9][16] =
|
||||
//const char gSubMenu_SIDE_BUTT[10][16] =
|
||||
const char g_sub_menu_SIDE_BUTT[9][16] =
|
||||
//const char g_sub_menu_SIDE_BUTT[10][16] =
|
||||
{
|
||||
"NONE",
|
||||
"FLASH\nLIGHT",
|
||||
@ -357,17 +357,17 @@ const char gSubMenu_SIDE_BUTT[9][16] =
|
||||
|
||||
// ***************************************************************************************
|
||||
|
||||
uint8_t MenuList_sorted[ARRAY_SIZE(MenuList)];
|
||||
uint8_t g_menu_list_sorted[ARRAY_SIZE(g_menu_list)];
|
||||
|
||||
bool gIsInSubMenu;
|
||||
uint8_t gMenuCursor;
|
||||
int8_t gMenuScrollDirection;
|
||||
int32_t gSubMenuSelection;
|
||||
bool g_is_in_sub_menu;
|
||||
uint8_t g_menu_cursor;
|
||||
int8_t g_menu_scroll_direction;
|
||||
int32_t g_sub_menu_selection;
|
||||
|
||||
// edit box
|
||||
char edit_original[17]; // a copy of the text before editing so that we can easily test for changes/differences
|
||||
char edit[17];
|
||||
int edit_index;
|
||||
char g_edit_original[17]; // a copy of the text before editing so that we can easily test for changes/differences
|
||||
char g_edit[17];
|
||||
int g_edit_index;
|
||||
|
||||
// ***************************************************************************************
|
||||
|
||||
@ -377,42 +377,42 @@ void UI_SortMenu(const bool hide_hidden)
|
||||
//
|
||||
// this means the menu order is entirely determined by the enum list (found in id/menu.h)
|
||||
// it now no longer depends on the order of entries in the above const list (they can be any order)
|
||||
|
||||
|
||||
unsigned int i;
|
||||
|
||||
unsigned int hidden_menu_count = gHidden_menu_count;
|
||||
unsigned int hidden_menu_count = g_hidden_menu_count;
|
||||
|
||||
#ifndef ENABLE_F_CAL_MENU
|
||||
hidden_menu_count--;
|
||||
#endif
|
||||
|
||||
gMenuListCount = ARRAY_SIZE(MenuList_sorted);
|
||||
g_menu_list_count = ARRAY_SIZE(g_menu_list_sorted);
|
||||
|
||||
for (i = 0; i < gMenuListCount; i++)
|
||||
MenuList_sorted[i] = MenuList[i].menu_id;
|
||||
for (i = 0; i < g_menu_list_count; i++)
|
||||
g_menu_list_sorted[i] = g_menu_list[i].menu_id;
|
||||
|
||||
// don't sort the hidden entries at the end, keep them at the end of the list
|
||||
|
||||
for (i = 0; i < (gMenuListCount - hidden_menu_count - 1); i++)
|
||||
for (i = 0; i < (g_menu_list_count - hidden_menu_count - 1); i++)
|
||||
{
|
||||
unsigned int k;
|
||||
unsigned int menu_id1 = MenuList_sorted[i];
|
||||
for (k = i + 1; k < (gMenuListCount - hidden_menu_count); k++)
|
||||
unsigned int menu_id1 = g_menu_list_sorted[i];
|
||||
for (k = i + 1; k < (g_menu_list_count - hidden_menu_count); k++)
|
||||
{
|
||||
unsigned int menu_id2 = MenuList_sorted[k];
|
||||
unsigned int menu_id2 = g_menu_list_sorted[k];
|
||||
if (menu_id2 < menu_id1)
|
||||
{ // swap
|
||||
const unsigned int id = menu_id1;
|
||||
menu_id1 = menu_id2;
|
||||
menu_id2 = id;
|
||||
MenuList_sorted[i] = menu_id1;
|
||||
MenuList_sorted[k] = menu_id2;
|
||||
g_menu_list_sorted[i] = menu_id1;
|
||||
g_menu_list_sorted[k] = menu_id2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hide_hidden)
|
||||
gMenuListCount -= hidden_menu_count; // hide the hidden menu items
|
||||
g_menu_list_count -= hidden_menu_count; // hide the hidden menu items
|
||||
}
|
||||
|
||||
void UI_DisplayMenu(void)
|
||||
@ -425,78 +425,78 @@ void UI_DisplayMenu(void)
|
||||
char Contact[16];
|
||||
|
||||
// clear the screen buffer
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
|
||||
#if 0
|
||||
// original menu layout
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gMenuCursor > 0 || i > 0)
|
||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||
UI_PrintString(MenuList[MenuList_sorted[gMenuCursor + i - 1]].name, 0, 0, i * 2, 8);
|
||||
if (g_menu_cursor > 0 || i > 0)
|
||||
if ((g_menu_list_count - 1) != g_menu_cursor || i != 2)
|
||||
UI_PrintString(g_menu_list[g_menu_list_sorted[g_menu_cursor + i - 1]].name, 0, 0, i * 2, 8);
|
||||
|
||||
// invert the current menu list item pixels
|
||||
for (i = 0; i < (8 * menu_list_width); i++)
|
||||
{
|
||||
gFrameBuffer[2][i] ^= 0xFF;
|
||||
gFrameBuffer[3][i] ^= 0xFF;
|
||||
g_frame_buffer[2][i] ^= 0xFF;
|
||||
g_frame_buffer[3][i] ^= 0xFF;
|
||||
}
|
||||
|
||||
// draw vertical separating dotted line
|
||||
for (i = 0; i < 7; i++)
|
||||
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
||||
g_frame_buffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
||||
|
||||
// draw the little sub-menu triangle marker
|
||||
if (gIsInSubMenu)
|
||||
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
if (g_is_in_sub_menu)
|
||||
memmove(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 + gMenuCursor, gMenuListCount);
|
||||
sprintf(String, "%2u.%u", 1 + g_menu_cursor, g_menu_list_count);
|
||||
UI_PrintStringSmall(String, 2, 0, 6);
|
||||
|
||||
#else
|
||||
{ // new menu layout .. experimental & unfinished
|
||||
|
||||
const int menu_index = gMenuCursor; // current selected menu item
|
||||
const int menu_index = g_menu_cursor; // current selected menu item
|
||||
i = 1;
|
||||
|
||||
if (!gIsInSubMenu)
|
||||
if (!g_is_in_sub_menu)
|
||||
{
|
||||
while (i < 2)
|
||||
{ // leading menu items - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k < 0)
|
||||
UI_PrintStringSmall(MenuList[MenuList_sorted[gMenuListCount + k]].name, 0, 0, i); // wrap-a-round
|
||||
UI_PrintStringSmall(g_menu_list[g_menu_list_sorted[g_menu_list_count + k]].name, 0, 0, i); // wrap-a-round
|
||||
else
|
||||
if (k >= 0 && k < (int)gMenuListCount)
|
||||
UI_PrintStringSmall(MenuList[MenuList_sorted[k]].name, 0, 0, i);
|
||||
if (k >= 0 && k < (int)g_menu_list_count)
|
||||
UI_PrintStringSmall(g_menu_list[g_menu_list_sorted[k]].name, 0, 0, i);
|
||||
i++;
|
||||
}
|
||||
|
||||
// current menu item - keep big n fat
|
||||
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
|
||||
UI_PrintString(MenuList[MenuList_sorted[menu_index]].name, 0, 0, 2, 8);
|
||||
if (menu_index >= 0 && menu_index < (int)g_menu_list_count)
|
||||
UI_PrintString(g_menu_list[g_menu_list_sorted[menu_index]].name, 0, 0, 2, 8);
|
||||
i++;
|
||||
|
||||
while (i < 4)
|
||||
{ // trailing menu item - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k >= 0 && k < (int)gMenuListCount)
|
||||
UI_PrintStringSmall(MenuList[MenuList_sorted[k]].name, 0, 0, 1 + i);
|
||||
if (k >= 0 && k < (int)g_menu_list_count)
|
||||
UI_PrintStringSmall(g_menu_list[g_menu_list_sorted[k]].name, 0, 0, 1 + i);
|
||||
else
|
||||
if (k >= (int)gMenuListCount)
|
||||
UI_PrintStringSmall(MenuList[MenuList_sorted[gMenuListCount - k]].name, 0, 0, 1 + i); // wrap-a-round
|
||||
if (k >= (int)g_menu_list_count)
|
||||
UI_PrintStringSmall(g_menu_list[g_menu_list_sorted[g_menu_list_count - k]].name, 0, 0, 1 + i); // wrap-a-round
|
||||
i++;
|
||||
}
|
||||
|
||||
// draw the menu index number/count
|
||||
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
|
||||
sprintf(String, "%2u.%u", 1 + g_menu_cursor, g_menu_list_count);
|
||||
UI_PrintStringSmall(String, 2, 0, 6);
|
||||
}
|
||||
else
|
||||
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
|
||||
if (menu_index >= 0 && menu_index < (int)g_menu_list_count)
|
||||
{ // current menu item
|
||||
strcpy(String, MenuList[MenuList_sorted[menu_index]].name);
|
||||
strcpy(String, g_menu_list[g_menu_list_sorted[menu_index]].name);
|
||||
// strcat(String, ":");
|
||||
UI_PrintString(String, 0, 0, 0, 8);
|
||||
// UI_PrintStringSmall(String, 0, 0, 0);
|
||||
@ -513,42 +513,42 @@ void UI_DisplayMenu(void)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (gMenuCursor)
|
||||
switch (g_menu_cursor)
|
||||
{
|
||||
case MENU_SQL:
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
sprintf(String, "%d", g_sub_menu_selection);
|
||||
break;
|
||||
|
||||
case MENU_MIC:
|
||||
{ // display the mic gain in actual dB rather than just an index number
|
||||
const uint8_t mic = gMicGain_dB2[gSubMenuSelection];
|
||||
const uint8_t mic = g_mic_gain_dB_2[g_sub_menu_selection];
|
||||
sprintf(String, "+%u.%01udB", mic / 2, mic % 2);
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
case MENU_MIC_BAR:
|
||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_STEP:
|
||||
sprintf(String, "%d.%02ukHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
|
||||
sprintf(String, "%d.%02ukHz", STEP_FREQ_TABLE[g_sub_menu_selection] / 100, abs(STEP_FREQ_TABLE[g_sub_menu_selection]) % 100);
|
||||
break;
|
||||
|
||||
case MENU_TXP:
|
||||
strcpy(String, gSubMenu_TXP[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_txp[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_R_DCS:
|
||||
case MENU_T_DCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
if (gSubMenuSelection < 105)
|
||||
sprintf(String, "D%03oN", DCS_Options[gSubMenuSelection - 1]);
|
||||
if (g_sub_menu_selection < 105)
|
||||
sprintf(String, "D%03oN", DCS_OPTIONS[g_sub_menu_selection - 1]);
|
||||
else
|
||||
sprintf(String, "D%03oI", DCS_Options[gSubMenuSelection - 105]);
|
||||
sprintf(String, "D%03oI", DCS_OPTIONS[g_sub_menu_selection - 105]);
|
||||
break;
|
||||
|
||||
case MENU_R_CTCS:
|
||||
@ -556,8 +556,8 @@ void UI_DisplayMenu(void)
|
||||
{
|
||||
#if 1
|
||||
unsigned int Code;
|
||||
FREQ_Config_t *pConfig = (gMenuCursor == MENU_R_CTCS) ? &gTxVfo->freq_config_rx : &gTxVfo->freq_config_tx;
|
||||
if (gSubMenuSelection == 0)
|
||||
freq_config_t *pConfig = (g_menu_cursor == MENU_R_CTCS) ? &g_tx_vfo->freq_config_rx : &g_tx_vfo->freq_config_tx;
|
||||
if (g_sub_menu_selection == 0)
|
||||
{
|
||||
strcpy(String, "OFF");
|
||||
|
||||
@ -571,41 +571,41 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||
sprintf(String, "%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 = gSubMenuSelection - 1;
|
||||
Code = g_sub_menu_selection - 1;
|
||||
pConfig->code = Code;
|
||||
|
||||
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||
BK4819_SetCTCSSFrequency(CTCSS_OPTIONS[Code]);
|
||||
}
|
||||
#else
|
||||
if (gSubMenuSelection == 0)
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||
sprintf(String, "%u.%uHz", CTCSS_OPTIONS[g_sub_menu_selection - 1] / 10, CTCSS_OPTIONS[g_sub_menu_selection - 1] % 10);
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_SFT_D:
|
||||
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_shift_dir[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_OFFSET:
|
||||
if (!gIsInSubMenu || gInputBoxIndex == 0)
|
||||
if (!g_is_in_sub_menu || g_input_box_index == 0)
|
||||
{
|
||||
sprintf(String, "%d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||
sprintf(String, "%d.%05u", g_sub_menu_selection / 100000, abs(g_sub_menu_selection) % 100000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
String[i ] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
||||
String[i ] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
String[3] = '.';
|
||||
for (i = 3; i < 6; i++)
|
||||
String[i + 1] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
||||
String[i + 1] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
String[ 7] = '-';
|
||||
String[ 8] = '-';
|
||||
String[ 9] = 0;
|
||||
@ -620,14 +620,14 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_W_N:
|
||||
strcpy(String, gSubMenu_W_N[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_w_n[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_SCR:
|
||||
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_SCRAMBLER[g_sub_menu_selection]);
|
||||
#if 1
|
||||
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||
if (g_sub_menu_selection > 0 && g_setting_scramble_enable)
|
||||
BK4819_EnableScramble(g_sub_menu_selection - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
#endif
|
||||
@ -635,35 +635,35 @@ void UI_DisplayMenu(void)
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
if (gSubMenuSelection == 0)
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
sprintf(String, "%d", g_sub_menu_selection);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ABR:
|
||||
strcpy(String, gSubMenu_backlight[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_backlight[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_AM:
|
||||
strcpy(String, (gSubMenuSelection == 0) ? "FM" : "AM");
|
||||
strcpy(String, (g_sub_menu_selection == 0) ? "FM" : "AM");
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
case MENU_AM_FIX_TEST1:
|
||||
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
|
||||
// gSetting_AM_fix = gSubMenuSelection;
|
||||
strcpy(String, g_sub_menu_AM_fix_test1[g_sub_menu_selection]);
|
||||
// g_setting_am_fix = g_sub_menu_selection;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_AUTOLK:
|
||||
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "AUTO");
|
||||
strcpy(String, (g_sub_menu_selection == 0) ? "OFF" : "AUTO");
|
||||
break;
|
||||
|
||||
case MENU_COMPAND:
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
strcpy(String, gSubMenu_RX_TX[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_rx_tx[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
@ -686,21 +686,21 @@ void UI_DisplayMenu(void)
|
||||
case MENU_350EN:
|
||||
case MENU_SCREN:
|
||||
case MENU_TX_EN:
|
||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_MEM_CH:
|
||||
case MENU_1_CALL:
|
||||
case MENU_DEL_CH:
|
||||
{
|
||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||
const bool valid = RADIO_CheckValidChannel(g_sub_menu_selection, false, 0);
|
||||
|
||||
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
||||
UI_GenerateChannelStringEx(String, valid, g_sub_menu_selection);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
|
||||
if (valid && !gAskForConfirmation)
|
||||
if (valid && !g_ask_for_confirmation)
|
||||
{ // show the frequency so that the user knows the channels frequency
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(g_sub_menu_selection);
|
||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
}
|
||||
@ -711,33 +711,33 @@ void UI_DisplayMenu(void)
|
||||
|
||||
case MENU_MEM_NAME:
|
||||
{
|
||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||
const bool valid = RADIO_CheckValidChannel(g_sub_menu_selection, false, 0);
|
||||
|
||||
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
||||
UI_GenerateChannelStringEx(String, valid, g_sub_menu_selection);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
|
||||
if (valid)
|
||||
{
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(g_sub_menu_selection);
|
||||
|
||||
if (!gIsInSubMenu || edit_index < 0)
|
||||
if (!g_is_in_sub_menu || g_edit_index < 0)
|
||||
{ // show the channel name
|
||||
BOARD_fetchChannelName(String, gSubMenuSelection);
|
||||
BOARD_fetchChannelName(String, g_sub_menu_selection);
|
||||
if (String[0] == 0)
|
||||
strcpy(String, "--");
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
||||
}
|
||||
else
|
||||
{ // show the channel name being edited
|
||||
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
||||
if (edit_index < 10)
|
||||
UI_PrintString( "^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
||||
UI_PrintString(g_edit, menu_item_x1, 0, 2, 8);
|
||||
if (g_edit_index < 10)
|
||||
UI_PrintString("^", menu_item_x1 + (8 * g_edit_index), 0, 4, 8); // show the cursor
|
||||
}
|
||||
|
||||
if (!gAskForConfirmation)
|
||||
if (!g_ask_for_confirmation)
|
||||
{ // show the frequency so that the user knows the channels frequency
|
||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
if (!gIsInSubMenu || edit_index < 0)
|
||||
if (!g_is_in_sub_menu || g_edit_index < 0)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
else
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
@ -749,158 +749,158 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
|
||||
case MENU_SAVE:
|
||||
strcpy(String, gSubMenu_SAVE[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_SAVE[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
// strcpy(String, gSubMenu_TDR[gSubMenuSelection]);
|
||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
||||
// strcpy(String, g_sub_menu_tdr[g_sub_menu_selection]);
|
||||
strcpy(String, g_sub_menu_off_on[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_XB:
|
||||
strcpy(String, gSubMenu_XB[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_xb[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_TOT:
|
||||
strcpy(String, gSubMenu_TOT[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_TOT[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
case MENU_VOICE:
|
||||
strcpy(String, gSubMenu_VOICE[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_voice[g_sub_menu_selection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_SC_REV:
|
||||
strcpy(String, gSubMenu_SC_REV[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_sc_rev[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_MDF:
|
||||
strcpy(String, gSubMenu_MDF[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_mdf[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_RP_STE:
|
||||
if (gSubMenuSelection == 0)
|
||||
if (g_sub_menu_selection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%d*100ms", gSubMenuSelection);
|
||||
sprintf(String, "%d*100ms", g_sub_menu_selection);
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
if (gSubMenuSelection < 2)
|
||||
sprintf(String, "LIST%u", 1 + gSubMenuSelection);
|
||||
if (g_sub_menu_selection < 2)
|
||||
sprintf(String, "LIST%u", 1 + g_sub_menu_selection);
|
||||
else
|
||||
strcpy(String, "ALL");
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
case MENU_AL_MOD:
|
||||
sprintf(String, gSubMenu_AL_MOD[gSubMenuSelection]);
|
||||
sprintf(String, g_sub_menu_AL_MOD[g_sub_menu_selection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ANI_ID:
|
||||
strcpy(String, g_eeprom.ani_DTMF_id);
|
||||
strcpy(String, g_eeprom.ani_dtmf_id);
|
||||
break;
|
||||
|
||||
case MENU_UPCODE:
|
||||
strcpy(String, g_eeprom.DTMF_up_code);
|
||||
strcpy(String, g_eeprom.dtmf_up_code);
|
||||
break;
|
||||
|
||||
case MENU_DWCODE:
|
||||
strcpy(String, g_eeprom.DTMF_down_code);
|
||||
strcpy(String, g_eeprom.dtmf_down_code);
|
||||
break;
|
||||
|
||||
case MENU_D_RSP:
|
||||
strcpy(String, gSubMenu_D_RSP[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_D_RSP[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_D_HOLD:
|
||||
// only allow 5, 10, 20, 30, 40, 50 or "STAY ON SCREEN" (60)
|
||||
switch (gSubMenuSelection)
|
||||
switch (g_sub_menu_selection)
|
||||
{
|
||||
case 4: gSubMenuSelection = 60; break;
|
||||
case 6: gSubMenuSelection = 10; break;
|
||||
case 9: gSubMenuSelection = 5; break;
|
||||
case 11: gSubMenuSelection = 20; break;
|
||||
case 19: gSubMenuSelection = 10; break;
|
||||
case 21: gSubMenuSelection = 30; break;
|
||||
case 29: gSubMenuSelection = 20; break;
|
||||
case 31: gSubMenuSelection = 40; break;
|
||||
case 39: gSubMenuSelection = 30; break;
|
||||
case 41: gSubMenuSelection = 50; break;
|
||||
case 49: gSubMenuSelection = 40; break;
|
||||
case 51: gSubMenuSelection = 60; break;
|
||||
case 59: gSubMenuSelection = 50; break;
|
||||
case 61: gSubMenuSelection = 5; break;
|
||||
case 4: g_sub_menu_selection = 60; break;
|
||||
case 6: g_sub_menu_selection = 10; break;
|
||||
case 9: g_sub_menu_selection = 5; break;
|
||||
case 11: g_sub_menu_selection = 20; break;
|
||||
case 19: g_sub_menu_selection = 10; break;
|
||||
case 21: g_sub_menu_selection = 30; break;
|
||||
case 29: g_sub_menu_selection = 20; break;
|
||||
case 31: g_sub_menu_selection = 40; break;
|
||||
case 39: g_sub_menu_selection = 30; break;
|
||||
case 41: g_sub_menu_selection = 50; break;
|
||||
case 49: g_sub_menu_selection = 40; break;
|
||||
case 51: g_sub_menu_selection = 60; break;
|
||||
case 59: g_sub_menu_selection = 50; break;
|
||||
case 61: g_sub_menu_selection = 5; break;
|
||||
}
|
||||
|
||||
if (gSubMenuSelection < DTMF_HOLD_MAX)
|
||||
sprintf(String, "%d sec", gSubMenuSelection);
|
||||
|
||||
if (g_sub_menu_selection < DTMF_HOLD_MAX)
|
||||
sprintf(String, "%d sec", g_sub_menu_selection);
|
||||
else
|
||||
strcpy(String, "STAY ON\nSCREEN"); // 60
|
||||
|
||||
break;
|
||||
|
||||
case MENU_D_PRE:
|
||||
sprintf(String, "%d*10ms", gSubMenuSelection);
|
||||
sprintf(String, "%d*10ms", g_sub_menu_selection);
|
||||
break;
|
||||
|
||||
case MENU_PTT_ID:
|
||||
strcpy(String, gSubMenu_PTT_ID[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_PTT_ID[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
strcpy(String, gSubMenu_BAT_TXT[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_BAT_TXT[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_D_LIST:
|
||||
gIsDtmfContactValid = DTMF_GetContact((int)gSubMenuSelection - 1, Contact);
|
||||
if (!gIsDtmfContactValid)
|
||||
g_dtmf_is_contact_valid = DTMF_GetContact((int)g_sub_menu_selection - 1, Contact);
|
||||
if (!g_dtmf_is_contact_valid)
|
||||
strcpy(String, "NULL");
|
||||
else
|
||||
memmove(String, Contact, 8);
|
||||
break;
|
||||
|
||||
case MENU_PONMSG:
|
||||
strcpy(String, gSubMenu_PONMSG[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_pwr_on_msg[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_ROGER:
|
||||
strcpy(String, gSubMenu_ROGER[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_roger_mode[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_VOL:
|
||||
sprintf(String, "%u.%02uV\n%u%%",
|
||||
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
||||
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
g_battery_voltage_average / 100, g_battery_voltage_average % 100,
|
||||
BATTERY_VoltsToPercent(g_battery_voltage_average));
|
||||
break;
|
||||
|
||||
case MENU_SIDE1_SHORT:
|
||||
case MENU_SIDE1_LONG:
|
||||
case MENU_SIDE2_SHORT:
|
||||
case MENU_SIDE2_LONG:
|
||||
strcpy(String, gSubMenu_SIDE_BUTT[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_SIDE_BUTT[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_RESET:
|
||||
strcpy(String, gSubMenu_RESET[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_RESET[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_F_LOCK:
|
||||
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
||||
strcpy(String, g_sub_menu_f_lock[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
{
|
||||
const uint32_t value = 22656 + gSubMenuSelection;
|
||||
const uint32_t value = 22656 + g_sub_menu_selection;
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
|
||||
writeXtalFreqCal(gSubMenuSelection, false);
|
||||
writeXtalFreqCal(g_sub_menu_selection, false);
|
||||
|
||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||
gSubMenuSelection,
|
||||
g_sub_menu_selection,
|
||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
}
|
||||
break;
|
||||
@ -908,8 +908,8 @@ void UI_DisplayMenu(void)
|
||||
|
||||
case MENU_BATCAL:
|
||||
{
|
||||
const uint16_t vol = (uint32_t)gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
||||
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, gSubMenuSelection);
|
||||
const uint16_t vol = (uint32_t)g_battery_voltage_average * g_battery_calibration[3] / g_sub_menu_selection;
|
||||
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, g_sub_menu_selection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -970,24 +970,24 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
|
||||
if (g_menu_cursor == MENU_SLIST1 || g_menu_cursor == MENU_SLIST2)
|
||||
{
|
||||
i = (gMenuCursor == MENU_SLIST1) ? 0 : 1;
|
||||
i = (g_menu_cursor == MENU_SLIST1) ? 0 : 1;
|
||||
|
||||
// if (gSubMenuSelection == 0xFF)
|
||||
if (gSubMenuSelection < 0)
|
||||
// if (g_sub_menu_selection == 0xFF)
|
||||
if (g_sub_menu_selection < 0)
|
||||
strcpy(String, "NULL");
|
||||
else
|
||||
UI_GenerateChannelStringEx(String, true, gSubMenuSelection);
|
||||
UI_GenerateChannelStringEx(String, true, g_sub_menu_selection);
|
||||
|
||||
// if (gSubMenuSelection == 0xFF || !g_eeprom.scan_list_enabled[i])
|
||||
if (gSubMenuSelection < 0 || !g_eeprom.scan_list_enabled[i])
|
||||
// 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, menu_item_x1, menu_item_x2, 0, 8);
|
||||
|
||||
// channel name
|
||||
BOARD_fetchChannelName(String, gSubMenuSelection);
|
||||
BOARD_fetchChannelName(String, g_sub_menu_selection);
|
||||
if (String[0] == 0)
|
||||
strcpy(String, "--");
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
||||
@ -998,7 +998,7 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
|
||||
// channel name
|
||||
BOARD_fetchChannelName(String, gSubMenuSelection);
|
||||
BOARD_fetchChannelName(String, g_sub_menu_selection);
|
||||
if (String[0] == 0)
|
||||
strcpy(String, "--");
|
||||
UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 2);
|
||||
@ -1017,54 +1017,54 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_MEM_CH ||
|
||||
gMenuCursor == MENU_DEL_CH ||
|
||||
gMenuCursor == MENU_1_CALL)
|
||||
if (g_menu_cursor == MENU_MEM_CH ||
|
||||
g_menu_cursor == MENU_DEL_CH ||
|
||||
g_menu_cursor == MENU_1_CALL)
|
||||
{ // display the channel name
|
||||
char s[11];
|
||||
BOARD_fetchChannelName(s, gSubMenuSelection);
|
||||
BOARD_fetchChannelName(s, g_sub_menu_selection);
|
||||
if (s[0] == 0)
|
||||
strcpy(s, "--");
|
||||
UI_PrintString(s, menu_item_x1, menu_item_x2, 2, 8);
|
||||
}
|
||||
|
||||
if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
if ((g_menu_cursor == MENU_R_CTCS || g_menu_cursor == MENU_R_DCS) && g_css_scan_mode != CSS_SCAN_MODE_OFF)
|
||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_UPCODE)
|
||||
if (strlen(g_eeprom.DTMF_up_code) > 8)
|
||||
UI_PrintString(g_eeprom.DTMF_up_code + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
if (g_menu_cursor == MENU_UPCODE)
|
||||
if (strlen(g_eeprom.dtmf_up_code) > 8)
|
||||
UI_PrintString(g_eeprom.dtmf_up_code + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_DWCODE)
|
||||
if (strlen(g_eeprom.DTMF_down_code) > 8)
|
||||
UI_PrintString(g_eeprom.DTMF_down_code + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
if (g_menu_cursor == MENU_DWCODE)
|
||||
if (strlen(g_eeprom.dtmf_down_code) > 8)
|
||||
UI_PrintString(g_eeprom.dtmf_down_code + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid)
|
||||
if (g_menu_cursor == MENU_D_LIST && g_dtmf_is_contact_valid)
|
||||
{
|
||||
Contact[11] = 0;
|
||||
memmove(&gDTMF_ID, Contact + 8, 4);
|
||||
memmove(&g_dtmf_id, Contact + 8, 4);
|
||||
sprintf(String, "ID:%s", Contact + 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_R_CTCS ||
|
||||
gMenuCursor == MENU_T_CTCS ||
|
||||
gMenuCursor == MENU_R_DCS ||
|
||||
gMenuCursor == MENU_T_DCS ||
|
||||
gMenuCursor == MENU_D_LIST)
|
||||
if (g_menu_cursor == MENU_R_CTCS ||
|
||||
g_menu_cursor == MENU_T_CTCS ||
|
||||
g_menu_cursor == MENU_R_DCS ||
|
||||
g_menu_cursor == MENU_T_DCS ||
|
||||
g_menu_cursor == MENU_D_LIST)
|
||||
{
|
||||
unsigned int Offset;
|
||||
NUMBER_ToDigits(gSubMenuSelection, String);
|
||||
Offset = (gMenuCursor == MENU_D_LIST) ? 2 : 3;
|
||||
UI_DisplaySmallDigits(Offset, String + (8 - Offset), 105, 0, false);
|
||||
NUMBER_ToDigits(g_sub_menu_selection, String);
|
||||
Offset = (g_menu_cursor == MENU_D_LIST) ? 2 : 3;
|
||||
UI_Displaysmall_digits(Offset, String + (8 - Offset), 105, 0, false);
|
||||
}
|
||||
|
||||
if ((gMenuCursor == MENU_RESET ||
|
||||
gMenuCursor == MENU_MEM_CH ||
|
||||
gMenuCursor == MENU_MEM_NAME ||
|
||||
gMenuCursor == MENU_DEL_CH) && gAskForConfirmation)
|
||||
if ((g_menu_cursor == MENU_RESET ||
|
||||
g_menu_cursor == MENU_MEM_CH ||
|
||||
g_menu_cursor == MENU_MEM_NAME ||
|
||||
g_menu_cursor == MENU_DEL_CH) && g_ask_for_confirmation)
|
||||
{ // display confirmation
|
||||
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
||||
strcpy(String, (g_ask_for_confirmation == 1) ? "SURE?" : "WAIT!");
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
}
|
||||
|
||||
|
76
ui/menu.h
76
ui/menu.h
@ -23,13 +23,13 @@
|
||||
#include "audio.h" // voice_id_t
|
||||
|
||||
typedef struct {
|
||||
const char name[7]; // menu display area only has room for 6 characters
|
||||
voice_id_t voice_id;
|
||||
uint8_t menu_id;
|
||||
const char name[7]; // menu display area only has room for 6 characters
|
||||
voice_id_t voice_id;
|
||||
uint8_t menu_id;
|
||||
} t_menu_item;
|
||||
|
||||
// currently this list MUST be in exactly the same order
|
||||
// as the other menu list "MenuList[]" in "ui/menu.c", otherwise
|
||||
// as the other menu list "g_menu_list[]" in "ui/menu.c", otherwise
|
||||
// you'll have big problems
|
||||
//
|
||||
// I'm going to fix that so that you can reorder the menu items
|
||||
@ -137,53 +137,53 @@ enum
|
||||
// ************************************
|
||||
};
|
||||
|
||||
extern const unsigned int gHidden_menu_count;
|
||||
extern const unsigned int g_hidden_menu_count;
|
||||
|
||||
extern const t_menu_item MenuList[];
|
||||
extern uint8_t MenuList_sorted[];
|
||||
extern const t_menu_item g_menu_list[];
|
||||
extern uint8_t g_menu_list_sorted[];
|
||||
|
||||
extern const char gSubMenu_TXP[3][5];
|
||||
extern const char gSubMenu_SFT_D[3][4];
|
||||
extern const char gSubMenu_W_N[2][7];
|
||||
extern const char gSubMenu_OFF_ON[2][4];
|
||||
extern const char gSubMenu_SAVE[5][4];
|
||||
extern const char gSubMenu_TOT[11][7];
|
||||
extern const char gSubMenu_TDR[3][10];
|
||||
extern const char gSubMenu_XB[3][10];
|
||||
extern const char g_sub_menu_txp[3][5];
|
||||
extern const char g_sub_menu_shift_dir[3][4];
|
||||
extern const char g_sub_menu_w_n[2][7];
|
||||
extern const char g_sub_menu_off_on[2][4];
|
||||
extern const char g_sub_menu_SAVE[5][4];
|
||||
extern const char g_sub_menu_TOT[11][7];
|
||||
extern const char g_sub_menu_tdr[3][10];
|
||||
extern const char g_sub_menu_xb[3][10];
|
||||
#ifdef ENABLE_VOICE
|
||||
extern const char gSubMenu_VOICE[3][4];
|
||||
extern const char g_sub_menu_voice[3][4];
|
||||
#endif
|
||||
extern const char gSubMenu_SC_REV[3][13];
|
||||
extern const char gSubMenu_MDF[4][15];
|
||||
extern const char g_sub_menu_sc_rev[3][13];
|
||||
extern const char g_sub_menu_mdf[4][15];
|
||||
#ifdef ENABLE_ALARM
|
||||
extern const char gSubMenu_AL_MOD[2][5];
|
||||
extern const char g_sub_menu_AL_MOD[2][5];
|
||||
#endif
|
||||
extern const char gSubMenu_D_RSP[4][11];
|
||||
extern const char gSubMenu_PTT_ID[5][15];
|
||||
extern const char gSubMenu_PONMSG[4][8];
|
||||
extern const char gSubMenu_ROGER[3][9];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char gSubMenu_F_LOCK[6][4];
|
||||
extern const char gSubMenu_backlight[8][7];
|
||||
extern const char gSubMenu_RX_TX[4][6];
|
||||
extern const char g_sub_menu_D_RSP[4][11];
|
||||
extern const char g_sub_menu_PTT_ID[5][15];
|
||||
extern const char g_sub_menu_pwr_on_msg[4][8];
|
||||
extern const char g_sub_menu_roger_mode[3][9];
|
||||
extern const char g_sub_menu_RESET[2][4];
|
||||
extern const char g_sub_menu_f_lock[6][4];
|
||||
extern const char g_sub_menu_backlight[8][7];
|
||||
extern const char g_sub_menu_rx_tx[4][6];
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
extern const char gSubMenu_AM_fix_test1[4][8];
|
||||
extern const char g_sub_menu_AM_fix_test1[4][8];
|
||||
#endif
|
||||
extern const char gSubMenu_BAT_TXT[3][8];
|
||||
extern const char g_sub_menu_BAT_TXT[3][8];
|
||||
|
||||
extern const char gSubMenu_SCRAMBLER[11][7];
|
||||
extern const char g_sub_menu_SCRAMBLER[11][7];
|
||||
|
||||
extern const char gSubMenu_SIDE_BUTT[9][16];
|
||||
extern const char g_sub_menu_SIDE_BUTT[9][16];
|
||||
|
||||
extern bool gIsInSubMenu;
|
||||
extern bool g_is_in_sub_menu;
|
||||
|
||||
extern uint8_t gMenuCursor;
|
||||
extern int8_t gMenuScrollDirection;
|
||||
extern int32_t gSubMenuSelection;
|
||||
extern uint8_t g_menu_cursor;
|
||||
extern int8_t g_menu_scroll_direction;
|
||||
extern int32_t g_sub_menu_selection;
|
||||
|
||||
extern char edit_original[17];
|
||||
extern char edit[17];
|
||||
extern int edit_index;
|
||||
extern char g_edit_original[17];
|
||||
extern char g_edit[17];
|
||||
extern int g_edit_index;
|
||||
|
||||
void UI_SortMenu(const bool hide_hidden);
|
||||
void UI_DisplayMenu(void);
|
||||
|
10
ui/scanner.c
10
ui/scanner.c
@ -32,10 +32,10 @@ void UI_DisplayScanner(void)
|
||||
char String[16];
|
||||
bool text_centered = false;
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gScanSingleFrequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED))
|
||||
if (g_scan_single_frequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED))
|
||||
{
|
||||
const uint32_t freq = gScanFrequency;
|
||||
sprintf(String, "FREQ %u.%05u", freq / 100000, freq % 100000);
|
||||
@ -51,9 +51,9 @@ void UI_DisplayScanner(void)
|
||||
strcpy(String, "CODE scanning");
|
||||
else
|
||||
if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE)
|
||||
sprintf(String, " CTC %u.%uHz", CTCSS_Options[gScanCssResultCode] / 10, CTCSS_Options[gScanCssResultCode] % 10);
|
||||
sprintf(String, " CTC %u.%uHz", CTCSS_OPTIONS[gScanCssResultCode] / 10, CTCSS_OPTIONS[gScanCssResultCode] % 10);
|
||||
else
|
||||
sprintf(String, " DCS D%03oN", DCS_Options[gScanCssResultCode]);
|
||||
sprintf(String, " DCS D%03oN", DCS_OPTIONS[gScanCssResultCode]);
|
||||
UI_PrintString(String, 2, 0, 3, 8);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
@ -81,7 +81,7 @@ void UI_DisplayScanner(void)
|
||||
|
||||
case SCAN_EDIT_STATE_BUSY:
|
||||
strcpy(String, "SAVE ");
|
||||
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
|
||||
UI_GenerateChannelStringEx(String + 5, g_show_chan_prefix, gScanChannel);
|
||||
break;
|
||||
|
||||
case SCAN_EDIT_STATE_DONE:
|
||||
|
58
ui/status.c
58
ui/status.c
@ -34,32 +34,32 @@
|
||||
|
||||
void UI_DisplayStatus(const bool test_display)
|
||||
{
|
||||
uint8_t *line = gStatusLine;
|
||||
uint8_t *line = g_status_line;
|
||||
unsigned int x = 0;
|
||||
unsigned int x1 = 0;
|
||||
|
||||
gUpdateStatus = false;
|
||||
g_update_status = false;
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(g_status_line, 0, sizeof(g_status_line));
|
||||
|
||||
// **************
|
||||
|
||||
// POWER-SAVE indicator
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
if (g_current_function == FUNCTION_TRANSMIT)
|
||||
{
|
||||
memmove(line + x, BITMAP_TX, sizeof(BITMAP_TX));
|
||||
x1 = x + sizeof(BITMAP_TX);
|
||||
}
|
||||
else
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING)
|
||||
if (g_current_function == FUNCTION_RECEIVE ||
|
||||
g_current_function == FUNCTION_MONITOR ||
|
||||
g_current_function == FUNCTION_INCOMING)
|
||||
{
|
||||
memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX));
|
||||
x1 = x + sizeof(BITMAP_RX);
|
||||
}
|
||||
else
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
|
||||
if (g_current_function == FUNCTION_POWER_SAVE || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
|
||||
x1 = x + sizeof(BITMAP_POWERSAVE);
|
||||
@ -68,7 +68,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
// NOASS SCAN indicator
|
||||
if (gIsNoaaMode || test_display)
|
||||
if (g_is_noaa_mode || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
x1 = x + sizeof(BITMAP_NOAA);
|
||||
@ -78,7 +78,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// hmmm, what to put in it's place
|
||||
#endif
|
||||
|
||||
if (gSetting_KILLED)
|
||||
if (g_setting_killed)
|
||||
{
|
||||
memset(line + x, 0xFF, 10);
|
||||
x1 = x + 10;
|
||||
@ -86,7 +86,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
else
|
||||
#ifdef ENABLE_FMRADIO
|
||||
// FM indicator
|
||||
if (gFmRadioMode || test_display)
|
||||
if (g_fm_radio_mode || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
x1 = x + sizeof(BITMAP_FM);
|
||||
@ -94,9 +94,9 @@ void UI_DisplayStatus(const bool test_display)
|
||||
else
|
||||
#endif
|
||||
// SCAN indicator
|
||||
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
||||
if (g_scan_state_dir != SCAN_OFF || g_screen_to_display == DISPLAY_SCANNER || test_display)
|
||||
{
|
||||
if (gNextChannel <= USER_CHANNEL_LAST)
|
||||
if (g_next_channel <= USER_CHANNEL_LAST)
|
||||
{ // channel mode
|
||||
if (g_eeprom.scan_list_default == 0)
|
||||
UI_PrintStringSmallBuffer("1", line + x);
|
||||
@ -119,10 +119,10 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// VOICE indicator
|
||||
if (g_eeprom.voice_prompt != VOICE_PROMPT_OFF || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
x1 = x + sizeof(BITMAP_VoicePrompt);
|
||||
memmove(line + x, BITMAP_VOICE_PROMPT, sizeof(BITMAP_VOICE_PROMPT));
|
||||
x1 = x + sizeof(BITMAP_VOICE_PROMPT);
|
||||
}
|
||||
x += sizeof(BITMAP_VoicePrompt);
|
||||
x += sizeof(BITMAP_VOICE_PROMPT);
|
||||
#else
|
||||
// hmmm, what to put in it's place
|
||||
#endif
|
||||
@ -130,7 +130,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// DUAL-WATCH indicator
|
||||
if (g_eeprom.dual_watch != DUAL_WATCH_OFF || test_display)
|
||||
{
|
||||
if (gDualWatchActive || test_display)
|
||||
if (g_dual_watch_active || test_display)
|
||||
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1));
|
||||
else
|
||||
memmove(line + x, BITMAP_TDR2, sizeof(BITMAP_TDR2));
|
||||
@ -158,15 +158,15 @@ 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));
|
||||
x += sizeof(BITMAP_KeyLock);
|
||||
memmove(line + x, BITMAP_KEYLOCK, sizeof(BITMAP_KEYLOCK));
|
||||
x += sizeof(BITMAP_KEYLOCK);
|
||||
x1 = x;
|
||||
}
|
||||
else
|
||||
if (g_was_f_key_pressed)
|
||||
if (g_f_key_was_pressed)
|
||||
{
|
||||
memmove(line + x, BITMAP_F_Key, sizeof(BITMAP_F_Key));
|
||||
x += sizeof(BITMAP_F_Key);
|
||||
memmove(line + x, BITMAP_F_KEY, sizeof(BITMAP_F_KEY));
|
||||
x += sizeof(BITMAP_F_KEY);
|
||||
x1 = x;
|
||||
}
|
||||
|
||||
@ -176,10 +176,10 @@ void UI_DisplayStatus(const bool test_display)
|
||||
|
||||
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BATTERY_LEVEL) - 3;
|
||||
|
||||
if (gChargingWithTypeC)
|
||||
if (g_charging_with_type_c)
|
||||
x2 -= sizeof(BITMAP_USB_C); // the radio is on charge
|
||||
|
||||
switch (gSetting_battery_text)
|
||||
switch (g_setting_battery_text)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
@ -187,7 +187,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
|
||||
case 1: // voltage
|
||||
{
|
||||
const uint16_t voltage = (gBatteryVoltageAverage <= 999) ? gBatteryVoltageAverage : 999; // limit to 9.99V
|
||||
const uint16_t voltage = (g_battery_voltage_average <= 999) ? g_battery_voltage_average : 999; // limit to 9.99V
|
||||
sprintf(s, "%u.%02uV", voltage / 100, voltage % 100);
|
||||
space_needed = (7 * strlen(s));
|
||||
if (x2 >= (x1 + space_needed))
|
||||
@ -199,7 +199,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
|
||||
case 2: // percentage
|
||||
{
|
||||
sprintf(s, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
sprintf(s, "%u%%", BATTERY_VoltsToPercent(g_battery_voltage_average));
|
||||
space_needed = (7 * strlen(s));
|
||||
if (x2 >= (x1 + space_needed))
|
||||
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
|
||||
@ -212,13 +212,13 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x = LCD_WIDTH - sizeof(BITMAP_BATTERY_LEVEL) - sizeof(BITMAP_USB_C);
|
||||
|
||||
// USB-C charge indicator
|
||||
if (gChargingWithTypeC || test_display)
|
||||
if (g_charging_with_type_c || test_display)
|
||||
memmove(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
x += sizeof(BITMAP_USB_C);
|
||||
|
||||
{ // BATTERY LEVEL indicator
|
||||
uint8_t bitmap[sizeof(BITMAP_BATTERY_LEVEL)];
|
||||
unsigned int i = gBatteryDisplayLevel;
|
||||
unsigned int i = g_battery_display_level;
|
||||
|
||||
memmove(bitmap, BITMAP_BATTERY_LEVEL, sizeof(BITMAP_BATTERY_LEVEL));
|
||||
|
||||
@ -237,7 +237,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
}
|
||||
}
|
||||
else
|
||||
if (gLowBattery)
|
||||
if (g_low_battery)
|
||||
memset(bitmap, 0, sizeof(bitmap));
|
||||
|
||||
memmove(line + x, bitmap, sizeof(bitmap));
|
||||
|
41
ui/ui.c
41
ui/ui.c
@ -35,16 +35,15 @@
|
||||
#include "ui/scanner.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
GUI_DisplayType_t gScreenToDisplay;
|
||||
GUI_DisplayType_t gRequestDisplayScreen = DISPLAY_INVALID;
|
||||
|
||||
uint8_t gAskForConfirmation;
|
||||
bool gAskToSave;
|
||||
bool gAskToDelete;
|
||||
gui_display_type_t g_screen_to_display;
|
||||
gui_display_type_t g_request_display_screen = DISPLAY_INVALID;
|
||||
uint8_t g_ask_for_confirmation;
|
||||
bool g_ask_to_save;
|
||||
bool g_ask_to_delete;
|
||||
|
||||
void GUI_DisplayScreen(void)
|
||||
{
|
||||
switch (gScreenToDisplay)
|
||||
switch (g_screen_to_display)
|
||||
{
|
||||
case DISPLAY_MAIN:
|
||||
UI_DisplayMain();
|
||||
@ -75,30 +74,30 @@ void GUI_DisplayScreen(void)
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||
void GUI_SelectNextDisplay(gui_display_type_t Display)
|
||||
{
|
||||
if (Display == DISPLAY_INVALID)
|
||||
return;
|
||||
|
||||
if (gScreenToDisplay != Display)
|
||||
if (g_screen_to_display != Display)
|
||||
{
|
||||
DTMF_clear_input_box();
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
gIsInSubMenu = false;
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
gScanStateDir = SCAN_OFF;
|
||||
g_input_box_index = 0;
|
||||
g_is_in_sub_menu = false;
|
||||
g_css_scan_mode = CSS_SCAN_MODE_OFF;
|
||||
g_scan_state_dir = SCAN_OFF;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
g_fm_scan_state = FM_SCAN_OFF;
|
||||
#endif
|
||||
gAskForConfirmation = 0;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
g_was_f_key_pressed = false;
|
||||
g_ask_for_confirmation = 0;
|
||||
g_ask_to_save = false;
|
||||
g_ask_to_delete = false;
|
||||
g_f_key_was_pressed = false;
|
||||
|
||||
gUpdateStatus = true;
|
||||
g_update_status = true;
|
||||
}
|
||||
|
||||
gScreenToDisplay = Display;
|
||||
gUpdateDisplay = true;
|
||||
g_screen_to_display = Display;
|
||||
g_update_display = true;
|
||||
}
|
||||
|
20
ui/ui.h
20
ui/ui.h
@ -20,27 +20,25 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum GUI_DisplayType_t
|
||||
enum gui_display_type_e
|
||||
{
|
||||
DISPLAY_MAIN = 0,
|
||||
DISPLAY_FM,
|
||||
DISPLAY_MENU,
|
||||
DISPLAY_SCANNER,
|
||||
DISPLAY_AIRCOPY,
|
||||
DISPLAY_INVALID = 0xFFu
|
||||
DISPLAY_INVALID // 0xff
|
||||
};
|
||||
typedef enum gui_display_type_e gui_display_type_t;
|
||||
|
||||
typedef enum GUI_DisplayType_t GUI_DisplayType_t;
|
||||
|
||||
extern GUI_DisplayType_t gScreenToDisplay;
|
||||
extern GUI_DisplayType_t gRequestDisplayScreen;
|
||||
|
||||
extern uint8_t gAskForConfirmation;
|
||||
extern bool gAskToSave;
|
||||
extern bool gAskToDelete;
|
||||
extern gui_display_type_t g_screen_to_display;
|
||||
extern gui_display_type_t g_request_display_screen;
|
||||
extern uint8_t g_ask_for_confirmation;
|
||||
extern bool g_ask_to_save;
|
||||
extern bool g_ask_to_delete;
|
||||
|
||||
void GUI_DisplayScreen(void);
|
||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display);
|
||||
void GUI_SelectNextDisplay(gui_display_type_t Display);
|
||||
|
||||
#endif
|
||||
|
||||
|
16
ui/welcome.c
16
ui/welcome.c
@ -29,8 +29,8 @@
|
||||
|
||||
void UI_DisplayReleaseKeys(void)
|
||||
{
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(g_status_line, 0, sizeof(g_status_line));
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
|
||||
UI_PrintString("RELEASE", 0, 127, 1, 10);
|
||||
UI_PrintString("ALL KEYS", 0, 127, 3, 10);
|
||||
@ -45,8 +45,8 @@ void UI_DisplayWelcome(void)
|
||||
char WelcomeString1[16];
|
||||
char WelcomeString2[16];
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(g_status_line, 0, sizeof(g_status_line));
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
|
||||
if (g_eeprom.pwr_on_display_mode == PWR_ON_DISPLAY_MODE_NONE)
|
||||
{
|
||||
@ -67,12 +67,12 @@ void UI_DisplayWelcome(void)
|
||||
{
|
||||
strcpy(WelcomeString0, "VOLTAGE");
|
||||
sprintf(WelcomeString1, "%u.%02uV %u%%",
|
||||
gBatteryVoltageAverage / 100,
|
||||
gBatteryVoltageAverage % 100,
|
||||
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
g_battery_voltage_average / 100,
|
||||
g_battery_voltage_average % 100,
|
||||
BATTERY_VoltsToPercent(g_battery_voltage_average));
|
||||
|
||||
#if 0
|
||||
sprintf(WelcomeString2, "Current %u", gBatteryCurrent); // needs scaling into mA
|
||||
sprintf(WelcomeString2, "Current %u", g_battery_current); // needs scaling into mA
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user