mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-22 01:32:43 +00:00
Restore wideband weak signal bandwidth (squelch more sensitive), added 5 sec BKLT
This commit is contained in:
parent
653a00b89d
commit
b02d46f66a
@ -1848,7 +1848,7 @@ void APP_TimeSlice500ms(void)
|
||||
if (gBacklightCountdown > 0)
|
||||
if (gScreenToDisplay != DISPLAY_MENU || gMenuCursor != MENU_ABR) // don't turn off backlight if user is in backlight menu option
|
||||
if (--gBacklightCountdown == 0)
|
||||
if (gEeprom.BACKLIGHT < 5)
|
||||
if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
@ -1961,7 +1961,7 @@ void APP_TimeSlice500ms(void)
|
||||
|
||||
ST7565_Configure_GPIO_B11();
|
||||
|
||||
//if (gEeprom.BACKLIGHT < 5)
|
||||
//if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight off
|
||||
}
|
||||
#ifdef ENABLE_VOICE
|
||||
@ -2092,7 +2092,6 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
bool bFlag = false;
|
||||
|
||||
// const bool backlight_was_on = (gBacklightCountdown > 0 || gEeprom.BACKLIGHT >= 5);
|
||||
const bool backlight_was_on = GPIO_CheckBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
|
||||
if (Key == KEY_EXIT && !backlight_was_on && gEeprom.BACKLIGHT > 0)
|
||||
|
59
app/main.c
59
app/main.c
@ -176,32 +176,39 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
#else
|
||||
|
||||
// TODO: FIX ME .. not working for VFO, works for channel
|
||||
|
||||
switch (gTxVfo->CHANNEL_BANDWIDTH)
|
||||
{
|
||||
case BANDWIDTH_WIDE:
|
||||
gTxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
||||
break;
|
||||
default:
|
||||
case BANDWIDTH_NARROW:
|
||||
gTxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_WIDE;
|
||||
break;
|
||||
}
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gRequestSaveChannel = 2;
|
||||
}
|
||||
else
|
||||
// if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
}
|
||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH);
|
||||
gUpdateDisplay = true;
|
||||
gRequestDisplayScreen = gScreenToDisplay;
|
||||
#if 0
|
||||
// toggle wide/narrow
|
||||
// TODO: FIX ME .. not working for VFO, works for channel
|
||||
switch (gTxVfo->CHANNEL_BANDWIDTH)
|
||||
{
|
||||
case BANDWIDTH_WIDE:
|
||||
gTxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
||||
break;
|
||||
default:
|
||||
case BANDWIDTH_NARROW:
|
||||
gTxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_WIDE;
|
||||
break;
|
||||
}
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gRequestSaveChannel = 2;
|
||||
}
|
||||
else
|
||||
//if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
}
|
||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH);
|
||||
gUpdateDisplay = true;
|
||||
gRequestDisplayScreen = gScreenToDisplay;
|
||||
#else
|
||||
// toggle scanlist-1
|
||||
gTxVfo->SCANLIST1_PARTICIPATION = gTxVfo->SCANLIST1_PARTICIPATION ? 0 : 1;
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE_1;
|
||||
gFlagResetVfos = true;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -85,7 +85,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
|
||||
case MENU_ABR:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_BACK_LIGHT) - 1;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1;
|
||||
break;
|
||||
|
||||
case MENU_F_LOCK:
|
||||
|
21
board.c
21
board.c
@ -27,6 +27,7 @@
|
||||
#include "bsp/dp32g030/saradc.h"
|
||||
#include "bsp/dp32g030/syscon.h"
|
||||
#include "driver/adc.h"
|
||||
//#include "driver/backlight.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "driver/bk1080.h"
|
||||
#endif
|
||||
@ -44,10 +45,7 @@
|
||||
#if defined(ENABLE_OVERLAY)
|
||||
#include "sram-overlay.h"
|
||||
#endif
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
#include "ui/menu.h"
|
||||
|
||||
static const uint32_t gDefaultFrequencyTable[] =
|
||||
{
|
||||
@ -545,7 +543,7 @@ void BOARD_EEPROM_Init(void)
|
||||
gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF;
|
||||
gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4;
|
||||
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
||||
gEeprom.BACKLIGHT = (Data[5] < 6) ? Data[5] : 4;
|
||||
gEeprom.BACKLIGHT = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 4;
|
||||
gEeprom.TAIL_NOTE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
||||
gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true;
|
||||
|
||||
@ -791,6 +789,19 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t BOARD_fetchChannelFrequency(const int channel)
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t frequency;
|
||||
uint32_t offset;
|
||||
} __attribute__((packed)) info;
|
||||
|
||||
EEPROM_ReadBuffer(channel * 16, &info, sizeof(info));
|
||||
|
||||
return info.frequency;
|
||||
}
|
||||
|
||||
void BOARD_fetchChannelName(char *s, const int channel)
|
||||
{
|
||||
int i;
|
||||
|
21
board.h
21
board.h
@ -19,16 +19,17 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void BOARD_FLASH_Init(void);
|
||||
void BOARD_GPIO_Init(void);
|
||||
void BOARD_PORTCON_Init(void);
|
||||
void BOARD_ADC_Init(void);
|
||||
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
||||
void BOARD_Init(void);
|
||||
void BOARD_EEPROM_Init(void);
|
||||
void BOARD_EEPROM_LoadMoreSettings(void);
|
||||
void BOARD_fetchChannelName(char *s, const int channel);
|
||||
void BOARD_FactoryReset(bool bIsAll);
|
||||
void BOARD_FLASH_Init(void);
|
||||
void BOARD_GPIO_Init(void);
|
||||
void BOARD_PORTCON_Init(void);
|
||||
void BOARD_ADC_Init(void);
|
||||
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
||||
void BOARD_Init(void);
|
||||
void BOARD_EEPROM_Init(void);
|
||||
void BOARD_EEPROM_LoadMoreSettings(void);
|
||||
uint32_t BOARD_fetchChannelFrequency(const int channel);
|
||||
void BOARD_fetchChannelName(char *s, const int channel);
|
||||
void BOARD_FactoryReset(bool bIsAll);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -33,21 +33,23 @@ void BACKLIGHT_TurnOn(void)
|
||||
switch (gEeprom.BACKLIGHT)
|
||||
{
|
||||
default:
|
||||
case 1: // 10 sec
|
||||
case 1: // 5 sec
|
||||
gBacklightCountdown = 2 * 5;
|
||||
break;
|
||||
case 2: // 10 sec
|
||||
gBacklightCountdown = 2 * 10;
|
||||
break;
|
||||
case 2: // 20 sec
|
||||
case 3: // 20 sec
|
||||
gBacklightCountdown = 2 * 20;
|
||||
break;
|
||||
case 3: // 40 sec
|
||||
case 4: // 40 sec
|
||||
gBacklightCountdown = 2 * 40;
|
||||
break;
|
||||
case 4: // 80 sec
|
||||
case 5: // 80 sec
|
||||
gBacklightCountdown = 2 * 80;
|
||||
break;
|
||||
case 5: // always on
|
||||
case 6: // always on
|
||||
gBacklightCountdown = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,7 +561,7 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth)
|
||||
BK4819_WriteRegister(BK4819_REG_43,
|
||||
(0u << 15) | // 0
|
||||
(3u << 12) | // 3 RF filter bandwidth
|
||||
(3u << 9) | // 0 RF filter bandwidth when signal is weak
|
||||
(0u << 9) | // 0 RF filter bandwidth when signal is weak
|
||||
(0u << 6) | // 0 AFTxLPF2 filter Band Width
|
||||
(2u << 4) | // 2 BW Mode Selection
|
||||
(1u << 3) | // 1
|
||||
@ -574,7 +574,7 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth)
|
||||
BK4819_WriteRegister(BK4819_REG_43, // 0x4048); // 0 100 000 001 00 1 0 00
|
||||
(0u << 15) | // 0
|
||||
(3u << 12) | // 4 RF filter bandwidth
|
||||
(3u << 9) | // 0 RF filter bandwidth when signal is weak
|
||||
(0u << 9) | // 0 RF filter bandwidth when signal is weak
|
||||
(1u << 6) | // 1 AFTxLPF2 filter Band Width
|
||||
(0u << 4) | // 0 BW Mode Selection
|
||||
(1u << 3) | // 1
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
2
main.c
2
main.c
@ -116,7 +116,7 @@ void Main(void)
|
||||
{
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
|
||||
if (gEeprom.BACKLIGHT < 5)
|
||||
if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||
else
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON
|
||||
|
245
ui/menu.c
245
ui/menu.c
@ -35,93 +35,91 @@
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
const t_menu_item MenuList[] =
|
||||
{
|
||||
{"SQL", 0, VOICE_ID_SQUELCH },
|
||||
{"STEP", 0, VOICE_ID_FREQUENCY_STEP },
|
||||
{"T-PWR", 0, VOICE_ID_POWER }, // was "TXP"
|
||||
{"R-DCS", 0, VOICE_ID_DCS }, // was "R_DCS"
|
||||
{"R-CTCS", 0, VOICE_ID_CTCSS }, // was "R_CTCS"
|
||||
{"T-DCS", 0, VOICE_ID_DCS }, // was "T_DCS"
|
||||
{"T-CTCS", 0, VOICE_ID_CTCSS }, // was "T_CTCS"
|
||||
{"T-DIR", 0, VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION}, // was "SFT_D"
|
||||
{"T-OFFS", 0, VOICE_ID_TX_OFFSET_FREQUENCY }, // was "OFFSET"
|
||||
{"T-VFO", 0, VOICE_ID_INVALID }, // was "WX"
|
||||
{"T-TOUT", 0, VOICE_ID_TRANSMIT_OVER_TIME }, // was "TOT"
|
||||
{"W/N", 0, VOICE_ID_CHANNEL_BANDWIDTH },
|
||||
{"SCRAM", 0, VOICE_ID_SCRAMBLER_ON }, // was "SCR"
|
||||
{"BUSYCL", 0, VOICE_ID_BUSY_LOCKOUT }, // was "BCL"
|
||||
{"CH-SAV", 0, VOICE_ID_MEMORY_CHANNEL }, // was "MEM-CH"
|
||||
{"CH-DEL", 0, VOICE_ID_DELETE_CHANNEL }, // was "DEL-CH"
|
||||
{"CH-NAM", 0, VOICE_ID_INVALID },
|
||||
{"CH-DIS", 0, VOICE_ID_INVALID }, // was "MDF"
|
||||
{"BATSAV", 0, VOICE_ID_SAVE_MODE }, // was "SAVE"
|
||||
{"VOX", 0, VOICE_ID_VOX },
|
||||
{"BACKLT", 0, VOICE_ID_INVALID }, // was "ABR"
|
||||
{"DUALRX", 0, VOICE_ID_DUAL_STANDBY }, // was "TDR"
|
||||
{"BEEP", 0, VOICE_ID_BEEP_PROMPT },
|
||||
// name, hidden, voice ID, menu ID
|
||||
|
||||
{"SQL", 0, VOICE_ID_SQUELCH, MENU_SQL },
|
||||
{"STEP", 0, VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
||||
{"T-PWR", 0, VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||
{"R-DCS", 0, VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||
{"R-CTCS", 0, VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||
{"T-DCS", 0, VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||
{"T-CTCS", 0, VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||
{"T-DIR", 0, VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||
{"T-OFFS", 0, VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||
{"T-VFO", 0, VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
||||
{"T-TOUT", 0, VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"W/N", 0, VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
||||
{"SCRAM", 0, VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||
{"BUSYCL", 0, VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
||||
{"CH-SAV", 0, VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||
{"CH-DEL", 0, VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||
{"CH-NAM", 0, VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||
{"CH-DIS", 0, VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||
{"BATSAV", 0, VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||
{"VOX", 0, VOICE_ID_VOX, MENU_VOX },
|
||||
{"BACKLT", 0, VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||
{"DUALRX", 0, VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
||||
{"BEEP", 0, VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||
#ifdef ENABLE_VOICE
|
||||
{"VOICE", 0, VOICE_ID_VOICE_PROMPT },
|
||||
{"VOICE", 0, VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||
#endif
|
||||
{"SC-REV", 0, VOICE_ID_INVALID },
|
||||
{"KEYLOC", 0, VOICE_ID_INVALID }, // was "AUTOLk"
|
||||
{"S-ADD1", 0, VOICE_ID_INVALID },
|
||||
{"S-ADD2", 0, VOICE_ID_INVALID },
|
||||
{"STE", 0, VOICE_ID_INVALID },
|
||||
{"RP-STE", 0, VOICE_ID_INVALID },
|
||||
{"MIC", 0, VOICE_ID_INVALID },
|
||||
{"SC-REV", 0, VOICE_ID_INVALID, MENU_SC_REV },
|
||||
{"KEYLOC", 0, VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||
{"S-ADD1", 0, VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||
{"S-ADD2", 0, VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||
{"STE", 0, VOICE_ID_INVALID, MENU_STE },
|
||||
{"RP-STE", 0, VOICE_ID_INVALID, MENU_RP_STE },
|
||||
{"MIC", 0, VOICE_ID_INVALID, MENU_MIC },
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
{"MICBAR", 0, VOICE_ID_INVALID },
|
||||
{"MICBAR", 0, VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||
#endif
|
||||
#ifdef ENABLE_COMPANDER
|
||||
{"COMPND", 0, VOICE_ID_INVALID },
|
||||
{"COMPND", 0, VOICE_ID_INVALID, MENU_COMPAND },
|
||||
#endif
|
||||
{"1-CALL", 0, VOICE_ID_INVALID },
|
||||
{"SLIST", 0, VOICE_ID_INVALID },
|
||||
{"SLIST1", 0, VOICE_ID_INVALID },
|
||||
{"SLIST2", 0, VOICE_ID_INVALID },
|
||||
{"1-CALL", 0, VOICE_ID_INVALID, MENU_1_CALL },
|
||||
{"SLIST", 0, VOICE_ID_INVALID, MENU_S_LIST },
|
||||
{"SLIST1", 0, VOICE_ID_INVALID, MENU_SLIST1 },
|
||||
{"SLIST2", 0, VOICE_ID_INVALID, MENU_SLIST2 },
|
||||
#ifdef ENABLE_ALARM
|
||||
"AL-MOD", 0, VOICE_ID_INVALID },
|
||||
"AL-MOD", 0, VOICE_ID_INVALID, MENU_AL_MOD },
|
||||
#endif
|
||||
{"ANI-ID", 0, VOICE_ID_ANI_CODE },
|
||||
{"UPCODE", 0, VOICE_ID_INVALID },
|
||||
{"DWCODE", 0, VOICE_ID_INVALID },
|
||||
{"D-ST", 0, VOICE_ID_INVALID },
|
||||
{"D-RSP", 0, VOICE_ID_INVALID },
|
||||
{"D-HOLD", 0, VOICE_ID_INVALID },
|
||||
{"D-PRE", 0, VOICE_ID_INVALID },
|
||||
{"PTT-ID", 0, VOICE_ID_INVALID },
|
||||
{"D-DCD", 0, VOICE_ID_INVALID },
|
||||
{"D-LIST", 0, VOICE_ID_INVALID },
|
||||
{"D-LIVE", 0, VOICE_ID_INVALID }, // live DTMF decoder
|
||||
{"PONMSG", 0, VOICE_ID_INVALID },
|
||||
{"ROGER", 0, VOICE_ID_INVALID },
|
||||
{"BATVOL", 0, VOICE_ID_INVALID }, // was "VOL"
|
||||
{"BATTXT", 0, VOICE_ID_INVALID },
|
||||
{"MODE", 0, VOICE_ID_INVALID }, // was "AM"
|
||||
{"ANI-ID", 0, VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||
{"UPCODE", 0, VOICE_ID_INVALID, MENU_UPCODE },
|
||||
{"DWCODE", 0, VOICE_ID_INVALID, MENU_DWCODE },
|
||||
{"D-ST", 0, VOICE_ID_INVALID, MENU_D_ST },
|
||||
{"D-RSP", 0, VOICE_ID_INVALID, MENU_D_RSP },
|
||||
{"D-HOLD", 0, VOICE_ID_INVALID, MENU_D_HOLD },
|
||||
{"D-PRE", 0, VOICE_ID_INVALID, MENU_D_PRE },
|
||||
{"PTT-ID", 0, VOICE_ID_INVALID, MENU_PTT_ID },
|
||||
{"D-DCD", 0, VOICE_ID_INVALID, MENU_D_DCD },
|
||||
{"D-LIST", 0, VOICE_ID_INVALID, MENU_D_LIST },
|
||||
{"D-LIVE", 0, VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||
{"PONMSG", 0, VOICE_ID_INVALID, MENU_PONMSG },
|
||||
{"ROGER", 0, VOICE_ID_INVALID, MENU_ROGER },
|
||||
{"BATVOL", 0, VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||
{"BATTXT", 0, VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||
{"MODE", 0, VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||
#ifdef ENABLE_NOAA
|
||||
{"NOAA-S", 0, VOICE_ID_INVALID },
|
||||
{"NOAA-S", 0, VOICE_ID_INVALID, MENU_NOAA_S },
|
||||
#endif
|
||||
{"RESET", 0, VOICE_ID_INITIALISATION }, // might be better to move this to the hidden menu items ?
|
||||
{"RESET", 0, VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||
|
||||
// hidden menu items from here on
|
||||
// hidden menu items from here on (center param set to '1')
|
||||
// enabled if pressing both the PTT and upper side button at power-on
|
||||
|
||||
{"F-LOCK", 1, VOICE_ID_INVALID },
|
||||
{"TX-200", 1, VOICE_ID_INVALID }, // was "200TX"
|
||||
{"TX-350", 1, VOICE_ID_INVALID }, // was "350TX"
|
||||
{"TX-500", 1, VOICE_ID_INVALID }, // was "500TX"
|
||||
{"350-EN", 1, VOICE_ID_INVALID }, // was "350EN"
|
||||
{"SCR-EN", 1, VOICE_ID_INVALID }, // was "SCREN"
|
||||
{"F-LOCK", 1, VOICE_ID_INVALID, MENU_F_LOCK },
|
||||
{"TX-200", 1, VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
||||
{"TX-350", 1, VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
||||
{"TX-500", 1, VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||
{"350-EN", 1, VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||
{"SCR-EN", 1, VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||
|
||||
{"TX-EN", 1, VOICE_ID_INVALID }, // enable TX
|
||||
{"F-CALI", 1, VOICE_ID_INVALID }, // reference xtal calibration
|
||||
{"TX-EN", 1, VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
{"F-CALI", 1, VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
|
||||
{"", 0, VOICE_ID_INVALID } // end of list - DO NOT delete this
|
||||
{"", 1, VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
||||
};
|
||||
|
||||
const char gSubMenu_TXP[3][5] =
|
||||
@ -245,9 +243,10 @@ const char gSubMenu_F_LOCK[6][4] =
|
||||
"438"
|
||||
};
|
||||
|
||||
const char gSubMenu_BACK_LIGHT[6][7] =
|
||||
const char gSubMenu_BACKLIGHT[7][7] =
|
||||
{
|
||||
"OFF",
|
||||
"5 sec",
|
||||
"10 sec",
|
||||
"20 sec",
|
||||
"40 sec",
|
||||
@ -284,9 +283,12 @@ int edit_index;
|
||||
|
||||
void UI_DisplayMenu(void)
|
||||
{
|
||||
unsigned int i;
|
||||
char String[16];
|
||||
char Contact[16];
|
||||
const unsigned int menu_list_width = 6; // max no. of characters on the menu list (left side)
|
||||
const unsigned int menu_item_x1 = (8 * menu_list_width) + 2;
|
||||
const unsigned int menu_item_x2 = LCD_WIDTH - 1;
|
||||
unsigned int i;
|
||||
char String[16];
|
||||
char Contact[16];
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
@ -295,16 +297,16 @@ void UI_DisplayMenu(void)
|
||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
||||
|
||||
// invert the pixels
|
||||
for (i = 0; i < 48; i++)
|
||||
// invert the menu list text pixels
|
||||
for (i = 0; i < (8 * menu_list_width); i++)
|
||||
{
|
||||
gFrameBuffer[2][i] ^= 0xFF;
|
||||
gFrameBuffer[3][i] ^= 0xFF;
|
||||
}
|
||||
|
||||
// draw vertical separating dotted line
|
||||
for (i = 0; i < 6; i++)
|
||||
gFrameBuffer[i][49] = 0xAA;
|
||||
for (i = 0; i < 7; i++)
|
||||
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
||||
|
||||
// draw the menu index number/count
|
||||
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
|
||||
@ -312,7 +314,7 @@ void UI_DisplayMenu(void)
|
||||
|
||||
// draw the little marker
|
||||
if (gIsInSubMenu)
|
||||
memmove(gFrameBuffer[0] + 50, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
@ -372,7 +374,7 @@ void UI_DisplayMenu(void)
|
||||
if (!gIsInSubMenu || gInputBoxIndex == 0)
|
||||
{
|
||||
sprintf(String, "%d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||
UI_PrintString(String, 50, 127, 1, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -386,10 +388,10 @@ void UI_DisplayMenu(void)
|
||||
String[ 9] = 0;
|
||||
String[10] = 0;
|
||||
String[11] = 0;
|
||||
UI_PrintString(String, 50, 127, 1, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
}
|
||||
|
||||
UI_PrintString("MHz", 50, 127, 3, 8);
|
||||
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 3, 8);
|
||||
|
||||
already_printed = true;
|
||||
break;
|
||||
@ -407,7 +409,7 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_ABR:
|
||||
strcpy(String, gSubMenu_BACK_LIGHT[gSubMenuSelection]);
|
||||
strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_AM:
|
||||
@ -451,20 +453,14 @@ void UI_DisplayMenu(void)
|
||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||
|
||||
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
||||
UI_PrintString(String, 50, 127, 0, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
|
||||
if (valid && !gAskForConfirmation)
|
||||
{ // show the frequency so that the user knows the channels frequency
|
||||
struct
|
||||
{
|
||||
uint32_t Frequency;
|
||||
uint32_t Offset;
|
||||
} __attribute__((packed)) Info;
|
||||
EEPROM_ReadBuffer(gSubMenuSelection * 16, &Info, sizeof(Info));
|
||||
|
||||
sprintf(String, "%03u.%05u", Info.Frequency / 100000, Info.Frequency % 100000);
|
||||
// UI_PrintStringSmall(String, 50, 127, 5);
|
||||
UI_PrintString(String, 50, 127, 4, 8);
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
||||
}
|
||||
|
||||
already_printed = true;
|
||||
@ -476,40 +472,35 @@ void UI_DisplayMenu(void)
|
||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||
|
||||
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
||||
UI_PrintString(String, 50, 127, 0, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
|
||||
if (valid)
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t Frequency;
|
||||
uint32_t Offset;
|
||||
} __attribute__((packed)) Info;
|
||||
EEPROM_ReadBuffer(gSubMenuSelection * 16, &Info, sizeof(Info));
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
||||
|
||||
if (!gIsInSubMenu || edit_index < 0)
|
||||
{ // show the channel name
|
||||
BOARD_fetchChannelName(String, gSubMenuSelection);
|
||||
if (String[0] == 0)
|
||||
strcpy(String, "--");
|
||||
UI_PrintString(String, 50, 127, 2, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
||||
}
|
||||
else
|
||||
{ // show the channel name being edited
|
||||
UI_PrintString(edit, 50, 0, 2, 8);
|
||||
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
||||
if (edit_index < 10)
|
||||
UI_PrintString("^", 50 + (8 * edit_index), 0, 4, 8); // show the cursor
|
||||
// UI_PrintStringSmall("^", 50 + (8 * edit_index), 0, 4);
|
||||
UI_PrintString( "^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
||||
// UI_PrintStringSmall("^", menu_item_x1 + (8 * edit_index), 0, 4);
|
||||
}
|
||||
|
||||
if (!gAskForConfirmation)
|
||||
{ // show the frequency so that the user knows the channels frequency
|
||||
sprintf(String, "%03u.%05u", Info.Frequency / 100000, Info.Frequency % 100000);
|
||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
if (!gIsInSubMenu || edit_index < 0)
|
||||
UI_PrintString(String, 50, 127, 4, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
else
|
||||
UI_PrintString(String, 50, 127, 5, 8);
|
||||
// UI_PrintStringSmall(String, 50, 127, 5);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -615,17 +606,17 @@ void UI_DisplayMenu(void)
|
||||
case MENU_VOL:
|
||||
// 1st text line
|
||||
sprintf(String, "%u.%02uV", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100);
|
||||
UI_PrintString(String, 50, 127, 1, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
|
||||
{ // 2nd text line .. percentage
|
||||
UI_PrintString(String, 50, 127, 1, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
|
||||
const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v);
|
||||
sprintf(String, "%u%%", percent);
|
||||
UI_PrintString(String, 50, 127, 3, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8);
|
||||
#if 0
|
||||
sprintf(String, "Curr %u", gBatteryCurrent); // needs scaling into mA
|
||||
UI_PrintString(String, 50, 127, 5, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -647,13 +638,13 @@ void UI_DisplayMenu(void)
|
||||
BK4819_WriteRegister(BK4819_REG_3B, value);
|
||||
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
UI_PrintString(String, 50, 127, 0, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
sprintf(String, "%u.%06u", xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
UI_PrintString(String, 50, 127, 2, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
||||
|
||||
UI_PrintString("MHz", 50, 127, 4, 8);
|
||||
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
already_printed = true;
|
||||
}
|
||||
@ -661,7 +652,7 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
|
||||
if (!already_printed)
|
||||
UI_PrintString(String, 50, 127, 2, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
||||
|
||||
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
|
||||
{
|
||||
@ -676,22 +667,22 @@ void UI_DisplayMenu(void)
|
||||
// if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i])
|
||||
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i])
|
||||
{
|
||||
UI_PrintString(String, 50, 127, 0, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
UI_PrintString(String, 50, 127, 0, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i]))
|
||||
{
|
||||
sprintf(String, "PRI1:%u", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
||||
UI_PrintString(String, 50, 127, 2, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i]))
|
||||
{
|
||||
sprintf(String, "PRI2:%u", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
||||
UI_PrintString(String, 50, 127, 4, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -706,26 +697,26 @@ void UI_DisplayMenu(void)
|
||||
BOARD_fetchChannelName(s, gSubMenuSelection);
|
||||
if (s[0] == 0)
|
||||
strcpy(s, "--");
|
||||
UI_PrintString(s, 50, 127, 2, 8);
|
||||
UI_PrintString(s, menu_item_x1, menu_item_x2, 2, 8);
|
||||
}
|
||||
|
||||
if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
UI_PrintString("SCAN", 50, 127, 4, 8);
|
||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_UPCODE)
|
||||
if (strlen(gEeprom.DTMF_UP_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_UP_CODE + 8, 50, 127, 4, 8);
|
||||
UI_PrintString(gEeprom.DTMF_UP_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_DWCODE)
|
||||
if (strlen(gEeprom.DTMF_DOWN_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, 50, 127, 4, 8);
|
||||
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid)
|
||||
{
|
||||
Contact[11] = 0;
|
||||
memmove(&gDTMF_ID, Contact + 8, 4);
|
||||
sprintf(String, "ID:%s", Contact + 8);
|
||||
UI_PrintString(String, 50, 127, 4, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_R_CTCS ||
|
||||
@ -746,7 +737,7 @@ void UI_DisplayMenu(void)
|
||||
gMenuCursor == MENU_DEL_CH) && gAskForConfirmation)
|
||||
{ // display confirmation
|
||||
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
||||
UI_PrintString(String, 50, 127, 5, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
}
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
|
@ -26,6 +26,7 @@ typedef struct {
|
||||
const char name[7]; // menu display only has room for 6 characters
|
||||
uint8_t hidden;
|
||||
VOICE_ID_t voice_id;
|
||||
uint8_t menu_id;
|
||||
} t_menu_item;
|
||||
|
||||
enum
|
||||
@ -132,7 +133,7 @@ extern const char gSubMenu_PONMSG[4][5];
|
||||
extern const char gSubMenu_ROGER[3][6];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char gSubMenu_F_LOCK[6][4];
|
||||
extern const char gSubMenu_BACK_LIGHT[6][7];
|
||||
extern const char gSubMenu_BACKLIGHT[7][7];
|
||||
#ifdef ENABLE_COMPANDER
|
||||
extern const char gSubMenu_Compand[4][6];
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user