Merge remote-tracking branch 'remotes/OneOfEleven/main'

This commit is contained in:
Krzysiek Egzmont
2023-10-03 18:45:03 +02:00
29 changed files with 405 additions and 247 deletions

View File

@@ -22,14 +22,14 @@ ENABLE_F_CAL_MENU := 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 := 0 ENABLE_BOOT_BEEPS := 0
ENABLE_COMPANDER := 1 ENABLE_COMPANDER := 0
ENABLE_SHOW_CHARGE_LEVEL := 1 ENABLE_SHOW_CHARGE_LEVEL := 1
ENABLE_REVERSE_BAT_SYMBOL := 1 ENABLE_REVERSE_BAT_SYMBOL := 1
ENABLE_CODE_SCAN_TIMEOUT := 0 ENABLE_CODE_SCAN_TIMEOUT := 0
ENABLE_AM_FIX := 1 ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0 ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_LOWER := 0 ENABLE_SQUELCH_LOWER := 0
ENABLE_RSSI_BAR := 1 ENABLE_FASTER_CHANNEL_SCAN := 1ENABLE_RSSI_BAR := 1
ENABLE_AUDIO_BAR := 1 ENABLE_AUDIO_BAR := 1
ENABLE_SPECTRUM := 1 ENABLE_SPECTRUM := 1
#ENABLE_COPY_CHAN_TO_VFO := 1 #ENABLE_COPY_CHAN_TO_VFO := 1
@@ -40,7 +40,8 @@ ENABLE_SPECTRUM := 1
TARGET = firmware TARGET = firmware
ifeq ($(ENABLE_LTO),1) ifeq ($(ENABLE_LTO), 1)
# can't have LTO and OVERLAY enabled at same time
ENABLE_OVERLAY := 0 ENABLE_OVERLAY := 0
endif endif
@@ -105,7 +106,9 @@ OBJS += app/scanner.o
ifeq ($(ENABLE_UART),1) ifeq ($(ENABLE_UART),1)
OBJS += app/uart.o OBJS += app/uart.o
endif endif
OBJS += am_fix.o ifeq ($(ENABLE_AM_FIX), 1)
OBJS += am_fix.o
endif
OBJS += audio.o OBJS += audio.o
OBJS += bitmaps.o OBJS += bitmaps.o
OBJS += board.o OBJS += board.o
@@ -138,7 +141,7 @@ OBJS += ui/welcome.o
OBJS += version.o OBJS += version.o
OBJS += main.o OBJS += main.o
ifeq ($(OS),Windows_NT) ifeq ($(OS), Windows_NT)
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
else else
TOP := $(shell pwd) TOP := $(shell pwd)
@@ -167,7 +170,7 @@ CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delet
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD #CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD #CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
ifeq ($(ENABLE_LTO),1) ifeq ($(ENABLE_LTO), 1)
# CFLAGS += -flto # CFLAGS += -flto
CFLAGS += -flto=2 CFLAGS += -flto=2
endif endif
@@ -253,8 +256,14 @@ endif
ifeq ($(ENABLE_AM_FIX_TEST1),1) ifeq ($(ENABLE_AM_FIX_TEST1),1)
CFLAGS += -DENABLE_AM_FIX_TEST1 CFLAGS += -DENABLE_AM_FIX_TEST1
endif endif
ifeq ($(ENABLE_SQUELCH_LOWER),1) ifeq ($(ENABLE_SQUELCH_MORE_SENSITIVE),1)
CFLAGS += -DENABLE_SQUELCH_LOWER CFLAGS += -DENABLE_SQUELCH_MORE_SENSITIVE
endif
ifeq ($(ENABLE_FASTER_CHANNEL_SCAN),1)
CFLAGS += -DENABLE_FASTER_CHANNEL_SCAN
endif
ifeq ($(ENABLE_BACKLIGHT_ON_RX),1)
CFLAGS += -DENABLE_BACKLIGHT_ON_RX
endif endif
ifeq ($(ENABLE_RSSI_BAR),1) ifeq ($(ENABLE_RSSI_BAR),1)
CFLAGS += -DENABLE_RSSI_BAR CFLAGS += -DENABLE_RSSI_BAR

View File

@@ -51,34 +51,35 @@ You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) .
``` ```
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming) ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
ENABLE_OVERLAY := 0 cpu FLASH stuff ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed
ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads - DISABLE overlay if you enable this ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (overlay will be disabled if you enable this)
ENABLE_UART := 1 without this you can't configure radio via PC ENABLE_UART := 1 without this you can't configure radio via PC !
ENABLE_AIRCOPY := 0 easier to just enter frequency ENABLE_AIRCOPY := 0 easier to just enter frequency with butts
ENABLE_FMRADIO := 1 WBFM VHF band 2 RX ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver
ENABLE_NOAA := 0 everything NOAA ENABLE_NOAA := 0 everything NOAA (only of any use in the USA)
ENABLE_VOICE := 0 want to hear voices ? ENABLE_VOICE := 0 want to hear voices ?
ENABLE_ALARM := 0 TX alarms ENABLE_ALARM := 0 TX alarms
ENABLE_1750HZ := 0 side key 1750Hz TX tone ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
ENABLE_BIG_FREQ := 0 big font frequencies ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode) ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though frontend not tuned over full range) ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-end/PA not designed for full range)
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead hold down keys 0-9 to access the functions ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead just hold down keys 0-9 to access the secondary butt functions
ENABLE_BOOT_BEEPS := 0 give user audio feedback on volume knob position at boot-up ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up
ENABLE_COMPANDER := 1 compander option (per channel) ENABLE_COMPANDER := 0 this is broken, don't bother with it for now .. compander option (per channel)
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right) ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt to end scan if disabled) ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan)
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation - ignore the on-screen RSSI (for now) ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
ENABLE_SQUELCH_LOWER := 1 squelch settings more sensitive - plan to let user adjust it in the menu ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
ENABLE_RSSI_BAR := 1 enable a dBm/Sx RSSI bar graph level ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy
ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
#ENABLE_COPY_CHAN_TO_VFO := 1 not yet implemented - copy the channel into the VFO #ENABLE_COPY_CHAN_TO_VFO := 1 not yet implemented - copy the current channel into the VFO
#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible #ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter #ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
``` ```

View File

@@ -30,12 +30,6 @@
#include "functions.h" #include "functions.h"
#include "misc.h" #include "misc.h"
// original QS front end register settings
const uint8_t orig_lna_short = 3; // 0dB
const uint8_t orig_lna = 2; // -14dB
const uint8_t orig_mixer = 3; // 0dB
const uint8_t orig_pga = 6; // -3dB
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
typedef struct typedef struct
@@ -449,7 +443,7 @@ const uint8_t orig_pga = 6; // -3dB
#if 0 #if 0
if (gain_table_index[vfo] == gain_table_index_prev[vfo]) if (gain_table_index[vfo] == gain_table_index_prev[vfo])
return; // no gain change return; // no gain change - this is to reduce writing to the BK chip on ever call
#endif #endif
#endif #endif

View File

