mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
Ignore all long-press/function keys whilst in menu
This commit is contained in:
parent
e042b21e65
commit
609df5f279
4
Makefile
4
Makefile
@ -13,7 +13,7 @@ ENABLE_NOAA := 0
|
||||
ENABLE_VOICE := 0
|
||||
ENABLE_VOX := 0
|
||||
ENABLE_ALARM := 0
|
||||
ENABLE_TX1750 := 1
|
||||
ENABLE_TX1750 := 0
|
||||
ENABLE_BIG_FREQ := 0
|
||||
ENABLE_SMALL_BOLD := 1
|
||||
ENABLE_KEEP_MEM_NAME := 1
|
||||
@ -31,7 +31,7 @@ ENABLE_AM_FIX_SHOW_DATA := 1
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 0
|
||||
ENABLE_RSSI_BAR := 1
|
||||
ENABLE_AUDIO_BAR := 1
|
||||
ENABLE_AUDIO_BAR := 0
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||
#ENABLE_BAND_SCOPE := 1
|
||||
|
@ -99,10 +99,10 @@ To compile directly in windows without the need of a linux virtual machine:
|
||||
1. Download and install "gcc-arm-none-eabi-10.3-2021.10-win32.exe" from https://developer.arm.com/downloads/-/gnu-rm
|
||||
2. Download and install "gnu_make-3.81.exe" from https://gnuwin32.sourceforge.net/packages/make.htm
|
||||
|
||||
3. You may (or not) need to manualy add gcc path to you OS environment PATH.
|
||||
3. You may need to (I didn't) manualy add gcc path to your OS environment PATH.
|
||||
ie add C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin
|
||||
|
||||
4. You may (or not) need to reboot your PC after installing the above
|
||||
4. You may need to reboot your PC after installing the above
|
||||
```
|
||||
|
||||
Then you can run 'win_make.bat' from the directory you saved this source code too.
|
||||
|
25
app/app.c
25
app/app.c
@ -677,17 +677,17 @@ static void MR_NextChannel(void)
|
||||
// this bit doesn't yet work if the other VFO is a frequency
|
||||
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||
// dual watch is enabled - include the other VFO in the scan
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||
chan = gEeprom.ScreenChannel[chan];
|
||||
if (IS_MR_CHANNEL(chan))
|
||||
{
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||
gNextMrChannel = chan;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
// {
|
||||
// chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||
// chan = gEeprom.ScreenChannel[chan];
|
||||
// if (IS_MR_CHANNEL(chan))
|
||||
// {
|
||||
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||
// gNextMrChannel = chan;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
default:
|
||||
case SCAN_NEXT_CHAN_MR:
|
||||
@ -2163,8 +2163,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
|
||||
if (!bKeyHeld)
|
||||
{
|
||||
// keypad is locked, tell the user
|
||||
{ // keypad is locked, tell the user
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
gKeypadLocked = 4; // 2 seconds
|
||||
gUpdateDisplay = true;
|
||||
|
@ -52,13 +52,23 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MENU &&
|
||||
gScreenToDisplay != DISPLAY_FM &&
|
||||
#ifdef ENABLE_FMRADIO
|
||||
!gFmRadioMode &&
|
||||
#endif
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{ // toggle the keyboad lock
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
||||
#endif
|
||||
|
||||
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
||||
|
||||
gRequestSaveSettings = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
|
19
app/main.c
19
app/main.c
@ -40,6 +40,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
uint8_t Band;
|
||||
uint8_t Vfo = gEeprom.TX_VFO;
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MENU)
|
||||
return;
|
||||
|
||||
switch (Key)
|
||||
{
|
||||
case KEY_0:
|
||||
@ -560,21 +563,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{ // copy channel to VFO
|
||||
|
||||
//const unsigned int vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
unsigned int vfo = gEeprom.TX_VFO;
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||
vfo = 1;
|
||||
else
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||
vfo = 0;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
vfo = 1;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||
vfo = 0;
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||
vfo = (vfo + 1) & 1u;
|
||||
const unsigned int vfo = get_rx_VFO();
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo]))
|
||||
{ // swap to the VFO
|
||||
|
2
board.c
2
board.c
@ -509,7 +509,7 @@ void BOARD_Init(void)
|
||||
BOARD_PORTCON_Init();
|
||||
BOARD_GPIO_Init();
|
||||
BOARD_ADC_Init();
|
||||
ST7565_Init();
|
||||
ST7565_Init(true);
|
||||
#ifdef ENABLE_FMRADIO
|
||||
BK1080_Init(0, false);
|
||||
#endif
|
||||
|
@ -82,10 +82,10 @@ void ST7565_BlitFullScreen(void)
|
||||
}
|
||||
|
||||
#if 0
|
||||
// whats the delay for I wonder ? .. it slows down scanning :(
|
||||
// whats the delay for I wonder, it holds things up :(
|
||||
SYSTEM_DelayMs(20);
|
||||
#else
|
||||
SYSTEM_DelayMs(1);
|
||||
// SYSTEM_DelayMs(1);
|
||||
#endif
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||
@ -119,6 +119,9 @@ void ST7565_FillScreen(uint8_t Value)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
// reset some of the displays settings to try and overcome the radios hardware problem - RF corrupting the display
|
||||
ST7565_Init(false);
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
@ -135,7 +138,9 @@ void ST7565_FillScreen(uint8_t Value)
|
||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||
}
|
||||
|
||||
void ST7565_Init(void)
|
||||
void ST7565_Init(const bool full)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
SPI0_Init();
|
||||
|
||||
@ -146,6 +151,7 @@ void ST7565_Init(void)
|
||||
ST7565_WriteByte(0xE2); // internal reset
|
||||
|
||||
SYSTEM_DelayMs(120);
|
||||
}
|
||||
|
||||
ST7565_WriteByte(0xA2); // bias 9
|
||||
ST7565_WriteByte(0xC0); // com normal
|
||||
@ -157,6 +163,9 @@ void ST7565_Init(void)
|
||||
ST7565_WriteByte(0xA4); // all points normal
|
||||
ST7565_WriteByte(0x24); //
|
||||
ST7565_WriteByte(0x81); // volume first ?
|
||||
|
||||
if (full)
|
||||
{
|
||||
ST7565_WriteByte(0x1f); // contrast ?
|
||||
ST7565_WriteByte(0x2B); // power control ?
|
||||
|
||||
@ -175,11 +184,13 @@ void ST7565_Init(void)
|
||||
|
||||
ST7565_WriteByte(0x40); // start line ?
|
||||
ST7565_WriteByte(0xAF); // display on ?
|
||||
}
|
||||
|
||||
SPI_WaitForUndocumentedTxFifoStatusBit();
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||
|
||||
if (full)
|
||||
ST7565_FillScreen(0x00);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const u
|
||||
void ST7565_BlitFullScreen(void);
|
||||
void ST7565_BlitStatusLine(void);
|
||||
void ST7565_FillScreen(uint8_t Value);
|
||||
void ST7565_Init(void);
|
||||
void ST7565_Init(const bool full);
|
||||
void ST7565_Configure_GPIO_B11(void);
|
||||
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
||||
void ST7565_WriteByte(uint8_t Value);
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
35
misc.c
35
misc.c
@ -17,6 +17,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
|
||||
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
||||
@ -259,7 +260,39 @@ int16_t gCurrentRSSI[2] = {0, 0}; // now one per VFO
|
||||
|
||||
uint8_t gIsLocked = 0xFF;
|
||||
|
||||
// --------
|
||||
unsigned int get_rx_VFO(void)
|
||||
{
|
||||
unsigned int rx_vfo = gEeprom.TX_VFO;
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||
rx_vfo = 0;
|
||||
else
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||
rx_vfo = 1;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
rx_vfo = 1;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||
rx_vfo = 0;
|
||||
return rx_vfo;
|
||||
}
|
||||
|
||||
unsigned int get_tx_VFO(void)
|
||||
{
|
||||
unsigned int tx_vfo = gEeprom.TX_VFO;
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||
tx_vfo = 1;
|
||||
else
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||
tx_vfo = 0;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
tx_vfo = 1;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||
tx_vfo = 0;
|
||||
return tx_vfo;
|
||||
}
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
||||
{
|
||||
|
3
misc.h
3
misc.h
@ -322,6 +322,9 @@ extern int16_t gCurrentRSSI[2]; // now one per VFO
|
||||
extern uint8_t gIsLocked;
|
||||
extern volatile uint8_t boot_counter_10ms;
|
||||
|
||||
unsigned int get_tx_VFO(void);
|
||||
unsigned int get_rx_VFO(void);
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger);
|
||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits);
|
||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit);
|
||||
|
33
radio.c
33
radio.c
@ -522,22 +522,8 @@ static void RADIO_SelectCurrentVfo(void)
|
||||
|
||||
void RADIO_SelectVfos(void)
|
||||
{
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||
gEeprom.TX_VFO = 1;
|
||||
else
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||
gEeprom.TX_VFO = 0;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
gEeprom.TX_VFO = 1;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||
gEeprom.TX_VFO = 0;
|
||||
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
gEeprom.RX_VFO = gEeprom.TX_VFO;
|
||||
else
|
||||
gEeprom.RX_VFO = (gEeprom.TX_VFO == 0) ? 1 : 0;
|
||||
gEeprom.TX_VFO = get_tx_VFO();
|
||||
gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_VFO : (gEeprom.TX_VFO + 1) & 1u;
|
||||
|
||||
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||
@ -877,10 +863,9 @@ void RADIO_SetVfoState(VfoState_t State)
|
||||
VfoState[1] = VFO_STATE_TX_DISABLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int chan = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) ? (gEeprom.RX_VFO + 1) & 1 : gEeprom.RX_VFO; // 1of11
|
||||
chan = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_VFO : chan;
|
||||
VfoState[chan] = State;
|
||||
{ // 1of11
|
||||
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
VfoState[vfo] = State;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@ -901,11 +886,11 @@ void RADIO_PrepareTX(void)
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_tx_10ms;
|
||||
gScheduleDualWatch = false;
|
||||
|
||||
if (!gRxVfoIsActive)
|
||||
if (gRxVfoIsActive)
|
||||
{ // use the TX vfo
|
||||
gEeprom.RX_VFO = gEeprom.TX_VFO;
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
|
||||
gRxVfoIsActive = true;
|
||||
// gRxVfoIsActive = true;
|
||||
}
|
||||
|
||||
// let the user see that DW is not active
|
||||
@ -939,7 +924,6 @@ void RADIO_PrepareTX(void)
|
||||
State = VFO_STATE_TX_DISABLE;
|
||||
}
|
||||
else
|
||||
//if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST)
|
||||
if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0)
|
||||
{ // TX frequency is allowed
|
||||
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
|
||||
@ -958,10 +942,13 @@ void RADIO_PrepareTX(void)
|
||||
if (State != VFO_STATE_NORMAL)
|
||||
{ // TX not allowed
|
||||
RADIO_SetVfoState(State);
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
gAlarmState = ALARM_STATE_OFF;
|
||||
#endif
|
||||
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user