Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b301a8d21e | ||
|
|
339e280a27 | ||
|
|
f8aaf47374 | ||
|
|
84e174544d | ||
|
|
ac05207ef0 | ||
|
|
9d5d36cc1f | ||
|
|
c5c86d0ad0 | ||
|
|
010ea0308a | ||
|
|
b3ca095af1 | ||
|
|
6a3a26c470 | ||
|
|
2551077cef | ||
|
|
2397e3950b | ||
|
|
d11e7863dc | ||
|
|
35c7530036 | ||
|
|
87d1cf7c86 | ||
|
|
bf2564b9f5 | ||
|
|
c59e0ea06c | ||
|
|
9ac3525683 | ||
|
|
3ac330ddee | ||
|
|
af342cf904 | ||
|
|
ec33203403 | ||
|
|
3c7f496f3e | ||
|
|
174c06dfbf |
38
Makefile
38
Makefile
@@ -8,16 +8,17 @@ ENABLE_OVERLAY := 0
|
||||
ENABLE_LTO := 1
|
||||
ENABLE_UART := 1
|
||||
ENABLE_AIRCOPY := 0
|
||||
ENABLE_FMRADIO := 0
|
||||
ENABLE_FMRADIO := 1
|
||||
ENABLE_NOAA := 0
|
||||
ENABLE_VOICE := 0
|
||||
ENABLE_ALARM := 0
|
||||
ENABLE_TX1750 := 0
|
||||
ENABLE_ALARM := 1
|
||||
ENABLE_TX1750 := 1
|
||||
ENABLE_BIG_FREQ := 1
|
||||
ENABLE_SMALL_BOLD := 1
|
||||
ENABLE_KEEP_MEM_NAME := 1
|
||||
ENABLE_WIDE_RX := 1
|
||||
ENABLE_TX_WHEN_AM := 0
|
||||
ENABLE_F_CAL_MENU := 0
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||
ENABLE_MAIN_KEY_HOLD := 1
|
||||
ENABLE_BOOT_BEEPS := 0
|
||||
@@ -26,10 +27,11 @@ ENABLE_SHOW_CHARGE_LEVEL := 1
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||
ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||
ENABLE_AM_FIX := 1
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1
|
||||
ENABLE_SQUELCH_LOWER := 1
|
||||
ENABLE_AM_FIX_SHOW_DATA := 0
|
||||
ENABLE_SQUELCH_LOWER := 0
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 1
|
||||
ENABLE_RSSI_BAR := 1
|
||||
ENABLE_AUDIO_BAR := 0
|
||||
ENABLE_AUDIO_BAR := 1
|
||||
ENABLE_SPECTRUM := 1
|
||||
#ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||
@@ -39,7 +41,8 @@ ENABLE_SPECTRUM := 1
|
||||
|
||||
TARGET = firmware
|
||||
|
||||
ifeq ($(ENABLE_LTO),1)
|
||||
ifeq ($(ENABLE_LTO), 1)
|
||||
# can't have LTO and OVERLAY enabled at same time
|
||||
ENABLE_OVERLAY := 0
|
||||
endif
|
||||
|
||||
@@ -104,7 +107,9 @@ OBJS += app/scanner.o
|
||||
ifeq ($(ENABLE_UART),1)
|
||||
OBJS += app/uart.o
|
||||
endif
|
||||
OBJS += am_fix.o
|
||||
ifeq ($(ENABLE_AM_FIX), 1)
|
||||
OBJS += am_fix.o
|
||||
endif
|
||||
OBJS += audio.o
|
||||
OBJS += bitmaps.o
|
||||
OBJS += board.o
|
||||
@@ -137,7 +142,7 @@ OBJS += ui/welcome.o
|
||||
OBJS += version.o
|
||||
OBJS += main.o
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifeq ($(OS), Windows_NT)
|
||||
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
else
|
||||
TOP := $(shell pwd)
|
||||
@@ -166,7 +171,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=gnu11 -MMD
|
||||
|
||||
ifeq ($(ENABLE_LTO),1)
|
||||
ifeq ($(ENABLE_LTO), 1)
|
||||
# CFLAGS += -flto
|
||||
CFLAGS += -flto=2
|
||||
endif
|
||||
@@ -219,6 +224,9 @@ endif
|
||||
ifeq ($(ENABLE_TX_WHEN_AM),1)
|
||||
CFLAGS += -DENABLE_TX_WHEN_AM
|
||||
endif
|
||||
ifeq ($(ENABLE_F_CAL_MENU),1)
|
||||
CFLAGS += -DENABLE_F_CAL_MENU
|
||||
endif
|
||||
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
||||
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||
endif
|
||||
@@ -249,8 +257,14 @@ endif
|
||||
ifeq ($(ENABLE_AM_FIX_TEST1),1)
|
||||
CFLAGS += -DENABLE_AM_FIX_TEST1
|
||||
endif
|
||||
ifeq ($(ENABLE_SQUELCH_LOWER),1)
|
||||
CFLAGS += -DENABLE_SQUELCH_LOWER
|
||||
ifeq ($(ENABLE_SQUELCH_MORE_SENSITIVE),1)
|
||||
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
|
||||
ifeq ($(ENABLE_RSSI_BAR),1)
|
||||
CFLAGS += -DENABLE_RSSI_BAR
|
||||
|
||||
46
README.md
46
README.md
@@ -36,9 +36,11 @@ Anyway, have fun.
|
||||
Please note that the Quansheng uv-k radios are not professional quality transceivers, their
|
||||
performance is strictly limited, somewhat below that of a decent transceiver. The RX front
|
||||
end has no track-tuned band pass filtering at all, and so are wide band/wide open to any
|
||||
and all signals over a wide frequency range. Using the radio in high intensity RF environments
|
||||
will nearly always destroy your reception, the receiver simply doesn't have a great dynamic
|
||||
range, though are quite sensitive (weak signal wise).
|
||||
and all signals over a wide frequency range.
|
||||
Using the radio in high intensity RF environments will nearly always destroy your reception,
|
||||
the receiver simply doesn't have a great dynamic range, which means distorted AM audio with
|
||||
strong received signals, there is nothing more anyone can do in firmware/software to stop that
|
||||
happening once the RX gain adjustment I do (AM fix) reaches the hardwares limit.
|
||||
|
||||
Saying that, they are nice toys for the price, fun to play with.
|
||||
|
||||
@@ -49,33 +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_OVERLAY := 0 cpu FLASH stuff
|
||||
ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads - DISABLE overlay if you enable this
|
||||
ENABLE_UART := 1 without this you can't configure radio via PC
|
||||
ENABLE_AIRCOPY := 0 easier to just enter frequency
|
||||
ENABLE_FMRADIO := 1 WBFM VHF band 2 RX
|
||||
ENABLE_NOAA := 0 everything NOAA
|
||||
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed
|
||||
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_AIRCOPY := 0 easier to just enter frequency with butts
|
||||
ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver
|
||||
ENABLE_NOAA := 0 everything NOAA (only of any use in the USA)
|
||||
ENABLE_VOICE := 0 want to hear voices ?
|
||||
ENABLE_ALARM := 0 TX alarms
|
||||
ENABLE_1750HZ := 0 side key 1750Hz TX tone
|
||||
ENABLE_BIG_FREQ := 0 big font frequencies
|
||||
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
|
||||
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_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_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_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead hold down keys 0-9 to access the functions
|
||||
ENABLE_BOOT_BEEPS := 0 give user audio feedback on volume knob position at boot-up
|
||||
ENABLE_COMPANDER := 1 compander option (per channel)
|
||||
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 gives user audio feedback on volume knob position at boot-up
|
||||
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_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_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_SHOW_DATA := 1 show debug data for the AM fix
|
||||
ENABLE_SQUELCH_LOWER := 1 squelch settings more sensitive - plan to let user adjust it in the menu
|
||||
ENABLE_RSSI_BAR := 1 enable a dBm/Sx RSSI bar graph level
|
||||
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 level (for now)
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
||||
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_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_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
||||
```
|
||||
|
||||
12
am_fix.c
12
am_fix.c
@@ -30,12 +30,6 @@
|
||||
#include "functions.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
|
||||
|
||||
typedef struct
|
||||
@@ -447,8 +441,10 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
gain_table_index[vfo] = (index <= max_index) ? index : max_index; // limit the gain index
|
||||
}
|
||||
|
||||
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
||||
return; // no gain change
|
||||
#if 0
|
||||
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
||||
return; // no gain change - this is to reduce writing to the BK chip on ever call
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
5
am_fix.h
5
am_fix.h
@@ -20,11 +20,6 @@
|
||||
#include <stdint.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
|
||||
extern int16_t rssi_gain_diff[2];
|
||||
|
||||
|
||||
10
app/action.c
10
app/action.c
@@ -109,7 +109,7 @@ void ACTION_Monitor(void)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
gRequestDisplayScreen = gScreenToDisplay;
|
||||
gRequestDisplayScreen = gScreenToDisplay;
|
||||
}
|
||||
|
||||
void ACTION_Scan(bool bRestart)
|
||||
@@ -251,7 +251,9 @@ void ACTION_Vox(void)
|
||||
#endif
|
||||
|
||||
gFlagPrepareTX = true;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -268,6 +270,7 @@ void ACTION_Vox(void)
|
||||
gInputBoxIndex = 0;
|
||||
gVoxResumeCountdown = 80;
|
||||
gFlagReconfigureVfos = true;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
@@ -279,7 +282,8 @@ void ACTION_Vox(void)
|
||||
|
||||
FM_Start();
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,9 +134,9 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
for (i = 0; i < ARRAY_SIZE(frequencyBandTable); i++)
|
||||
{
|
||||
if (Frequency >= LowerLimitFrequencyBandTable[i] && Frequency <= UpperLimitFrequencyBandTable[i])
|
||||
if (Frequency >= frequencyBandTable[i].lower && Frequency < frequencyBandTable[i].upper)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
|
||||
450
app/app.c
450
app/app.c
@@ -62,6 +62,12 @@
|
||||
#include "ui/status.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 updateRSSI(const int vfo)
|
||||
@@ -95,7 +101,7 @@ static void APP_CheckForIncoming(void)
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE)
|
||||
{ // CTCSS/DTS scanning
|
||||
|
||||
ScanPauseDelayIn_10ms = 100; // 1 second
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_DETECTED;
|
||||
}
|
||||
@@ -157,10 +163,11 @@ static void APP_CheckForIncoming(void)
|
||||
updateRSSI(gEeprom.RX_CHANNEL);
|
||||
gUpdateRSSI = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ScanPauseDelayIn_10ms = 20; // 200ms
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
|
||||
@@ -223,7 +230,7 @@ static void APP_HandleIncoming(void)
|
||||
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||
{ // DTMF DCD is enabled
|
||||
|
||||
// DTMF_HandleRequest();
|
||||
DTMF_HandleRequest();
|
||||
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
@@ -401,7 +408,7 @@ Skip:
|
||||
break;
|
||||
|
||||
case SCAN_RESUME_CO:
|
||||
ScanPauseDelayIn_10ms = 360;
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_7_10ms;
|
||||
gScheduleScanListen = false;
|
||||
break;
|
||||
|
||||
@@ -461,6 +468,9 @@ static void APP_HandleFunction(void)
|
||||
|
||||
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)
|
||||
return;
|
||||
|
||||
@@ -469,19 +479,15 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
BK1080_Init(0, false);
|
||||
#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)
|
||||
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);
|
||||
|
||||
gEnableSpeaker = true;
|
||||
|
||||
BACKLIGHT_TurnOn();
|
||||
if (gSetting_backlight_on_rx)
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
if (gScanState != SCAN_OFF)
|
||||
{
|
||||
@@ -490,7 +496,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
case SCAN_RESUME_TO:
|
||||
if (!gScanPauseMode)
|
||||
{
|
||||
ScanPauseDelayIn_10ms = 500;
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gScanPauseMode = true;
|
||||
}
|
||||
@@ -509,19 +515,21 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gIsNoaaMode)
|
||||
{
|
||||
gRxVfo->CHANNEL_SAVE = gNoaaChannel + NOAA_CHANNEL_FIRST;
|
||||
gRxVfo->pRX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gRxVfo->pTX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gRxVfo->CHANNEL_SAVE;
|
||||
gNOAA_Countdown_10ms = 500; // 5 sec
|
||||
gScheduleNOAA = false;
|
||||
gRxVfo->CHANNEL_SAVE = gNoaaChannel + NOAA_CHANNEL_FIRST;
|
||||
gRxVfo->pRX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gRxVfo->pTX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gEeprom.ScreenChannel[chan] = gRxVfo->CHANNEL_SAVE;
|
||||
gNOAA_Countdown_10ms = 500; // 5 sec
|
||||
gScheduleNOAA = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
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
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ******************************************
|
||||
{ // RF RX front end gain
|
||||
|
||||
// original setting
|
||||
uint16_t lna_short = orig_lna_short;
|
||||
uint16_t lna = orig_lna;
|
||||
uint16_t mixer = orig_mixer;
|
||||
uint16_t pga = orig_pga;
|
||||
|
||||
// original setting
|
||||
uint8_t lna_short = orig_lna_short;
|
||||
uint8_t lna = orig_lna;
|
||||
uint8_t mixer = orig_mixer;
|
||||
uint8_t pga = orig_pga;
|
||||
|
||||
if (gRxVfo->AM_mode)
|
||||
{ // AM
|
||||
/*
|
||||
#ifndef ENABLE_AM_FIX
|
||||
const uint32_t rx_frequency = gRxVfo->pRX->Frequency;
|
||||
|
||||
// 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
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if (gRxVfo->AM_mode && gSetting_AM_fix)
|
||||
{ // AM RX mode
|
||||
if (reset_am_fix)
|
||||
AM_fix_reset(chan); // TODO: only reset it when moving channel/frequency
|
||||
AM_fix_10ms(chan);
|
||||
}
|
||||
else
|
||||
{ // increase the front end to compensate the reduced gain, but more gain decreases dynamic range :(
|
||||
lna_short = 3; // 3 original
|
||||
lna = 4; // 2 original, 4 increased
|
||||
mixer = 3; // 3 original
|
||||
pga = 7; // 6 original, 7 increased
|
||||
{ // FM RX mode
|
||||
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
|
||||
}
|
||||
#else
|
||||
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
|
||||
#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
|
||||
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
|
||||
// AF gain - original QS values
|
||||
BK4819_WriteRegister(BK4819_REG_48,
|
||||
(11u << 12) | // ??? .. 0 to 15, doesn't seem to make any difference
|
||||
( 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)
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gVoiceWriteIndex == 0)
|
||||
// if (gVoiceWriteIndex == 0)
|
||||
#endif
|
||||
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)
|
||||
#endif
|
||||
{ // squelch is disabled
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
return;
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
else
|
||||
gUpdateDisplay = true;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
|
||||
@@ -613,7 +601,7 @@ uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
|
||||
|
||||
if (pInfo->StepFrequency == 833)
|
||||
{
|
||||
const uint32_t Lower = LowerLimitFrequencyBandTable[pInfo->Band];
|
||||
const uint32_t Lower = frequencyBandTable[pInfo->Band].lower;
|
||||
const uint32_t Delta = Frequency - Lower;
|
||||
uint32_t Base = (Delta / 2500) * 2500;
|
||||
const uint32_t Index = ((Delta - Base) % 2500) / 833;
|
||||
@@ -624,11 +612,11 @@ uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
|
||||
Frequency = Lower + Base + (Index * 833);
|
||||
}
|
||||
|
||||
if (Frequency > UpperLimitFrequencyBandTable[pInfo->Band])
|
||||
Frequency = LowerLimitFrequencyBandTable[pInfo->Band];
|
||||
if (Frequency >= frequencyBandTable[pInfo->Band].upper)
|
||||
Frequency = frequencyBandTable[pInfo->Band].lower;
|
||||
else
|
||||
if (Frequency < LowerLimitFrequencyBandTable[pInfo->Band])
|
||||
Frequency = FREQUENCY_FloorToStep(UpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, LowerLimitFrequencyBandTable[pInfo->Band]);
|
||||
if (Frequency < frequencyBandTable[pInfo->Band].lower)
|
||||
Frequency = FREQUENCY_FloorToStep(frequencyBandTable[pInfo->Band].upper, pInfo->StepFrequency, frequencyBandTable[pInfo->Band].lower);
|
||||
|
||||
return Frequency;
|
||||
}
|
||||
@@ -641,58 +629,79 @@ static void FREQ_NextChannel(void)
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
ScanPauseDelayIn_10ms = 10;
|
||||
bScanKeepFrequency = false;
|
||||
// ScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||
ScanPauseDelayIn_10ms = 10; // 100ms
|
||||
|
||||
bScanKeepFrequency = false;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void MR_NextChannel(void)
|
||||
{
|
||||
const uint8_t Ch1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const uint8_t Ch2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const bool bEnabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT];
|
||||
uint8_t PreviousCh = gNextMrChannel;
|
||||
uint8_t Ch;
|
||||
static unsigned int prev_mr_chan = 0;
|
||||
const bool enabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const unsigned int chan1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const unsigned int chan2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const unsigned int prev_chan = gNextMrChannel;
|
||||
unsigned int chan = 0;
|
||||
|
||||
if (bEnabled)
|
||||
if (enabled)
|
||||
{
|
||||
if (gCurrentScanList == 0)
|
||||
switch (gCurrentScanList)
|
||||
{
|
||||
gPreviousMrChannel = gNextMrChannel;
|
||||
if (RADIO_CheckValidChannel(Ch1, false, 0))
|
||||
gNextMrChannel = Ch1;
|
||||
else
|
||||
gCurrentScanList = 1;
|
||||
}
|
||||
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||
prev_mr_chan = gNextMrChannel;
|
||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||
{
|
||||
//gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gNextMrChannel = chan1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (gCurrentScanList == 1)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(Ch2, false, 0))
|
||||
gNextMrChannel = Ch2;
|
||||
else
|
||||
gCurrentScanList = 2;
|
||||
}
|
||||
case SCAN_NEXT_CHAN_SCANLIST2:
|
||||
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||
{
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||
gNextMrChannel = chan2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (gCurrentScanList == 2)
|
||||
{
|
||||
gNextMrChannel = gPreviousMrChannel;
|
||||
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (Ch == 0xFF)
|
||||
return;
|
||||
// this bit doesn't work at all - yet :(
|
||||
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
// chan = (gEeprom.RX_CHANNEL + 1) & 1u;
|
||||
// chan = gEeprom.MrChannel[chan];
|
||||
// chan = gEeprom.ScreenChannel[chan];
|
||||
// chan = gEeprom.VfoInfo[chan].CHANNEL_SAVE;
|
||||
// chan = 14;
|
||||
// if (RADIO_CheckValidChannel(chan, false, 0))
|
||||
// {
|
||||
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||
// gNextMrChannel = chan;
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
gNextMrChannel = Ch;
|
||||
default:
|
||||
case SCAN_NEXT_CHAN_MR:
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_MR;
|
||||
gNextMrChannel = prev_mr_chan;
|
||||
chan = 0xffffffff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (!enabled || chan == 0xffffffff)
|
||||
{
|
||||
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (Ch == 0xFF)
|
||||
chan = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (chan == 0xFF)
|
||||
return;
|
||||
|
||||
gNextMrChannel = Ch;
|
||||
gNextMrChannel = chan;
|
||||
}
|
||||
|
||||
if (PreviousCh != gNextMrChannel)
|
||||
if (prev_chan != gNextMrChannel)
|
||||
{
|
||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
|
||||
@@ -703,12 +712,17 @@ static void MR_NextChannel(void)
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
bScanKeepFrequency = false;
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
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
|
||||
|
||||
if (bEnabled)
|
||||
if (++gCurrentScanList > 2)
|
||||
gCurrentScanList = 0;
|
||||
bScanKeepFrequency = false;
|
||||
|
||||
if (enabled)
|
||||
if (++gCurrentScanList >= SCAN_NEXT_NUM)
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
@@ -990,7 +1004,7 @@ static void APP_HandleVox(void)
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT && gSerialConfigCountDown_500ms == 0)
|
||||
{
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
RADIO_PrepareTX();
|
||||
@@ -1009,8 +1023,8 @@ void APP_Update(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gTxTimeoutReached)
|
||||
{ // transmitter timed out
|
||||
if ((gCurrentFunction == FUNCTION_TRANSMIT && gTxTimeoutReached) || gSerialConfigCountDown_500ms > 0)
|
||||
{ // transmitter timed out or must de-key
|
||||
gTxTimeoutReached = false;
|
||||
|
||||
gFlagEndTransmission = true;
|
||||
@@ -1258,47 +1272,21 @@ void APP_CheckKeys(void)
|
||||
|
||||
if (gPttIsPressed)
|
||||
{
|
||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||
{ // PTT released
|
||||
#if 0
|
||||
// denoise the PTT
|
||||
unsigned int i = 6; // test the PTT button for 6ms
|
||||
unsigned int count = 0;
|
||||
while (i-- > 0)
|
||||
{
|
||||
SYSTEM_DelayMs(1);
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||
{ // PTT pressed
|
||||
if (count > 0)
|
||||
count--;
|
||||
continue;
|
||||
}
|
||||
if (++count < 3)
|
||||
continue;
|
||||
|
||||
// stop transmitting
|
||||
APP_ProcessKey(KEY_PTT, false, false);
|
||||
gPttIsPressed = false;
|
||||
if (gKeyReading1 != KEY_INVALID)
|
||||
gPttWasReleased = true;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if (++gPttDebounceCounter >= 3) // 30ms
|
||||
{ // stop transmitting
|
||||
APP_ProcessKey(KEY_PTT, false, false);
|
||||
gPttIsPressed = false;
|
||||
if (gKeyReading1 != KEY_INVALID)
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
#endif
|
||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || gSerialConfigCountDown_500ms > 0)
|
||||
{ // PTT released or serial comms config in progress
|
||||
if (++gPttDebounceCounter >= 3 || gSerialConfigCountDown_500ms > 0) // 30ms
|
||||
{ // stop transmitting
|
||||
APP_ProcessKey(KEY_PTT, false, false);
|
||||
gPttIsPressed = false;
|
||||
if (gKeyReading1 != KEY_INVALID)
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
gPttDebounceCounter = 0;
|
||||
}
|
||||
else
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && gSerialConfigCountDown_500ms == 0)
|
||||
{ // PTT pressed
|
||||
if (++gPttDebounceCounter >= 3) // 30ms
|
||||
{ // start transmitting
|
||||
@@ -1450,7 +1438,6 @@ void APP_TimeSlice10ms(void)
|
||||
// Skipping authentic device checks
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
// if (gFmRadioCountdown_500ms > 0)
|
||||
if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11
|
||||
return;
|
||||
#endif
|
||||
@@ -1490,22 +1477,27 @@ void APP_TimeSlice10ms(void)
|
||||
if (gAlarmState == ALARM_STATE_TXALARM)
|
||||
{
|
||||
gAlarmState = ALARM_STATE_ALARM;
|
||||
|
||||
RADIO_EnableCxCSS();
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
|
||||
BK4819_Enable_AfDac_DiscMode_TxDsp();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
|
||||
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
gAlarmState = ALARM_STATE_TXALARM;
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
||||
RADIO_SetTxParameters();
|
||||
BK4819_TransmitTone(true, 500);
|
||||
SYSTEM_DelayMs(2);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
gEnableSpeaker = true;
|
||||
gAlarmToneCounter = 0;
|
||||
}
|
||||
@@ -1561,6 +1553,9 @@ void APP_TimeSlice10ms(void)
|
||||
switch (gScanCssState)
|
||||
{
|
||||
case SCAN_CSS_STATE_OFF:
|
||||
|
||||
// must be RF frequency scanning if we're here ?
|
||||
|
||||
if (!BK4819_GetFrequencyScanResult(&Result))
|
||||
break;
|
||||
|
||||
@@ -1589,12 +1584,14 @@ void APP_TimeSlice10ms(void)
|
||||
gScanUseCssResult = false;
|
||||
gScanProgressIndicator = 0;
|
||||
gScanCssState = SCAN_CSS_STATE_SCANNING;
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_SCANNER);
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
//gScanDelay_10ms = scan_delay_10ms;
|
||||
gScanDelay_10ms = 20 / 10; // 20ms
|
||||
gScanDelay_10ms = scan_delay_10ms;
|
||||
//gScanDelay_10ms = 1; // 10ms
|
||||
break;
|
||||
|
||||
case SCAN_CSS_STATE_SCANNING:
|
||||
@@ -1680,7 +1677,9 @@ void cancelUserInputModes(void)
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputIndex = 0;
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
}
|
||||
}
|
||||
@@ -1714,6 +1713,11 @@ void APP_TimeSlice500ms(void)
|
||||
if (--gDTMF_RX_timeout == 0)
|
||||
DTMF_clear_RX();
|
||||
|
||||
if (gSerialConfigCountDown_500ms > 0)
|
||||
{
|
||||
// gReducedService = true; // a serial config upload/download is in progress
|
||||
}
|
||||
|
||||
// Skipped authentic device check
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -1745,23 +1749,27 @@ void APP_TimeSlice500ms(void)
|
||||
|
||||
// Skipped authentic device check
|
||||
|
||||
if ((gBatteryCheckCounter & 1) == 0)
|
||||
{
|
||||
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryVoltageIndex++], &gBatteryCurrent);
|
||||
if (gBatteryVoltageIndex > 3)
|
||||
gBatteryVoltageIndex = 0;
|
||||
BATTERY_GetReadings(true);
|
||||
}
|
||||
|
||||
// regular display updates (once every 2 sec) - if need be
|
||||
if ((gBatteryCheckCounter & 3) == 0)
|
||||
{
|
||||
if (gChargingWithTypeC || gSetting_battery_text > 0)
|
||||
gUpdateStatus = true;
|
||||
#ifdef ENABLE_SHOW_CHARGE_LEVEL
|
||||
if (gChargingWithTypeC)
|
||||
gUpdateDisplay = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
if ((gBatteryCheckCounter & 1) == 0)
|
||||
{
|
||||
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryVoltageIndex++], &gBatteryCurrent);
|
||||
|
||||
if (gBatteryVoltageIndex > 3)
|
||||
gBatteryVoltageIndex = 0;
|
||||
|
||||
BATTERY_GetReadings(true);
|
||||
}
|
||||
|
||||
// regular statusbar updates (once every 2 sec) if need be
|
||||
if ((gBatteryCheckCounter & 3) == 0)
|
||||
if (gChargingWithTypeC || gSetting_battery_text > 0)
|
||||
gUpdateStatus = true;
|
||||
|
||||
if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
updateRSSI(gEeprom.RX_CHANNEL);
|
||||
|
||||
@@ -1783,6 +1791,8 @@ void APP_TimeSlice500ms(void)
|
||||
if (gScanState == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
||||
#endif
|
||||
{
|
||||
bool exit_menu = false;
|
||||
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
|
||||
{
|
||||
if (--gKeyLockCountdown == 0)
|
||||
@@ -1791,52 +1801,55 @@ void APP_TimeSlice500ms(void)
|
||||
gUpdateStatus = true; // lock symbol needs showing
|
||||
}
|
||||
|
||||
if (gVoltageMenuCountdown > 0)
|
||||
if (gMenuCountdown > 0)
|
||||
if (--gMenuCountdown == 0)
|
||||
exit_menu = true; // exit menu mode
|
||||
|
||||
if (exit_menu)
|
||||
{
|
||||
if (--gVoltageMenuCountdown == 0)
|
||||
gMenuCountdown = 0;
|
||||
|
||||
if (gEeprom.BACKLIGHT == 0 && gScreenToDisplay == DISPLAY_MENU)
|
||||
{
|
||||
if (gEeprom.BACKLIGHT == 0 && gScreenToDisplay == DISPLAY_MENU)
|
||||
{
|
||||
gBacklightCountdown = 0;
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||
}
|
||||
|
||||
if (gInputBoxIndex > 0 || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||
{
|
||||
BK4819_StopScan();
|
||||
|
||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
gInputBoxIndex = 0;
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputIndex = 0;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode &&
|
||||
gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef ENABLE_CODE_SCAN_TIMEOUT
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
#endif
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
gBacklightCountdown = 0;
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||
}
|
||||
|
||||
if (gInputBoxIndex > 0 || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||
{
|
||||
BK4819_StopScan();
|
||||
|
||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
gInputBoxIndex = 0;
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputIndex = 0;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode &&
|
||||
gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef ENABLE_CODE_SCAN_TIMEOUT
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
#endif
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1943,7 +1956,7 @@ void APP_TimeSlice500ms(void)
|
||||
}
|
||||
else
|
||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||
|
||||
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT &&
|
||||
gCurrentFunction != FUNCTION_RECEIVE)
|
||||
@@ -1987,7 +2000,8 @@ void APP_TimeSlice500ms(void)
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1996,7 +2010,7 @@ void CHANNEL_Next(bool bFlag, int8_t Direction)
|
||||
RADIO_SelectVfos();
|
||||
|
||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||
gCurrentScanList = 0;
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gScanState = Direction;
|
||||
|
||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||
@@ -2077,15 +2091,17 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gFlagSaveChannel);
|
||||
gFlagSaveChannel = false;
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, VFO_CONFIGURE);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Key != KEY_PTT)
|
||||
gVoltageMenuCountdown = menu_timeout_500ms;
|
||||
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
||||
gMenuCountdown = menu_timeout_500ms;
|
||||
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
@@ -2270,9 +2286,11 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
case DISPLAY_MAIN:
|
||||
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
|
||||
|
||||
#ifdef ENABLE_MAIN_KEY_HOLD
|
||||
bKeyHeld = false; // allow the channel setting to be saved
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -2328,6 +2346,8 @@ Skip:
|
||||
|
||||
if (gFlagAcceptSetting)
|
||||
{
|
||||
gMenuCountdown = menu_timeout_500ms;
|
||||
|
||||
MENU_AcceptSetting();
|
||||
|
||||
gFlagRefreshSetting = true;
|
||||
@@ -2376,6 +2396,7 @@ Skip:
|
||||
if (!bKeyHeld)
|
||||
{
|
||||
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gRequestSaveChannel);
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
if (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
@@ -2383,6 +2404,7 @@ Skip:
|
||||
else
|
||||
{
|
||||
gFlagSaveChannel = gRequestSaveChannel;
|
||||
|
||||
if (gRequestDisplayScreen == DISPLAY_INVALID)
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
@@ -2435,6 +2457,8 @@ Skip:
|
||||
if (gFlagRefreshSetting)
|
||||
{
|
||||
gFlagRefreshSetting = false;
|
||||
gMenuCountdown = menu_timeout_500ms;
|
||||
|
||||
MENU_ShowCurrentSetting();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,14 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "functions.h"
|
||||
#include "frequencies.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 CHANNEL_Next(bool bFlag, int8_t Direction);
|
||||
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
|
||||
|
||||
32
app/dtmf.c
32
app/dtmf.c
@@ -159,7 +159,7 @@ DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
||||
for (i = 0; i < size; i++)
|
||||
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE)
|
||||
break;
|
||||
|
||||
|
||||
return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ void DTMF_HandleRequest(void)
|
||||
DTMF_clear_RX();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||
{ // D-DCD is disabled or we're alive
|
||||
DTMF_clear_RX();
|
||||
@@ -207,7 +207,7 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // bugger
|
||||
|
||||
|
||||
if (gEeprom.PERMIT_REMOTE_KILL)
|
||||
{
|
||||
gSetting_KILLED = true; // oooerr !
|
||||
@@ -238,17 +238,17 @@ void DTMF_HandleRequest(void)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gDTMF_RX_index >= 9)
|
||||
{ // look for the REVIVE code
|
||||
|
||||
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // shit, we're back !
|
||||
|
||||
|
||||
gSetting_KILLED = false;
|
||||
|
||||
DTMF_clear_RX();
|
||||
@@ -268,7 +268,7 @@ void DTMF_HandleRequest(void)
|
||||
{ // look for ACK reply
|
||||
|
||||
strcpy(String, "AB");
|
||||
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
@@ -290,7 +290,7 @@ void DTMF_HandleRequest(void)
|
||||
gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP &&
|
||||
gDTMF_RX_index >= 9)
|
||||
{ // waiting for a reply
|
||||
|
||||
|
||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
@@ -373,25 +373,27 @@ void DTMF_Reply(void)
|
||||
pString = String;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case DTMF_REPLY_AB:
|
||||
pString = "AB";
|
||||
break;
|
||||
|
||||
|
||||
case DTMF_REPLY_AAAAA:
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||
pString = String;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
case DTMF_REPLY_NONE:
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOT)
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
||||
{
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
// send TX-UP DTMF
|
||||
pString = gEeprom.DTMF_UP_CODE;
|
||||
break;
|
||||
}
|
||||
@@ -400,16 +402,16 @@ void DTMF_Reply(void)
|
||||
|
||||
if (pString == NULL)
|
||||
return;
|
||||
|
||||
|
||||
Delay = gEeprom.DTMF_PRELOAD_TIME;
|
||||
|
||||
|
||||
if (gEeprom.DTMF_SIDE_TONE)
|
||||
{ // the will also hear the transmitted tones
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
gEnableSpeaker = true;
|
||||
Delay = (gEeprom.DTMF_PRELOAD_TIME < 60) ? 60 : gEeprom.DTMF_PRELOAD_TIME;
|
||||
}
|
||||
|
||||
|
||||
SYSTEM_DelayMs(Delay);
|
||||
|
||||
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
||||
|
||||
@@ -86,7 +86,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState == FM_SCAN_OFF)
|
||||
{
|
||||
@@ -104,9 +104,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
if (!bKeyPressed)
|
||||
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
|
||||
{
|
||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||
//if (gScreenToDisplay == DISPLAY_MAIN)
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{
|
||||
@@ -132,10 +132,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
|
||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||
|
||||
// beep when you release the PTT
|
||||
//gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL; // 1of11
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -149,7 +148,10 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
|
||||
gPttDebounceCounter = 0;
|
||||
gPttIsPressed = false;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -160,17 +162,15 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gScreenToDisplay == DISPLAY_MENU || gScreenToDisplay == DISPLAY_FM)
|
||||
#else
|
||||
if (gScreenToDisplay == DISPLAY_MENU)
|
||||
if (gScreenToDisplay == DISPLAY_FM)
|
||||
{
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gInputBoxIndex = 0;
|
||||
gPttIsPressed = false;
|
||||
gPttDebounceCounter = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gInputBoxIndex = 0;
|
||||
gPttIsPressed = false;
|
||||
gPttDebounceCounter = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{
|
||||
@@ -213,21 +213,26 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
gDTMF_State = DTMF_STATE_0;
|
||||
}
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gFlagPrepareTX = true;
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
||||
gUpdateStatus = true;
|
||||
gFlagStopScan = true;
|
||||
@@ -237,7 +242,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
else
|
||||
{
|
||||
MENU_StopCssScan();
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
}
|
||||
}
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -247,11 +254,10 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
|
||||
gPttWasPressed = true;
|
||||
}
|
||||
|
||||
|
||||
35
app/main.c
35
app/main.c
@@ -80,6 +80,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
if (beep)
|
||||
@@ -104,6 +105,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
gRequestSaveSettings = 1;
|
||||
gFlagReconfigureVfos = true;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
if (beep)
|
||||
@@ -165,6 +167,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_5:
|
||||
if(beep) {
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
@@ -182,7 +185,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
#elif defined(ENABLE_SPECTRUM)
|
||||
APP_RunSpectrum();
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
// toggle scanlist-1 and scanlist 2
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{
|
||||
@@ -204,7 +209,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_6:
|
||||
@@ -358,20 +363,20 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
|
||||
// clamp the frequency entered to some valid value
|
||||
if (Frequency < LowerLimitFrequencyBandTable[0])
|
||||
if (Frequency < frequencyBandTable[0].lower)
|
||||
{
|
||||
Frequency = LowerLimitFrequencyBandTable[0];
|
||||
Frequency = frequencyBandTable[0].lower;
|
||||
}
|
||||
else
|
||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
{
|
||||
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2;
|
||||
Frequency = (Frequency < center) ? bx_stop1_Hz : bx_start2_Hz;
|
||||
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||
Frequency = (Frequency < center) ? BX4819_band1.upper : BX4819_band2.lower;
|
||||
}
|
||||
else
|
||||
if (Frequency > UpperLimitFrequencyBandTable[6])
|
||||
if (Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||
{
|
||||
Frequency = UpperLimitFrequencyBandTable[6];
|
||||
Frequency = frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -395,12 +400,12 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
// Frequency += 75; // is this meant to be rounding ?
|
||||
Frequency += gTxVfo->StepFrequency / 2; // no idea, but this is
|
||||
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]);
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, frequencyBandTable[gTxVfo->Band].lower);
|
||||
|
||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
{ // clamp the frequency to the limit
|
||||
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2;
|
||||
Frequency = (Frequency < center) ? bx_stop1_Hz - gTxVfo->StepFrequency : bx_start2_Hz;
|
||||
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||
Frequency = (Frequency < center) ? BX4819_band1.upper - gTxVfo->StepFrequency : BX4819_band2.lower;
|
||||
}
|
||||
|
||||
gTxVfo->freq_config_RX.Frequency = Frequency;
|
||||
@@ -603,7 +608,6 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
if (bFlag)
|
||||
{
|
||||
gFlagRefreshSetting = true;
|
||||
gFlagBackupSetting = true;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
|
||||
@@ -651,6 +655,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
gDTMF_InputMode = true;
|
||||
memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox));
|
||||
gDTMF_InputIndex = 0;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
@@ -808,7 +813,9 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
DTMF_Append(Character);
|
||||
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gPttWasReleased = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
|
||||
99
app/menu.c
99
app/menu.c
@@ -212,6 +212,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
case MENU_MIC_BAR:
|
||||
#endif
|
||||
case MENU_ABR_ON_RX:
|
||||
case MENU_BCL:
|
||||
case MENU_BEEP:
|
||||
case MENU_AUTOLK:
|
||||
@@ -315,14 +316,16 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = 16;
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
*pMin = -50;
|
||||
*pMax = +50;
|
||||
break;
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
*pMin = -50;
|
||||
*pMax = +50;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_BATCAL:
|
||||
*pMin = 1760; // 0
|
||||
*pMax = 2000; // 2300
|
||||
*pMin = 1600; // 0
|
||||
*pMax = 2200; // 2300
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -404,9 +407,6 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_T_CTCS:
|
||||
pConfig = &gTxVfo->freq_config_TX;
|
||||
|
||||
// Fallthrough
|
||||
|
||||
case MENU_R_CTCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
{
|
||||
@@ -416,14 +416,20 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
}
|
||||
Code = 0;
|
||||
pConfig->Code = Code;
|
||||
pConfig->CodeType = CODE_TYPE_OFF;
|
||||
|
||||
BK4819_ExitSubAu();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
Code = gSubMenuSelection - 1;
|
||||
pConfig->Code = Code;
|
||||
|
||||
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||
}
|
||||
pConfig->Code = Code;
|
||||
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
@@ -444,6 +450,12 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_SCR:
|
||||
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
||||
#if 0
|
||||
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
#endif
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
@@ -498,6 +510,10 @@ void MENU_AcceptSetting(void)
|
||||
gEeprom.BACKLIGHT = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_ABR_ON_RX:
|
||||
gSetting_backlight_on_rx = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
gEeprom.DUAL_WATCH = gSubMenuSelection;
|
||||
gFlagReconfigureVfos = true;
|
||||
@@ -582,7 +598,10 @@ void MENU_AcceptSetting(void)
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
gTxVfo->Compander = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
// gRequestSaveChannel = 1;
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -736,10 +755,11 @@ void MENU_AcceptSetting(void)
|
||||
gSetting_TX_EN = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
//if (gF_LOCK)
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
writeXtalFreqCal(gSubMenuSelection);
|
||||
return;
|
||||
return;
|
||||
#endif
|
||||
|
||||
case MENU_BATCAL:
|
||||
gBatteryCalibration[3] = gSubMenuSelection;
|
||||
@@ -912,6 +932,10 @@ void MENU_ShowCurrentSetting(void)
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
|
||||
break;
|
||||
|
||||
case MENU_ABR_ON_RX:
|
||||
gSubMenuSelection = gSetting_backlight_on_rx;
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
gSubMenuSelection = gEeprom.DUAL_WATCH;
|
||||
break;
|
||||
@@ -1106,9 +1130,11 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gSetting_TX_EN;
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
break;
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_BATCAL:
|
||||
gSubMenuSelection = gBatteryCalibration[3];
|
||||
@@ -1117,12 +1143,6 @@ void MENU_ShowCurrentSetting(void)
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// if (gFlagBackupSetting)
|
||||
{ // save a copy incase the user wants to back out
|
||||
// gFlagBackupSetting = false;
|
||||
gSubMenuSelection_original = gSubMenuSelection;
|
||||
}
|
||||
}
|
||||
|
||||
static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
@@ -1176,7 +1196,6 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
gMenuCursor = Value - 1;
|
||||
gFlagRefreshSetting = true;
|
||||
gFlagBackupSetting = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1192,7 +1211,6 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
gMenuCursor = Value - 1;
|
||||
gFlagRefreshSetting = true;
|
||||
gFlagBackupSetting = true;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -1301,17 +1319,6 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gIsInSubMenu)
|
||||
{
|
||||
// ***********************
|
||||
// restore original value
|
||||
|
||||
if (gMenuCursor == MENU_F_CALI)
|
||||
{
|
||||
// if (gF_LOCK)
|
||||
// writeXtalFreqCal(gSubMenuSelection_original);
|
||||
}
|
||||
|
||||
// ***********************
|
||||
|
||||
if (gInputBoxIndex == 0 || gMenuCursor != MENU_OFFSET)
|
||||
{
|
||||
gAskForConfirmation = 0;
|
||||
@@ -1616,7 +1623,6 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
|
||||
|
||||
gFlagRefreshSetting = true;
|
||||
gFlagBackupSetting = true;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
|
||||
@@ -1736,6 +1742,19 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
break;
|
||||
}
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MENU && gMenuCursor == MENU_VOL)
|
||||
gVoltageMenuCountdown = menu_timeout_500ms;
|
||||
if (gScreenToDisplay == DISPLAY_MENU)
|
||||
{
|
||||
if (gMenuCursor == MENU_VOL ||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
gMenuCursor == MENU_F_CALI ||
|
||||
#endif
|
||||
gMenuCursor == MENU_BATCAL)
|
||||
{
|
||||
gMenuCountdown = menu_timeout_long_500ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
gMenuCountdown = menu_timeout_500ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
case 0:
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
||||
gUpdateStatus = true;
|
||||
gFlagStopScan = true;
|
||||
|
||||
15
app/uart.c
15
app/uart.c
@@ -225,10 +225,16 @@ static void CMD_0514(const uint8_t *pBuffer)
|
||||
const CMD_0514_t *pCmd = (const CMD_0514_t *)pBuffer;
|
||||
|
||||
Timestamp = pCmd->Timestamp;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||
#endif
|
||||
|
||||
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||
|
||||
// turn the LCD backlight off
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
|
||||
SendVersion();
|
||||
}
|
||||
|
||||
@@ -241,9 +247,12 @@ static void CMD_051B(const uint8_t *pBuffer)
|
||||
if (pCmd->Timestamp != Timestamp)
|
||||
return;
|
||||
|
||||
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||
#endif
|
||||
|
||||
memset(&Reply, 0, sizeof(Reply));
|
||||
Reply.Header.ID = 0x051C;
|
||||
Reply.Header.Size = pCmd->Size + 4;
|
||||
@@ -269,11 +278,14 @@ static void CMD_051D(const uint8_t *pBuffer)
|
||||
if (pCmd->Timestamp != Timestamp)
|
||||
return;
|
||||
|
||||
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||
|
||||
bReloadEeprom = false;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||
#endif
|
||||
|
||||
Reply.Header.ID = 0x051E;
|
||||
Reply.Header.Size = sizeof(Reply.Data);
|
||||
Reply.Data.Offset = pCmd->Offset;
|
||||
@@ -389,8 +401,11 @@ static void CMD_052F(const uint8_t *pBuffer)
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
|
||||
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||
|
||||
Timestamp = pCmd->Timestamp;
|
||||
|
||||
// turn the LCD backlight off
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
|
||||
SendVersion();
|
||||
|
||||
7
audio.c
7
audio.c
@@ -279,12 +279,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
SYSTEM_DelayMs(Delay * 10);
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
||||
{
|
||||
if (gRxVfo->AM_mode)
|
||||
BK4819_SetAF(BK4819_AF_AM);
|
||||
else
|
||||
BK4819_SetAF(BK4819_AF_OPEN);
|
||||
}
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
|
||||
26
bitmaps.c
26
bitmaps.c
@@ -4,7 +4,7 @@
|
||||
// all these images are on their right sides
|
||||
// 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
|
||||
// "S"
|
||||
@@ -29,6 +29,30 @@ const uint8_t BITMAP_PowerSave[8] =
|
||||
#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] =
|
||||
{
|
||||
0b01011101,
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
#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_BatteryLevel1[17];
|
||||
|
||||
1
board.c
1
board.c
@@ -712,6 +712,7 @@ void BOARD_EEPROM_Init(void)
|
||||
#ifdef ENABLE_AM_FIX
|
||||
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
|
||||
#endif
|
||||
gSetting_backlight_on_rx = (Data[7] & (1u << 6)) ? true : false;
|
||||
|
||||
if (!gEeprom.VFO_OPEN)
|
||||
{
|
||||
|
||||
@@ -716,15 +716,15 @@ void BK4819_SetupSquelch(
|
||||
// 0 ~ 255
|
||||
//
|
||||
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
|
||||
#if 0
|
||||
#ifndef ENABLE_FASTER_CHANNEL_SCAN
|
||||
// original
|
||||
(1u << 14) // 1 ???
|
||||
| (5u << 11) // 5 squelch = 1 delay .. 0 ~ 7
|
||||
| (3u << 9) // 3 squelch = 0 delay .. 0 ~ 3
|
||||
| SquelchOpenGlitchThresh); // 0 ~ 255
|
||||
#else
|
||||
// faster (but twitchier)
|
||||
(1u << 14) // 1 ???
|
||||
| (2u << 11) // squelch = 1 delay .. 0 ~ 7
|
||||
| (1u << 9) // squelch = 0 delay .. 0 ~ 3
|
||||
| SquelchOpenGlitchThresh); // 0 ~ 255
|
||||
#endif
|
||||
|
||||
@@ -831,14 +831,16 @@ void BK4819_SetCompander(const unsigned int mode)
|
||||
// mode 2 .. RX
|
||||
// mode 3 .. TX and RX
|
||||
|
||||
const uint16_t r31 = BK4819_ReadRegister(BK4819_REG_31);
|
||||
|
||||
if (mode == 0)
|
||||
{ // disable
|
||||
BK4819_WriteRegister(BK4819_REG_31, BK4819_ReadRegister(BK4819_REG_31) & ~(1u < 3));
|
||||
BK4819_WriteRegister(BK4819_REG_31, r31 & ~(1u < 3));
|
||||
return;
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
@@ -848,9 +850,18 @@ void BK4819_SetCompander(const unsigned int mode)
|
||||
// 10 = 2:1
|
||||
// 11 = 4:1
|
||||
//
|
||||
const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 3 : 0; // 4:1
|
||||
BK4819_WriteRegister(BK4819_REG_29, (BK4819_ReadRegister(BK4819_REG_29) & ~(3u < 14)) | (compress_ratio < 14));
|
||||
|
||||
// REG_29 <13:7> 86 Compress (AF Tx) 0 dB point (dB)
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// REG_28 <15:14> 01 Expander (AF Rx) Ratio
|
||||
@@ -859,8 +870,17 @@ void BK4819_SetCompander(const unsigned int mode)
|
||||
// 10 = 1:3
|
||||
// 11 = 1:4
|
||||
//
|
||||
const uint16_t expand_ratio = (mode >= 2) ? 3 : 0; // 1:4
|
||||
BK4819_WriteRegister(BK4819_REG_28, (BK4819_ReadRegister(BK4819_REG_28) & ~(3u < 14)) | (expand_ratio < 14));
|
||||
// REG_28 <13:7> 86 Expander (AF Rx) 0 dB point (dB)
|
||||
//
|
||||
// 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)
|
||||
@@ -1487,10 +1507,15 @@ void BK4819_PlayRogerMDC(void)
|
||||
unsigned int i;
|
||||
|
||||
BK4819_SetAF(BK4819_AF_MUTE);
|
||||
BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable, RX Bandwidth FFSK1200/1800, 0xAA or 0x55 Preamble, 11 RX Gain,
|
||||
// 101 RX Mode, FFSK1200/1800 TX
|
||||
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone2 to 1200Hz
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone2 and Set Tone2 Gain
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable,
|
||||
// RX Bandwidth FFSK 1200/1800
|
||||
// 0xAA or 0x55 Preamble
|
||||
// 11 RX Gain,
|
||||
// 101 RX Mode
|
||||
// TX FFSK 1200/1800
|
||||
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone-2 to 1200Hz
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone-2 and Set Tone2 Gain
|
||||
BK4819_WriteRegister(BK4819_REG_5D, 0x0D00); // Set FSK data length to 13 bytes
|
||||
BK4819_WriteRegister(BK4819_REG_59, 0x8068); // 4 byte sync length, 6 byte preamble, clear TX FIFO
|
||||
BK4819_WriteRegister(BK4819_REG_59, 0x0068); // Same, but clear TX FIFO is now unset (clearing done)
|
||||
@@ -1509,7 +1534,7 @@ void BK4819_PlayRogerMDC(void)
|
||||
|
||||
SYSTEM_DelayMs(180);
|
||||
|
||||
// Stop FSK TX, reset Tone2, disable FSK
|
||||
// Stop FSK TX, reset Tone-2, disable FSK
|
||||
BK4819_WriteRegister(BK4819_REG_59, 0x0068);
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0x0000);
|
||||
BK4819_WriteRegister(BK4819_REG_58, 0x0000);
|
||||
|
||||
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
121
frequencies.c
121
frequencies.c
@@ -19,52 +19,29 @@
|
||||
#include "settings.h"
|
||||
|
||||
// the BK4819 has 2 bands it covers, 18MHz ~ 630MHz and 760MHz ~ 1300MHz
|
||||
const freq_band_table_t BX4819_band1 = { 1800000, 63000000};
|
||||
const freq_band_table_t BX4819_band2 = {84000000, 130000000};
|
||||
|
||||
const uint32_t bx_start1_Hz = 1800000; // 18MHz
|
||||
const uint32_t bx_stop1_Hz = 63000000; // 630MHz
|
||||
|
||||
//const uint32_t bx_start2_Hz = 76000000; // 760MHz // my one radio the BK chip managed to lock down to this frequency
|
||||
const uint32_t bx_start2_Hz = 84000000; // 840MHz // but best to go with datasheet specification really
|
||||
const uint32_t bx_stop2_Hz = 130000000; // 1300MHz
|
||||
|
||||
const uint32_t LowerLimitFrequencyBandTable[7] =
|
||||
const freq_band_table_t frequencyBandTable[7] =
|
||||
{
|
||||
#ifndef ENABLE_WIDE_RX
|
||||
5000000,
|
||||
// QS original
|
||||
{ 5000000, 7600000},
|
||||
{10800000, 13600000},
|
||||
{13600000, 17400000},
|
||||
{17400000, 35000000},
|
||||
{35000000, 40000000},
|
||||
{40000000, 47000000},
|
||||
{47000000, 60000000}
|
||||
#else
|
||||
1800000,
|
||||
#endif
|
||||
10800000,
|
||||
13600000,
|
||||
17400000,
|
||||
35000000,
|
||||
40000000,
|
||||
47000000
|
||||
};
|
||||
|
||||
const uint32_t MiddleFrequencyBandTable[7] =
|
||||
{
|
||||
6500000,
|
||||
12200000,
|
||||
15000000,
|
||||
26000000,
|
||||
37000000,
|
||||
43500000,
|
||||
55000000
|
||||
};
|
||||
|
||||
const uint32_t UpperLimitFrequencyBandTable[7] =
|
||||
{
|
||||
7600000,
|
||||
13599990,
|
||||
17399990,
|
||||
34999990,
|
||||
39999990,
|
||||
46999990,
|
||||
#ifndef ENABLE_WIDE_RX
|
||||
60000000
|
||||
#else
|
||||
130000000
|
||||
// extended range
|
||||
{ 1800000, 10800000},
|
||||
{10800000, 13600000},
|
||||
{13600000, 17400000},
|
||||
{17400000, 35000000},
|
||||
{35000000, 40000000},
|
||||
{40000000, 47000000},
|
||||
{47000000, 130000000}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -84,37 +61,24 @@ const uint32_t UpperLimitFrequencyBandTable[7] =
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
const uint16_t StepFrequencyTable[7] =
|
||||
{
|
||||
250,
|
||||
500,
|
||||
625,
|
||||
1000,
|
||||
1250,
|
||||
2500,
|
||||
833
|
||||
};
|
||||
#ifndef ENABLE_12_5KHZ_STEP
|
||||
// QS steps (*10 Hz)
|
||||
const uint16_t StepFrequencyTable[7] = {250, 500, 625, 1000, 1250, 2500, 833};
|
||||
#else
|
||||
const uint16_t StepFrequencyTable[7] =
|
||||
{
|
||||
125,
|
||||
250,
|
||||
625,
|
||||
1000,
|
||||
1250,
|
||||
2500,
|
||||
833
|
||||
};
|
||||
// includes 1.25kHz step
|
||||
const uint16_t StepFrequencyTable[7] = {125, 250, 625, 1000, 1250, 2500, 833};
|
||||
#endif
|
||||
|
||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
|
||||
{
|
||||
int band;
|
||||
for (band = BAND7_470MHz; band >= BAND1_50MHz; band--)
|
||||
if (Frequency >= LowerLimitFrequencyBandTable[band])
|
||||
return band;
|
||||
for (band = ARRAY_SIZE(frequencyBandTable) - 1; band >= 0; band--)
|
||||
if (Frequency >= frequencyBandTable[band].lower)
|
||||
// if (Frequency < frequencyBandTable[band].upper)
|
||||
return (FREQUENCY_Band_t)band;
|
||||
|
||||
return BAND1_50MHz;
|
||||
// return BAND_NONE;
|
||||
}
|
||||
|
||||
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency)
|
||||
@@ -156,26 +120,16 @@ uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)
|
||||
|
||||
return Lower + (Step * Index);
|
||||
}
|
||||
/*
|
||||
int TX_freq_check(VFO_Info_t *pInfo)
|
||||
{ // return '0' if TX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
const uint32_t Frequency = pInfo->pTX->Frequency;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (pInfo->CHANNEL_SAVE > FREQ_CHANNEL_LAST)
|
||||
return -1;
|
||||
#endif
|
||||
*/
|
||||
int TX_freq_check(const uint32_t Frequency)
|
||||
{ // return '0' if TX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6])
|
||||
return -1;
|
||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
||||
return -1;
|
||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||
return -1; // not allowed outside this range
|
||||
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
return -1; // BX chip does not work in this range
|
||||
|
||||
switch (gSetting_F_LOCK)
|
||||
{
|
||||
@@ -239,9 +193,10 @@ int RX_freq_check(const uint32_t Frequency)
|
||||
{ // return '0' if RX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6])
|
||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||
return -1;
|
||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
||||
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
return -1;
|
||||
|
||||
return 0; // OK frequency
|
||||
|
||||
@@ -19,17 +19,20 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "radio.h"
|
||||
#define ENABLE_12_5KHZ_STEP
|
||||
|
||||
extern const uint32_t bx_start1_Hz;
|
||||
extern const uint32_t bx_stop1_Hz;
|
||||
typedef struct {
|
||||
const uint32_t lower;
|
||||
const uint32_t upper;
|
||||
} freq_band_table_t;
|
||||
|
||||
extern const uint32_t bx_start2_Hz;
|
||||
extern const uint32_t bx_stop2_Hz;
|
||||
extern const freq_band_table_t BX4819_band1;
|
||||
extern const freq_band_table_t BX4819_band2;
|
||||
|
||||
enum FREQUENCY_Band_t
|
||||
{
|
||||
BAND1_NONE = -1,
|
||||
extern const freq_band_table_t frequencyBandTable[7];
|
||||
|
||||
enum FREQUENCY_Band_t {
|
||||
BAND_NONE = -1,
|
||||
BAND1_50MHz = 0,
|
||||
BAND2_108MHz,
|
||||
BAND3_136MHz,
|
||||
@@ -38,26 +41,44 @@ enum FREQUENCY_Band_t
|
||||
BAND6_400MHz,
|
||||
BAND7_470MHz
|
||||
};
|
||||
|
||||
typedef enum FREQUENCY_Band_t FREQUENCY_Band_t;
|
||||
|
||||
extern const uint32_t LowerLimitFrequencyBandTable[7];
|
||||
extern const uint32_t MiddleFrequencyBandTable[7];
|
||||
extern const uint32_t UpperLimitFrequencyBandTable[7];
|
||||
#ifndef ENABLE_12_5KHZ_STEP
|
||||
// QS steps
|
||||
enum STEP_Setting_t {
|
||||
STEP_2_5kHz = 0,
|
||||
STEP_5_0kHz,
|
||||
STEP_6_25kHz,
|
||||
STEP_10_0kHz,
|
||||
STEP_12_5kHz,
|
||||
STEP_25_0kHz,
|
||||
STEP_8_33kHz
|
||||
};
|
||||
#else
|
||||
// includes 1.25kHz step
|
||||
enum STEP_Setting_t {
|
||||
STEP_1_25kHz = 0,
|
||||
STEP_2_5kHz,
|
||||
STEP_6_25kHz,
|
||||
STEP_10_0kHz,
|
||||
STEP_12_5kHz,
|
||||
STEP_25_0kHz,
|
||||
STEP_8_33kHz
|
||||
};
|
||||
#endif
|
||||
typedef enum STEP_Setting_t STEP_Setting_t;
|
||||
|
||||
extern const uint16_t StepFrequencyTable[7];
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
extern const uint32_t NoaaFrequencyTable[10];
|
||||
extern const uint32_t NoaaFrequencyTable[10];
|
||||
#endif
|
||||
|
||||
extern const uint16_t StepFrequencyTable[7];
|
||||
|
||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency);
|
||||
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency);
|
||||
uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower);
|
||||
|
||||
//int TX_freq_check(VFO_Info_t *pInfo);
|
||||
int TX_freq_check(const uint32_t Frequency);
|
||||
int RX_freq_check(const uint32_t Frequency);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
10
functions.c
10
functions.c
@@ -28,6 +28,7 @@
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/system.h"
|
||||
#include "frequencies.h"
|
||||
#include "functions.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
@@ -73,6 +74,8 @@ void FUNCTION_Init(void)
|
||||
#ifdef ENABLE_NOAA
|
||||
gNOAACountdown_10ms = 0;
|
||||
#endif
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
@@ -112,6 +115,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
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);
|
||||
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
|
||||
case FUNCTION_MONITOR:
|
||||
@@ -137,7 +141,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
|
||||
gUpdateStatus = true;
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
|
||||
return;
|
||||
|
||||
case FUNCTION_TRANSMIT:
|
||||
@@ -183,6 +189,8 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
}
|
||||
#endif
|
||||
|
||||
gUpdateStatus = true;
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
RADIO_SetTxParameters();
|
||||
|
||||
@@ -86,37 +86,22 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
|
||||
|
||||
gBatteryDisplayLevel = 0;
|
||||
|
||||
if (Voltage >= gBatteryCalibration[5])
|
||||
gBatteryDisplayLevel = 11;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[4] + gBatteryCalibration[5]) / 2))
|
||||
gBatteryDisplayLevel = 10;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[4])
|
||||
gBatteryDisplayLevel = 9;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[3] + gBatteryCalibration[4]) / 2))
|
||||
gBatteryDisplayLevel = 8;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[3])
|
||||
gBatteryDisplayLevel = 7;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[2] + gBatteryCalibration[3]) / 2))
|
||||
if (gBatteryCalibration[5] < Voltage)
|
||||
gBatteryDisplayLevel = 6;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[2])
|
||||
if (gBatteryCalibration[4] < Voltage)
|
||||
gBatteryDisplayLevel = 5;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[1] + gBatteryCalibration[2]) / 2))
|
||||
if (gBatteryCalibration[3] < Voltage)
|
||||
gBatteryDisplayLevel = 4;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[1])
|
||||
if (gBatteryCalibration[2] < Voltage)
|
||||
gBatteryDisplayLevel = 3;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[0] + gBatteryCalibration[1]) / 2))
|
||||
if (gBatteryCalibration[1] < Voltage)
|
||||
gBatteryDisplayLevel = 2;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[0])
|
||||
if (gBatteryCalibration[0] < Voltage)
|
||||
gBatteryDisplayLevel = 1;
|
||||
|
||||
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
|
||||
|
||||
15
main.c
15
main.c
@@ -110,10 +110,19 @@ void Main(void)
|
||||
gMenuListCount++;
|
||||
|
||||
if (BootMode == BOOT_MODE_F_LOCK)
|
||||
gF_LOCK = true; // flag to say use the hidden menu items
|
||||
{
|
||||
gF_LOCK = true; // flag to say include the hidden menu items
|
||||
}
|
||||
else
|
||||
gMenuListCount -= 9; // hide the last few menu items
|
||||
{ // hide the hidden menu items
|
||||
|
||||
gMenuListCount -= 9;
|
||||
|
||||
#ifndef ENABLE_F_CAL_MENU
|
||||
gMenuListCount++;
|
||||
#endif
|
||||
}
|
||||
|
||||
// wait for user to release all butts before moving on
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||
KEYBOARD_Poll() != KEY_INVALID ||
|
||||
@@ -132,7 +141,7 @@ void Main(void)
|
||||
gDebounceCounter = 0;
|
||||
}
|
||||
|
||||
if (!gChargingWithTypeC && !gBatteryDisplayLevel)
|
||||
if (!gChargingWithTypeC && gBatteryDisplayLevel == 0)
|
||||
{
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
|
||||
|
||||
23
misc.c
23
misc.c
@@ -24,7 +24,8 @@ const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
||||
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
||||
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
||||
|
||||
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
||||
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||
|
||||
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
||||
@@ -51,6 +52,9 @@ const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
||||
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
|
||||
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
||||
const uint16_t scan_pause_delay_in_5_10ms = 1000 / 10; // 1 sec
|
||||
const uint16_t scan_pause_delay_in_6_10ms = 100 / 10; // 100ms
|
||||
const uint16_t scan_pause_delay_in_7_10ms = 3600 / 10; // 3.6 seconds
|
||||
|
||||
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
||||
|
||||
@@ -79,6 +83,8 @@ bool gSetting_TX_EN;
|
||||
uint8_t gSetting_F_LOCK;
|
||||
bool gSetting_ScrambleEnable;
|
||||
|
||||
bool gSetting_backlight_on_rx;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
bool gSetting_AM_fix;
|
||||
#endif
|
||||
@@ -121,6 +127,8 @@ volatile uint16_t gDualWatchCountdown_10ms;
|
||||
volatile bool gDualWatchCountdownExpired = true;
|
||||
bool gDualWatchActive = false;
|
||||
|
||||
volatile uint8_t gSerialConfigCountDown_500ms;
|
||||
|
||||
volatile bool gNextTimeslice_500ms;
|
||||
|
||||
volatile uint16_t gTxTimerCountdown_500ms;
|
||||
@@ -152,7 +160,7 @@ bool gUpdateRSSI;
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
AlarmState_t gAlarmState;
|
||||
#endif
|
||||
uint8_t gVoltageMenuCountdown;
|
||||
uint16_t gMenuCountdown;
|
||||
bool gPttWasReleased;
|
||||
bool gPttWasPressed;
|
||||
uint8_t gKeypadLocked;
|
||||
@@ -169,7 +177,6 @@ bool gFlagPrepareTX;
|
||||
|
||||
bool gFlagAcceptSetting;
|
||||
bool gFlagRefreshSetting;
|
||||
bool gFlagBackupSetting;
|
||||
|
||||
bool gFlagSaveVfo;
|
||||
bool gFlagSaveSettings;
|
||||
@@ -192,10 +199,11 @@ bool gFlagEndTransmission;
|
||||
uint16_t gLowBatteryCountdown;
|
||||
uint8_t gNextMrChannel;
|
||||
ReceptionMode_t gRxReceptionMode;
|
||||
uint8_t gRestoreMrChannel;
|
||||
uint8_t gCurrentScanList;
|
||||
uint8_t gPreviousMrChannel;
|
||||
uint32_t gRestoreFrequency;
|
||||
|
||||
uint8_t gRestoreMrChannel;
|
||||
enum scan_next_chan_t gCurrentScanList;
|
||||
uint32_t gRestoreFrequency;
|
||||
|
||||
bool gRxVfoIsActive;
|
||||
#ifdef ENABLE_ALARM
|
||||
uint8_t gAlarmToneCounter;
|
||||
@@ -211,7 +219,6 @@ uint8_t gScanDelay_10ms;
|
||||
uint8_t gAircopySendCountdown;
|
||||
#endif
|
||||
uint8_t gFSKWriteIndex;
|
||||
uint8_t gNeverUsed;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
bool gIsNoaaMode;
|
||||
|
||||
29
misc.h
29
misc.h
@@ -63,7 +63,6 @@ enum AlarmState_t {
|
||||
ALARM_STATE_ALARM,
|
||||
ALARM_STATE_TX1750
|
||||
};
|
||||
|
||||
typedef enum AlarmState_t AlarmState_t;
|
||||
|
||||
enum ReceptionMode_t {
|
||||
@@ -71,7 +70,6 @@ enum ReceptionMode_t {
|
||||
RX_MODE_DETECTED, // signal detected
|
||||
RX_MODE_LISTENING //
|
||||
};
|
||||
|
||||
typedef enum ReceptionMode_t ReceptionMode_t;
|
||||
|
||||
enum CssScanMode_t
|
||||
@@ -80,9 +78,17 @@ enum CssScanMode_t
|
||||
CSS_SCAN_MODE_SCANNING,
|
||||
CSS_SCAN_MODE_FOUND,
|
||||
};
|
||||
|
||||
typedef enum CssScanMode_t CssScanMode_t;
|
||||
|
||||
enum scan_next_chan_t {
|
||||
SCAN_NEXT_CHAN_SCANLIST1 = 0,
|
||||
SCAN_NEXT_CHAN_SCANLIST2,
|
||||
SCAN_NEXT_CHAN_DUAL_WATCH,
|
||||
SCAN_NEXT_CHAN_MR,
|
||||
SCAN_NEXT_NUM
|
||||
};
|
||||
typedef enum scan_next_chan_t scan_next_chan_t;
|
||||
|
||||
extern const uint8_t fm_resume_countdown_500ms;
|
||||
extern const uint8_t fm_radio_countdown_500ms;
|
||||
extern const uint16_t fm_play_countdown_scan_10ms;
|
||||
@@ -90,6 +96,7 @@ extern const uint16_t fm_play_countdown_noscan_10ms;
|
||||
extern const uint16_t fm_restore_countdown_10ms;
|
||||
|
||||
extern const uint8_t menu_timeout_500ms;
|
||||
extern const uint16_t menu_timeout_long_500ms;
|
||||
|
||||
extern const uint8_t DTMF_RX_live_timeout_500ms;
|
||||
extern const uint8_t DTMF_RX_timeout_500ms;
|
||||
@@ -127,6 +134,9 @@ extern const uint16_t scan_pause_delay_in_1_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_2_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_3_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_4_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_5_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_6_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_7_10ms;
|
||||
|
||||
//extern const uint16_t gMax_bat_v;
|
||||
//extern const uint16_t gMin_bat_v;
|
||||
@@ -142,6 +152,8 @@ extern bool gSetting_TX_EN;
|
||||
extern uint8_t gSetting_F_LOCK;
|
||||
extern bool gSetting_ScrambleEnable;
|
||||
|
||||
extern bool gSetting_backlight_on_rx;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
extern bool gSetting_AM_fix;
|
||||
#endif
|
||||
@@ -185,6 +197,8 @@ extern volatile uint16_t gDualWatchCountdown_10ms;
|
||||
extern volatile bool gDualWatchCountdownExpired;
|
||||
extern bool gDualWatchActive;
|
||||
|
||||
extern volatile uint8_t gSerialConfigCountDown_500ms;
|
||||
|
||||
extern volatile bool gNextTimeslice_500ms;
|
||||
|
||||
extern volatile uint16_t gTxTimerCountdown_500ms;
|
||||
@@ -216,7 +230,7 @@ extern uint8_t gBatteryVoltageIndex;
|
||||
extern CssScanMode_t gCssScanMode;
|
||||
extern bool gUpdateRSSI;
|
||||
extern AlarmState_t gAlarmState;
|
||||
extern uint8_t gVoltageMenuCountdown;
|
||||
extern uint16_t gMenuCountdown;
|
||||
extern bool gPttWasReleased;
|
||||
extern bool gPttWasPressed;
|
||||
extern bool gFlagReconfigureVfos;
|
||||
@@ -233,7 +247,6 @@ extern bool gFlagPrepareTX;
|
||||
|
||||
extern bool gFlagAcceptSetting; // accept menu setting
|
||||
extern bool gFlagRefreshSetting; // refresh menu display
|
||||
extern bool gFlagBackupSetting; // save a copy of the current menu setting
|
||||
|
||||
extern bool gFlagSaveVfo;
|
||||
extern bool gFlagSaveSettings;
|
||||
@@ -256,10 +269,11 @@ extern bool gFlagEndTransmission;
|
||||
extern uint16_t gLowBatteryCountdown;
|
||||
extern uint8_t gNextMrChannel;
|
||||
extern ReceptionMode_t gRxReceptionMode;
|
||||
|
||||
extern uint8_t gRestoreMrChannel;
|
||||
extern uint8_t gCurrentScanList;
|
||||
extern uint8_t gPreviousMrChannel;
|
||||
extern scan_next_chan_t gCurrentScanList;
|
||||
extern uint32_t gRestoreFrequency;
|
||||
|
||||
extern bool gRxVfoIsActive;
|
||||
extern uint8_t gAlarmToneCounter;
|
||||
extern uint16_t gAlarmRunningCounter;
|
||||
@@ -273,7 +287,6 @@ extern uint8_t gScanDelay_10ms;
|
||||
extern uint8_t gAircopySendCountdown;
|
||||
#endif
|
||||
extern uint8_t gFSKWriteIndex;
|
||||
extern uint8_t gNeverUsed;
|
||||
#ifdef ENABLE_NOAA
|
||||
extern bool gIsNoaaMode;
|
||||
extern uint8_t gNoaaChannel;
|
||||
|
||||
94
radio.c
94
radio.c
@@ -122,7 +122,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
|
||||
pInfo->SCANLIST1_PARTICIPATION = true;
|
||||
pInfo->SCANLIST2_PARTICIPATION = true;
|
||||
pInfo->STEP_SETTING = STEP_12_5kHz;
|
||||
pInfo->StepFrequency = 2500;
|
||||
pInfo->StepFrequency = StepFrequencyTable[pInfo->STEP_SETTING];
|
||||
pInfo->CHANNEL_SAVE = ChannelSave;
|
||||
pInfo->FrequencyReverse = false;
|
||||
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||
@@ -210,7 +210,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
|
||||
Index = Channel - FREQ_CHANNEL_FIRST;
|
||||
|
||||
RADIO_InitInfo(pRadio, Channel, LowerLimitFrequencyBandTable[Index]);
|
||||
RADIO_InitInfo(pRadio, Channel, frequencyBandTable[Index].lower);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
if (Band > BAND7_470MHz)
|
||||
{
|
||||
Band = BAND6_400MHz;
|
||||
// Band = FREQUENCY_GetBand(gEeprom.ScreenChannel[VFO]); // 1of11 bug fix, or have I broke it ?
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
@@ -344,7 +343,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
}
|
||||
|
||||
// ***************
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t Frequency;
|
||||
@@ -369,14 +368,14 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
Band = FREQUENCY_GetBand(Frequency);
|
||||
#endif
|
||||
|
||||
if (Frequency < LowerLimitFrequencyBandTable[Band])
|
||||
Frequency = LowerLimitFrequencyBandTable[Band];
|
||||
if (Frequency < frequencyBandTable[Band].lower)
|
||||
Frequency = frequencyBandTable[Band].lower;
|
||||
else
|
||||
if (Frequency > UpperLimitFrequencyBandTable[Band])
|
||||
Frequency = UpperLimitFrequencyBandTable[Band];
|
||||
if (Frequency > frequencyBandTable[Band].upper)
|
||||
Frequency = frequencyBandTable[Band].upper;
|
||||
else
|
||||
if (Channel >= FREQ_CHANNEL_FIRST)
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, LowerLimitFrequencyBandTable[Band]);
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, frequencyBandTable[Band].lower);
|
||||
|
||||
pRadio->freq_config_RX.Frequency = Frequency;
|
||||
|
||||
@@ -457,17 +456,21 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
|
||||
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
|
||||
|
||||
#if ENABLE_SQUELCH_LOWER
|
||||
// make squelch more sensitive
|
||||
#if ENABLE_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->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 7) / 8;
|
||||
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 10) / 11;
|
||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 10) / 11;
|
||||
|
||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 8) / 7;
|
||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 11) / 10;
|
||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 11) / 10;
|
||||
|
||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 8) / 7;
|
||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 11) / 10;
|
||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 11) / 10;
|
||||
#endif
|
||||
|
||||
if (pInfo->SquelchOpenNoiseThresh > 127)
|
||||
@@ -485,9 +488,9 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
Txp[0],
|
||||
Txp[1],
|
||||
Txp[2],
|
||||
LowerLimitFrequencyBandTable[Band],
|
||||
MiddleFrequencyBandTable[Band],
|
||||
UpperLimitFrequencyBandTable[Band],
|
||||
frequencyBandTable[Band].lower,
|
||||
(frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2,
|
||||
frequencyBandTable[Band].upper,
|
||||
pInfo->pTX->Frequency);
|
||||
}
|
||||
|
||||
@@ -507,20 +510,11 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// limit to 50MHz to 600MHz
|
||||
if (Frequency < 5000000)
|
||||
Frequency = 5000000;
|
||||
else
|
||||
if (Frequency > 60000000)
|
||||
Frequency = 60000000;
|
||||
#else
|
||||
if (Frequency < LowerLimitFrequencyBandTable[0])
|
||||
Frequency = LowerLimitFrequencyBandTable[0];
|
||||
else
|
||||
if (Frequency > UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1])
|
||||
Frequency = UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1];
|
||||
#endif
|
||||
if (Frequency < frequencyBandTable[0].lower)
|
||||
Frequency = frequencyBandTable[0].lower;
|
||||
else
|
||||
if (Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||
Frequency = frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper;
|
||||
|
||||
pInfo->freq_config_TX.Frequency = Frequency;
|
||||
}
|
||||
@@ -557,7 +551,7 @@ void RADIO_SelectVfos(void)
|
||||
|
||||
void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
{
|
||||
BK4819_FilterBandwidth_t Bandwidth;
|
||||
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||
uint16_t InterruptMask;
|
||||
uint32_t Frequency;
|
||||
|
||||
@@ -567,7 +561,6 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
|
||||
Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||
switch (Bandwidth)
|
||||
{
|
||||
default:
|
||||
@@ -575,8 +568,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
case BK4819_FILTER_BW_WIDE:
|
||||
case BK4819_FILTER_BW_NARROW:
|
||||
#ifdef ENABLE_AM_FIX
|
||||
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
|
||||
// BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
#else
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
#endif
|
||||
@@ -620,6 +613,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
|
||||
|
||||
// what does this in do ?
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
|
||||
|
||||
// AF RX Gain and DAC
|
||||
@@ -632,7 +626,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
#endif
|
||||
{
|
||||
if (gRxVfo->AM_mode == 0)
|
||||
{
|
||||
{ // FM
|
||||
uint8_t CodeType = gSelectedCodeType;
|
||||
uint8_t Code = gSelectedCode;
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
@@ -807,7 +801,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
void RADIO_SetTxParameters(void)
|
||||
{
|
||||
BK4819_FilterBandwidth_t Bandwidth;
|
||||
BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
@@ -815,7 +809,6 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
|
||||
Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
||||
switch (Bandwidth)
|
||||
{
|
||||
default:
|
||||
@@ -823,8 +816,8 @@ void RADIO_SetTxParameters(void)
|
||||
case BK4819_FILTER_BW_WIDE:
|
||||
case BK4819_FILTER_BW_NARROW:
|
||||
#ifdef ENABLE_AM_FIX
|
||||
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
|
||||
// BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
#else
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
#endif
|
||||
@@ -865,9 +858,7 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
BK4819_SetCDCSSCodeWord(
|
||||
DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code)
|
||||
);
|
||||
BK4819_SetCDCSSCodeWord(DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -948,8 +939,8 @@ void RADIO_PrepareTX(void)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!gSetting_TX_EN)
|
||||
{ // TX is disabled
|
||||
if (!gSetting_TX_EN || gSerialConfigCountDown_500ms > 0)
|
||||
{ // TX is disabled or config upload/download in progress
|
||||
State = VFO_STATE_TX_DISABLE;
|
||||
}
|
||||
else
|
||||
@@ -962,8 +953,7 @@ void RADIO_PrepareTX(void)
|
||||
if (gBatteryDisplayLevel == 0)
|
||||
State = VFO_STATE_BAT_LOW; // charge your battery !
|
||||
else
|
||||
//if (gBatteryDisplayLevel >= 6)
|
||||
if (gBatteryDisplayLevel >= 11) // I've increased the battery level bar resolution
|
||||
if (gBatteryDisplayLevel >= 6)
|
||||
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
|
||||
}
|
||||
else
|
||||
@@ -982,7 +972,7 @@ void RADIO_PrepareTX(void)
|
||||
}
|
||||
|
||||
// TX is allowed
|
||||
|
||||
|
||||
if (gDTMF_ReplyState == DTMF_REPLY_ANI)
|
||||
{
|
||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||
@@ -1061,7 +1051,7 @@ void RADIO_SendEndOfTransmission(void)
|
||||
BK4819_PlayRogerMDC();
|
||||
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||
(gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_EOT || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
|
||||
(gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
|
||||
{ // end-of-tx
|
||||
if (gEeprom.DTMF_SIDE_TONE)
|
||||
{
|
||||
|
||||
37
radio.h
37
radio.h
@@ -21,6 +21,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "dcs.h"
|
||||
#include "frequencies.h"
|
||||
|
||||
enum {
|
||||
MR_CH_BAND_MASK = 0x0F << 0,
|
||||
@@ -42,40 +43,13 @@ enum {
|
||||
};
|
||||
|
||||
enum PTT_ID_t {
|
||||
PTT_ID_OFF = 0,
|
||||
PTT_ID_BOT,
|
||||
PTT_ID_EOT,
|
||||
PTT_ID_BOTH
|
||||
PTT_ID_OFF = 0, // OFF
|
||||
PTT_ID_TX_UP, // BEGIN OF TX
|
||||
PTT_ID_TX_DOWN, // END OF TX
|
||||
PTT_ID_BOTH // BOTH
|
||||
};
|
||||
|
||||
typedef enum PTT_ID_t PTT_ID_t;
|
||||
|
||||
#if 0
|
||||
enum STEP_Setting_t
|
||||
{
|
||||
STEP_2_5kHz,
|
||||
STEP_5_0kHz,
|
||||
STEP_6_25kHz,
|
||||
STEP_10_0kHz,
|
||||
STEP_12_5kHz,
|
||||
STEP_25_0kHz,
|
||||
STEP_8_33kHz
|
||||
};
|
||||
#else
|
||||
enum STEP_Setting_t
|
||||
{
|
||||
STEP_1_25kHz,
|
||||
STEP_2_5kHz,
|
||||
STEP_6_25kHz,
|
||||
STEP_10_0kHz,
|
||||
STEP_12_5kHz,
|
||||
STEP_25_0kHz,
|
||||
STEP_8_33kHz
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef enum STEP_Setting_t STEP_Setting_t;
|
||||
|
||||
enum VfoState_t
|
||||
{
|
||||
VFO_STATE_NORMAL = 0,
|
||||
@@ -86,7 +60,6 @@ enum VfoState_t
|
||||
VFO_STATE_ALARM,
|
||||
VFO_STATE_VOLTAGE_HIGH
|
||||
};
|
||||
|
||||
typedef enum VfoState_t VfoState_t;
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -57,6 +57,7 @@ void SystickHandler(void)
|
||||
gNextTimeslice_500ms = true;
|
||||
|
||||
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
||||
DECREMENT(gSerialConfigCountDown_500ms);
|
||||
}
|
||||
|
||||
if ((gGlobalSysTickCounter & 3) == 0)
|
||||
|
||||
@@ -174,6 +174,8 @@ void SETTINGS_SaveSettings(void)
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
|
||||
#endif
|
||||
if (!gSetting_backlight_on_rx) State[7] &= ~(1u << 6);
|
||||
|
||||
EEPROM_WriteBuffer(0x0F40, State);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "frequencies.h"
|
||||
#include "radio.h"
|
||||
|
||||
enum POWER_OnDisplayMode_t {
|
||||
@@ -28,7 +29,6 @@ enum POWER_OnDisplayMode_t {
|
||||
POWER_ON_DISPLAY_MODE_VOLTAGE,
|
||||
POWER_ON_DISPLAY_MODE_NONE
|
||||
};
|
||||
|
||||
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
|
||||
|
||||
enum {
|
||||
@@ -90,7 +90,6 @@ enum {
|
||||
VOICE_PROMPT_CHINESE,
|
||||
VOICE_PROMPT_ENGLISH
|
||||
};
|
||||
|
||||
typedef enum VOICE_Prompt_t VOICE_Prompt_t;
|
||||
#endif
|
||||
|
||||
@@ -98,7 +97,6 @@ enum ALARM_Mode_t {
|
||||
ALARM_MODE_SITE = 0,
|
||||
ALARM_MODE_TONE
|
||||
};
|
||||
|
||||
typedef enum ALARM_Mode_t ALARM_Mode_t;
|
||||
|
||||
enum ROGER_Mode_t {
|
||||
@@ -106,7 +104,6 @@ enum ROGER_Mode_t {
|
||||
ROGER_MODE_ROGER,
|
||||
ROGER_MODE_MDC
|
||||
};
|
||||
|
||||
typedef enum ROGER_Mode_t ROGER_Mode_t;
|
||||
|
||||
enum CHANNEL_DisplayMode_t {
|
||||
@@ -115,7 +112,6 @@ enum CHANNEL_DisplayMode_t {
|
||||
MDF_NAME,
|
||||
MDF_NAME_FREQ
|
||||
};
|
||||
|
||||
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -226,7 +222,6 @@ typedef struct {
|
||||
|
||||
VFO_Info_t VfoInfo[2];
|
||||
} EEPROM_Config_t;
|
||||
|
||||
extern EEPROM_Config_t gEeprom;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
|
||||
92
ui/main.c
92
ui/main.c
@@ -36,7 +36,18 @@
|
||||
#include "ui/main.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
bool center_line_is_free = true;
|
||||
enum center_line_t {
|
||||
CENTER_LINE_NONE = 0,
|
||||
CENTER_LINE_IN_USE,
|
||||
CENTER_LINE_AUDIO_BAR,
|
||||
CENTER_LINE_RSSI,
|
||||
CENTER_LINE_AM_FIX_DATA,
|
||||
CENTER_LINE_DTMF_DEC,
|
||||
CENTER_LINE_CHARGE_DATA
|
||||
};
|
||||
typedef enum center_line_t center_line_t;
|
||||
|
||||
center_line_t center_line = CENTER_LINE_NONE;
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
@@ -69,6 +80,9 @@ bool center_line_is_free = true;
|
||||
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
|
||||
unsigned int i;
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MAIN)
|
||||
return;
|
||||
|
||||
#if 1
|
||||
// TX audio level
|
||||
|
||||
@@ -154,14 +168,14 @@ bool center_line_is_free = true;
|
||||
|
||||
if (rssi_dBm >= (s9_dBm + 6))
|
||||
{ // S9+XXdB, 1dB increment
|
||||
const char *fmt[] = {"%-4d +%u ", "%-4d +%2u "};
|
||||
const unsigned int dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
|
||||
sprintf(s, (dB < 10) ? fmt[0] : fmt[1], rssi_dBm, dB);
|
||||
const char *fmt[] = {"%3d 9+%u ", "%3d 9+%2u "};
|
||||
const unsigned int s9_dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
|
||||
sprintf(s, (s9_dB < 10) ? fmt[0] : fmt[1], rssi_dBm, s9_dB);
|
||||
}
|
||||
else
|
||||
{ // S0 ~ S9, 6dB per S-point
|
||||
const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0;
|
||||
sprintf(s, "%-4d S%u ", rssi_dBm, s_level);
|
||||
sprintf(s, "%4d S%u ", rssi_dBm, s_level);
|
||||
}
|
||||
UI_PrintStringSmall(s, 2, 0, line);
|
||||
|
||||
@@ -184,7 +198,9 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
{
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
|
||||
if (!center_line_is_free)
|
||||
// optional larger RSSI dBm, S-point and bar level
|
||||
|
||||
if (center_line != CENTER_LINE_RSSI)
|
||||
return;
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
@@ -193,9 +209,11 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
{
|
||||
UI_DisplayRSSIBar(rssi, true);
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
// original little RS bars
|
||||
|
||||
// const int16_t dBm = (rssi / 2) - 160;
|
||||
const uint8_t Line = (vfo == 0) ? 3 : 7;
|
||||
uint8_t *p_line = gFrameBuffer[Line - 1];
|
||||
@@ -290,8 +308,7 @@ void UI_DisplayMain(void)
|
||||
char String[16];
|
||||
unsigned int vfo_num;
|
||||
|
||||
// true if the center screen line is available to use
|
||||
center_line_is_free = true;
|
||||
center_line = CENTER_LINE_NONE;
|
||||
|
||||
// #ifdef SINGLE_VFO_CHAN
|
||||
// const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false;
|
||||
@@ -318,7 +335,7 @@ void UI_DisplayMain(void)
|
||||
const bool same_vfo = (channel == vfo_num) ? true : false;
|
||||
uint8_t *p_line0 = gFrameBuffer[line + 0];
|
||||
uint8_t *p_line1 = gFrameBuffer[line + 1];
|
||||
uint32_t duff_beer = 0;
|
||||
uint8_t mode = 0;
|
||||
uint8_t state;
|
||||
|
||||
if (single_vfo)
|
||||
@@ -356,7 +373,7 @@ void UI_DisplayMain(void)
|
||||
{
|
||||
sprintf(String, ">%s", gDTMF_InputBox);
|
||||
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
}
|
||||
UI_PrintString(String, 2, 0, vfo_num * 3, 8);
|
||||
|
||||
@@ -375,11 +392,11 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
}
|
||||
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
||||
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -405,23 +422,36 @@ void UI_DisplayMain(void)
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
if (gAlarmState == ALARM_STATE_ALARM)
|
||||
duff_beer = 2;
|
||||
mode = 2;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
||||
if (channel == vfo_num)
|
||||
{ // show the TX symbol
|
||||
duff_beer = 1;
|
||||
UI_PrintStringSmall("TX", 14, 0, line);
|
||||
mode = 1;
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
UI_PrintStringSmallBold("TX", 14, 0, line);
|
||||
#else
|
||||
UI_PrintStringSmall("TX", 14, 0, line);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // receiving .. show the RX symbol
|
||||
duff_beer = 2;
|
||||
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num)
|
||||
UI_PrintStringSmall("RX", 14, 0, line);
|
||||
mode = 2;
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
|
||||
@@ -483,7 +513,7 @@ void UI_DisplayMain(void)
|
||||
{ // user entering a frequency
|
||||
UI_DisplayFrequency(gInputBox, 32, line, true, false);
|
||||
|
||||
center_line_is_free = false;
|
||||
// center_line = CENTER_LINE_IN_USE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -593,7 +623,7 @@ void UI_DisplayMain(void)
|
||||
{ // show the TX/RX level
|
||||
uint8_t Level = 0;
|
||||
|
||||
if (duff_beer == 1)
|
||||
if (mode == 1)
|
||||
{ // TX power level
|
||||
switch (gRxVfo->OUTPUT_POWER)
|
||||
{
|
||||
@@ -603,7 +633,7 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
}
|
||||
else
|
||||
if (duff_beer == 2)
|
||||
if (mode == 2)
|
||||
{ // RX signal level
|
||||
#ifndef ENABLE_RSSI_BAR
|
||||
// bar graph
|
||||
@@ -640,7 +670,7 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
else
|
||||
{ // 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 char *code_list[] = {"", "CT", "DCS", "DCR"};
|
||||
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list))
|
||||
@@ -689,7 +719,7 @@ void UI_DisplayMain(void)
|
||||
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, line + 1);
|
||||
}
|
||||
|
||||
if (center_line_is_free)
|
||||
if (center_line == CENTER_LINE_NONE)
|
||||
{ // we're free to use the middle line
|
||||
|
||||
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
@@ -699,8 +729,8 @@ void UI_DisplayMain(void)
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{
|
||||
center_line = CENTER_LINE_AUDIO_BAR;
|
||||
UI_DisplayAudioBar();
|
||||
center_line_is_free = false;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -708,9 +738,9 @@ void UI_DisplayMain(void)
|
||||
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
|
||||
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);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
center_line_is_free = false;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -718,12 +748,12 @@ void UI_DisplayMain(void)
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
if (rx)
|
||||
{
|
||||
center_line = CENTER_LINE_RSSI;
|
||||
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
|
||||
center_line_is_free = false;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
|
||||
if (rx || gCurrentFunction == FUNCTION_FOREGROUND || gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
{
|
||||
#if 1
|
||||
@@ -731,20 +761,20 @@ void UI_DisplayMain(void)
|
||||
{ // show live DTMF decode
|
||||
const unsigned int len = strlen(gDTMF_RX_live);
|
||||
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 ");
|
||||
strcat(String, gDTMF_RX_live + idx);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
center_line_is_free = false;
|
||||
}
|
||||
#else
|
||||
if (gSetting_live_DTMF_decoder && gDTMF_RX_index > 0)
|
||||
{ // show live DTMF decode
|
||||
const unsigned int len = gDTMF_RX_index;
|
||||
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 ");
|
||||
strcat(String, gDTMF_RX + idx);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
center_line_is_free = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -752,11 +782,11 @@ void UI_DisplayMain(void)
|
||||
else
|
||||
if (gChargingWithTypeC)
|
||||
{ // charging .. show the battery state
|
||||
center_line = CENTER_LINE_CHARGE_DATA;
|
||||
sprintf(String, "Charge %u.%02uV %u%%",
|
||||
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
||||
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
center_line_is_free = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
220
ui/menu.c
220
ui/menu.c
@@ -44,36 +44,37 @@ const t_menu_item MenuList[] =
|
||||
|
||||
{"SQL", VOICE_ID_SQUELCH, MENU_SQL },
|
||||
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
||||
{"T-PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||
{"R-DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||
{"R-CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||
{"T-DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||
{"T-CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||
{"T-DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||
{"T-OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||
{"T-VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
||||
{"T-TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"T PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||
{"R DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||
{"R CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||
{"T DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||
{"T CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||
{"T DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||
{"T OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||
{"T VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
||||
{"T TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
||||
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
||||
{"CH-SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||
{"CH-DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||
{"CH-NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||
{"CH-DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||
{"CH SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||
{"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||
{"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||
{"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"
|
||||
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||
#ifdef ENABLE_VOICE
|
||||
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||
#endif
|
||||
{"SC-REV", VOICE_ID_INVALID, MENU_SC_REV },
|
||||
{"SC REV", VOICE_ID_INVALID, MENU_SC_REV },
|
||||
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||
{"S-ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||
{"S-ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||
{"STE", VOICE_ID_INVALID, MENU_STE },
|
||||
{"RP-STE", VOICE_ID_INVALID, MENU_RP_STE },
|
||||
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
|
||||
{"MIC", VOICE_ID_INVALID, MENU_MIC },
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||
@@ -81,34 +82,34 @@ const t_menu_item MenuList[] =
|
||||
#ifdef ENABLE_COMPANDER
|
||||
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
|
||||
#endif
|
||||
{"1-CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
||||
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
||||
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
|
||||
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
|
||||
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
|
||||
#ifdef ENABLE_ALARM
|
||||
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||
#endif
|
||||
{"ANI-ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
|
||||
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
|
||||
{"PTT-ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||
{"D-ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||
{"D-RSP", VOICE_ID_INVALID, MENU_D_RSP },
|
||||
{"D-HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||
{"D-PRE", VOICE_ID_INVALID, MENU_D_PRE },
|
||||
{"D-DCD", VOICE_ID_INVALID, MENU_D_DCD },
|
||||
{"D-LIST", VOICE_ID_INVALID, MENU_D_LIST },
|
||||
{"D-LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||
{"D RSP", VOICE_ID_INVALID, MENU_D_RSP },
|
||||
{"D HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||
{"D PRE", VOICE_ID_INVALID, MENU_D_PRE },
|
||||
{"D DCD", VOICE_ID_INVALID, MENU_D_DCD },
|
||||
{"D LIST", VOICE_ID_INVALID, MENU_D_LIST },
|
||||
{"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
|
||||
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
|
||||
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||
#ifdef ENABLE_AM_FIX
|
||||
{"AM-FIX", VOICE_ID_INVALID, MENU_AM_FIX },
|
||||
{"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX },
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
{"AM-FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
|
||||
{"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
||||
@@ -118,15 +119,17 @@ const t_menu_item MenuList[] =
|
||||
// hidden menu items from here on
|
||||
// enabled if pressing both the PTT and upper side button at power-on
|
||||
|
||||
{"F-LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
|
||||
{"TX-200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
||||
{"TX-350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
||||
{"TX-500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||
{"350-EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||
{"SCR-EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||
{"F LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
|
||||
{"TX 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
||||
{"TX 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
||||
{"TX 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||
{"350 EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||
|
||||
{"TX-EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
{"F-CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
{"TX EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
{"F CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
#endif
|
||||
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
||||
|
||||
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
||||
@@ -207,9 +210,6 @@ const char gSubMenu_XB[3][10] =
|
||||
|
||||
const char gSubMenu_SC_REV[3][13] =
|
||||
{
|
||||
// "TIME\nOPER",
|
||||
// "CARRIER\nOPER",
|
||||
// "SEARCH\nOPER"
|
||||
"TIME",
|
||||
"CARRIER",
|
||||
"SEARCH"
|
||||
@@ -231,9 +231,9 @@ const char gSubMenu_MDF[4][15] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_D_RSP[4][6] =
|
||||
const char gSubMenu_D_RSP[4][11] =
|
||||
{
|
||||
"NULL",
|
||||
"DO\nNOTHING",
|
||||
"RING",
|
||||
"REPLY",
|
||||
"BOTH"
|
||||
@@ -255,11 +255,11 @@ const char gSubMenu_PONMSG[4][8] =
|
||||
"NONE"
|
||||
};
|
||||
|
||||
const char gSubMenu_ROGER[3][6] =
|
||||
const char gSubMenu_ROGER[3][9] =
|
||||
{
|
||||
"OFF",
|
||||
"ROGER",
|
||||
"MDC"
|
||||
"MDC\n1200"
|
||||
};
|
||||
|
||||
const char gSubMenu_RESET[2][4] =
|
||||
@@ -336,10 +336,9 @@ bool gIsInSubMenu;
|
||||
uint8_t gMenuCursor;
|
||||
int8_t gMenuScrollDirection;
|
||||
int32_t gSubMenuSelection;
|
||||
int32_t gSubMenuSelection_original = 0; // copy of the original value
|
||||
|
||||
// edit box
|
||||
char edit_original[17] = {0}; // a copy of the text before editing so that we can easily test for changes/difference
|
||||
char edit_original[17]; // a copy of the text before editing so that we can easily test for changes/difference
|
||||
char edit[17];
|
||||
int edit_index;
|
||||
|
||||
@@ -349,21 +348,21 @@ void UI_DisplayMenu(void)
|
||||
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[64];
|
||||
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||
char Contact[16];
|
||||
|
||||
// clear the screen
|
||||
// clear the screen buffer
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
// draw the left menu list
|
||||
#if 0
|
||||
|
||||
// original menu layout
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gMenuCursor > 0 || i > 0)
|
||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
||||
|
||||
// invert the current menu list item text pixels
|
||||
// invert the current menu list item pixels
|
||||
for (i = 0; i < (8 * menu_list_width); i++)
|
||||
{
|
||||
gFrameBuffer[2][i] ^= 0xFF;
|
||||
@@ -374,7 +373,7 @@ void UI_DisplayMenu(void)
|
||||
for (i = 0; i < 7; i++)
|
||||
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
||||
|
||||
// draw the little triangle marker if we're in the sub-menu
|
||||
// draw the little sub-menu triangle marker
|
||||
if (gIsInSubMenu)
|
||||
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
|
||||
@@ -383,14 +382,15 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintStringSmall(String, 2, 0, 6);
|
||||
|
||||
#else
|
||||
{
|
||||
{ // new menu layout .. experimental & unfinished
|
||||
|
||||
const int menu_index = gMenuCursor; // current selected menu item
|
||||
i = 1;
|
||||
|
||||
if (!gIsInSubMenu)
|
||||
{
|
||||
while (i < 2)
|
||||
{ // leading menu items
|
||||
{ // leading menu items - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k < 0)
|
||||
UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
|
||||
@@ -400,13 +400,13 @@ void UI_DisplayMenu(void)
|
||||
i++;
|
||||
}
|
||||
|
||||
// current menu item
|
||||
// current menu item - keep big n fat
|
||||
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
|
||||
UI_PrintString(MenuList[menu_index].name, 0, 0, 2, 8);
|
||||
i++;
|
||||
|
||||
while (i < 4)
|
||||
{ // trailing menu item
|
||||
{ // trailing menu item - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k >= 0 && k < (int)gMenuListCount)
|
||||
UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i);
|
||||
@@ -457,7 +457,7 @@ void UI_DisplayMenu(void)
|
||||
#endif
|
||||
|
||||
case MENU_STEP:
|
||||
sprintf(String, "%d.%02uKHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
|
||||
sprintf(String, "%d.%02ukHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
|
||||
break;
|
||||
|
||||
case MENU_TXP:
|
||||
@@ -477,12 +477,42 @@ void UI_DisplayMenu(void)
|
||||
|
||||
case MENU_R_CTCS:
|
||||
case MENU_T_CTCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||
break;
|
||||
{
|
||||
#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)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_SFT_D:
|
||||
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
|
||||
break;
|
||||
@@ -519,6 +549,12 @@ void UI_DisplayMenu(void)
|
||||
|
||||
case MENU_SCR:
|
||||
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
||||
#if 1
|
||||
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MENU_VOX:
|
||||
@@ -539,6 +575,7 @@ void UI_DisplayMenu(void)
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
case MENU_AM_FIX_TEST1:
|
||||
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
|
||||
// gSetting_AM_fix = gSubMenuSelection;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -555,6 +592,7 @@ void UI_DisplayMenu(void)
|
||||
#ifdef ENABLE_AM_FIX
|
||||
case MENU_AM_FIX:
|
||||
#endif
|
||||
case MENU_ABR_ON_RX:
|
||||
case MENU_BCL:
|
||||
case MENU_BEEP:
|
||||
case MENU_S_ADD1:
|
||||
@@ -589,7 +627,6 @@ void UI_DisplayMenu(void)
|
||||
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;
|
||||
@@ -619,7 +656,6 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
||||
if (edit_index < 10)
|
||||
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)
|
||||
@@ -629,7 +665,6 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
else
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -746,19 +781,21 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
{
|
||||
const uint32_t value = 22656 + gSubMenuSelection;
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
|
||||
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value
|
||||
BK4819_WriteRegister(BK4819_REG_3B, value);
|
||||
|
||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||
gSubMenuSelection,
|
||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
}
|
||||
break;
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
{
|
||||
const uint32_t value = 22656 + gSubMenuSelection;
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
|
||||
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value
|
||||
BK4819_WriteRegister(BK4819_REG_3B, value);
|
||||
|
||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||
gSubMenuSelection,
|
||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_BATCAL:
|
||||
{
|
||||
@@ -769,9 +806,9 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
|
||||
if (!already_printed)
|
||||
{
|
||||
{ // we now do multi-line text in a single string
|
||||
|
||||
unsigned int y;
|
||||
unsigned int k = 0;
|
||||
unsigned int lines = 1;
|
||||
unsigned int len = strlen(String);
|
||||
bool small = false;
|
||||
@@ -782,9 +819,9 @@ void UI_DisplayMenu(void)
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (String[i] == '\n' && i < (len - 1))
|
||||
{
|
||||
{ // found new line char
|
||||
lines++;
|
||||
String[i] = 0;
|
||||
String[i] = 0; // null terminate the line
|
||||
}
|
||||
}
|
||||
|
||||
@@ -795,21 +832,28 @@ void UI_DisplayMenu(void)
|
||||
lines = 7;
|
||||
}
|
||||
|
||||
// move the 1st line up
|
||||
// center vertically'ish
|
||||
if (small)
|
||||
y = 3 - ((lines + 0) / 2);
|
||||
y = 3 - ((lines + 0) / 2); // untested
|
||||
else
|
||||
y = 2 - ((lines + 0) / 2);
|
||||
|
||||
// draw the text lines
|
||||
for (i = 0; i < len && lines > 0; lines--)
|
||||
{
|
||||
if (small)
|
||||
UI_PrintStringSmall(String + k, menu_item_x1, menu_item_x2, y);
|
||||
UI_PrintStringSmall(String + i, menu_item_x1, menu_item_x2, y);
|
||||
else
|
||||
UI_PrintString(String + k, menu_item_x1, menu_item_x2, y, 8);
|
||||
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8);
|
||||
|
||||
// look for start of next line
|
||||
while (i < len && String[i] >= 32)
|
||||
i++;
|
||||
k = ++i;
|
||||
|
||||
// hop over the null term char(s)
|
||||
while (i < len && String[i] < 32)
|
||||
i++;
|
||||
|
||||
y += small ? 1 : 2;
|
||||
}
|
||||
}
|
||||
|
||||
50
ui/menu.h
50
ui/menu.h
@@ -51,11 +51,12 @@ enum
|
||||
MENU_SAVE,
|
||||
MENU_VOX,
|
||||
MENU_ABR,
|
||||
MENU_ABR_ON_RX,
|
||||
MENU_TDR,
|
||||
MENU_BEEP,
|
||||
#ifdef ENABLE_VOICE
|
||||
MENU_VOICE,
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
MENU_VOICE,
|
||||
#endif
|
||||
MENU_SC_REV,
|
||||
MENU_AUTOLK,
|
||||
MENU_S_ADD1,
|
||||
@@ -63,19 +64,19 @@ enum
|
||||
MENU_STE,
|
||||
MENU_RP_STE,
|
||||
MENU_MIC,
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
MENU_MIC_BAR,
|
||||
#endif
|
||||
#ifdef ENABLE_COMPANDER
|
||||
MENU_COMPAND,
|
||||
#endif
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
MENU_MIC_BAR,
|
||||
#endif
|
||||
#ifdef ENABLE_COMPANDER
|
||||
MENU_COMPAND,
|
||||
#endif
|
||||
MENU_1_CALL,
|
||||
MENU_S_LIST,
|
||||
MENU_SLIST1,
|
||||
MENU_SLIST2,
|
||||
#ifdef ENABLE_ALARM
|
||||
MENU_AL_MOD,
|
||||
#endif
|
||||
#ifdef ENABLE_ALARM
|
||||
MENU_AL_MOD,
|
||||
#endif
|
||||
MENU_ANI_ID,
|
||||
MENU_UPCODE,
|
||||
MENU_DWCODE,
|
||||
@@ -92,15 +93,15 @@ enum
|
||||
MENU_VOL,
|
||||
MENU_BAT_TXT,
|
||||
MENU_AM,
|
||||
#ifdef ENABLE_AM_FIX
|
||||
MENU_AM_FIX,
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
MENU_AM_FIX_TEST1,
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
MENU_NOAA_S,
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX
|
||||
MENU_AM_FIX,
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
MENU_AM_FIX_TEST1,
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
MENU_NOAA_S,
|
||||
#endif
|
||||
MENU_RESET,
|
||||
|
||||
// items after here are normally hidden
|
||||
@@ -113,7 +114,9 @@ enum
|
||||
MENU_SCREN,
|
||||
|
||||
MENU_TX_EN, // enable TX
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
MENU_F_CALI, // reference xtal calibration
|
||||
#endif
|
||||
MENU_BATCAL // battery voltage calibration
|
||||
};
|
||||
|
||||
@@ -135,10 +138,10 @@ extern const char gSubMenu_MDF[4][15];
|
||||
#ifdef ENABLE_ALARM
|
||||
extern const char gSubMenu_AL_MOD[2][5];
|
||||
#endif
|
||||
extern const char gSubMenu_D_RSP[4][6];
|
||||
extern const char gSubMenu_D_RSP[4][11];
|
||||
extern const char gSubMenu_PTT_ID[4][7];
|
||||
extern const char gSubMenu_PONMSG[4][8];
|
||||
extern const char gSubMenu_ROGER[3][6];
|
||||
extern const char gSubMenu_ROGER[3][9];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char gSubMenu_F_LOCK[6][4];
|
||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||
@@ -157,7 +160,6 @@ extern bool gIsInSubMenu;
|
||||
extern uint8_t gMenuCursor;
|
||||
extern int8_t gMenuScrollDirection;
|
||||
extern int32_t gSubMenuSelection;
|
||||
extern int32_t gSubMenuSelection_original;
|
||||
|
||||
extern char edit_original[17];
|
||||
extern char edit[17];
|
||||
|
||||
53
ui/status.c
53
ui/status.c
@@ -45,12 +45,26 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// **************
|
||||
|
||||
// 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)
|
||||
{
|
||||
memmove(line + x, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
|
||||
x1 = x + sizeof(BITMAP_PowerSave);
|
||||
memmove(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
|
||||
x1 = x + sizeof(BITMAP_POWERSAVE);
|
||||
}
|
||||
x += sizeof(BITMAP_PowerSave);
|
||||
x += sizeof(BITMAP_POWERSAVE);
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
// NOASS SCAN indicator
|
||||
@@ -187,54 +201,35 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x += sizeof(BITMAP_USB_C);
|
||||
|
||||
// BATTERY LEVEL indicator
|
||||
#if 1
|
||||
if (gBatteryDisplayLevel >= 2 && !gLowBattery)
|
||||
{
|
||||
line += x;
|
||||
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
|
||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||
line += sizeof(BITMAP_BatteryLevel1);
|
||||
if (gBatteryDisplayLevel >= 2)
|
||||
memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 5)
|
||||
if (gBatteryDisplayLevel >= 3)
|
||||
memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 7)
|
||||
if (gBatteryDisplayLevel >= 4)
|
||||
memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 9)
|
||||
if (gBatteryDisplayLevel >= 5)
|
||||
memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#else
|
||||
if (gBatteryDisplayLevel >= 2)
|
||||
memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 5)
|
||||
if (gBatteryDisplayLevel >= 3)
|
||||
memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 7)
|
||||
if (gBatteryDisplayLevel >= 4)
|
||||
memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 9)
|
||||
if (gBatteryDisplayLevel >= 5)
|
||||
memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if (gLowBatteryBlink == 1)
|
||||
memmove(line + x, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#else
|
||||
// UI_DisplayBattery(gBatteryDisplayLevel);
|
||||
|
||||
line += x;
|
||||
if (gBatteryDisplayLevel > 0)
|
||||
{
|
||||
const uint8_t level = (gBatteryDisplayLevel <= 11) ? gBatteryDisplayLevel : 11;
|
||||
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#ifdef ENABLE_REVERSE_BAT_SYMBOL
|
||||
for (uint8_t i = 0; i < level; i++)
|
||||
line[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#else
|
||||
for (uint8_t i = 0; i < level; i++)
|
||||
line[sizeof(BITMAP_BatteryLevel1) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
memset(line, 0, sizeof(BITMAP_BatteryLevel1));
|
||||
#endif
|
||||
|
||||
// **************
|
||||
|
||||
|
||||
Reference in New Issue
Block a user