@@ -20,11 +20,6 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
extern const uint8_t orig_lna_short;
extern const uint8_t orig_lna;
extern const uint8_t orig_mixer;
extern const uint8_t orig_pga;
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
extern int16_t rssi_gain_diff[2]; extern int16_t rssi_gain_diff[2];

View File

@@ -251,6 +251,8 @@ void ACTION_Vox(void)
#endif #endif
gFlagPrepareTX = true; gFlagPrepareTX = true;
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
} }
#endif #endif
@@ -268,6 +270,7 @@ void ACTION_Vox(void)
gInputBoxIndex = 0; gInputBoxIndex = 0;
gVoxResumeCountdown = 80; gVoxResumeCountdown = 80;
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
return; return;
} }
@@ -280,6 +283,7 @@ void ACTION_Vox(void)
FM_Start(); FM_Start();
gInputBoxIndex = 0; gInputBoxIndex = 0;
gRequestDisplayScreen = DISPLAY_FM; gRequestDisplayScreen = DISPLAY_FM;
} }
} }

135
app/app.c
View File

@@ -62,6 +62,12 @@
#include "ui/status.h" #include "ui/status.h"
#include "ui/ui.h" #include "ui/ui.h"
// original QS front end register settings
const uint8_t orig_lna_short = 3; // 0dB
const uint8_t orig_lna = 2; // -14dB
const uint8_t orig_mixer = 3; // 0dB
const uint8_t orig_pga = 6; // -3dB
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
static void updateRSSI(const int vfo) static void updateRSSI(const int vfo)
@@ -157,6 +163,7 @@ static void APP_CheckForIncoming(void)
updateRSSI(gEeprom.RX_CHANNEL); updateRSSI(gEeprom.RX_CHANNEL);
gUpdateRSSI = true; gUpdateRSSI = true;
} }
return; return;
} }
@@ -223,7 +230,7 @@ static void APP_HandleIncoming(void)
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED) if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
{ // DTMF DCD is enabled { // DTMF DCD is enabled
// DTMF_HandleRequest(); DTMF_HandleRequest();
if (gDTMF_CallState == DTMF_CALL_STATE_NONE) if (gDTMF_CallState == DTMF_CALL_STATE_NONE)
{ {
@@ -461,6 +468,9 @@ static void APP_HandleFunction(void)
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix) void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
{ {
const unsigned int chan = gEeprom.RX_CHANNEL;
// const unsigned int chan = gRxVfo->CHANNEL_SAVE;
if (gSetting_KILLED) if (gSetting_KILLED)
return; return;
@@ -469,18 +479,14 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
BK1080_Init(0, false); BK1080_Init(0, false);
#endif #endif
#ifdef ENABLE_AM_FIX
if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && reset_am_fix)
AM_fix_reset(gEeprom.RX_CHANNEL); // TODO: only reset it when moving channel/frequency
#endif
// clear the other vfo's rssi level (to hide the antenna symbol) // clear the other vfo's rssi level (to hide the antenna symbol)
gVFO_RSSI_bar_level[gEeprom.RX_CHANNEL == 0] = 0; gVFO_RSSI_bar_level[(chan + 1) & 1u] = 0;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = true; gEnableSpeaker = true;
if (gSetting_backlight_on_rx)
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
if (gScanState != SCAN_OFF) if (gScanState != SCAN_OFF)
@@ -512,7 +518,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
gRxVfo->CHANNEL_SAVE = gNoaaChannel + NOAA_CHANNEL_FIRST; gRxVfo->CHANNEL_SAVE = gNoaaChannel + NOAA_CHANNEL_FIRST;
gRxVfo->pRX->Frequency = NoaaFrequencyTable[gNoaaChannel]; gRxVfo->pRX->Frequency = NoaaFrequencyTable[gNoaaChannel];
gRxVfo->pTX->Frequency = NoaaFrequencyTable[gNoaaChannel]; gRxVfo->pTX->Frequency = NoaaFrequencyTable[gNoaaChannel];
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gRxVfo->CHANNEL_SAVE; gEeprom.ScreenChannel[chan] = gRxVfo->CHANNEL_SAVE;
gNOAA_Countdown_10ms = 500; // 5 sec gNOAA_Countdown_10ms = 500; // 5 sec
gScheduleNOAA = false; gScheduleNOAA = false;
} }
@@ -521,7 +527,9 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
if (gCssScanMode != CSS_SCAN_MODE_OFF) if (gCssScanMode != CSS_SCAN_MODE_OFF)
gCssScanMode = CSS_SCAN_MODE_FOUND; gCssScanMode = CSS_SCAN_MODE_FOUND;
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) if (gScanState == SCAN_OFF &&
gCssScanMode == CSS_SCAN_MODE_OFF &&
gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
{ // not scanning, dual watch is enabled { // not scanning, dual watch is enabled
gDualWatchCountdown_10ms = dual_watch_count_after_2_10ms; gDualWatchCountdown_10ms = dual_watch_count_after_2_10ms;
@@ -534,53 +542,31 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
gUpdateStatus = true; gUpdateStatus = true;
} }
// ****************************************** { // RF RX front end gain
// original setting // original setting
uint8_t lna_short = orig_lna_short; uint16_t lna_short = orig_lna_short;
uint8_t lna = orig_lna; uint16_t lna = orig_lna;
uint8_t mixer = orig_mixer; uint16_t mixer = orig_mixer;
uint8_t pga = orig_pga; uint16_t pga = orig_pga;
if (gRxVfo->AM_mode) #ifdef ENABLE_AM_FIX
{ // AM if (gRxVfo->AM_mode && gSetting_AM_fix)
/* { // AM RX mode
#ifndef ENABLE_AM_FIX if (reset_am_fix)
const uint32_t rx_frequency = gRxVfo->pRX->Frequency; AM_fix_reset(chan); // TODO: only reset it when moving channel/frequency
AM_fix_10ms(chan);
// the RX gain abrutly reduces above this frequency
// I guess this is (one of) the freq the hardware switches the front ends over ?
if (rx_frequency <= 22640000)
{ // decrease front end gain - AM demodulator saturates at a slightly higher signal level
lna_short = 3; // 3 original
lna = 2; // 2 original
mixer = 3; // 3 original
pga = 3; // 6 original, 3 reduced
} }
else else
{ // increase the front end to compensate the reduced gain, but more gain decreases dynamic range :( { // FM RX mode
lna_short = 3; // 3 original BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
lna = 4; // 2 original, 4 increased
mixer = 3; // 3 original
pga = 7; // 6 original, 7 increased
} }
#else
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
#endif #endif
*/
// what do these 4 other gain settings do ???
//BK4819_WriteRegister(BK4819_REG_12, 0x037B); // 000000 11 011 11 011
//BK4819_WriteRegister(BK4819_REG_11, 0x027B); // 000000 10 011 11 011
//BK4819_WriteRegister(BK4819_REG_10, 0x007A); // 000000 00 011 11 010
//BK4819_WriteRegister(BK4819_REG_14, 0x0019); // 000000 00 000 11 001
gNeverUsed = 0;
} }
// apply the front end gain settings // AF gain - original QS values
BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)lna_short << 8) | ((uint16_t)lna << 5) | ((uint16_t)mixer << 3) | ((uint16_t)pga << 0));
// ******************************************
// AF gain - original
BK4819_WriteRegister(BK4819_REG_48, BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ??? .. 0 to 15, doesn't seem to make any difference (11u << 12) | // ??? .. 0 to 15, doesn't seem to make any difference
( 0u << 10) | // AF Rx Gain-1 ( 0u << 10) | // AF Rx Gain-1
@@ -588,7 +574,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2) (gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
if (gVoiceWriteIndex == 0) // if (gVoiceWriteIndex == 0)
#endif #endif
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN); BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
@@ -600,11 +586,13 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
if (Function == FUNCTION_MONITOR) if (Function == FUNCTION_MONITOR)
#endif #endif
{ // squelch is disabled { // squelch is disabled
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
return;
} }
else
gUpdateDisplay = true; gUpdateDisplay = true;
gUpdateStatus = true;
} }
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step) uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
@@ -678,7 +666,7 @@ static void MR_NextChannel(void)
break; break;
} }
// this bit doesn't work at all :( // this bit doesn't work at all - yet :(
case SCAN_NEXT_CHAN_DUAL_WATCH: case SCAN_NEXT_CHAN_DUAL_WATCH:
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) // if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
{ {
@@ -724,8 +712,11 @@ static void MR_NextChannel(void)
gUpdateDisplay = true; gUpdateDisplay = true;
} }
// ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms; #ifdef ENABLE_FASTER_CHANNEL_SCAN
ScanPauseDelayIn_10ms = 8; // 80ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ? ScanPauseDelayIn_10ms = 8; // 80ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
#else
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
#endif
bScanKeepFrequency = false; bScanKeepFrequency = false;
@@ -1013,7 +1004,7 @@ static void APP_HandleVox(void)
if (gCurrentFunction == FUNCTION_POWER_SAVE) if (gCurrentFunction == FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_FOREGROUND); FUNCTION_Select(FUNCTION_FOREGROUND);
if (gCurrentFunction != FUNCTION_TRANSMIT) if (gCurrentFunction != FUNCTION_TRANSMIT && gSerialConfigCountDown_500ms == 0)
{ {
gDTMF_ReplyState = DTMF_REPLY_NONE; gDTMF_ReplyState = DTMF_REPLY_NONE;
RADIO_PrepareTX(); RADIO_PrepareTX();
@@ -1032,8 +1023,8 @@ void APP_Update(void)
} }
#endif #endif
if (gCurrentFunction == FUNCTION_TRANSMIT && gTxTimeoutReached) if ((gCurrentFunction == FUNCTION_TRANSMIT && gTxTimeoutReached) || gSerialConfigCountDown_500ms > 0)
{ // transmitter timed out { // transmitter timed out or must de-key
gTxTimeoutReached = false; gTxTimeoutReached = false;
gFlagEndTransmission = true; gFlagEndTransmission = true;
@@ -1486,22 +1477,27 @@ void APP_TimeSlice10ms(void)
if (gAlarmState == ALARM_STATE_TXALARM) if (gAlarmState == ALARM_STATE_TXALARM)
{ {
gAlarmState = ALARM_STATE_ALARM; gAlarmState = ALARM_STATE_ALARM;
RADIO_EnableCxCSS(); RADIO_EnableCxCSS();
BK4819_SetupPowerAmplifier(0, 0); BK4819_SetupPowerAmplifier(0, 0);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false); BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
BK4819_Enable_AfDac_DiscMode_TxDsp(); BK4819_Enable_AfDac_DiscMode_TxDsp();
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false); BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
GUI_DisplayScreen(); GUI_DisplayScreen();
} }
else else
{ {
gAlarmState = ALARM_STATE_TXALARM; gAlarmState = ALARM_STATE_TXALARM;
GUI_DisplayScreen(); GUI_DisplayScreen();
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true); BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
RADIO_SetTxParameters(); RADIO_SetTxParameters();
BK4819_TransmitTone(true, 500); BK4819_TransmitTone(true, 500);
SYSTEM_DelayMs(2); SYSTEM_DelayMs(2);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = true; gEnableSpeaker = true;
gAlarmToneCounter = 0; gAlarmToneCounter = 0;
} }
@@ -1588,7 +1584,9 @@ void APP_TimeSlice10ms(void)
gScanUseCssResult = false; gScanUseCssResult = false;
gScanProgressIndicator = 0; gScanProgressIndicator = 0;
gScanCssState = SCAN_CSS_STATE_SCANNING; gScanCssState = SCAN_CSS_STATE_SCANNING;
GUI_SelectNextDisplay(DISPLAY_SCANNER); GUI_SelectNextDisplay(DISPLAY_SCANNER);
gUpdateStatus = true; gUpdateStatus = true;
} }
@@ -1679,7 +1677,9 @@ void cancelUserInputModes(void)
gDTMF_InputMode = false; gDTMF_InputMode = false;
gDTMF_InputIndex = 0; gDTMF_InputIndex = 0;
gInputBoxIndex = 0; gInputBoxIndex = 0;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
} }
} }
@@ -1715,12 +1715,7 @@ void APP_TimeSlice500ms(void)
if (gSerialConfigCountDown_500ms > 0) if (gSerialConfigCountDown_500ms > 0)
{ {
gReducedService = true; // a serial config upload/download is in progress // gReducedService = true; // a serial config upload/download is in progress
// if (gCurrentFunction == FUNCTION_TRANSMIT)
// { // stop transmitting
//
// }
} }
// Skipped authentic device check // Skipped authentic device check
@@ -1754,15 +1749,11 @@ void APP_TimeSlice500ms(void)
// Skipped authentic device check // Skipped authentic device check
if (gCurrentFunction != FUNCTION_TRANSMIT)
{
if ((gBatteryCheckCounter & 1) == 0) if ((gBatteryCheckCounter & 1) == 0)
{ {
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryVoltageIndex++], &gBatteryCurrent); BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryVoltageIndex++], &gBatteryCurrent);
if (gBatteryVoltageIndex > 3) if (gBatteryVoltageIndex > 3)
gBatteryVoltageIndex = 0; gBatteryVoltageIndex = 0;
BATTERY_GetReadings(true); BATTERY_GetReadings(true);
} }
@@ -1771,13 +1762,14 @@ void APP_TimeSlice500ms(void)
{ {
if (gChargingWithTypeC || gSetting_battery_text > 0) if (gChargingWithTypeC || gSetting_battery_text > 0)
gUpdateStatus = true; gUpdateStatus = true;
#ifdef ENABLE_SHOW_CHARGE_LEVEL #ifdef ENABLE_SHOW_CHARGE_LEVEL
if (gChargingWithTypeC) if (gChargingWithTypeC)
gUpdateDisplay = true; gUpdateDisplay = true;
#endif #endif
} }
if (gCurrentFunction != FUNCTION_TRANSMIT)
{
if (gCurrentFunction != FUNCTION_POWER_SAVE) if (gCurrentFunction != FUNCTION_POWER_SAVE)
updateRSSI(gEeprom.RX_CHANNEL); updateRSSI(gEeprom.RX_CHANNEL);
@@ -2008,6 +2000,7 @@ void APP_TimeSlice500ms(void)
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
} }
#endif #endif
@@ -2098,17 +2091,17 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{ {
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gFlagSaveChannel); SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gFlagSaveChannel);
gFlagSaveChannel = false; gFlagSaveChannel = false;
RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, VFO_CONFIGURE); RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, VFO_CONFIGURE);
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
} }
} }
else else
{ {
if (Key != KEY_PTT) if (gScreenToDisplay == DISPLAY_MENU) // 1of11
{
gMenuCountdown = menu_timeout_500ms; gMenuCountdown = menu_timeout_500ms;
}
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
@@ -2293,9 +2286,11 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{ {
case DISPLAY_MAIN: case DISPLAY_MAIN:
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld); MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
#ifdef ENABLE_MAIN_KEY_HOLD #ifdef ENABLE_MAIN_KEY_HOLD
bKeyHeld = false; // allow the channel setting to be saved bKeyHeld = false; // allow the channel setting to be saved
#endif #endif
break; break;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
@@ -2401,6 +2396,7 @@ Skip:
if (!bKeyHeld) if (!bKeyHeld)
{ {
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gRequestSaveChannel); SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gRequestSaveChannel);
if (gScreenToDisplay != DISPLAY_SCANNER) if (gScreenToDisplay != DISPLAY_SCANNER)
if (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere if (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere
gVfoConfigureMode = VFO_CONFIGURE; gVfoConfigureMode = VFO_CONFIGURE;
@@ -2408,6 +2404,7 @@ Skip:
else else
{ {
gFlagSaveChannel = gRequestSaveChannel; gFlagSaveChannel = gRequestSaveChannel;
if (gRequestDisplayScreen == DISPLAY_INVALID) if (gRequestDisplayScreen == DISPLAY_INVALID)
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
} }

View File

@@ -23,6 +23,11 @@
#include "frequencies.h" #include "frequencies.h"
#include "radio.h" #include "radio.h"
extern const uint8_t orig_lna_short;
extern const uint8_t orig_lna;
extern const uint8_t orig_mixer;
extern const uint8_t orig_pga;
void APP_EndTransmission(void); void APP_EndTransmission(void);
void CHANNEL_Next(bool bFlag, int8_t Direction); void CHANNEL_Next(bool bFlag, int8_t Direction);
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix); void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);

View File

@@ -104,9 +104,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
{ {
gInputBoxIndex = 0; gInputBoxIndex = 0;
if (!bKeyPressed) if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
{ {
if (gScreenToDisplay == DISPLAY_MAIN) //if (gScreenToDisplay == DISPLAY_MAIN)
{ {
if (gCurrentFunction == FUNCTION_TRANSMIT) if (gCurrentFunction == FUNCTION_TRANSMIT)
{ {
@@ -132,10 +132,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
RADIO_SetVfoState(VFO_STATE_NORMAL); RADIO_SetVfoState(VFO_STATE_NORMAL);
// beep when you release the PTT if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
//gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL; // 1of11
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
return; return;
} }
@@ -149,7 +148,10 @@ void GENERIC_Key_PTT(bool bKeyPressed)
gPttDebounceCounter = 0; gPttDebounceCounter = 0;
gPttIsPressed = false; gPttIsPressed = false;
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
return; return;
} }
@@ -160,10 +162,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
if (gCssScanMode == CSS_SCAN_MODE_OFF) if (gCssScanMode == CSS_SCAN_MODE_OFF)
{ {
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gScreenToDisplay == DISPLAY_MENU || gScreenToDisplay == DISPLAY_FM) if (gScreenToDisplay == DISPLAY_FM)
#else
if (gScreenToDisplay == DISPLAY_MENU)
#endif
{ {
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
gInputBoxIndex = 0; gInputBoxIndex = 0;
@@ -171,6 +170,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
gPttDebounceCounter = 0; gPttDebounceCounter = 0;
return; return;
} }
#endif
if (gScreenToDisplay != DISPLAY_SCANNER) if (gScreenToDisplay != DISPLAY_SCANNER)
{ {
@@ -213,6 +213,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
gDTMF_State = DTMF_STATE_0; gDTMF_State = DTMF_STATE_0;
} }
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
gDTMF_InputMode = false; gDTMF_InputMode = false;
@@ -220,14 +221,18 @@ void GENERIC_Key_PTT(bool bKeyPressed)
return; return;
} }
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
gFlagPrepareTX = true; gFlagPrepareTX = true;
gInputBoxIndex = 0; gInputBoxIndex = 0;
return; return;
} }
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX; gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
gUpdateStatus = true; gUpdateStatus = true;
gFlagStopScan = true; gFlagStopScan = true;
@@ -237,6 +242,8 @@ void GENERIC_Key_PTT(bool bKeyPressed)
else else
{ {
MENU_StopCssScan(); MENU_StopCssScan();
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MENU; gRequestDisplayScreen = DISPLAY_MENU;
} }
} }
@@ -254,4 +261,3 @@ void GENERIC_Key_PTT(bool bKeyPressed)
gPttWasPressed = true; gPttWasPressed = true;
} }

