diff --git a/Makefile b/Makefile index 21af1bd..07e8ade 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/firmware.bin b/firmware.bin index 7130a34..6d4de92 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index b26b03f..6f2d608 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/main.c b/main.c index ed80e7f..8cf14fa 100644 --- a/main.c +++ b/main.c @@ -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 diff --git a/ui/helper.c b/ui/helper.c index 1717baf..e439db3 100644 --- a/ui/helper.c +++ b/ui/helper.c @@ -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; diff --git a/ui/main.c b/ui/main.c index 31e5107..27a7cb9 100644 --- a/ui/main.c +++ b/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; diff --git a/ui/menu.c b/ui/menu.c index 56bb3f0..520b2fc 100644 --- a/ui/menu.c +++ b/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; diff --git a/ui/menu.h b/ui/menu.h index fe90bf0..c0f4b06 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -117,6 +117,7 @@ enum MENU_SIDE1_LONG, MENU_SIDE2_SHORT, MENU_SIDE2_LONG, + MENU_VERSION, MENU_RESET, // ************************************ diff --git a/ui/welcome.c b/ui/welcome.c index 9b0cd48..7bdcc6e 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -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 diff --git a/version.c b/version.c index a260a19..5dede6e 100644 --- a/version.c +++ b/version.c @@ -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__;