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:
parent
640011c78b
commit
1ac09b09f0
2
Makefile
2
Makefile
@ -13,7 +13,7 @@ ENABLE_AIRCOPY := 1
|
|||||||
ENABLE_FMRADIO := 1
|
ENABLE_FMRADIO := 1
|
||||||
ENABLE_NOAA := 0
|
ENABLE_NOAA := 0
|
||||||
ENABLE_VOICE := 1
|
ENABLE_VOICE := 1
|
||||||
ENABLE_MUTE_RADIO_FOR_VOICE := 0
|
ENABLE_MUTE_RADIO_FOR_VOICE := 1
|
||||||
ENABLE_VOX := 1
|
ENABLE_VOX := 1
|
||||||
ENABLE_ALARM := 1
|
ENABLE_ALARM := 1
|
||||||
ENABLE_TX1750 := 1
|
ENABLE_TX1750 := 1
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
3
main.c
3
main.c
@ -70,8 +70,9 @@ void Main(void)
|
|||||||
|
|
||||||
g_boot_counter_10ms = 250; // 2.5 sec
|
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(UART_Version_str);
|
||||||
|
UART_SendText("\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Not implementing authentic device checks
|
// Not implementing authentic device checks
|
||||||
|
@ -96,7 +96,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (End > Start)
|
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_width = ARRAY_SIZE(g_font_small[0]);
|
||||||
const unsigned int char_spacing = char_width + 1;
|
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;
|
size_t i;
|
||||||
|
|
||||||
if (End > Start)
|
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_width = ARRAY_SIZE(g_font_small_bold[0]);
|
||||||
const unsigned int char_spacing = char_width + 1;
|
const unsigned int char_spacing = char_width + 1;
|
||||||
|
13
ui/main.c
13
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;
|
const unsigned int len = (level <= bar_width) ? level : bar_width;
|
||||||
uint8_t *p_line = g_frame_buffer[line];
|
uint8_t *p_line = g_frame_buffer[line];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char s[16];
|
char s[17];
|
||||||
|
|
||||||
if (now)
|
if (now)
|
||||||
memset(p_line, 0, LCD_WIDTH);
|
memset(p_line, 0, LCD_WIDTH);
|
||||||
|
|
||||||
sprintf(s, "TX %u", secs);
|
sprintf(s, "TX %u", secs);
|
||||||
UI_PrintStringSmallBold(s, 2, 0, line); // issue UI_PrintStringSmallBold //UI_PrintStringSmall(s, 2, 0, line);
|
UI_PrintStringSmallBold(s, 2, 0, line); // issue UI_PrintStringSmallBold //UI_PrintStringSmall(s, 2, 0, line);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// solid bar
|
// solid bar
|
||||||
for (i = 0; i < bar_width; i++)
|
for (i = 0; i < bar_width; i++)
|
||||||
@ -127,14 +128,14 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
|||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
|
|
||||||
unsigned int sqrt16(unsigned int value)
|
uint32_t sqrt16(uint32_t value)
|
||||||
{ // return square root of 'value'
|
{ // return square root of 'value'
|
||||||
unsigned int shift = 16; // number of bits supplied in 'value' .. 2 ~ 32
|
unsigned int shift = 16; // this is the number of bits supplied in 'value' .. 2 ~ 32
|
||||||
unsigned int bit = 1u << --shift;
|
uint32_t bit = 1u << --shift;
|
||||||
unsigned int sqrti = 0;
|
uint32_t sqrti = 0;
|
||||||
while (bit)
|
while (bit)
|
||||||
{
|
{
|
||||||
const unsigned int temp = ((sqrti << 1) | bit) << shift--;
|
const uint32_t temp = ((sqrti << 1) | bit) << shift--;
|
||||||
if (value >= temp)
|
if (value >= temp)
|
||||||
{
|
{
|
||||||
value -= temp;
|
value -= temp;
|
||||||
|
20
ui/menu.c
20
ui/menu.c
@ -35,6 +35,7 @@
|
|||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/menu.h"
|
#include "ui/menu.h"
|
||||||
#include "ui/ui.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
|
// 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 },
|
{"SIDE1L", VOICE_ID_INVALID, MENU_SIDE1_LONG },
|
||||||
{"SIDE2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT },
|
{"SIDE2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT },
|
||||||
{"SIDE2L", VOICE_ID_INVALID, MENU_SIDE2_LONG },
|
{"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 ?
|
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||||
|
|
||||||
// hidden menu items from here on
|
// 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]);
|
strcpy(String, g_sub_menu_SIDE_BUTT[g_sub_menu_selection]);
|
||||||
break;
|
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:
|
case MENU_RESET:
|
||||||
strcpy(String, g_sub_menu_RESET[g_sub_menu_selection]);
|
strcpy(String, g_sub_menu_RESET[g_sub_menu_selection]);
|
||||||
break;
|
break;
|
||||||
|
@ -117,6 +117,7 @@ enum
|
|||||||
MENU_SIDE1_LONG,
|
MENU_SIDE1_LONG,
|
||||||
MENU_SIDE2_SHORT,
|
MENU_SIDE2_SHORT,
|
||||||
MENU_SIDE2_LONG,
|
MENU_SIDE2_LONG,
|
||||||
|
MENU_VERSION,
|
||||||
MENU_RESET,
|
MENU_RESET,
|
||||||
|
|
||||||
// ************************************
|
// ************************************
|
||||||
|
@ -89,7 +89,7 @@ void UI_DisplayWelcome(void)
|
|||||||
if (strlen(str2) <= 12)
|
if (strlen(str2) <= 12)
|
||||||
UI_PrintString(str2, 0, 127, 5, 10);
|
UI_PrintString(str2, 0, 127, 5, 10);
|
||||||
else
|
else
|
||||||
UI_PrintStringSmallBold(str2, 0, 127, 5);
|
UI_PrintStringSmall(str2, 0, 127, 5);
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
18
version.c
18
version.c
@ -1,16 +1,12 @@
|
|||||||
|
|
||||||
#define ONE_OF_ELEVEN_VER
|
|
||||||
|
|
||||||
#ifdef GIT_HASH
|
#ifdef GIT_HASH
|
||||||
#define VER GIT_HASH
|
#define __VER__ GIT_HASH
|
||||||
#else
|
#else
|
||||||
#define VER "231012"
|
#define __VER__ "231012"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ONE_OF_ELEVEN_VER
|
//#define __VER_PREFIX__ "OEFW-"
|
||||||
const char Version_str[] = "OEFW-"VER;
|
#define __VER_PREFIX__ "1o11-"
|
||||||
const char UART_Version_str[] = "UV-K5 Firmware, Open Edition, OEFW-"VER"\r\n";
|
|
||||||
#else
|
const char Version_str[] = __VER_PREFIX__ __VER__;
|
||||||
const char Version_str[] = "1o11-"VER;
|
const char UART_Version_str[] = "UV-K5 Firmware, Open Edition, " __VER_PREFIX__ __VER__ ", " __DATE__ " " __TIME__;
|
||||||
const char UART_Version_str[] = "UV-K5 Firmware, Open Edition, 1o11-"VER"\r\n";
|
|
||||||
#endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user