View File

@@ -80,6 +80,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
gRequestSaveVFO = true; gRequestSaveVFO = true;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
if (beep) if (beep)
@@ -104,6 +105,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
gRequestSaveSettings = 1; gRequestSaveSettings = 1;
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
if (beep) if (beep)
@@ -650,6 +652,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
gDTMF_InputMode = true; gDTMF_InputMode = true;
memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox)); memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox));
gDTMF_InputIndex = 0; gDTMF_InputIndex = 0;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
return; return;
} }
@@ -807,7 +810,9 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
DTMF_Append(Character); DTMF_Append(Character);
gKeyInputCountdown = key_input_timeout_500ms; gKeyInputCountdown = key_input_timeout_500ms;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
gPttWasReleased = true; gPttWasReleased = true;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
return; return;

View File

@@ -212,6 +212,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
case MENU_MIC_BAR: case MENU_MIC_BAR:
#endif #endif
case MENU_ABR_ON_RX:
case MENU_BCL: case MENU_BCL:
case MENU_BEEP: case MENU_BEEP:
case MENU_AUTOLK: case MENU_AUTOLK:
@@ -406,9 +407,6 @@ void MENU_AcceptSetting(void)
case MENU_T_CTCS: case MENU_T_CTCS:
pConfig = &gTxVfo->freq_config_TX; pConfig = &gTxVfo->freq_config_TX;
// Fallthrough
case MENU_R_CTCS: case MENU_R_CTCS:
if (gSubMenuSelection == 0) if (gSubMenuSelection == 0)
{ {
@@ -418,14 +416,20 @@ void MENU_AcceptSetting(void)
return; return;
} }
Code = 0; Code = 0;
pConfig->Code = Code;
pConfig->CodeType = CODE_TYPE_OFF; pConfig->CodeType = CODE_TYPE_OFF;
BK4819_ExitSubAu();
} }
else else
{ {
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE; pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
Code = gSubMenuSelection - 1; Code = gSubMenuSelection - 1;
}
pConfig->Code = Code; pConfig->Code = Code;
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
}
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
return; return;
@@ -446,6 +450,12 @@ void MENU_AcceptSetting(void)
case MENU_SCR: case MENU_SCR:
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection; gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
#if 0
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
BK4819_EnableScramble(gSubMenuSelection - 1);
else
BK4819_DisableScramble();
#endif
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
return; return;
@@ -500,6 +510,10 @@ void MENU_AcceptSetting(void)
gEeprom.BACKLIGHT = gSubMenuSelection; gEeprom.BACKLIGHT = gSubMenuSelection;
break; break;
case MENU_ABR_ON_RX:
gSetting_backlight_on_rx = gSubMenuSelection;
break;
case MENU_TDR: case MENU_TDR:
gEeprom.DUAL_WATCH = gSubMenuSelection; gEeprom.DUAL_WATCH = gSubMenuSelection;
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
@@ -584,7 +598,10 @@ void MENU_AcceptSetting(void)
#ifdef ENABLE_COMPANDER #ifdef ENABLE_COMPANDER
case MENU_COMPAND: case MENU_COMPAND:
gTxVfo->Compander = gSubMenuSelection; gTxVfo->Compander = gSubMenuSelection;
gRequestSaveChannel = 1; SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
gVfoConfigureMode = VFO_CONFIGURE;
gFlagResetVfos = true;
// gRequestSaveChannel = 1;
return; return;
#endif #endif
@@ -915,6 +932,10 @@ void MENU_ShowCurrentSetting(void)
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
break; break;
case MENU_ABR_ON_RX:
gSubMenuSelection = gSetting_backlight_on_rx;
break;
case MENU_TDR: case MENU_TDR:
gSubMenuSelection = gEeprom.DUAL_WATCH; gSubMenuSelection = gEeprom.DUAL_WATCH;
break; break;

