0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-05-19 00:11:18 +03:00

Added 'VER' menu item to show the firmware version

This commit is contained in:
OneOfEleven 2023-10-12 10:45:35 +01:00
parent 640011c78b
commit 1ac09b09f0
10 changed files with 42 additions and 23 deletions

View File

@ -13,7 +13,7 @@ ENABLE_AIRCOPY := 1
ENABLE_FMRADIO := 1
ENABLE_NOAA := 0
ENABLE_VOICE := 1
ENABLE_MUTE_RADIO_FOR_VOICE := 0
ENABLE_MUTE_RADIO_FOR_VOICE := 1
ENABLE_VOX := 1
ENABLE_ALARM := 1
ENABLE_TX1750 := 1

Binary file not shown.

Binary file not shown.

3
main.c
View File

@ -70,8 +70,9 @@ void Main(void)
g_boot_counter_10ms = 250; // 2.5 sec
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
#if defined(ENABLE_UART)
UART_SendText(UART_Version_str);
UART_SendText("\r\n");
#endif
// Not implementing authentic device checks

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -117,6 +117,7 @@ enum
MENU_SIDE1_LONG,
MENU_SIDE2_SHORT,
MENU_SIDE2_LONG,
MENU_VERSION,
MENU_RESET,
// ************************************

View File

@ -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

View File

@ -1,16 +1,12 @@
#define ONE_OF_ELEVEN_VER
#ifdef GIT_HASH
#define VER GIT_HASH
#define __VER__ GIT_HASH
#else
#define VER "231012"
#define __VER__ "231012"
#endif
#ifndef ONE_OF_ELEVEN_VER
const char Version_str[] = "OEFW-"VER;
const char UART_Version_str[] = "UV-K5 Firmware, Open Edition, OEFW-"VER"\r\n";
#else
const char Version_str[] = "1o11-"VER;
const char UART_Version_str[] = "UV-K5 Firmware, Open Edition, 1o11-"VER"\r\n";
#endif
//#define __VER_PREFIX__ "OEFW-"
#define __VER_PREFIX__ "1o11-"
const char Version_str[] = __VER_PREFIX__ __VER__;
const char UART_Version_str[] = "UV-K5 Firmware, Open Edition, " __VER_PREFIX__ __VER__ ", " __DATE__ " " __TIME__;