diff --git a/Makefile b/Makefile index 8843d7d..01a7a2f 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ ENABLE_WIDE_RX := 1 ENABLE_TX_WHEN_AM := 0 ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 ENABLE_MAIN_KEY_HOLD := 1 +ENABLE_BOOT_BEEPS := 1 #ENABLE_SINGLE_VFO_CHAN := 1 #ENABLE_BAND_SCOPE := 1 @@ -177,6 +178,9 @@ endif ifeq ($(ENABLE_MAIN_KEY_HOLD),1) CFLAGS += -DENABLE_MAIN_KEY_HOLD endif +ifeq ($(ENABLE_BOOT_BEEPS),1) + CFLAGS += -DENABLE_BOOT_BEEPS +endif ifeq ($(ENABLE_SINGLE_VFO_CHAN),1) CFLAGS += -DENABLE_SINGLE_VFO_CHAN endif diff --git a/README.md b/README.md index f61ffeb..4b132a2 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ ENABLE_WIDE_RX := 1 enable the RX in the full 18MHz to 1300 ENABLE_TX_WHEN_AM := 0 allow TX when RX set to AM ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 use CTCSS tail phase shift rather than QS's 55Hz tone method ENABLE_MAIN_KEY_HOLD := 1 keys 0-9 can be held down to bypass having to press the F-key +ENABLE_BOOT_BEEPS := 1 gives the user some audio feedback on the volume level knob position at boot-up #ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented #ENABLE_BAND_SCOPE := 1 not yet implemented ``` @@ -39,7 +40,7 @@ To enable the custom option, set the above option to '1' * Finer RSSI bar steps * Nicer/cleaner big numeric font than original QS big numeric font * Various menu re-wordings - trying to reduce 'WTH does that mean ?' -* + others +* plus others # Compiler diff --git a/app/app.c b/app/app.c index 5413443..4e24fc8 100644 --- a/app/app.c +++ b/app/app.c @@ -16,6 +16,7 @@ #include +#include "scheduler.h" #include "app/action.h" #ifdef ENABLE_AIRCOPY #include "app/aircopy.h" @@ -1173,6 +1174,12 @@ void APP_TimeSlice10ms(void) { gFlashLightBlinkCounter++; + #ifdef ENABLE_BOOT_BEEPS + if (boot_counter < 255) + if ((boot_counter % 25) == 0) + AUDIO_PlayBeep(BEEP_440HZ_40MS_OPTIONAL); + #endif + if (UART_IsCommandAvailable()) { __disable_irq(); diff --git a/app/menu.c b/app/menu.c index 58863d1..cef66db 100644 --- a/app/menu.c +++ b/app/menu.c @@ -165,12 +165,16 @@ int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax) case MENU_VOICE: #endif case MENU_SC_REV: - case MENU_PONMSG: case MENU_ROGER: *pMin = 0; *pMax = 2; break; + case MENU_PONMSG: + *pMin = 0; + *pMax = 3; + break; + case MENU_R_DCS: case MENU_T_DCS: *pMin = 0; diff --git a/audio.c b/audio.c index 1b8c0e4..bcf014c 100644 --- a/audio.c +++ b/audio.c @@ -68,7 +68,7 @@ #endif -BEEP_Type_t gBeepToPlay; +BEEP_Type_t gBeepToPlay = BEEP_NONE; void AUDIO_PlayBeep(BEEP_Type_t Beep) { @@ -76,7 +76,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) uint16_t ToneFrequency; uint16_t Duration; - if (Beep != BEEP_500HZ_60MS_DOUBLE_BEEP && Beep != BEEP_440HZ_500MS && !gEeprom.BEEP_CONTROL) + if (Beep != BEEP_500HZ_60MS_DOUBLE_BEEP && + Beep != BEEP_440HZ_500MS && + !gEeprom.BEEP_CONTROL) return; #ifdef ENABLE_AIRCOPY @@ -106,6 +108,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) switch (Beep) { + default: + case BEEP_NONE: + ToneFrequency = 220; + break; case BEEP_1KHZ_60MS_OPTIONAL: ToneFrequency = 1000; break; @@ -113,7 +119,8 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) case BEEP_500HZ_60MS_DOUBLE_BEEP: ToneFrequency = 500; break; - default: + case BEEP_440HZ_40MS_OPTIONAL: + case BEEP_440HZ_500MS: ToneFrequency = 440; break; } @@ -134,11 +141,19 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) SYSTEM_DelayMs(60); BK4819_EnterTxMute(); SYSTEM_DelayMs(20); + // Fallthrough + case BEEP_1KHZ_60MS_OPTIONAL: BK4819_ExitTxMute(); Duration = 60; break; + + case BEEP_440HZ_40MS_OPTIONAL: + BK4819_ExitTxMute(); + Duration = 40; + break; + case BEEP_440HZ_500MS: default: BK4819_ExitTxMute(); diff --git a/audio.h b/audio.h index 5c4b3ba..bec6126 100644 --- a/audio.h +++ b/audio.h @@ -26,7 +26,8 @@ enum BEEP_Type_t BEEP_1KHZ_60MS_OPTIONAL, BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL, BEEP_440HZ_500MS, - BEEP_500HZ_60MS_DOUBLE_BEEP + BEEP_500HZ_60MS_DOUBLE_BEEP, + BEEP_440HZ_40MS_OPTIONAL }; typedef enum BEEP_Type_t BEEP_Type_t; diff --git a/board.c b/board.c index 6c89d70..894f8ae 100644 --- a/board.c +++ b/board.c @@ -407,7 +407,7 @@ void BOARD_EEPROM_Init(void) gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO; #endif gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false; - gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 3) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE; + gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 4) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE; // 0E98..0E9F EEPROM_ReadBuffer(0x0E98, Data, 8); diff --git a/firmware b/firmware index 8f67ff4..354e164 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index e7e5a23..d1662e3 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 51f58ba..5e64482 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/helper/boot.c b/helper/boot.c index 386a07d..d8a4879 100644 --- a/helper/boot.c +++ b/helper/boot.c @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #ifdef ENABLE_AIRCOPY #include "app/aircopy.h" #endif @@ -31,16 +33,14 @@ BOOT_Mode_t BOOT_GetMode(void) { - KEY_Code_t Keys[2]; unsigned int i; + KEY_Code_t Keys[2]; for (i = 0; i < 2; i++) { if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT)) return BOOT_MODE_NORMAL; - Keys[i] = KEYBOARD_Poll(); - SYSTEM_DelayMs(20); } @@ -66,20 +66,11 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode) { if (Mode == BOOT_MODE_F_LOCK) { + gMenuListCount += 6; // enable the last 6 menu items gMenuCursor = MENU_350TX; gSubMenuSelection = gSetting_350TX; GUI_SelectNextDisplay(DISPLAY_MENU); gF_LOCK = true; - gMenuListCount = 57; - #ifndef ENABLE_VOICE - gMenuListCount--; - #endif - #ifndef ENABLE_ALARM - gMenuListCount--; - #endif - #ifndef ENABLE_NOAA - gMenuListCount--; - #endif } #ifdef ENABLE_AIRCOPY else @@ -113,5 +104,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode) } #endif else + { GUI_SelectNextDisplay(DISPLAY_MAIN); + } } diff --git a/main.c b/main.c index 9814867..5bae662 100644 --- a/main.c +++ b/main.c @@ -16,6 +16,7 @@ #include +#include "scheduler.h" #include "app/app.h" #include "app/dtmf.h" #include "audio.h" @@ -35,6 +36,7 @@ #include "settings.h" #include "ui/lock.h" #include "ui/welcome.h" +#include "ui/menu.h" #include "version.h" #ifndef ARRAY_SIZE @@ -48,6 +50,8 @@ void _putchar(char c) void Main(void) { + unsigned int i; + // Enable clock gating of blocks we need SYSCON_DEV_CLK_GATE = 0 | SYSCON_DEV_CLK_GATE_GPIOA_BITS_ENABLE @@ -87,14 +91,13 @@ void Main(void) RADIO_SetupRegisters(true); - { - unsigned int i; - for (i = 0; i < ARRAY_SIZE(gBatteryVoltages); i++) - BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[i], &gBatteryCurrent); - } + for (i = 0; i < ARRAY_SIZE(gBatteryVoltages); i++) + BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[i], &gBatteryCurrent); BATTERY_GetReadings(false); + gMenuListCount = 0; + if (!gChargingWithTypeC && !gBatteryDisplayLevel) { FUNCTION_Select(FUNCTION_POWER_SAVE); @@ -108,24 +111,26 @@ void Main(void) } else { - BOOT_Mode_t BootMode; + BOOT_Mode_t BootMode; + + // count the number of menu list items + while (MenuList[gMenuListCount][0] != 0) + gMenuListCount++; + gMenuListCount -= 6; UI_DisplayWelcome(); - BACKLIGHT_TurnOn(); - SYSTEM_DelayMs(2000); - - gMenuListCount = 51; - #ifndef ENABLE_ALARM - gMenuListCount--; - #endif - #ifndef ENABLE_VOICE - gMenuListCount--; - #endif - #ifndef ENABLE_NOAA - gMenuListCount--; - #endif + if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE) + { // 2.55 second boot-up screen + while (boot_counter < 255) + { + #ifdef ENABLE_BOOT_BEEPS + if ((boot_counter % 25) == 0) + AUDIO_PlayBeep(BEEP_440HZ_40MS_OPTIONAL); + #endif + } + } BootMode = BOOT_GetMode(); diff --git a/scheduler.c b/scheduler.c index 4fd40d1..27a441b 100644 --- a/scheduler.c +++ b/scheduler.c @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "scheduler.h" #ifdef ENABLE_FMRADIO #include "app/fm.h" #endif @@ -38,6 +39,7 @@ } while(0) static volatile uint32_t gGlobalSysTickCounter; +volatile uint8_t boot_counter = 0; void SystickHandler(void); @@ -45,7 +47,7 @@ void SystickHandler(void); void SystickHandler(void) { gGlobalSysTickCounter++; - + gNextTimeslice = true; if ((gGlobalSysTickCounter % 50) == 0) @@ -101,4 +103,7 @@ void SystickHandler(void) if (gVoxStopCountdown) gVoxStopCountdown--; + + if (boot_counter < 255) + boot_counter++; } diff --git a/settings.h b/settings.h index 8c57639..68508dd 100644 --- a/settings.h +++ b/settings.h @@ -25,7 +25,8 @@ enum POWER_OnDisplayMode_t { POWER_ON_DISPLAY_MODE_FULL_SCREEN = 0, POWER_ON_DISPLAY_MODE_MESSAGE, - POWER_ON_DISPLAY_MODE_VOLTAGE + POWER_ON_DISPLAY_MODE_VOLTAGE, + POWER_ON_DISPLAY_MODE_NONE }; typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t; diff --git a/ui/menu.c b/ui/menu.c index c8034be..5d33350 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -30,7 +30,7 @@ #include "ui/menu.h" #include "ui/ui.h" -static const char MenuList[][7] = +const char MenuList[][7] = { "SQL", "Step", @@ -98,7 +98,9 @@ static const char MenuList[][7] = "200-TX", // was "200TX" "500-TX", // was "500TX" "350-EN", // was "350EN" - "SCR-EN" // was "SCREN" + "SCR-EN", // was "SCREN" + + "" // indicate end of list }; #if 0 @@ -224,11 +226,12 @@ static const char gSubMenu_PTT_ID[4][5] = "BOTH", }; -static const char gSubMenu_PONMSG[3][5] = +static const char gSubMenu_PONMSG[4][5] = { "FULL", "MSG", "VOL", + "NONE" }; static const char gSubMenu_ROGER[3][6] = diff --git a/ui/menu.h b/ui/menu.h index d872370..5537895 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -87,11 +87,13 @@ enum MENU_SCREN }; -extern bool gIsInSubMenu; +extern const char MenuList[][7]; -extern uint8_t gMenuCursor; -extern int8_t gMenuScrollDirection; -extern uint32_t gSubMenuSelection; +extern bool gIsInSubMenu; + +extern uint8_t gMenuCursor; +extern int8_t gMenuScrollDirection; +extern uint32_t gSubMenuSelection; void UI_DisplayMenu(void); diff --git a/ui/welcome.c b/ui/welcome.c index 94393b6..8ef677c 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -36,6 +36,11 @@ void UI_DisplayWelcome(void) memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); + if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_NONE) + { + ST7565_FillScreen(0xFF); + } + else if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_FULL_SCREEN) { ST7565_FillScreen(0xFF);