View File

@@ -92,6 +92,7 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
{ {
case 0: case 0:
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX; gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
gUpdateStatus = true; gUpdateStatus = true;
gFlagStopScan = true; gFlagStopScan = true;

View File

@@ -230,8 +230,7 @@ static void CMD_0514(const uint8_t *pBuffer)
gFmRadioCountdown_500ms = fm_radio_countdown_500ms; gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
#endif #endif
gSerialConfigCountDown_500ms = 6; // 3 sec gSerialConfigCountDown_500ms = 12; // 6 sec
gSerialConfigCountDown_done = false;
// turn the LCD backlight off // turn the LCD backlight off
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
@@ -248,8 +247,7 @@ static void CMD_051B(const uint8_t *pBuffer)
if (pCmd->Timestamp != Timestamp) if (pCmd->Timestamp != Timestamp)
return; return;
gSerialConfigCountDown_500ms = 6; // 3 sec gSerialConfigCountDown_500ms = 12; // 6 sec
gSerialConfigCountDown_done = false;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFmRadioCountdown_500ms = fm_radio_countdown_500ms; gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
@@ -280,8 +278,7 @@ static void CMD_051D(const uint8_t *pBuffer)
if (pCmd->Timestamp != Timestamp) if (pCmd->Timestamp != Timestamp)
return; return;
gSerialConfigCountDown_500ms = 6; // 3 sec gSerialConfigCountDown_500ms = 12; // 6 sec
gSerialConfigCountDown_done = false;
bReloadEeprom = false; bReloadEeprom = false;
@@ -404,8 +401,7 @@ static void CMD_052F(const uint8_t *pBuffer)
if (gCurrentFunction == FUNCTION_POWER_SAVE) if (gCurrentFunction == FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_FOREGROUND); FUNCTION_Select(FUNCTION_FOREGROUND);
gSerialConfigCountDown_500ms = 6; // 3 sec gSerialConfigCountDown_500ms = 12; // 6 sec
gSerialConfigCountDown_done = false;
Timestamp = pCmd->Timestamp; Timestamp = pCmd->Timestamp;

View File

@@ -279,12 +279,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
SYSTEM_DelayMs(Delay * 10); SYSTEM_DelayMs(Delay * 10);
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
{ BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
if (gRxVfo->AM_mode)
BK4819_SetAF(BK4819_AF_AM);
else
BK4819_SetAF(BK4819_AF_OPEN);
}
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gFmRadioMode) if (gFmRadioMode)

View File

@@ -4,7 +4,7 @@
// all these images are on their right sides // all these images are on their right sides
// turn your monitor 90-deg anti-clockwise to see the images // turn your monitor 90-deg anti-clockwise to see the images
const uint8_t BITMAP_PowerSave[8] = const uint8_t BITMAP_POWERSAVE[8] =
{ {
#if 0 #if 0
// "S" // "S"
@@ -29,6 +29,30 @@ const uint8_t BITMAP_PowerSave[8] =
#endif #endif
}; };
const uint8_t BITMAP_TX[8] =
{ // "TX"
0b00000000,
0b00000001,
0b00000001,
0b01111111,
0b00000001,
0b00000001,
0b00000000,
0b00000000
};
const uint8_t BITMAP_RX[8] =
{ // "RX"
0b00000000,
0b01111111,
0b00001001,
0b00011001,
0b01100110,
0b00000000,
0b00000000,
0b00000000
};
const uint8_t BITMAP_BatteryLevel[2] = const uint8_t BITMAP_BatteryLevel[2] =
{ {
0b01011101, 0b01011101,

View File

@@ -4,7 +4,9 @@
#include <stdint.h> #include <stdint.h>
extern const uint8_t BITMAP_PowerSave[8]; extern const uint8_t BITMAP_POWERSAVE[8];
extern const uint8_t BITMAP_TX[8];
extern const uint8_t BITMAP_RX[8];
extern const uint8_t BITMAP_BatteryLevel[2]; extern const uint8_t BITMAP_BatteryLevel[2];
extern const uint8_t BITMAP_BatteryLevel1[17]; extern const uint8_t BITMAP_BatteryLevel1[17];

View File

@@ -712,6 +712,7 @@ void BOARD_EEPROM_Init(void)
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false; gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
#endif #endif
gSetting_backlight_on_rx = (Data[7] & (1u << 6)) ? true : false;
if (!gEeprom.VFO_OPEN) if (!gEeprom.VFO_OPEN)
{ {

View File

@@ -716,14 +716,14 @@ void BK4819_SetupSquelch(
// 0 ~ 255 // 0 ~ 255
// //
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000 BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
#if 0 #ifndef ENABLE_FASTER_CHANNEL_SCAN
// original // original
(1u << 14) // 1 ??? (1u << 14) // 1 ???
| (5u << 11) // 5 squelch = 1 delay .. 0 ~ 7 | (5u << 11) // 5 squelch = 1 delay .. 0 ~ 7
| (3u << 9) // 3 squelch = 0 delay .. 0 ~ 3 | (3u << 9) // 3 squelch = 0 delay .. 0 ~ 3
| SquelchOpenGlitchThresh); // 0 ~ 255 | SquelchOpenGlitchThresh); // 0 ~ 255
#else #else
// supposedly fast // faster (but twitchier)
(1u << 14) // 1 ??? (1u << 14) // 1 ???
| SquelchOpenGlitchThresh); // 0 ~ 255 | SquelchOpenGlitchThresh); // 0 ~ 255
#endif #endif
@@ -831,14 +831,16 @@ void BK4819_SetCompander(const unsigned int mode)
// mode 2 .. RX // mode 2 .. RX
// mode 3 .. TX and RX // mode 3 .. TX and RX
const uint16_t r31 = BK4819_ReadRegister(BK4819_REG_31);
if (mode == 0) if (mode == 0)
{ // disable { // disable
BK4819_WriteRegister(BK4819_REG_31, BK4819_ReadRegister(BK4819_REG_31) & ~(1u < 3)); BK4819_WriteRegister(BK4819_REG_31, r31 & ~(1u < 3));
return; return;
} }
// enable // enable
BK4819_WriteRegister(BK4819_REG_31, BK4819_ReadRegister(BK4819_REG_31) | (1u < 3)); BK4819_WriteRegister(BK4819_REG_31, r31 | (1u < 3));
// set the compressor ratio // set the compressor ratio
// //
@@ -848,8 +850,17 @@ void BK4819_SetCompander(const unsigned int mode)
// 10 = 2:1 // 10 = 2:1
// 11 = 4:1 // 11 = 4:1
// //
const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 3 : 0; // 4:1 // REG_29 <13:7> 86 Compress (AF Tx) 0 dB point (dB)
BK4819_WriteRegister(BK4819_REG_29, (BK4819_ReadRegister(BK4819_REG_29) & ~(3u < 14)) | (compress_ratio < 14)); //
// REG_29 <6:0> 64 Compress (AF Tx) noise point (dB)
//
// const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 2 : 0; // 2:1
// const uint16_t compress_0dB = 86;
// const uint16_t compress_noise_dB = 64;
// BK4819_WriteRegister(BK4819_REG_29, // (BK4819_ReadRegister(BK4819_REG_29) & ~(3u < 14)) | (compress_ratio < 14));
// (compress_ratio < 14)
// | (compress_0dB < 7)
// | (compress_noise_dB < 0));
// set the expander ratio // set the expander ratio
// //
@@ -859,8 +870,17 @@ void BK4819_SetCompander(const unsigned int mode)
// 10 = 1:3 // 10 = 1:3
// 11 = 1:4 // 11 = 1:4
// //
const uint16_t expand_ratio = (mode >= 2) ? 3 : 0; // 1:4 // REG_28 <13:7> 86 Expander (AF Rx) 0 dB point (dB)
BK4819_WriteRegister(BK4819_REG_28, (BK4819_ReadRegister(BK4819_REG_28) & ~(3u < 14)) | (expand_ratio < 14)); //
// REG_28 <6:0> 56 Expander (AF Rx) noise point (dB)
//
// const uint16_t expand_ratio = (mode >= 2) ? 1 : 0; // 1:2
// const uint16_t expand_0dB = 86;
// const uint16_t expand_noise_dB = 56;
// BK4819_WriteRegister(BK4819_REG_28, // (BK4819_ReadRegister(BK4819_REG_28) & ~(3u < 14)) | (expand_ratio < 14));
// (expand_ratio < 14)
// | (expand_0dB < 7)
// | (expand_noise_dB < 0));
} }
void BK4819_DisableVox(void) void BK4819_DisableVox(void)

Binary file not shown.

Binary file not shown.

View File

@@ -74,6 +74,8 @@ void FUNCTION_Init(void)
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
gNOAACountdown_10ms = 0; gNOAACountdown_10ms = 0;
#endif #endif
gUpdateStatus = true;
} }
void FUNCTION_Select(FUNCTION_Type_t Function) void FUNCTION_Select(FUNCTION_Type_t Function)
@@ -113,6 +115,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED) if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
gDTMF_AUTO_RESET_TIME = 1 + (gEeprom.DTMF_AUTO_RESET_TIME * 2); gDTMF_AUTO_RESET_TIME = 1 + (gEeprom.DTMF_AUTO_RESET_TIME * 2);
gUpdateStatus = true;
return; return;
case FUNCTION_MONITOR: case FUNCTION_MONITOR:
@@ -138,7 +141,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
gUpdateStatus = true; gUpdateStatus = true;
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
return; return;
case FUNCTION_TRANSMIT: case FUNCTION_TRANSMIT:
@@ -184,6 +189,8 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
} }
#endif #endif
gUpdateStatus = true;
GUI_DisplayScreen(); GUI_DisplayScreen();
RADIO_SetTxParameters(); RADIO_SetTxParameters();

