0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +03:00

Added boot-up screen menu option, boot-beeps option

This commit is contained in:
OneOfEleven
2023-09-15 06:28:45 +01:00
parent 494faf5cee
commit 2fe8cd3757
17 changed files with 94 additions and 48 deletions

View File

@ -15,6 +15,7 @@ ENABLE_WIDE_RX := 1
ENABLE_TX_WHEN_AM := 0 ENABLE_TX_WHEN_AM := 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
ENABLE_MAIN_KEY_HOLD := 1 ENABLE_MAIN_KEY_HOLD := 1
ENABLE_BOOT_BEEPS := 1
#ENABLE_SINGLE_VFO_CHAN := 1 #ENABLE_SINGLE_VFO_CHAN := 1
#ENABLE_BAND_SCOPE := 1 #ENABLE_BAND_SCOPE := 1
@ -177,6 +178,9 @@ endif
ifeq ($(ENABLE_MAIN_KEY_HOLD),1) ifeq ($(ENABLE_MAIN_KEY_HOLD),1)
CFLAGS += -DENABLE_MAIN_KEY_HOLD CFLAGS += -DENABLE_MAIN_KEY_HOLD
endif endif
ifeq ($(ENABLE_BOOT_BEEPS),1)
CFLAGS += -DENABLE_BOOT_BEEPS
endif
ifeq ($(ENABLE_SINGLE_VFO_CHAN),1) ifeq ($(ENABLE_SINGLE_VFO_CHAN),1)
CFLAGS += -DENABLE_SINGLE_VFO_CHAN CFLAGS += -DENABLE_SINGLE_VFO_CHAN
endif endif

View File

@ -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_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_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_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_SINGLE_VFO_CHAN := 1 not yet implemented
#ENABLE_BAND_SCOPE := 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 * Finer RSSI bar steps
* Nicer/cleaner big numeric font than original QS big numeric font * Nicer/cleaner big numeric font than original QS big numeric font
* Various menu re-wordings - trying to reduce 'WTH does that mean ?' * Various menu re-wordings - trying to reduce 'WTH does that mean ?'
* + others * plus others
# Compiler # Compiler

View File

