mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 14:48:03 +03:00
Added 'VER' menu item to show the firmware version
This commit is contained in:
@ -96,7 +96,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
||||
size_t i;
|
||||
|
||||
if (End > Start)
|
||||
Start += (((End - Start) - (Length * 8)) + 1) / 2;
|
||||
Start += (((End - Start) - (Length * 7)) + 1) / 2;
|
||||
|
||||
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);
|
||||
const unsigned int char_spacing = char_width + 1;
|
||||
@ -119,7 +119,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
||||
size_t i;
|
||||
|
||||
if (End > Start)
|
||||
Start += (((End - Start) - (Length * 8)) + 1) / 2;
|
||||
Start += (((End - Start) - (Length * 7)) + 1) / 2;
|
||||
|
||||
const unsigned int char_width = ARRAY_SIZE(g_font_small_bold[0]);
|
||||
const unsigned int char_spacing = char_width + 1;
|
||||
|
15
ui/main.c
15
ui/main.c
@ -79,13 +79,14 @@ center_line_t center_line = CENTER_LINE_NONE;
|
||||
const unsigned int len = (level <= bar_width) ? level : bar_width;
|
||||
uint8_t *p_line = g_frame_buffer[line];
|
||||
unsigned int i;
|
||||
char s[16];
|
||||
char s[17];
|
||||
|
||||
if (now)
|
||||
memset(p_line, 0, LCD_WIDTH);
|
||||
|
||||
sprintf(s, "TX %u", secs);
|
||||
UI_PrintStringSmallBold(s, 2, 0, line); // issue UI_PrintStringSmallBold //UI_PrintStringSmall(s, 2, 0, line);
|
||||
|
||||
#if 1
|
||||
// solid bar
|
||||
for (i = 0; i < bar_width; i++)
|
||||
@ -118,7 +119,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
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 1: memmove(p + 0, BITMAP_ANTENNA, sizeof(BITMAP_ANTENNA));
|
||||
case 0: break;
|
||||
}
|
||||
|
||||
@ -127,14 +128,14 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
|
||||
unsigned int sqrt16(unsigned int value)
|
||||
uint32_t sqrt16(uint32_t value)
|
||||
{ // return square root of 'value'
|
||||
unsigned int shift = 16; // number of bits supplied in 'value' .. 2 ~ 32
|
||||
unsigned int bit = 1u << --shift;
|
||||
unsigned int sqrti = 0;
|
||||
unsigned int shift = 16; // this is the number of bits supplied in 'value' .. 2 ~ 32
|
||||
uint32_t bit = 1u << --shift;
|
||||
uint32_t sqrti = 0;
|
||||
while (bit)
|
||||
{
|
||||
const unsigned int temp = ((sqrti << 1) | bit) << shift--;
|
||||
const uint32_t temp = ((sqrti << 1) | bit) << shift--;
|
||||
if (value >= temp)
|
||||
{
|
||||
value -= temp;
|
||||
|
20
ui/menu.c
20
ui/menu.c
@ -35,6 +35,7 @@
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
#include "version.h"
|
||||
|
||||
// ***************************************************************************************
|
||||
// NOTE. the oder of menu entries you on-screen is now solely determined by the enum list order in ui/menu.h
|
||||
@ -122,6 +123,7 @@ const t_menu_item g_menu_list[] =
|
||||
{"SIDE1L", VOICE_ID_INVALID, MENU_SIDE1_LONG },
|
||||
{"SIDE2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT },
|
||||
{"SIDE2L", VOICE_ID_INVALID, MENU_SIDE2_LONG },
|
||||
{"VER", VOICE_ID_INVALID, MENU_VERSION },
|
||||
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||
|
||||
// hidden menu items from here on
|
||||
@ -970,6 +972,24 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, g_sub_menu_SIDE_BUTT[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_VERSION:
|
||||
{ // show the version string on multiple lines - if need be
|
||||
const unsigned int slen = strlen(Version_str);
|
||||
unsigned int m = 0;
|
||||
unsigned int k = 0;
|
||||
i = 0;
|
||||
while (i < (sizeof(String) - 1) && k < slen)
|
||||
{
|
||||
String[i++] = Version_str[k++];
|
||||
if (++m >= 9 && k < slen && i < (sizeof(String) - 1))
|
||||
{
|
||||
m = 0;
|
||||
String[i++] = '\n';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_RESET:
|
||||
strcpy(String, g_sub_menu_RESET[g_sub_menu_selection]);
|
||||
break;
|
||||
|
@ -117,6 +117,7 @@ enum
|
||||
MENU_SIDE1_LONG,
|
||||
MENU_SIDE2_SHORT,
|
||||
MENU_SIDE2_LONG,
|
||||
MENU_VERSION,
|
||||
MENU_RESET,
|
||||
|
||||
// ************************************
|
||||
|
@ -89,7 +89,7 @@ void UI_DisplayWelcome(void)
|
||||
if (strlen(str2) <= 12)
|
||||
UI_PrintString(str2, 0, 127, 5, 10);
|
||||
else
|
||||
UI_PrintStringSmallBold(str2, 0, 127, 5);
|
||||
UI_PrintStringSmall(str2, 0, 127, 5);
|
||||
|
||||
|
||||
#if 1
|
||||
|
Reference in New Issue
Block a user