4
misc.c
View File

@@ -83,6 +83,8 @@ bool gSetting_TX_EN;
uint8_t gSetting_F_LOCK; uint8_t gSetting_F_LOCK;
bool gSetting_ScrambleEnable; bool gSetting_ScrambleEnable;
bool gSetting_backlight_on_rx;
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
bool gSetting_AM_fix; bool gSetting_AM_fix;
#endif #endif
@@ -126,7 +128,6 @@ volatile bool gDualWatchCountdownExpired = true;
bool gDualWatchActive = false; bool gDualWatchActive = false;
volatile uint8_t gSerialConfigCountDown_500ms; volatile uint8_t gSerialConfigCountDown_500ms;
volatile bool gSerialConfigCountDown_done;
volatile bool gNextTimeslice_500ms; volatile bool gNextTimeslice_500ms;
@@ -218,7 +219,6 @@ uint8_t gScanDelay_10ms;
uint8_t gAircopySendCountdown; uint8_t gAircopySendCountdown;
#endif #endif
uint8_t gFSKWriteIndex; uint8_t gFSKWriteIndex;
uint8_t gNeverUsed;
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
bool gIsNoaaMode; bool gIsNoaaMode;

4
misc.h
View File

@@ -152,6 +152,8 @@ extern bool gSetting_TX_EN;
extern uint8_t gSetting_F_LOCK; extern uint8_t gSetting_F_LOCK;
extern bool gSetting_ScrambleEnable; extern bool gSetting_ScrambleEnable;
extern bool gSetting_backlight_on_rx;
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
extern bool gSetting_AM_fix; extern bool gSetting_AM_fix;
#endif #endif
@@ -196,7 +198,6 @@ extern volatile bool gDualWatchCountdownExpired;
extern bool gDualWatchActive; extern bool gDualWatchActive;
extern volatile uint8_t gSerialConfigCountDown_500ms; extern volatile uint8_t gSerialConfigCountDown_500ms;
extern volatile bool gSerialConfigCountDown_done;
extern volatile bool gNextTimeslice_500ms; extern volatile bool gNextTimeslice_500ms;
@@ -286,7 +287,6 @@ extern uint8_t gScanDelay_10ms;
extern uint8_t gAircopySendCountdown; extern uint8_t gAircopySendCountdown;
#endif #endif
extern uint8_t gFSKWriteIndex; extern uint8_t gFSKWriteIndex;
extern uint8_t gNeverUsed;
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
extern bool gIsNoaaMode; extern bool gIsNoaaMode;
extern uint8_t gNoaaChannel; extern uint8_t gNoaaChannel;

