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_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

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_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

View File

@ -16,6 +16,7 @@
#include <string.h>
#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();

View File

@ -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;

21
audio.c
View File

@ -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();

View File

@ -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;

View File

@ -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);

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
#include <string.h>
#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);
}
}

43
main.c
View File

@ -16,6 +16,7 @@
#include <string.h>
#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();

View File

@ -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++;
}

View File

@ -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;

View File

@ -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] =

View File

@ -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);

View File

@ -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);