diff --git a/Makefile b/Makefile index bc40e52..63b1147 100644 --- a/Makefile +++ b/Makefile @@ -33,8 +33,14 @@ ENABLE_AUDIO_BAR := 1 #ENABLE_SINGLE_VFO_CHAN := 1 #ENABLE_BAND_SCOPE := 1 +############################################################# + TARGET = firmware +ifeq ($(ENABLE_LTO),1) + ENABLE_OVERLAY := 0 +endif + BSP_DEFINITIONS := $(wildcard hardware/*/*.def) BSP_HEADERS := $(patsubst hardware/%,bsp/%,$(BSP_DEFINITIONS)) BSP_HEADERS := $(patsubst %.def,%.h,$(BSP_HEADERS)) diff --git a/README.md b/README.md index 118addb..e28e5c2 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) . ``` ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming) -ENABLE_OVERLAY := 1 cpu FLASH stuff -ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads +ENABLE_OVERLAY := 0 cpu FLASH stuff +ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads - DISABLE overlay if you enable this ENABLE_UART := 1 without this you can't configure radio via PC ENABLE_AIRCOPY := 0 easier to just enter frequency ENABLE_FMRADIO := 1 WBFM VHF band 2 RX diff --git a/firmware.bin b/firmware.bin index e7a58e7..a3043a6 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 4e938b7..4470b03 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/frequencies.c b/frequencies.c index 57460c1..65f070f 100644 --- a/frequencies.c +++ b/frequencies.c @@ -205,6 +205,8 @@ int TX_FREQUENCY_Check(const uint32_t Frequency) case F_LOCK_CE: if (Frequency >= 14400000 && Frequency < 14600000) return 0; + if (Frequency >= 43000000 && Frequency < 44000000) + return 0; break; case F_LOCK_GB: diff --git a/helper/boot.c b/helper/boot.c index 651d0c2..b5a0c1e 100644 --- a/helper/boot.c +++ b/helper/boot.c @@ -39,8 +39,10 @@ BOOT_Mode_t BOOT_GetMode(void) for (i = 0; i < 2; i++) { if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT)) - return BOOT_MODE_NORMAL; + return BOOT_MODE_NORMAL; // PTT not pressed + Keys[i] = KEYBOARD_Poll(); + SYSTEM_DelayMs(20); } @@ -48,6 +50,7 @@ BOOT_Mode_t BOOT_GetMode(void) { gKeyReading0 = Keys[0]; gKeyReading1 = Keys[0]; + gDebounceCounter = 2; if (Keys[0] == KEY_SIDE1) @@ -66,7 +69,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode) { if (Mode == BOOT_MODE_F_LOCK) { - // enable all the menu items +/* // enable all the menu items gMenuListCount = 0; // while (MenuList[gMenuListCount].name != NULL) while (MenuList[gMenuListCount].name[0] != '\0') @@ -74,8 +77,10 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode) gMenuCursor = MENU_350TX; gSubMenuSelection = gSetting_350TX; +*/ GUI_SelectNextDisplay(DISPLAY_MENU); - gF_LOCK = true; + + gF_LOCK = true; } #ifdef ENABLE_AIRCOPY else diff --git a/main.c b/main.c index c1dc33e..b39081f 100644 --- a/main.c +++ b/main.c @@ -50,6 +50,7 @@ void _putchar(char c) void Main(void) { unsigned int i; + BOOT_Mode_t BootMode; // Enable clock gating of blocks we need SYSCON_DEV_CLK_GATE = 0 @@ -67,7 +68,7 @@ void Main(void) UART_Init(); boot_counter_10ms = 250; // 2.5 sec - + UART_Send(UART_Version, strlen(UART_Version)); // Not implementing authentic device checks @@ -101,12 +102,38 @@ void Main(void) AM_fix_init(); #endif - // count the number of menu list items - gMenuListCount = 0; - while (MenuList[gMenuListCount].name[0] != '\0') - gMenuListCount++; - gMenuListCount -= 8; // disable the last 'n' items + BootMode = BOOT_GetMode(); + if (BootMode == BOOT_MODE_F_LOCK) + { // enable all the menu items + gMenuListCount = 0; + while (MenuList[gMenuListCount].name[0] != '\0') + gMenuListCount++; + + gMenuCursor = MENU_350TX; + gSubMenuSelection = gSetting_350TX; + gF_LOCK = true; + } + else + { // hide the hidden menu items + gMenuListCount = 0; + while (MenuList[gMenuListCount].name[0] != '\0') + gMenuListCount++; + gMenuListCount -= 8; // disable the last 'n' items + } + // wait for user to release all keys/butts before moving on + if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || KEYBOARD_Poll() != KEY_INVALID) + { // keys are pressed + UI_DisplayReleaseKeys(); + BACKLIGHT_TurnOn(); + i = 0; + while (i < 50) // 500ms + { + i = (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && KEYBOARD_Poll() == KEY_INVALID) ? i + 1 : 0; + SYSTEM_DelayMs(10); + } + } + if (!gChargingWithTypeC && !gBatteryDisplayLevel) { FUNCTION_Select(FUNCTION_POWER_SAVE); @@ -120,9 +147,8 @@ void Main(void) } else { - BOOT_Mode_t BootMode; - UI_DisplayWelcome(); + BACKLIGHT_TurnOn(); if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE) @@ -131,7 +157,7 @@ void Main(void) { if (KEYBOARD_Poll() != KEY_INVALID) { // halt boot beeps - boot_counter_10ms = 0; + boot_counter_10ms = 0; break; } #ifdef ENABLE_BOOT_BEEPS @@ -141,8 +167,6 @@ void Main(void) } } - BootMode = BOOT_GetMode(); - if (gEeprom.POWER_ON_PASSWORD < 1000000) { bIsInLockScreen = true; @@ -179,6 +203,8 @@ void Main(void) #ifdef ENABLE_NOAA RADIO_ConfigureNOAA(); #endif + + // ****************** } while (1) diff --git a/ui/menu.c b/ui/menu.c index b09205b..ccdf777 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -370,6 +370,9 @@ void UI_DisplayMenu(void) while (i < 2) { // leading menu items const int k = menu_index + i - 2; + if (k < 0) + UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round + else if (k >= 0 && k < (int)gMenuListCount) UI_PrintStringSmall(MenuList[k].name, 0, 0, i); i++; @@ -384,6 +387,9 @@ void UI_DisplayMenu(void) const int k = menu_index + i - 2; if (k >= 0 && k < (int)gMenuListCount) UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i); + else + if (k >= (int)gMenuListCount) + UI_PrintStringSmall(MenuList[gMenuListCount - k].name, 0, 0, 1 + i); // wrap-a-round i++; } } diff --git a/ui/welcome.c b/ui/welcome.c index 8ef677c..814e417 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -27,6 +27,18 @@ #include "ui/status.h" #include "version.h" +void UI_DisplayReleaseKeys(void) +{ + memset(gStatusLine, 0, sizeof(gStatusLine)); + memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); + + UI_PrintString("RELEASE", 0, 127, 1, 10); + UI_PrintString("ALL KEYS", 0, 127, 3, 10); + + ST7565_BlitStatusLine(); // blank status line + ST7565_BlitFullScreen(); +} + void UI_DisplayWelcome(void) { char WelcomeString0[16]; diff --git a/ui/welcome.h b/ui/welcome.h index 1f7c6dd..b21a85e 100644 --- a/ui/welcome.h +++ b/ui/welcome.h @@ -17,6 +17,7 @@ #ifndef UI_WELCOME_H #define UI_WELCOME_H +void UI_DisplayReleaseKeys(void); void UI_DisplayWelcome(void); #endif