35
radio.c
View File

@@ -218,7 +218,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (Band > BAND7_470MHz) if (Band > BAND7_470MHz)
{ {
Band = BAND6_400MHz; Band = BAND6_400MHz;
// Band = FREQUENCY_GetBand(gEeprom.ScreenChannel[VFO]); // 1of11 bug fix, or have I broke it ?
} }
if (IS_MR_CHANNEL(Channel)) if (IS_MR_CHANNEL(Channel))
@@ -372,8 +371,8 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (Frequency < frequencyBandTable[Band].lower) if (Frequency < frequencyBandTable[Band].lower)
Frequency = frequencyBandTable[Band].lower; Frequency = frequencyBandTable[Band].lower;
else else
if (Frequency > frequencyBandTable[Band + 1].upper) if (Frequency > frequencyBandTable[Band].upper)
Frequency = frequencyBandTable[Band + 1].upper; Frequency = frequencyBandTable[Band].upper;
else else
if (Channel >= FREQ_CHANNEL_FIRST) if (Channel >= FREQ_CHANNEL_FIRST)
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, frequencyBandTable[Band].lower); Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, frequencyBandTable[Band].lower);
@@ -457,17 +456,21 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90 EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100 EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
#if ENABLE_SQUELCH_LOWER #if ENABLE_SQUELCH_MORE_SENSITIVE
// make squelch more sensitive // make squelch a little more sensitive
//
// getting the best setting here is still experimental, bare with me
//
// note that 'noise' and 'glitch' value are inverted compared to 'rssi' values
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9; pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 10) / 11;
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 7) / 8; pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 10) / 11;
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 8) / 7; pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 11) / 10;
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8; pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 11) / 10;
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 8) / 7; pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 11) / 10;
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8; pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 11) / 10;
#endif #endif
if (pInfo->SquelchOpenNoiseThresh > 127) if (pInfo->SquelchOpenNoiseThresh > 127)
@@ -548,7 +551,7 @@ void RADIO_SelectVfos(void)
void RADIO_SetupRegisters(bool bSwitchToFunction0) void RADIO_SetupRegisters(bool bSwitchToFunction0)
{ {
BK4819_FilterBandwidth_t Bandwidth; BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
uint16_t InterruptMask; uint16_t InterruptMask;
uint32_t Frequency; uint32_t Frequency;
@@ -558,7 +561,6 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false); BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
switch (Bandwidth) switch (Bandwidth)
{ {
default: default:
@@ -611,6 +613,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_PickRXFilterPathBasedOnFrequency(Frequency); BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
// what does this in do ?
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true); BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
// AF RX Gain and DAC // AF RX Gain and DAC
@@ -623,7 +626,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
#endif #endif
{ {
if (gRxVfo->AM_mode == 0) if (gRxVfo->AM_mode == 0)
{ { // FM
uint8_t CodeType = gSelectedCodeType; uint8_t CodeType = gSelectedCodeType;
uint8_t Code = gSelectedCode; uint8_t Code = gSelectedCode;
if (gCssScanMode == CSS_SCAN_MODE_OFF) if (gCssScanMode == CSS_SCAN_MODE_OFF)
@@ -936,8 +939,8 @@ void RADIO_PrepareTX(void)
} }
else else
#endif #endif
if (!gSetting_TX_EN) if (!gSetting_TX_EN || gSerialConfigCountDown_500ms > 0)
{ // TX is disabled { // TX is disabled or config upload/download in progress
State = VFO_STATE_TX_DISABLE; State = VFO_STATE_TX_DISABLE;
} }
else else

View File

@@ -57,7 +57,7 @@ void SystickHandler(void)
gNextTimeslice_500ms = true; gNextTimeslice_500ms = true;
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached); DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
DECREMENT_AND_TRIGGER(gSerialConfigCountDown_500ms, gSerialConfigCountDown_done); DECREMENT(gSerialConfigCountDown_500ms);
} }
if ((gGlobalSysTickCounter & 3) == 0) if ((gGlobalSysTickCounter & 3) == 0)

