mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
fix battery cal menu input
This commit is contained in:
parent
c92ef43b39
commit
5f13884e88
@ -621,7 +621,7 @@ static void AIRCOPY_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
INPUTBOX_Append(Key);
|
INPUTBOX_append(Key);
|
||||||
|
|
||||||
g_request_display_screen = DISPLAY_AIRCOPY;
|
g_request_display_screen = DISPLAY_AIRCOPY;
|
||||||
|
|
||||||
|
2
app/fm.c
2
app/fm.c
@ -261,7 +261,7 @@ static void FM_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
State = g_eeprom.fm_is_channel_mode ? STATE_USER_MODE : STATE_FREQ_MODE;
|
State = g_eeprom.fm_is_channel_mode ? STATE_USER_MODE : STATE_FREQ_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INPUTBOX_Append(Key);
|
INPUTBOX_append(Key);
|
||||||
|
|
||||||
g_request_display_screen = DISPLAY_FM;
|
g_request_display_screen = DISPLAY_FM;
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ void toggle_chan_scanlist(void)
|
|||||||
g_screen_to_display = DISPLAY_INVALID;
|
g_screen_to_display = DISPLAY_INVALID;
|
||||||
GUI_SelectNextDisplay(DISPLAY_MENU);
|
GUI_SelectNextDisplay(DISPLAY_MENU);
|
||||||
g_menu_cursor = MENU_MEM_SAVE;
|
g_menu_cursor = MENU_MEM_SAVE;
|
||||||
g_is_in_sub_menu = true;
|
g_in_sub_menu = true;
|
||||||
if (chan <= USER_CHANNEL_LAST)
|
if (chan <= USER_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
@ -452,7 +452,7 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
|
|
||||||
// add the digit to the channel/frequency input box
|
// add the digit to the channel/frequency input box
|
||||||
|
|
||||||
INPUTBOX_Append(Key);
|
INPUTBOX_append(Key);
|
||||||
|
|
||||||
g_request_display_screen = DISPLAY_MAIN;
|
g_request_display_screen = DISPLAY_MAIN;
|
||||||
|
|
||||||
|
97
app/menu.c
97
app/menu.c
@ -1320,10 +1320,10 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
|
|
||||||
static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
||||||
{
|
{
|
||||||
uint8_t Offset;
|
unsigned int index;
|
||||||
int32_t Min;
|
int32_t min;
|
||||||
int32_t Max;
|
int32_t max;
|
||||||
uint16_t Value = 0;
|
uint32_t value = 0;
|
||||||
|
|
||||||
if (key_held || !key_pressed)
|
if (key_held || !key_pressed)
|
||||||
return;
|
return;
|
||||||
@ -1357,11 +1357,11 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
INPUTBOX_Append(Key);
|
INPUTBOX_append(Key);
|
||||||
|
|
||||||
g_request_display_screen = DISPLAY_MENU;
|
g_request_display_screen = DISPLAY_MENU;
|
||||||
|
|
||||||
if (!g_is_in_sub_menu)
|
if (!g_in_sub_menu)
|
||||||
{
|
{
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
@ -1371,26 +1371,26 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
case 2:
|
case 2:
|
||||||
g_input_box_index = 0;
|
g_input_box_index = 0;
|
||||||
|
|
||||||
Value = (g_input_box[0] * 10) + g_input_box[1];
|
value = (g_input_box[0] * 10) + g_input_box[1];
|
||||||
|
|
||||||
if (Value > 0 && Value <= g_menu_list_count)
|
if (value > 0 && value <= g_menu_list_count)
|
||||||
{
|
{
|
||||||
g_menu_cursor = Value - 1;
|
g_menu_cursor = value - 1;
|
||||||
g_flag_refresh_menu = true;
|
g_flag_refresh_menu = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Value <= g_menu_list_count)
|
if (value <= g_menu_list_count)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
g_input_box[0] = g_input_box[1];
|
g_input_box[0] = g_input_box[1];
|
||||||
g_input_box_index = 1;
|
g_input_box_index = 1;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
Value = g_input_box[0];
|
value = g_input_box[0];
|
||||||
if (Value > 0 && Value <= g_menu_list_count)
|
if (value > 0 && value <= g_menu_list_count)
|
||||||
{
|
{
|
||||||
g_menu_cursor = Value - 1;
|
g_menu_cursor = value - 1;
|
||||||
g_flag_refresh_menu = true;
|
g_flag_refresh_menu = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1410,7 +1410,7 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
if (g_input_box_index < 6)
|
if (g_input_box_index < 6)
|
||||||
{ // invalid frequency
|
{ // not yet enough characters
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
g_another_voice_id = (voice_id_t)Key;
|
g_another_voice_id = (voice_id_t)Key;
|
||||||
#endif
|
#endif
|
||||||
@ -1422,7 +1422,27 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
NUMBER_Get(g_input_box, &Frequency);
|
NUMBER_Get(g_input_box, &Frequency);
|
||||||
g_sub_menu_selection = FREQUENCY_FloorToStep(Frequency + 75, g_tx_vfo->step_freq, 0);
|
g_input_box_index = 0;
|
||||||
|
|
||||||
|
g_sub_menu_selection = FREQUENCY_FloorToStep(Frequency + (g_tx_vfo->step_freq / 2), g_tx_vfo->step_freq, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_menu_cursor == MENU_BAT_CAL)
|
||||||
|
{
|
||||||
|
g_sub_menu_selection = INPUTBOX_value(); // get the current value from the input box
|
||||||
|
|
||||||
|
if (g_input_box_index < 4)
|
||||||
|
{ // not yet enough characters
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
g_another_voice_id = (voice_id_t)Key;
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
g_another_voice_id = (voice_id_t)Key;
|
||||||
|
#endif
|
||||||
|
|
||||||
g_input_box_index = 0;
|
g_input_box_index = 0;
|
||||||
return;
|
return;
|
||||||
@ -1445,14 +1465,14 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
|
|
||||||
g_input_box_index = 0;
|
g_input_box_index = 0;
|
||||||
|
|
||||||
Value = ((g_input_box[0] * 100) + (g_input_box[1] * 10) + g_input_box[2]) - 1;
|
value = ((g_input_box[0] * 100) + (g_input_box[1] * 10) + g_input_box[2]) - 1;
|
||||||
|
|
||||||
if (Value <= USER_CHANNEL_LAST)
|
if (value <= USER_CHANNEL_LAST)
|
||||||
{ // user channel
|
{ // user channel
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
g_another_voice_id = (voice_id_t)Key;
|
g_another_voice_id = (voice_id_t)Key;
|
||||||
#endif
|
#endif
|
||||||
g_sub_menu_selection = Value;
|
g_sub_menu_selection = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1460,34 +1480,37 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MENU_GetLimits(g_menu_cursor, &Min, &Max))
|
if (MENU_GetLimits(g_menu_cursor, &min, &max))
|
||||||
{
|
{
|
||||||
g_input_box_index = 0;
|
g_input_box_index = 0;
|
||||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset = (Max >= 100) ? 3 : (Max >= 10) ? 2 : 1;
|
index = (max >= 100000) ? 6 : (max >= 10000) ? 5 : (max >= 1000) ? 4 : (max >= 100) ? 3 : (max >= 10) ? 2 : 1;
|
||||||
|
// NUMBER_Get(g_input_box, &value);
|
||||||
switch (g_input_box_index)
|
switch (g_input_box_index)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
Value = g_input_box[0];
|
value = g_input_box[0];
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Value = (g_input_box[0] * 10) + g_input_box[1];
|
value = (g_input_box[0] * 10) + g_input_box[1];
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Value = (g_input_box[0] * 100) + (g_input_box[1] * 10) + g_input_box[2];
|
value = (g_input_box[0] * 100) + (g_input_box[1] * 10) + g_input_box[2];
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
value = (g_input_box[0] * 1000) + (g_input_box[1] * 100) + (g_input_box[2] * 10) + g_input_box[3];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Offset == g_input_box_index)
|
if (index == g_input_box_index)
|
||||||
g_input_box_index = 0;
|
g_input_box_index = 0;
|
||||||
|
|
||||||
if (Value <= Max)
|
if ((int32_t)value <= max)
|
||||||
{
|
{
|
||||||
g_sub_menu_selection = Value;
|
g_sub_menu_selection = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1503,12 +1526,12 @@ static void MENU_Key_EXIT(bool key_pressed, bool key_held)
|
|||||||
|
|
||||||
if (g_css_scan_mode == CSS_SCAN_MODE_OFF)
|
if (g_css_scan_mode == CSS_SCAN_MODE_OFF)
|
||||||
{
|
{
|
||||||
if (g_is_in_sub_menu)
|
if (g_in_sub_menu)
|
||||||
{
|
{
|
||||||
if (g_input_box_index == 0 || g_menu_cursor != MENU_OFFSET)
|
if (g_input_box_index == 0 || g_menu_cursor != MENU_OFFSET)
|
||||||
{
|
{
|
||||||
g_ask_for_confirmation = 0;
|
g_ask_for_confirmation = 0;
|
||||||
g_is_in_sub_menu = false;
|
g_in_sub_menu = false;
|
||||||
g_input_box_index = 0;
|
g_input_box_index = 0;
|
||||||
g_flag_refresh_menu = true;
|
g_flag_refresh_menu = true;
|
||||||
|
|
||||||
@ -1559,7 +1582,7 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
|||||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
g_request_display_screen = DISPLAY_MENU;
|
g_request_display_screen = DISPLAY_MENU;
|
||||||
|
|
||||||
if (!g_is_in_sub_menu)
|
if (!g_in_sub_menu)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
if (g_menu_cursor != MENU_SCRAMBLER)
|
if (g_menu_cursor != MENU_SCRAMBLER)
|
||||||
@ -1573,7 +1596,7 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_ask_for_confirmation = 0;
|
g_ask_for_confirmation = 0;
|
||||||
g_is_in_sub_menu = true;
|
g_in_sub_menu = true;
|
||||||
|
|
||||||
// if (g_menu_cursor != MENU_DTMF_LIST)
|
// if (g_menu_cursor != MENU_DTMF_LIST)
|
||||||
{
|
{
|
||||||
@ -1616,7 +1639,7 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
|||||||
if (memcmp(g_edit_original, g_edit, sizeof(g_edit_original)) == 0)
|
if (memcmp(g_edit_original, g_edit, sizeof(g_edit_original)) == 0)
|
||||||
{ // no change - drop it
|
{ // no change - drop it
|
||||||
g_flag_accept_setting = false;
|
g_flag_accept_setting = false;
|
||||||
g_is_in_sub_menu = false;
|
g_in_sub_menu = false;
|
||||||
g_ask_for_confirmation = 0;
|
g_ask_for_confirmation = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1629,7 +1652,7 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
|||||||
|
|
||||||
// exiting the sub menu
|
// exiting the sub menu
|
||||||
|
|
||||||
if (g_is_in_sub_menu)
|
if (g_in_sub_menu)
|
||||||
{
|
{
|
||||||
if (g_menu_cursor == MENU_RESET ||
|
if (g_menu_cursor == MENU_RESET ||
|
||||||
g_menu_cursor == MENU_MEM_SAVE ||
|
g_menu_cursor == MENU_MEM_SAVE ||
|
||||||
@ -1664,14 +1687,14 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_flag_accept_setting = true;
|
g_flag_accept_setting = true;
|
||||||
g_is_in_sub_menu = false;
|
g_in_sub_menu = false;
|
||||||
g_ask_for_confirmation = 0;
|
g_ask_for_confirmation = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_flag_accept_setting = true;
|
g_flag_accept_setting = true;
|
||||||
g_is_in_sub_menu = false;
|
g_in_sub_menu = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1757,7 +1780,7 @@ static void MENU_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Direction)
|
|||||||
uint8_t Channel;
|
uint8_t Channel;
|
||||||
bool bCheckScanList;
|
bool bCheckScanList;
|
||||||
|
|
||||||
if (g_menu_cursor == MENU_MEM_NAME && g_is_in_sub_menu && g_edit_index >= 0)
|
if (g_menu_cursor == MENU_MEM_NAME && g_in_sub_menu && g_edit_index >= 0)
|
||||||
{ // change the character
|
{ // change the character
|
||||||
if (key_pressed && g_edit_index < 10 && Direction != 0)
|
if (key_pressed && g_edit_index < 10 && Direction != 0)
|
||||||
{
|
{
|
||||||
@ -1801,7 +1824,7 @@ static void MENU_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Direction)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_is_in_sub_menu)
|
if (!g_in_sub_menu)
|
||||||
{
|
{
|
||||||
g_menu_cursor = NUMBER_AddWithWraparound(g_menu_cursor, -Direction, 0, g_menu_list_count - 1);
|
g_menu_cursor = NUMBER_AddWithWraparound(g_menu_cursor, -Direction, 0, g_menu_list_count - 1);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ static void SEARCH_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
|
|
||||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
INPUTBOX_Append(Key);
|
INPUTBOX_append(Key);
|
||||||
|
|
||||||
g_request_display_screen = DISPLAY_SEARCH;
|
g_request_display_screen = DISPLAY_SEARCH;
|
||||||
|
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
10
misc.c
10
misc.c
@ -305,16 +305,16 @@ unsigned int get_TX_VFO(void)
|
|||||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint32_t Multiplier = 10000000;
|
uint32_t mul = 10000000;
|
||||||
uint32_t Value = 0;
|
uint32_t val = 0;
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (pDigits[i] > 9)
|
if (pDigits[i] > 9)
|
||||||
break;
|
break;
|
||||||
Value += pDigits[i] * Multiplier;
|
val += pDigits[i] * mul;
|
||||||
Multiplier /= 10U;
|
mul /= 10u;
|
||||||
}
|
}
|
||||||
*pInteger = Value;
|
*pInteger = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits)
|
void NUMBER_ToDigits(uint32_t Value, char *pDigits)
|
||||||
|
@ -21,7 +21,23 @@
|
|||||||
char g_input_box[8];
|
char g_input_box[8];
|
||||||
uint8_t g_input_box_index;
|
uint8_t g_input_box_index;
|
||||||
|
|
||||||
void INPUTBOX_Append(const key_code_t Digit)
|
uint32_t INPUTBOX_value(void)
|
||||||
|
{
|
||||||
|
int i = g_input_box_index;
|
||||||
|
uint32_t val = 0;
|
||||||
|
uint32_t mul = 1;
|
||||||
|
while (--i >= 0)
|
||||||
|
{
|
||||||
|
if (g_input_box[i] < 10)
|
||||||
|
{
|
||||||
|
val += (uint32_t)g_input_box[i] * mul;
|
||||||
|
mul *= 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void INPUTBOX_append(const key_code_t Digit)
|
||||||
{
|
{
|
||||||
if (g_input_box_index >= sizeof(g_input_box))
|
if (g_input_box_index >= sizeof(g_input_box))
|
||||||
return;
|
return;
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
extern char g_input_box[8];
|
extern char g_input_box[8];
|
||||||
extern uint8_t g_input_box_index;
|
extern uint8_t g_input_box_index;
|
||||||
|
|
||||||
void INPUTBOX_Append(const key_code_t Digit);
|
uint32_t INPUTBOX_value(void);
|
||||||
|
void INPUTBOX_append(const key_code_t Digit);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
23
ui/menu.c
23
ui/menu.c
@ -381,7 +381,7 @@ const char g_sub_menu_SIDE_BUTT[9][16] =
|
|||||||
|
|
||||||
uint8_t g_menu_list_sorted[ARRAY_SIZE(g_menu_list)];
|
uint8_t g_menu_list_sorted[ARRAY_SIZE(g_menu_list)];
|
||||||
|
|
||||||
bool g_is_in_sub_menu;
|
bool g_in_sub_menu;
|
||||||
uint8_t g_menu_cursor;
|
uint8_t g_menu_cursor;
|
||||||
int8_t g_menu_scroll_direction;
|
int8_t g_menu_scroll_direction;
|
||||||
int32_t g_sub_menu_selection;
|
int32_t g_sub_menu_selection;
|
||||||
@ -478,7 +478,7 @@ void UI_DisplayMenu(void)
|
|||||||
g_frame_buffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
g_frame_buffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
||||||
|
|
||||||
// draw the little sub-menu triangle marker
|
// draw the little sub-menu triangle marker
|
||||||
if (g_is_in_sub_menu)
|
if (g_in_sub_menu)
|
||||||
memmove(g_frame_buffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
memmove(g_frame_buffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||||
|
|
||||||
// draw the menu index number/count
|
// draw the menu index number/count
|
||||||
@ -491,7 +491,7 @@ void UI_DisplayMenu(void)
|
|||||||
const int menu_index = g_menu_cursor; // current selected menu item
|
const int menu_index = g_menu_cursor; // current selected menu item
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
if (!g_is_in_sub_menu)
|
if (!g_in_sub_menu)
|
||||||
{
|
{
|
||||||
while (i < 2)
|
while (i < 2)
|
||||||
{ // leading menu items - small text
|
{ // leading menu items - small text
|
||||||
@ -647,7 +647,7 @@ void UI_DisplayMenu(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_OFFSET:
|
case MENU_OFFSET:
|
||||||
if (!g_is_in_sub_menu || g_input_box_index == 0)
|
if (!g_in_sub_menu || g_input_box_index == 0)
|
||||||
{
|
{
|
||||||
sprintf(String, "%d.%05u", g_sub_menu_selection / 100000, abs(g_sub_menu_selection) % 100000);
|
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);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||||
@ -655,7 +655,7 @@ void UI_DisplayMenu(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
String[i ] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
String[i + 0] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||||
String[3] = '.';
|
String[3] = '.';
|
||||||
for (i = 3; i < 6; i++)
|
for (i = 3; i < 6; i++)
|
||||||
String[i + 1] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
String[i + 1] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||||
@ -844,7 +844,7 @@ void UI_DisplayMenu(void)
|
|||||||
case MENU_MEM_NAME:
|
case MENU_MEM_NAME:
|
||||||
{
|
{
|
||||||
const bool valid = RADIO_CheckValidChannel(g_sub_menu_selection, false, 0);
|
const bool valid = RADIO_CheckValidChannel(g_sub_menu_selection, false, 0);
|
||||||
const unsigned int y = (!g_is_in_sub_menu || g_edit_index < 0) ? 1 : 0;
|
const unsigned int y = (!g_in_sub_menu || g_edit_index < 0) ? 1 : 0;
|
||||||
|
|
||||||
UI_GenerateChannelStringEx(String, valid ? "CH-" : "", g_sub_menu_selection);
|
UI_GenerateChannelStringEx(String, valid ? "CH-" : "", g_sub_menu_selection);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, y, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, y, 8);
|
||||||
@ -853,7 +853,7 @@ void UI_DisplayMenu(void)
|
|||||||
{
|
{
|
||||||
const uint32_t frequency = BOARD_fetchChannelFrequency(g_sub_menu_selection);
|
const uint32_t frequency = BOARD_fetchChannelFrequency(g_sub_menu_selection);
|
||||||
|
|
||||||
if (!g_is_in_sub_menu || g_edit_index < 0)
|
if (!g_in_sub_menu || g_edit_index < 0)
|
||||||
{ // show the channel name
|
{ // show the channel name
|
||||||
BOARD_fetchChannelName(String, g_sub_menu_selection);
|
BOARD_fetchChannelName(String, g_sub_menu_selection);
|
||||||
if (String[0] == 0)
|
if (String[0] == 0)
|
||||||
@ -870,7 +870,7 @@ void UI_DisplayMenu(void)
|
|||||||
if (!g_ask_for_confirmation)
|
if (!g_ask_for_confirmation)
|
||||||
{ // show the frequency so that the user knows the channels frequency
|
{ // show the frequency so that the user knows the channels frequency
|
||||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||||
if (!g_is_in_sub_menu || g_edit_index < 0)
|
if (!g_in_sub_menu || g_edit_index < 0)
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, y + 4, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, y + 4, 8);
|
||||||
else
|
else
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, y + 5, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, y + 5, 8);
|
||||||
@ -1134,7 +1134,10 @@ void UI_DisplayMenu(void)
|
|||||||
case MENU_BAT_CAL:
|
case MENU_BAT_CAL:
|
||||||
{
|
{
|
||||||
const uint16_t vol = (uint32_t)g_battery_voltage_average * g_battery_calibration[3] / g_sub_menu_selection;
|
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);
|
if (!g_in_sub_menu || g_input_box_index == 0)
|
||||||
|
sprintf(String, "%u.%02uV\n%d", vol / 100, vol % 100, g_sub_menu_selection);
|
||||||
|
else
|
||||||
|
sprintf(String, "%u.%02uV\n%d\n%04d", vol / 100, vol % 100, g_battery_calibration[3], g_sub_menu_selection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1259,7 +1262,7 @@ void UI_DisplayMenu(void)
|
|||||||
g_menu_cursor == MENU_TX_CDCSS ||
|
g_menu_cursor == MENU_TX_CDCSS ||
|
||||||
g_menu_cursor == MENU_DTMF_LIST)
|
g_menu_cursor == MENU_DTMF_LIST)
|
||||||
{
|
{
|
||||||
if (g_is_in_sub_menu)
|
if (g_in_sub_menu)
|
||||||
{
|
{
|
||||||
unsigned int Offset;
|
unsigned int Offset;
|
||||||
NUMBER_ToDigits(g_sub_menu_selection, String);
|
NUMBER_ToDigits(g_sub_menu_selection, String);
|
||||||
|
@ -191,7 +191,7 @@ extern const char g_sub_MENU_SCRAMBLERAMBLER[11][7];
|
|||||||
extern const char g_sub_menu_SIDE_BUTT[9][16];
|
extern const char g_sub_menu_SIDE_BUTT[9][16];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern bool g_is_in_sub_menu;
|
extern bool g_in_sub_menu;
|
||||||
|
|
||||||
extern uint8_t g_menu_cursor;
|
extern uint8_t g_menu_cursor;
|
||||||
extern int8_t g_menu_scroll_direction;
|
extern int8_t g_menu_scroll_direction;
|
||||||
|
2
ui/ui.c
2
ui/ui.c
@ -86,7 +86,7 @@ void GUI_SelectNextDisplay(gui_display_type_t Display)
|
|||||||
DTMF_clear_input_box();
|
DTMF_clear_input_box();
|
||||||
|
|
||||||
g_input_box_index = 0;
|
g_input_box_index = 0;
|
||||||
g_is_in_sub_menu = false;
|
g_in_sub_menu = false;
|
||||||
g_css_scan_mode = CSS_SCAN_MODE_OFF;
|
g_css_scan_mode = CSS_SCAN_MODE_OFF;
|
||||||
g_scan_state_dir = SCAN_STATE_DIR_OFF;
|
g_scan_state_dir = SCAN_STATE_DIR_OFF;
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
|
Loading…
x
Reference in New Issue
Block a user