@ -16,6 +16,7 @@
#include <string.h> #include <string.h>
#include "scheduler.h"
#include "app/action.h" #include "app/action.h"
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
#include "app/aircopy.h" #include "app/aircopy.h"
@ -1173,6 +1174,12 @@ void APP_TimeSlice10ms(void)
{ {
gFlashLightBlinkCounter++; gFlashLightBlinkCounter++;
#ifdef ENABLE_BOOT_BEEPS
if (boot_counter < 255)
if ((boot_counter % 25) == 0)
AUDIO_PlayBeep(BEEP_440HZ_40MS_OPTIONAL);
#endif
if (UART_IsCommandAvailable()) if (UART_IsCommandAvailable())
{ {
__disable_irq(); __disable_irq();

View File

@ -165,12 +165,16 @@ int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax)
case MENU_VOICE: case MENU_VOICE:
#endif #endif
case MENU_SC_REV: case MENU_SC_REV:
case MENU_PONMSG:
case MENU_ROGER: case MENU_ROGER:
*pMin = 0; *pMin = 0;
*pMax = 2; *pMax = 2;
break; break;
case MENU_PONMSG:
*pMin = 0;
*pMax = 3;
break;
case MENU_R_DCS: case MENU_R_DCS:
case MENU_T_DCS: case MENU_T_DCS:
*pMin = 0; *pMin = 0;

21
audio.c
View File

@ -68,7 +68,7 @@
#endif #endif
BEEP_Type_t gBeepToPlay; BEEP_Type_t gBeepToPlay = BEEP_NONE;
void AUDIO_PlayBeep(BEEP_Type_t Beep) void AUDIO_PlayBeep(BEEP_Type_t Beep)
{ {
@ -76,7 +76,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
uint16_t ToneFrequency; uint16_t ToneFrequency;
uint16_t Duration; 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; return;
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
@ -106,6 +108,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
switch (Beep) switch (Beep)
{ {
default:
case BEEP_NONE:
ToneFrequency = 220;
break;
case BEEP_1KHZ_60MS_OPTIONAL: case BEEP_1KHZ_60MS_OPTIONAL:
ToneFrequency = 1000; ToneFrequency = 1000;
break; break;
@ -113,7 +119,8 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
case BEEP_500HZ_60MS_DOUBLE_BEEP: case BEEP_500HZ_60MS_DOUBLE_BEEP:
ToneFrequency = 500; ToneFrequency = 500;
break; break;
default: case BEEP_440HZ_40MS_OPTIONAL:
case BEEP_440HZ_500MS:
ToneFrequency = 440; ToneFrequency = 440;
break; break;
} }
@ -134,11 +141,19 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
SYSTEM_DelayMs(60); SYSTEM_DelayMs(60);
BK4819_EnterTxMute(); BK4819_EnterTxMute();
SYSTEM_DelayMs(20); SYSTEM_DelayMs(20);
// Fallthrough // Fallthrough
case BEEP_1KHZ_60MS_OPTIONAL: case BEEP_1KHZ_60MS_OPTIONAL:
BK4819_ExitTxMute(); BK4819_ExitTxMute();
Duration = 60; Duration = 60;
break; break;
case BEEP_440HZ_40MS_OPTIONAL:
BK4819_ExitTxMute();
Duration = 40;
break;
case BEEP_440HZ_500MS: case BEEP_440HZ_500MS:
default: default:
BK4819_ExitTxMute(); BK4819_ExitTxMute();

View File

@ -26,7 +26,8 @@ enum BEEP_Type_t
BEEP_1KHZ_60MS_OPTIONAL, BEEP_1KHZ_60MS_OPTIONAL,
BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL, BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL,
BEEP_440HZ_500MS, 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; typedef enum BEEP_Type_t BEEP_Type_t;

View File

@ -407,7 +407,7 @@ void BOARD_EEPROM_Init(void)
gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO; gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO;
#endif #endif
gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false; 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 // 0E98..0E9F
EEPROM_ReadBuffer(0x0E98, Data, 8); EEPROM_ReadBuffer(0x0E98, Data, 8);

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <string.h>
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
#include "app/aircopy.h" #include "app/aircopy.h"
#endif #endif
@ -31,16 +33,14 @@
BOOT_Mode_t BOOT_GetMode(void) BOOT_Mode_t BOOT_GetMode(void)
{ {
KEY_Code_t Keys[2];
unsigned int i; unsigned int i;
KEY_Code_t Keys[2];
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT)) if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
return BOOT_MODE_NORMAL; return BOOT_MODE_NORMAL;
Keys[i] = KEYBOARD_Poll(); Keys[i] = KEYBOARD_Poll();
SYSTEM_DelayMs(20); SYSTEM_DelayMs(20);
} }
@ -66,20 +66,11 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
{ {
if (Mode == BOOT_MODE_F_LOCK) if (Mode == BOOT_MODE_F_LOCK)
{ {
gMenuListCount += 6; // enable the last 6 menu items
gMenuCursor = MENU_350TX; gMenuCursor = MENU_350TX;
gSubMenuSelection = gSetting_350TX; gSubMenuSelection = gSetting_350TX;
GUI_SelectNextDisplay(DISPLAY_MENU); GUI_SelectNextDisplay(DISPLAY_MENU);
gF_LOCK = true; gF_LOCK = true;
gMenuListCount = 57;
#ifndef ENABLE_VOICE
gMenuListCount--;
#endif
#ifndef ENABLE_ALARM
gMenuListCount--;
#endif
#ifndef ENABLE_NOAA
gMenuListCount--;
#endif
} }
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
else else
@ -113,5 +104,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
} }
#endif #endif
else else
{
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
}
} }

43
main.c
View File

@ -16,6 +16,7 @@
#include <string.h> #include <string.h>
#include "scheduler.h"
#include "app/app.h" #include "app/app.h"
#include "app/dtmf.h" #include "app/dtmf.h"
#include "audio.h" #include "audio.h"
@ -35,6 +36,7 @@
#include "settings.h" #include "settings.h"
#include "ui/lock.h" #include "ui/lock.h"
#include "ui/welcome.h" #include "ui/welcome.h"
#include "ui/menu.h"
#include "version.h" #include "version.h"
#ifndef ARRAY_SIZE #ifndef ARRAY_SIZE
@ -48,6 +50,8 @@ void _putchar(char c)
void Main(void) void Main(void)
{ {
unsigned int i;
// Enable clock gating of blocks we need // Enable clock gating of blocks we need
SYSCON_DEV_CLK_GATE = 0 SYSCON_DEV_CLK_GATE = 0
| SYSCON_DEV_CLK_GATE_GPIOA_BITS_ENABLE | SYSCON_DEV_CLK_GATE_GPIOA_BITS_ENABLE
@ -87,14 +91,13 @@ void Main(void)
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
{ for (i = 0; i < ARRAY_SIZE(gBatteryVoltages); i++)
unsigned int i; BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[i], &gBatteryCurrent);
for (i = 0; i < ARRAY_SIZE(gBatteryVoltages); i++)
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[i], &gBatteryCurrent);
}
BATTERY_GetReadings(false); BATTERY_GetReadings(false);
gMenuListCount = 0;
if (!gChargingWithTypeC && !gBatteryDisplayLevel) if (!gChargingWithTypeC && !gBatteryDisplayLevel)
{ {
FUNCTION_Select(FUNCTION_POWER_SAVE); FUNCTION_Select(FUNCTION_POWER_SAVE);
@ -108,24 +111,26 @@ void Main(void)
} }
else 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(); UI_DisplayWelcome();
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
SYSTEM_DelayMs(2000); if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE)
{ // 2.55 second boot-up screen
gMenuListCount = 51; while (boot_counter < 255)
#ifndef ENABLE_ALARM {
gMenuListCount--; #ifdef ENABLE_BOOT_BEEPS
#endif if ((boot_counter % 25) == 0)
#ifndef ENABLE_VOICE AUDIO_PlayBeep(BEEP_440HZ_40MS_OPTIONAL);
gMenuListCount--; #endif
#endif }
#ifndef ENABLE_NOAA }
gMenuListCount--;
#endif
BootMode = BOOT_GetMode(); BootMode = BOOT_GetMode();

View File

@ -14,6 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "scheduler.h"
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
#include "app/fm.h" #include "app/fm.h"
#endif #endif
@ -38,6 +39,7 @@
} while(0) } while(0)
static volatile uint32_t gGlobalSysTickCounter; static volatile uint32_t gGlobalSysTickCounter;
volatile uint8_t boot_counter = 0;
void SystickHandler(void); void SystickHandler(void);
@ -101,4 +103,7 @@ void SystickHandler(void)
if (gVoxStopCountdown) if (gVoxStopCountdown)
gVoxStopCountdown--; gVoxStopCountdown--;
if (boot_counter < 255)
boot_counter++;
} }