View File

@@ -174,6 +174,8 @@ void SETTINGS_SaveSettings(void)
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
if (!gSetting_AM_fix) State[7] &= ~(1u << 5); if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
#endif #endif
if (!gSetting_backlight_on_rx) State[7] &= ~(1u << 6);
EEPROM_WriteBuffer(0x0F40, State); EEPROM_WriteBuffer(0x0F40, State);
} }

View File

@@ -80,6 +80,9 @@ center_line_t center_line = CENTER_LINE_NONE;
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x; const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
unsigned int i; unsigned int i;
if (gScreenToDisplay != DISPLAY_MAIN)
return;
#if 1 #if 1
// TX audio level // TX audio level
@@ -332,7 +335,7 @@ void UI_DisplayMain(void)
const bool same_vfo = (channel == vfo_num) ? true : false; const bool same_vfo = (channel == vfo_num) ? true : false;
uint8_t *p_line0 = gFrameBuffer[line + 0]; uint8_t *p_line0 = gFrameBuffer[line + 0];
uint8_t *p_line1 = gFrameBuffer[line + 1]; uint8_t *p_line1 = gFrameBuffer[line + 1];
uint32_t duff_beer = 0; uint8_t mode = 0;
uint8_t state; uint8_t state;
if (single_vfo) if (single_vfo)
@@ -419,23 +422,36 @@ void UI_DisplayMain(void)
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (gAlarmState == ALARM_STATE_ALARM) if (gAlarmState == ALARM_STATE_ALARM)
duff_beer = 2; mode = 2;
else else
#endif #endif
{ {
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL; channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
if (channel == vfo_num) if (channel == vfo_num)
{ // show the TX symbol { // show the TX symbol
duff_beer = 1; mode = 1;
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold("TX", 14, 0, line);
#else
UI_PrintStringSmall("TX", 14, 0, line); UI_PrintStringSmall("TX", 14, 0, line);
#endif
} }
} }
} }
else else
{ // receiving .. show the RX symbol { // receiving .. show the RX symbol
duff_beer = 2; mode = 2;
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num) if ((gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING) &&
gEeprom.RX_CHANNEL == vfo_num)
{
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold("RX", 14, 0, line);
#else
UI_PrintStringSmall("RX", 14, 0, line); UI_PrintStringSmall("RX", 14, 0, line);
#endif
}
} }
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
@@ -607,7 +623,7 @@ void UI_DisplayMain(void)
{ // show the TX/RX level { // show the TX/RX level
uint8_t Level = 0; uint8_t Level = 0;
if (duff_beer == 1) if (mode == 1)
{ // TX power level { // TX power level
switch (gRxVfo->OUTPUT_POWER) switch (gRxVfo->OUTPUT_POWER)
{ {
@@ -617,7 +633,7 @@ void UI_DisplayMain(void)
} }
} }
else else
if (duff_beer == 2) if (mode == 2)
{ // RX signal level { // RX signal level
#ifndef ENABLE_RSSI_BAR #ifndef ENABLE_RSSI_BAR
// bar graph // bar graph
@@ -654,7 +670,7 @@ void UI_DisplayMain(void)
} }
else else
{ // or show the CTCSS/DCS symbol { // or show the CTCSS/DCS symbol
const FREQ_Config_t *pConfig = (duff_beer == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX; const FREQ_Config_t *pConfig = (mode == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
const unsigned int code_type = pConfig->CodeType; const unsigned int code_type = pConfig->CodeType;
const char *code_list[] = {"", "CT", "DCS", "DCR"}; const char *code_list[] = {"", "CT", "DCS", "DCR"};
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list)) if (code_type >= 0 && code_type < ARRAY_SIZE(code_list))
@@ -713,8 +729,8 @@ void UI_DisplayMain(void)
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT) if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT)
{ {
UI_DisplayAudioBar();
center_line = CENTER_LINE_AUDIO_BAR; center_line = CENTER_LINE_AUDIO_BAR;
UI_DisplayAudioBar();
} }
else else
#endif #endif
@@ -722,9 +738,9 @@ void UI_DisplayMain(void)
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA) #if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix) if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
{ {
center_line = CENTER_LINE_AM_FIX_DATA;
AM_fix_print_data(gEeprom.RX_CHANNEL, String); AM_fix_print_data(gEeprom.RX_CHANNEL, String);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
center_line = CENTER_LINE_AM_FIX_DATA;
} }
else else
#endif #endif
@@ -732,8 +748,8 @@ void UI_DisplayMain(void)
#ifdef ENABLE_RSSI_BAR #ifdef ENABLE_RSSI_BAR
if (rx) if (rx)
{ {
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
center_line = CENTER_LINE_RSSI; center_line = CENTER_LINE_RSSI;
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
} }
else else
#endif #endif
@@ -745,20 +761,20 @@ void UI_DisplayMain(void)
{ // show live DTMF decode { // show live DTMF decode
const unsigned int len = strlen(gDTMF_RX_live); const unsigned int len = strlen(gDTMF_RX_live);
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
center_line = CENTER_LINE_DTMF_DEC;
strcpy(String, "DTMF "); strcpy(String, "DTMF ");
strcat(String, gDTMF_RX_live + idx); strcat(String, gDTMF_RX_live + idx);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
center_line = CENTER_LINE_DTMF_DEC;
} }
#else #else
if (gSetting_live_DTMF_decoder && gDTMF_RX_index > 0) if (gSetting_live_DTMF_decoder && gDTMF_RX_index > 0)
{ // show live DTMF decode { // show live DTMF decode
const unsigned int len = gDTMF_RX_index; const unsigned int len = gDTMF_RX_index;
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
center_line = CENTER_LINE_DTMF_DEC;
strcpy(String, "DTMF "); strcpy(String, "DTMF ");
strcat(String, gDTMF_RX + idx); strcat(String, gDTMF_RX + idx);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
center_line = CENTER_LINE_DTMF_DEC;
} }
#endif #endif
@@ -766,11 +782,11 @@ void UI_DisplayMain(void)
else else
if (gChargingWithTypeC) if (gChargingWithTypeC)
{ // charging .. show the battery state { // charging .. show the battery state
center_line = CENTER_LINE_CHARGE_DATA;
sprintf(String, "Charge %u.%02uV %u%%", sprintf(String, "Charge %u.%02uV %u%%",
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
BATTERY_VoltsToPercent(gBatteryVoltageAverage)); BATTERY_VoltsToPercent(gBatteryVoltageAverage));
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
center_line = CENTER_LINE_CHARGE_DATA;
} }
#endif #endif
} }

View File

@@ -62,7 +62,8 @@ const t_menu_item MenuList[] =
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF" {"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE" {"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
{"VOX", VOICE_ID_VOX, MENU_VOX }, {"VOX", VOICE_ID_VOX, MENU_VOX },
{"BACKLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR" {"BLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
{"BLT RX", VOICE_ID_INVALID, MENU_ABR_ON_RX },
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR" {"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP }, {"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@@ -476,11 +477,41 @@ void UI_DisplayMenu(void)
case MENU_R_CTCS: case MENU_R_CTCS:
case MENU_T_CTCS: case MENU_T_CTCS:
{
#if 1
unsigned int Code;
FREQ_Config_t *pConfig = (gMenuCursor == MENU_R_CTCS) ? &gTxVfo->freq_config_RX : &gTxVfo->freq_config_TX;
if (gSubMenuSelection == 0)
{
strcpy(String, "OFF");
if (pConfig->CodeType != CODE_TYPE_CONTINUOUS_TONE)
break;
Code = 0;
pConfig->CodeType = CODE_TYPE_OFF;
pConfig->Code = Code;
BK4819_ExitSubAu();
}
else
{
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
Code = gSubMenuSelection - 1;
pConfig->Code = Code;
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
}
#else
if (gSubMenuSelection == 0) if (gSubMenuSelection == 0)
strcpy(String, "OFF"); strcpy(String, "OFF");
else else
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10); sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
#endif
break; break;
}
case MENU_SFT_D: case MENU_SFT_D:
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]); strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
@@ -518,6 +549,12 @@ void UI_DisplayMenu(void)
case MENU_SCR: case MENU_SCR:
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]); strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
#if 1
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
BK4819_EnableScramble(gSubMenuSelection - 1);
else
BK4819_DisableScramble();
#endif
break; break;
case MENU_VOX: case MENU_VOX:
@@ -538,6 +575,7 @@ void UI_DisplayMenu(void)
#ifdef ENABLE_AM_FIX_TEST1 #ifdef ENABLE_AM_FIX_TEST1
case MENU_AM_FIX_TEST1: case MENU_AM_FIX_TEST1:
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]); strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
// gSetting_AM_fix = gSubMenuSelection;
break; break;
#endif #endif
@@ -554,6 +592,7 @@ void UI_DisplayMenu(void)
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
case MENU_AM_FIX: case MENU_AM_FIX:
#endif #endif
case MENU_ABR_ON_RX:
case MENU_BCL: case MENU_BCL:
case MENU_BEEP: case MENU_BEEP:
case MENU_S_ADD1: case MENU_S_ADD1:

View File

@@ -51,6 +51,7 @@ enum
MENU_SAVE, MENU_SAVE,
MENU_VOX, MENU_VOX,
MENU_ABR, MENU_ABR,
MENU_ABR_ON_RX,
MENU_TDR, MENU_TDR,
MENU_BEEP, MENU_BEEP,
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE

View File

@@ -45,12 +45,26 @@ void UI_DisplayStatus(const bool test_display)
// ************** // **************
// POWER-SAVE indicator // POWER-SAVE indicator
if (gCurrentFunction == FUNCTION_TRANSMIT)
{
memmove(line + x, BITMAP_TX, sizeof(BITMAP_TX));
x1 = x + sizeof(BITMAP_TX);
}
else
if (gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING)
{
memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX));
x1 = x + sizeof(BITMAP_RX);
}
else
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display) if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
{ {
memmove(line + x, BITMAP_PowerSave, sizeof(BITMAP_PowerSave)); memmove(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
x1 = x + sizeof(BITMAP_PowerSave); x1 = x + sizeof(BITMAP_POWERSAVE);
} }
x += sizeof(BITMAP_PowerSave); x += sizeof(BITMAP_POWERSAVE);
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
// NOASS SCAN indicator // NOASS SCAN indicator