View File

@ -25,7 +25,8 @@
enum POWER_OnDisplayMode_t { enum POWER_OnDisplayMode_t {
POWER_ON_DISPLAY_MODE_FULL_SCREEN = 0, POWER_ON_DISPLAY_MODE_FULL_SCREEN = 0,
POWER_ON_DISPLAY_MODE_MESSAGE, 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; typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;

View File

@ -30,7 +30,7 @@
#include "ui/menu.h" #include "ui/menu.h"
#include "ui/ui.h" #include "ui/ui.h"
static const char MenuList[][7] = const char MenuList[][7] =
{ {
"SQL", "SQL",
"Step", "Step",
@ -98,7 +98,9 @@ static const char MenuList[][7] =
"200-TX", // was "200TX" "200-TX", // was "200TX"
"500-TX", // was "500TX" "500-TX", // was "500TX"
"350-EN", // was "350EN" "350-EN", // was "350EN"
"SCR-EN" // was "SCREN" "SCR-EN", // was "SCREN"
"" // indicate end of list
}; };
#if 0 #if 0
@ -224,11 +226,12 @@ static const char gSubMenu_PTT_ID[4][5] =
"BOTH", "BOTH",
}; };
static const char gSubMenu_PONMSG[3][5] = static const char gSubMenu_PONMSG[4][5] =
{ {
"FULL", "FULL",
"MSG", "MSG",
"VOL", "VOL",
"NONE"
}; };
static const char gSubMenu_ROGER[3][6] = static const char gSubMenu_ROGER[3][6] =

View File

@ -87,11 +87,13 @@ enum
MENU_SCREN MENU_SCREN
}; };
extern bool gIsInSubMenu; extern const char MenuList[][7];
extern uint8_t gMenuCursor; extern bool gIsInSubMenu;
extern int8_t gMenuScrollDirection;
extern uint32_t gSubMenuSelection; extern uint8_t gMenuCursor;
extern int8_t gMenuScrollDirection;
extern uint32_t gSubMenuSelection;
void UI_DisplayMenu(void); void UI_DisplayMenu(void);

View File

@ -36,6 +36,11 @@ void UI_DisplayWelcome(void)
memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gStatusLine, 0, sizeof(gStatusLine));
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); 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) if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_FULL_SCREEN)
{ {
ST7565_FillScreen(0xFF); ST7565_FillScreen(0xFF);