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

This commit is contained in:
Krzysiek Egzmont
2023-10-06 11:21:10 +02:00
50 changed files with 955 additions and 664 deletions

View File

@@ -15,6 +15,7 @@ ENABLE_VOICE := 0
ENABLE_VOX := 1 ENABLE_VOX := 1
ENABLE_ALARM := 0 ENABLE_ALARM := 0
ENABLE_TX1750 := 0 ENABLE_TX1750 := 0
ENABLE_PWRON_PASSWORD := 0
ENABLE_BIG_FREQ := 1 ENABLE_BIG_FREQ := 1
ENABLE_SMALL_BOLD := 1 ENABLE_SMALL_BOLD := 1
ENABLE_KEEP_MEM_NAME := 1 ENABLE_KEEP_MEM_NAME := 1
@@ -29,7 +30,7 @@ ENABLE_CODE_SCAN_TIMEOUT := 0
ENABLE_AM_FIX := 1 ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0 ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_MORE_SENSITIVE := 1 ENABLE_SQUELCH_MORE_SENSITIVE := 1
#ENABLE_FASTER_CHANNEL_SCAN := 0 ENABLE_FASTER_CHANNEL_SCAN := 1
ENABLE_RSSI_BAR := 1 ENABLE_RSSI_BAR := 1
ENABLE_AUDIO_BAR := 1 ENABLE_AUDIO_BAR := 1
ENABLE_COPY_CHAN_TO_VFO := 1 ENABLE_COPY_CHAN_TO_VFO := 1
@@ -137,7 +138,9 @@ ifeq ($(ENABLE_FMRADIO),1)
endif endif
OBJS += ui/helper.o OBJS += ui/helper.o
OBJS += ui/inputbox.o OBJS += ui/inputbox.o
OBJS += ui/lock.o ifeq ($(ENABLE_PWRON_PASSWORD),1)
OBJS += ui/lock.o
endif
OBJS += ui/main.o OBJS += ui/main.o
OBJS += ui/menu.o OBJS += ui/menu.o
OBJS += ui/scanner.o OBJS += ui/scanner.o
@@ -157,6 +160,7 @@ AS = arm-none-eabi-gcc
CC = CC =
LD = arm-none-eabi-gcc LD = arm-none-eabi-gcc
ifeq ($(ENABLE_CLANG),0) ifeq ($(ENABLE_CLANG),0)
CC += arm-none-eabi-gcc CC += arm-none-eabi-gcc
# Use GCC's linker to avoid undefined symbol errors # Use GCC's linker to avoid undefined symbol errors
@@ -186,24 +190,27 @@ endif
CFLAGS = CFLAGS =
ifeq ($(ENABLE_CLANG),0) ifeq ($(ENABLE_CLANG),0)
CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
# CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD
# CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
# CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
else else
# Oz needed to make it fit on flash # Oz needed to make it fit on flash
CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
endif endif
ifeq ($(ENABLE_LTO),1) ifeq ($(ENABLE_LTO),1)
CFLAGS += -flto=2 CFLAGS += -flto=2
else else
# We get most of the space savings if LTO creates problems # We get most of the space savings if LTO creates problems
CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -ffunction-sections -fdata-sections
endif endif
# May cause unhelpful build failures # May cause unhelpful build failures
#CFLAGS += -Wpadded #CFLAGS += -Wpadded
# catch any and all warnings
#CFLAGS += -Wextra
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\" CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
@@ -246,6 +253,9 @@ endif
ifeq ($(ENABLE_TX1750),1) ifeq ($(ENABLE_TX1750),1)
CFLAGS += -DENABLE_TX1750 CFLAGS += -DENABLE_TX1750
endif endif
ifeq ($(ENABLE_PWRON_PASSWORD),1)
CFLAGS += -DENABLE_PWRON_PASSWORD
endif
ifeq ($(ENABLE_KEEP_MEM_NAME),1) ifeq ($(ENABLE_KEEP_MEM_NAME),1)
CFLAGS += -DENABLE_KEEP_MEM_NAME CFLAGS += -DENABLE_KEEP_MEM_NAME
endif endif
@@ -319,13 +329,13 @@ endif
LDFLAGS += --specs=nano.specs LDFLAGS += --specs=nano.specs
ifeq ($(ENABLE_LTO),0) ifeq ($(ENABLE_LTO),0)
# Throw away unneeded func/data sections like LTO does # Throw away unneeded func/data sections like LTO does
LDFLAGS += -Wl,--gc-sections LDFLAGS += -Wl,--gc-sections
endif endif
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
ASFLAGS += -g ASFLAGS += -g
CFLAGS += -g CFLAGS += -g
LDFLAGS += -g LDFLAGS += -g
endif endif

View File

@@ -33,27 +33,31 @@ Anyway, have fun.
# Radio performance # Radio performance
Please note that the Quansheng uv-k radios are not professional quality transceivers, their Please note that the Quansheng UV-Kx radios are not professional quality transceivers, their
performance is strictly limited, somewhat below that of a decent transceiver. The RX front performance is strictly limited. The RX front end has no track-tuned band pass filtering
end has no track-tuned band pass filtering at all, and so are wide band/wide open to any at all, and so are wide band/wide open to any and all signals over a large frequency range.
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. Using the radio in high intensity RF environments will most likely make reception anything but
easy (AM mode will suffer far more than FM ever will), the receiver simply doesn't have a
great dynamic range, which results in distorted AM audio with stronger RX'ed signals.
There is nothing more anyone can do in firmware/software to improve that, once the RX gain
adjustment I do (AM fix) reaches the hardwares limit, your AM RX audio will be all but
non-existant (just like Quansheng's firmware).
On the other hand, FM RX audio will/should be fine.
But, they are nice toys for the price, fun to play with.
# User customization # User customization
You can customize the firmware by enabling/disabling various compile options. You can customize the firmware by enabling/disabling various compile options, this allows
us to remove certain firmware features in order to make room in the flash for others.
You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) .. You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) ..
``` ```
ENABLE_CLANG := 0 experimental, builds with clang instead of gcc (LTO will be disabled if you enable this) ENABLE_CLANG := 0 **experimental, builds with clang instead of gcc (LTO will be disabled if you enable this)
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming) ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed 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_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this)
ENABLE_UART := 1 without this you can't configure radio via PC ! ENABLE_UART := 1 without this you can't configure radio via PC !
ENABLE_AIRCOPY := 0 easier to just enter frequency with butts ENABLE_AIRCOPY := 0 easier to just enter frequency with butts
ENABLE_FMRADIO := 0 WBFM VHF broadcast band receiver ENABLE_FMRADIO := 0 WBFM VHF broadcast band receiver
@@ -62,6 +66,7 @@ ENABLE_VOICE := 0 want to hear voices ?
ENABLE_VOX := 0 ENABLE_VOX := 0
ENABLE_ALARM := 0 TX alarms ENABLE_ALARM := 0 TX alarms
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access) ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
ENABLE_PWRON_PASSWORD := 1 power-on password stuff
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware) ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode) ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
@@ -76,7 +81,7 @@ ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan ti
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 := 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_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
ENABLE_SQUELCH_MORE_SENSITIVE := 0 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves ENABLE_SQUELCH_MORE_SENSITIVE := 0 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
#ENABLE_FASTER_CHANNEL_SCAN := 0 don't use (for now) .. increases the channel scan speed, but the squelch is also made more twitchy 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_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M') ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M')
@@ -89,10 +94,10 @@ ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO
* Long-press 'M' .. Copy selected channel into same VFO, then switch VFO to frequency mode * Long-press 'M' .. Copy selected channel into same VFO, then switch VFO to frequency mode
* *
* Long-press '7' .. Toggle selected channel scanlist setting .. if VOX is disabled in Makefile * Long-press '7' .. Toggle selected channel scanlist setting .. if VOX is disabled in Makefile
* or * or
* Long-press '5' .. Toggle selected channel scanlist setting .. if NOAA is disabled in Makefile * Long-press '5' .. Toggle selected channel scanlist setting .. if NOAA is disabled in Makefile
* *
* Long-press '*' .. Start scanning, then toggles scanlist scan 1, 2 or ALL channel scanning * Long-press '*' .. Start scanning, then toggles the scanning between scanlists 1, 2 or ALL channels
# Some changes made from the Quansheng firmware # Some changes made from the Quansheng firmware
@@ -178,13 +183,13 @@ You may obtain a copy of the License at
# Example changes/updates # Example changes/updates
<p float="left"> <p float="left">
<img src="/image1.png" width=300 /> <img src="/images/image1.png" width=300 />
<img src="/image2.png" width=300 /> <img src="/images/image2.png" width=300 />
<img src="/image3.png" width=300 /> <img src="/images/image3.png" width=300 />
</p> </p>
Video showing the AM fix working .. Video showing the AM fix working ..
<video src="/AM_fix.mp4"></video> <video src="/images/AM_fix.mp4"></video>
<video src="https://github.com/OneOfEleven/uv-k5-firmware-custom/assets/51590168/2a3a9cdc-97da-4966-bf0d-1ce6ad09779c"></video> <video src="https://github.com/OneOfEleven/uv-k5-firmware-custom/assets/51590168/2a3a9cdc-97da-4966-bf0d-1ce6ad09779c"></video>

View File

@@ -475,7 +475,7 @@
void AM_fix_print_data(const int vfo, char *s) void AM_fix_print_data(const int vfo, char *s)
{ {
if (s != NULL && vfo >= 0 && vfo < ARRAY_SIZE(gain_table_index)) if (s != NULL && vfo >= 0 && vfo < (int)ARRAY_SIZE(gain_table_index))
{ {
const unsigned int index = gain_table_index[vfo]; const unsigned int index = gain_table_index[vfo];
// sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]); // sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]);

View File

@@ -84,11 +84,11 @@ void ACTION_Monitor(void)
gMonitor = false; gMonitor = false;
if (gScanState != SCAN_OFF) if (gScanStateDir != SCAN_OFF)
{ {
ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
gScanPauseMode = true; gScanPauseMode = true;
} }
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
@@ -182,23 +182,36 @@ void ACTION_Scan(bool bRestart)
{ {
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
if (gScanState != SCAN_OFF) if (gScanStateDir != SCAN_OFF)
{ { // already scanning
#if 1
if (gNextMrChannel <= MR_CHANNEL_LAST)
{ // channel mode
// keep scanning but toggle between scan lists // keep scanning but toggle between scan lists
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3; gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
// jump to the next channel
CHANNEL_Next(true, gScanStateDir);
gScanPauseDelayIn_10ms = 1;
gScheduleScanListen = false;
gUpdateStatus = true; gUpdateStatus = true;
#else }
else
{ // stop scanning
SCANNER_Stop(); SCANNER_Stop();
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_SCANNING_STOP; gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
#endif #endif
#endif }
} }
else else
{ { // start scanning
CHANNEL_Next(true, 1);
CHANNEL_Next(true, SCAN_FWD);
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN); AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
@@ -215,9 +228,16 @@ void ACTION_Scan(bool bRestart)
} }
} }
else else
if (!bRestart) // if (!bRestart)
{ // keep scanning but toggle between scan lists if (!bRestart && gNextMrChannel <= MR_CHANNEL_LAST)
{ // channel mode, keep scanning but toggle between scan lists
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3; gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
// jump to the next channel
CHANNEL_Next(true, gScanStateDir);
gScanPauseDelayIn_10ms = 1;
gScheduleScanListen = false;
gUpdateStatus = true; gUpdateStatus = true;
} }
else else
@@ -313,6 +333,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed) if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed)
{ {
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (gDTMF_InputIndex > 0) if (gDTMF_InputIndex > 0)
{ {
gDTMF_InputBox[--gDTMF_InputIndex] = '-'; gDTMF_InputBox[--gDTMF_InputIndex] = '-';

116
app/app.c
View File

@@ -95,15 +95,15 @@ static void APP_CheckForIncoming(void)
// squelch is open // squelch is open
if (gScanState == SCAN_OFF) if (gScanStateDir == SCAN_OFF)
{ // not RF scanning { // not RF scanning
if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE) if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE)
{ // CTCSS/DTS scanning { // CTCSS/DTS scanning
ScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
gRxReceptionMode = RX_MODE_DETECTED; gRxReceptionMode = RX_MODE_DETECTED;
} }
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
@@ -166,8 +166,8 @@ static void APP_CheckForIncoming(void)
return; return;
} }
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
} }
gRxReceptionMode = RX_MODE_DETECTED; gRxReceptionMode = RX_MODE_DETECTED;
@@ -200,7 +200,7 @@ static void APP_HandleIncoming(void)
return; return;
} }
bFlag = (gScanState == SCAN_OFF && gCurrentCodeType == CODE_TYPE_OFF); bFlag = (gScanStateDir == SCAN_OFF && gCurrentCodeType == CODE_TYPE_OFF);
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gNOAACountdown_10ms > 0) if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gNOAACountdown_10ms > 0)
@@ -224,7 +224,7 @@ static void APP_HandleIncoming(void)
if (!bFlag) if (!bFlag)
return; return;
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF) if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
{ // not scanning { // not scanning
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED) if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
{ // DTMF DCD is enabled { // DTMF DCD is enabled
@@ -268,7 +268,7 @@ static void APP_HandleReceive(void)
goto Skip; goto Skip;
} }
if (gScanState != SCAN_OFF && IS_FREQ_CHANNEL(gNextMrChannel)) if (gScanStateDir != SCAN_OFF && IS_FREQ_CHANNEL(gNextMrChannel))
{ {
if (g_SquelchLost) if (g_SquelchLost)
return; return;
@@ -399,7 +399,7 @@ Skip:
gUpdateDisplay = true; gUpdateDisplay = true;
if (gScanState != SCAN_OFF) if (gScanStateDir != SCAN_OFF)
{ {
switch (gEeprom.SCAN_RESUME_MODE) switch (gEeprom.SCAN_RESUME_MODE)
{ {
@@ -407,8 +407,8 @@ Skip:
break; break;
case SCAN_RESUME_CO: case SCAN_RESUME_CO:
ScanPauseDelayIn_10ms = scan_pause_delay_in_7_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_7_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
break; break;
case SCAN_RESUME_SE: case SCAN_RESUME_SE:
@@ -488,23 +488,23 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
if (gSetting_backlight_on_tx_rx >= 2) if (gSetting_backlight_on_tx_rx >= 2)
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
if (gScanState != SCAN_OFF) if (gScanStateDir != SCAN_OFF)
{ {
switch (gEeprom.SCAN_RESUME_MODE) switch (gEeprom.SCAN_RESUME_MODE)
{ {
case SCAN_RESUME_TO: case SCAN_RESUME_TO:
if (!gScanPauseMode) if (!gScanPauseMode)
{ {
ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
gScanPauseMode = true; gScanPauseMode = true;
} }
break; break;
case SCAN_RESUME_CO: case SCAN_RESUME_CO:
case SCAN_RESUME_SE: case SCAN_RESUME_SE:
ScanPauseDelayIn_10ms = 0; gScanPauseDelayIn_10ms = 0;
gScheduleScanListen = false; gScheduleScanListen = false;
break; break;
} }
@@ -527,7 +527,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
if (gCssScanMode != CSS_SCAN_MODE_OFF) if (gCssScanMode != CSS_SCAN_MODE_OFF)
gCssScanMode = CSS_SCAN_MODE_FOUND; gCssScanMode = CSS_SCAN_MODE_FOUND;
if (gScanState == SCAN_OFF && if (gScanStateDir == SCAN_OFF &&
gCssScanMode == CSS_SCAN_MODE_OFF && gCssScanMode == CSS_SCAN_MODE_OFF &&
gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
{ // not scanning, dual watch is enabled { // not scanning, dual watch is enabled
@@ -623,14 +623,17 @@ uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
static void FREQ_NextChannel(void) static void FREQ_NextChannel(void)
{ {
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanState); gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
RADIO_ApplyOffset(gRxVfo); RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
// ScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms; #ifdef ENABLE_FASTER_CHANNEL_SCAN
ScanPauseDelayIn_10ms = 10; // 100ms .. it don't like any faster :( gScanPauseDelayIn_10ms = 9; // 90ms
#else
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
#endif
bScanKeepFrequency = false; bScanKeepFrequency = false;
gUpdateDisplay = true; gUpdateDisplay = true;
@@ -647,6 +650,9 @@ static void MR_NextChannel(void)
if (enabled) if (enabled)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gCurrentScanList) switch (gCurrentScanList)
{ {
case SCAN_NEXT_CHAN_SCANLIST1: case SCAN_NEXT_CHAN_SCANLIST1:
@@ -657,7 +663,7 @@ static void MR_NextChannel(void)
if (RADIO_CheckValidChannel(chan1, false, 0)) if (RADIO_CheckValidChannel(chan1, false, 0))
{ {
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
gNextMrChannel = chan1; gNextMrChannel = chan1;
break; break;
} }
} }
@@ -680,7 +686,7 @@ static void MR_NextChannel(void)
// { // {
// chan = (gEeprom.RX_VFO + 1) & 1u; // chan = (gEeprom.RX_VFO + 1) & 1u;
// chan = gEeprom.ScreenChannel[chan]; // chan = gEeprom.ScreenChannel[chan];
// if (IS_MR_CHANNEL(chan)) // if (chan <= MR_CHANNEL_LAST)
// { // {
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH; // gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
// gNextMrChannel = chan; // gNextMrChannel = chan;
@@ -695,11 +701,13 @@ static void MR_NextChannel(void)
chan = 0xff; chan = 0xff;
break; break;
} }
#pragma GCC diagnostic pop
} }
if (!enabled || chan == 0xff) if (!enabled || chan == 0xff)
{ {
chan = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT); chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
if (chan == 0xFF) if (chan == 0xFF)
{ // no valid channel found { // no valid channel found
@@ -722,9 +730,9 @@ static void MR_NextChannel(void)
} }
#ifdef ENABLE_FASTER_CHANNEL_SCAN #ifdef ENABLE_FASTER_CHANNEL_SCAN
ScanPauseDelayIn_10ms = 8; // 80ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ? gScanPauseDelayIn_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
#else #else
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
#endif #endif
bScanKeepFrequency = false; bScanKeepFrequency = false;
@@ -971,7 +979,7 @@ void APP_EndTransmission(void)
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
return; return;
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF) if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
return; return;
if (gVOX_NoiseDetected) if (gVOX_NoiseDetected)
@@ -1063,9 +1071,9 @@ void APP_Update(void)
#endif #endif
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
if (gScreenToDisplay != DISPLAY_SCANNER && gScanState != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0) if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0)
#else #else
if (gScreenToDisplay != DISPLAY_SCANNER && gScanState != SCAN_OFF && gScheduleScanListen && !gPttIsPressed) if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed)
#endif #endif
{ // scanning { // scanning
@@ -1074,14 +1082,14 @@ void APP_Update(void)
if (gCurrentFunction == FUNCTION_INCOMING) if (gCurrentFunction == FUNCTION_INCOMING)
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
else else
FREQ_NextChannel(); FREQ_NextChannel(); // switch to next frequency
} }
else else
{ {
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING) if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
else else
MR_NextChannel(); MR_NextChannel(); // switch to next channel
} }
gScanPauseMode = false; gScanPauseMode = false;
@@ -1124,7 +1132,7 @@ void APP_Update(void)
if (gScheduleDualWatch) if (gScheduleDualWatch)
#endif #endif
{ {
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF) if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
{ {
if (!gPttIsPressed && if (!gPttIsPressed &&
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
@@ -1174,7 +1182,7 @@ void APP_Update(void)
gPttIsPressed || gPttIsPressed ||
gKeyBeingHeld || gKeyBeingHeld ||
gEeprom.BATTERY_SAVE == 0 || gEeprom.BATTERY_SAVE == 0 ||
gScanState != SCAN_OFF || gScanStateDir != SCAN_OFF ||
gCssScanMode != CSS_SCAN_MODE_OFF || gCssScanMode != CSS_SCAN_MODE_OFF ||
gScreenToDisplay != DISPLAY_MAIN || gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE) gDTMF_CallState != DTMF_CALL_STATE_NONE)
@@ -1199,7 +1207,7 @@ void APP_Update(void)
gPttIsPressed || gPttIsPressed ||
gKeyBeingHeld || gKeyBeingHeld ||
gEeprom.BATTERY_SAVE == 0 || gEeprom.BATTERY_SAVE == 0 ||
gScanState != SCAN_OFF || gScanStateDir != SCAN_OFF ||
gCssScanMode != CSS_SCAN_MODE_OFF || gCssScanMode != CSS_SCAN_MODE_OFF ||
gScreenToDisplay != DISPLAY_MAIN || gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE) gDTMF_CallState != DTMF_CALL_STATE_NONE)
@@ -1233,7 +1241,7 @@ void APP_Update(void)
#endif #endif
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF &&
gScanState == SCAN_OFF && gScanStateDir == SCAN_OFF &&
gCssScanMode == CSS_SCAN_MODE_OFF) gCssScanMode == CSS_SCAN_MODE_OFF)
{ // dual watch mode, toggle between the two VFO's { // dual watch mode, toggle between the two VFO's
DUALWATCH_Alternate(); DUALWATCH_Alternate();
@@ -1247,7 +1255,7 @@ void APP_Update(void)
gRxIdleMode = false; // RX is awake gRxIdleMode = false; // RX is awake
} }
else else
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gUpdateRSSI) if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gUpdateRSSI)
{ // dual watch mode, go back to sleep { // dual watch mode, go back to sleep
updateRSSI(gEeprom.RX_VFO); updateRSSI(gEeprom.RX_VFO);
@@ -1371,7 +1379,7 @@ void APP_CheckKeys(void)
Key == KEY_DOWN || Key == KEY_DOWN ||
Key == KEY_EXIT || Key == KEY_EXIT ||
Key == KEY_MENU || Key == KEY_MENU ||
Key <= KEY_9) // keys 0-9 can be held down to bypass pressing the F-Key (Key >= KEY_0 && Key <= KEY_9)) // keys 0-9 can be held down to bypass pressing the F-Key
{ {
gKeyBeingHeld = true; gKeyBeingHeld = true;
APP_ProcessKey(Key, true, true); APP_ProcessKey(Key, true, true);
@@ -1812,9 +1820,9 @@ void APP_TimeSlice500ms(void)
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
if (gScanState == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)) if (gScanStateDir == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
#else #else
if (gScanState == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)) if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
#endif #endif
{ {
bool exit_menu = false; bool exit_menu = false;
@@ -2034,32 +2042,32 @@ void APP_TimeSlice500ms(void)
} }
#endif #endif
void CHANNEL_Next(bool bFlag, int8_t Direction) void CHANNEL_Next(const bool bFlag, const int8_t scan_direction)
{ {
RADIO_SelectVfos(); RADIO_SelectVfos();
gNextMrChannel = gRxVfo->CHANNEL_SAVE; gNextMrChannel = gRxVfo->CHANNEL_SAVE;
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
gScanState = Direction; gScanStateDir = scan_direction;
if (IS_MR_CHANNEL(gNextMrChannel)) if (gNextMrChannel <= MR_CHANNEL_LAST)
{ { // channel mode
if (bFlag) if (bFlag)
gRestoreMrChannel = gNextMrChannel; gRestoreMrChannel = gNextMrChannel;
MR_NextChannel(); MR_NextChannel();
} }
else else
{ { // frequency mode
if (bFlag) if (bFlag)
gRestoreFrequency = gRxVfo->freq_config_RX.Frequency; gRestoreFrequency = gRxVfo->freq_config_RX.Frequency;
FREQ_NextChannel(); FREQ_NextChannel();
} }
ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
gRxReceptionMode = RX_MODE_NONE; gRxReceptionMode = RX_MODE_NONE;
gScanPauseMode = false; gScanPauseMode = false;
bScanKeepFrequency = false; bScanKeepFrequency = false;
} }
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
@@ -2190,7 +2198,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Key != KEY_STAR && Key != KEY_STAR &&
Key != KEY_MENU) Key != KEY_MENU)
{ {
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF) if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
{ // FREQ/CTCSS/DCS scanning { // FREQ/CTCSS/DCS scanning
if (bKeyPressed && !bKeyHeld) if (bKeyPressed && !bKeyHeld)
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL); AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
@@ -2248,14 +2256,16 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
char Code; char Code;
if (Key == KEY_SIDE2) if (Key == KEY_SIDE2)
{ { // transmit 1750Hz tone
Code = 0xFE; Code = 0xFE;
} }
else else
{ {
Code = DTMF_GetCharacter(Key); Code = DTMF_GetCharacter(Key - KEY_0);
if (Code == 0xFF) if (Code == 0xFF)
goto Skip; goto Skip;
// transmit DTMF keys
} }
if (!bKeyPressed || bKeyHeld) if (!bKeyPressed || bKeyHeld)

View File

@@ -29,7 +29,7 @@ extern const uint8_t orig_mixer;
extern const uint8_t orig_pga; extern const uint8_t orig_pga;
void APP_EndTransmission(void); void APP_EndTransmission(void);
void CHANNEL_Next(bool bFlag, int8_t Direction); void CHANNEL_Next(const bool bFlag, const int8_t scan_direction);
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix); void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step); uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step);
void APP_Update(void); void APP_Update(void);

View File

@@ -184,7 +184,7 @@ void DTMF_HandleRequest(void)
if (!gDTMF_RX_pending) if (!gDTMF_RX_pending)
return; // nothing new received return; // nothing new received
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF) if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
{ // we're busy scanning { // we're busy scanning
DTMF_clear_RX(); DTMF_clear_RX();
return; return;
@@ -331,6 +331,9 @@ void DTMF_HandleRequest(void)
gUpdateDisplay = true; gUpdateDisplay = true;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gEeprom.DTMF_DECODE_RESPONSE) switch (gEeprom.DTMF_DECODE_RESPONSE)
{ {
case DTMF_DEC_RESPONSE_BOTH: case DTMF_DEC_RESPONSE_BOTH:
@@ -348,6 +351,8 @@ void DTMF_HandleRequest(void)
break; break;
} }
#pragma GCC diagnostic pop
if (gDTMF_IsGroupCall) if (gDTMF_IsGroupCall)
gDTMF_ReplyState = DTMF_REPLY_NONE; gDTMF_ReplyState = DTMF_REPLY_NONE;
} }
@@ -385,8 +390,9 @@ void DTMF_Reply(void)
default: default:
case DTMF_REPLY_NONE: case DTMF_REPLY_NONE:
if (gDTMF_CallState != DTMF_CALL_STATE_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_APOLLO ||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN) gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
{ {
gDTMF_ReplyState = DTMF_REPLY_NONE; gDTMF_ReplyState = DTMF_REPLY_NONE;

View File

@@ -154,7 +154,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
return; return;
} }
if (gScanState != SCAN_OFF) if (gScanStateDir != SCAN_OFF)
{ {
SCANNER_Stop(); SCANNER_Stop();

View File

@@ -37,6 +37,9 @@
#include "settings.h" #include "settings.h"
#include "ui/inputbox.h" #include "ui/inputbox.h"
#include "ui/ui.h" #include "ui/ui.h"
#ifdef ENABLE_SPECTRUM
// #include "app/spectrum.h"
#endif
void toggle_chan_scanlist(void) void toggle_chan_scanlist(void)
{ // toggle the selected channels scanlist setting { // toggle the selected channels scanlist setting
@@ -71,7 +74,14 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
uint8_t Vfo = gEeprom.TX_VFO; uint8_t Vfo = gEeprom.TX_VFO;
if (gScreenToDisplay == DISPLAY_MENU) if (gScreenToDisplay == DISPLAY_MENU)
{
// if (beep)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return; return;
}
// if (beep)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
switch (Key) switch (Key)
{ {
@@ -355,7 +365,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) // if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
// #endif // #endif
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
{ // user is entering frequency { // user is entering a frequency
uint32_t Frequency; uint32_t Frequency;
@@ -488,7 +498,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
if (!gFmRadioMode) if (!gFmRadioMode)
#endif #endif
{ {
if (gScanState == SCAN_OFF) if (gScanStateDir == SCAN_OFF)
{ {
if (gInputBoxIndex == 0) if (gInputBoxIndex == 0)
return; return;
@@ -538,6 +548,10 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
{ {
if (bKeyPressed && !bKeyHeld)
// menu key pressed
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (bKeyHeld) if (bKeyHeld)
{ // menu key held down (long press) { // menu key held down (long press)
@@ -560,11 +574,11 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
if (gEeprom.VFO_OPEN && gCssScanMode == CSS_SCAN_MODE_OFF) if (gEeprom.VFO_OPEN && gCssScanMode == CSS_SCAN_MODE_OFF)
{ {
if (gScanState != SCAN_OFF) if (gScanStateDir != SCAN_OFF)
{ {
if (gCurrentFunction != FUNCTION_INCOMING || if (gCurrentFunction != FUNCTION_INCOMING ||
gRxReceptionMode == RX_MODE_NONE || gRxReceptionMode == RX_MODE_NONE ||
ScanPauseDelayIn_10ms == 0) gScanPauseDelayIn_10ms == 0)
{ // scan is running (not paused) { // scan is running (not paused)
return; return;
} }
@@ -611,14 +625,10 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
const bool bFlag = (gInputBoxIndex == 0); const bool bFlag = (gInputBoxIndex == 0);
gInputBoxIndex = 0; gInputBoxIndex = 0;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (bFlag) if (bFlag)
{ {
gFlagRefreshSetting = true; gFlagRefreshSetting = true;
gRequestDisplayScreen = DISPLAY_MENU; gRequestDisplayScreen = DISPLAY_MENU;
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_MENU; gAnotherVoiceID = VOICE_ID_MENU;
#endif #endif
@@ -640,7 +650,8 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
} }
if (bKeyHeld || !bKeyPressed) if (bKeyHeld || !bKeyPressed)
{ { // long press
if (bKeyHeld || bKeyPressed) if (bKeyHeld || bKeyPressed)
{ {
if (!bKeyHeld) if (!bKeyHeld)
@@ -655,9 +666,9 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
} }
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (gScanState == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
#else #else
if (gScanState == SCAN_OFF) if (gScanStateDir == SCAN_OFF)
#endif #endif
{ {
gKeyInputCountdown = key_input_timeout_500ms; gKeyInputCountdown = key_input_timeout_500ms;
@@ -740,7 +751,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
} }
if (gScanState == SCAN_OFF) if (gScanStateDir == SCAN_OFF)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(Channel)) if (IS_NOT_NOAA_CHANNEL(Channel))
@@ -796,7 +807,10 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
return; return;
} }
// jump to the next channel
CHANNEL_Next(false, Direction); CHANNEL_Next(false, Direction);
gScanPauseDelayIn_10ms = 1;
gScheduleScanListen = false;
gPttWasReleased = true; gPttWasReleased = true;
} }
@@ -816,7 +830,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{ {
if (!bKeyHeld) if (!bKeyHeld)
{ {
const char Character = DTMF_GetCharacter(Key); const char Character = DTMF_GetCharacter(Key - KEY_0);
if (Character != 0xFF) if (Character != 0xFF)
{ // add key to DTMF string { // add key to DTMF string
DTMF_Append(Character); DTMF_Append(Character);
@@ -835,7 +849,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// TODO: ??? // TODO: ???
if (Key > KEY_PTT) if (Key > KEY_PTT)
{ {
Key = KEY_SIDE2; Key = KEY_SIDE2; // what's this doing ???
} }
switch (Key) switch (Key)

View File

@@ -86,8 +86,8 @@ void MENU_StartCssScan(int8_t Direction)
MENU_SelectNextCode(); MENU_SelectNextCode();
ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
} }
void MENU_StopCssScan(void) void MENU_StopCssScan(void)
@@ -408,6 +408,9 @@ void MENU_AcceptSetting(void)
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
return; return;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
case MENU_T_CTCS: case MENU_T_CTCS:
pConfig = &gTxVfo->freq_config_TX; pConfig = &gTxVfo->freq_config_TX;
case MENU_R_CTCS: case MENU_R_CTCS:
@@ -436,6 +439,8 @@ void MENU_AcceptSetting(void)
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
return; return;
#pragma GCC diagnostic pop
case MENU_SFT_D: case MENU_SFT_D:
gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection; gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection;
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
@@ -819,7 +824,7 @@ void MENU_SelectNextCode(void)
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
ScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms; gScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
gUpdateDisplay = true; gUpdateDisplay = true;
} }
@@ -1193,6 +1198,9 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (!gIsInSubMenu) if (!gIsInSubMenu)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gInputBoxIndex) switch (gInputBoxIndex)
{ {
case 2: case 2:
@@ -1224,6 +1232,8 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
break; break;
} }
#pragma GCC diagnostic pop
gInputBoxIndex = 0; gInputBoxIndex = 0;
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
@@ -1269,7 +1279,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
if (IS_MR_CHANNEL(Value)) if (Value <= MR_CHANNEL_LAST)
{ {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
@@ -1661,6 +1671,9 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
VFO = 0; VFO = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gMenuCursor) switch (gMenuCursor)
{ {
case MENU_DEL_CH: case MENU_DEL_CH:
@@ -1681,6 +1694,8 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
return; return;
} }
#pragma GCC diagnostic pop
Channel = RADIO_FindNextChannel(gSubMenuSelection + Direction, Direction, bCheckScanList, VFO); Channel = RADIO_FindNextChannel(gSubMenuSelection + Direction, Direction, bCheckScanList, VFO);
if (Channel != 0xFF) if (Channel != 0xFF)
gSubMenuSelection = Channel; gSubMenuSelection = Channel;

View File

@@ -37,11 +37,11 @@ uint32_t gScanFrequency;
bool gScanPauseMode; bool gScanPauseMode;
SCAN_CssState_t gScanCssState; SCAN_CssState_t gScanCssState;
volatile bool gScheduleScanListen = true; volatile bool gScheduleScanListen = true;
volatile uint16_t ScanPauseDelayIn_10ms; volatile uint16_t gScanPauseDelayIn_10ms;
uint8_t gScanProgressIndicator; uint8_t gScanProgressIndicator;
uint8_t gScanHitCount; uint8_t gScanHitCount;
bool gScanUseCssResult; bool gScanUseCssResult;
int8_t gScanState; int8_t gScanStateDir;
bool bScanKeepFrequency; bool bScanKeepFrequency;
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
@@ -53,7 +53,9 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
uint16_t Channel; uint16_t Channel;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
INPUTBOX_Append(Key); INPUTBOX_Append(Key);
gRequestDisplayScreen = DISPLAY_SCANNER; gRequestDisplayScreen = DISPLAY_SCANNER;
if (gInputBoxIndex < 3) if (gInputBoxIndex < 3)
@@ -65,9 +67,9 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
} }
gInputBoxIndex = 0; gInputBoxIndex = 0;
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
if (IS_MR_CHANNEL(Channel)) Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
if (Channel <= MR_CHANNEL_LAST)
{ {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
@@ -193,7 +195,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
} }
} }
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
{ {
gScannerEditState = 1; gScannerEditState = 1;
gScanChannel = gTxVfo->CHANNEL_SAVE; gScanChannel = gTxVfo->CHANNEL_SAVE;
@@ -247,7 +249,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
gTxVfo->freq_config_TX.Code = gScanCssResultCode; gTxVfo->freq_config_TX.Code = gScanCssResultCode;
} }
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
{ {
Channel = gScanChannel; Channel = gScanChannel;
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel; gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
@@ -424,11 +426,11 @@ void SCANNER_Stop(void)
{ {
const uint8_t Previous = gRestoreMrChannel; const uint8_t Previous = gRestoreMrChannel;
gScanState = SCAN_OFF; gScanStateDir = SCAN_OFF;
if (!bScanKeepFrequency) if (!bScanKeepFrequency)
{ {
if (IS_MR_CHANNEL(gNextMrChannel)) if (gNextMrChannel <= MR_CHANNEL_LAST)
{ {
gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel; gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous; gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous;
@@ -446,7 +448,7 @@ void SCANNER_Stop(void)
return; return;
} }
if (!IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) if (gRxVfo->CHANNEL_SAVE > MR_CHANNEL_LAST)
{ {
RADIO_ApplyOffset(gRxVfo); RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo);

View File

@@ -32,7 +32,9 @@ typedef enum SCAN_CssState_t SCAN_CssState_t;
enum enum
{ {
SCAN_OFF = 0, SCAN_REV = -1,
SCAN_OFF = 0,
SCAN_FWD = +1
}; };
extern DCS_CodeType_t gScanCssResultType; extern DCS_CodeType_t gScanCssResultType;
@@ -46,11 +48,11 @@ extern uint32_t gScanFrequency;
extern bool gScanPauseMode; extern bool gScanPauseMode;
extern SCAN_CssState_t gScanCssState; extern SCAN_CssState_t gScanCssState;
extern volatile bool gScheduleScanListen; extern volatile bool gScheduleScanListen;
extern volatile uint16_t ScanPauseDelayIn_10ms; extern volatile uint16_t gScanPauseDelayIn_10ms;
extern uint8_t gScanProgressIndicator; extern uint8_t gScanProgressIndicator;
extern uint8_t gScanHitCount; extern uint8_t gScanHitCount;
extern bool gScanUseCssResult; extern bool gScanUseCssResult;
extern int8_t gScanState; extern int8_t gScanStateDir;
extern bool bScanKeepFrequency; extern bool bScanKeepFrequency;
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);

View File

@@ -48,7 +48,7 @@ typedef struct {
} Header_t; } Header_t;
typedef struct { typedef struct {
uint8_t Padding[2]; uint8_t Padding[2];
uint16_t ID; uint16_t ID;
} Footer_t; } Footer_t;
@@ -60,10 +60,10 @@ typedef struct {
typedef struct { typedef struct {
Header_t Header; Header_t Header;
struct { struct {
char Version[16]; char Version[16];
bool bHasCustomAesKey; bool bHasCustomAesKey;
bool bIsInLockScreen; bool bIsInLockScreen;
uint8_t Padding[2]; uint8_t Padding[2];
uint32_t Challenge[4]; uint32_t Challenge[4];
} Data; } Data;
} REPLY_0514_t; } REPLY_0514_t;
@@ -71,8 +71,8 @@ typedef struct {
typedef struct { typedef struct {
Header_t Header; Header_t Header;
uint16_t Offset; uint16_t Offset;
uint8_t Size; uint8_t Size;
uint8_t Padding; uint8_t Padding;
uint32_t Timestamp; uint32_t Timestamp;
} CMD_051B_t; } CMD_051B_t;
@@ -80,19 +80,19 @@ typedef struct {
Header_t Header; Header_t Header;
struct { struct {
uint16_t Offset; uint16_t Offset;
uint8_t Size; uint8_t Size;
uint8_t Padding; uint8_t Padding;
uint8_t Data[128]; uint8_t Data[128];
} Data; } Data;
} REPLY_051B_t; } REPLY_051B_t;
typedef struct { typedef struct {
Header_t Header; Header_t Header;
uint16_t Offset; uint16_t Offset;
uint8_t Size; uint8_t Size;
bool bAllowPassword; bool bAllowPassword;
uint32_t Timestamp; uint32_t Timestamp;
uint8_t Data[0]; uint8_t Data[0];
} CMD_051D_t; } CMD_051D_t;
typedef struct { typedef struct {
@@ -106,8 +106,8 @@ typedef struct {
Header_t Header; Header_t Header;
struct { struct {
uint16_t RSSI; uint16_t RSSI;
uint8_t ExNoiseIndicator; uint8_t ExNoiseIndicator;
uint8_t GlitchIndicator; uint8_t GlitchIndicator;
} Data; } Data;
} REPLY_0527_t; } REPLY_0527_t;
@@ -137,7 +137,10 @@ typedef struct {
uint32_t Timestamp; uint32_t Timestamp;
} CMD_052F_t; } CMD_052F_t;
static const uint8_t Obfuscation[16] = { 0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80 }; static const uint8_t Obfuscation[16] =
{
0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80
};
static union static union
{ {
@@ -157,12 +160,11 @@ static void SendReply(void *pReply, uint16_t Size)
{ {
Header_t Header; Header_t Header;
Footer_t Footer; Footer_t Footer;
uint8_t *pBytes;
uint16_t i;
if (bIsEncrypted) if (bIsEncrypted)
{ {
pBytes = (uint8_t *)pReply; uint8_t *pBytes = (uint8_t *)pReply;
unsigned int i;
for (i = 0; i < Size; i++) for (i = 0; i < Size; i++)
pBytes[i] ^= Obfuscation[i % 16]; pBytes[i] ^= Obfuscation[i % 16];
} }
@@ -171,6 +173,7 @@ static void SendReply(void *pReply, uint16_t Size)
Header.Size = Size; Header.Size = Size;
UART_Send(&Header, sizeof(Header)); UART_Send(&Header, sizeof(Header));
UART_Send(pReply, Size); UART_Send(pReply, Size);
if (bIsEncrypted) if (bIsEncrypted)
{ {
Footer.Padding[0] = Obfuscation[(Size + 0) % 16] ^ 0xFF; Footer.Padding[0] = Obfuscation[(Size + 0) % 16] ^ 0xFF;
@@ -205,14 +208,16 @@ static void SendVersion(void)
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse) static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
{ {
uint8_t i; unsigned int i;
uint32_t IV[4]; uint32_t IV[4];
IV[0] = 0; IV[0] = 0;
IV[1] = 0; IV[1] = 0;
IV[2] = 0; IV[2] = 0;
IV[3] = 0; IV[3] = 0;
AES_Encrypt(pKey, IV, pIn, IV, true); AES_Encrypt(pKey, IV, pIn, IV, true);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
if (IV[i] != pResponse[i]) if (IV[i] != pResponse[i])
return true; return true;
@@ -254,10 +259,10 @@ static void CMD_051B(const uint8_t *pBuffer)
#endif #endif
memset(&Reply, 0, sizeof(Reply)); memset(&Reply, 0, sizeof(Reply));
Reply.Header.ID = 0x051C; Reply.Header.ID = 0x051C;
Reply.Header.Size = pCmd->Size + 4; Reply.Header.Size = pCmd->Size + 4;
Reply.Data.Offset = pCmd->Offset; Reply.Data.Offset = pCmd->Offset;
Reply.Data.Size = pCmd->Size; Reply.Data.Size = pCmd->Size;
if (bHasCustomAesKey) if (bHasCustomAesKey)
bLocked = gIsLocked; bLocked = gIsLocked;
@@ -294,7 +299,7 @@ static void CMD_051D(const uint8_t *pBuffer)
if (!bIsLocked) if (!bIsLocked)
{ {
uint16_t i; unsigned int i;
for (i = 0; i < (pCmd->Size / 8); i++) for (i = 0; i < (pCmd->Size / 8); i++)
{ {
const uint16_t Offset = pCmd->Offset + (i * 8U); const uint16_t Offset = pCmd->Offset + (i * 8U);
@@ -331,23 +336,25 @@ static void CMD_0529(void)
{ {
REPLY_0529_t Reply; REPLY_0529_t Reply;
Reply.Header.ID = 0x52A; Reply.Header.ID = 0x52A;
Reply.Header.Size = sizeof(Reply.Data); Reply.Header.Size = sizeof(Reply.Data);
// Original doesn't actually send current! // Original doesn't actually send current!
BOARD_ADC_GetBatteryInfo(&Reply.Data.Voltage, &Reply.Data.Current); BOARD_ADC_GetBatteryInfo(&Reply.Data.Voltage, &Reply.Data.Current);
SendReply(&Reply, sizeof(Reply)); SendReply(&Reply, sizeof(Reply));
} }
static void CMD_052D(const uint8_t *pBuffer) static void CMD_052D(const uint8_t *pBuffer)
{ {
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer; const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
REPLY_052D_t Reply; REPLY_052D_t Reply;
bool bIsLocked; bool bIsLocked;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFmRadioCountdown_500ms = fm_radio_countdown_500ms; gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
#endif #endif
Reply.Header.ID = 0x052E; Reply.Header.ID = 0x052E;
Reply.Header.Size = sizeof(Reply.Data); Reply.Header.Size = sizeof(Reply.Data);
bIsLocked = bHasCustomAesKey; bIsLocked = bHasCustomAesKey;
@@ -413,15 +420,13 @@ static void CMD_052F(const uint8_t *pBuffer)
bool UART_IsCommandAvailable(void) bool UART_IsCommandAvailable(void)
{ {
uint16_t DmaLength;
uint16_t CommandLength;
uint16_t Index; uint16_t Index;
uint16_t TailIndex; uint16_t TailIndex;
uint16_t Size; uint16_t Size;
uint16_t CRC; uint16_t CRC;
uint16_t i; uint16_t CommandLength;
uint16_t DmaLength = DMA_CH0->ST & 0xFFFU;
DmaLength = DMA_CH0->ST & 0xFFFU;
while (1) while (1)
{ {
if (gUART_WriteIndex == DmaLength) if (gUART_WriteIndex == DmaLength)
@@ -450,7 +455,7 @@ bool UART_IsCommandAvailable(void)
Index = DMA_INDEX(gUART_WriteIndex, 2); Index = DMA_INDEX(gUART_WriteIndex, 2);
Size = (UART_DMA_Buffer[DMA_INDEX(Index, 1)] << 8) | UART_DMA_Buffer[Index]; Size = (UART_DMA_Buffer[DMA_INDEX(Index, 1)] << 8) | UART_DMA_Buffer[Index];
if ((Size + 8) > sizeof(UART_DMA_Buffer)) if ((Size + 8u) > sizeof(UART_DMA_Buffer))
{ {
gUART_WriteIndex = DmaLength; gUART_WriteIndex = DmaLength;
return false; return false;
@@ -495,8 +500,11 @@ bool UART_IsCommandAvailable(void)
bIsEncrypted = true; bIsEncrypted = true;
if (bIsEncrypted) if (bIsEncrypted)
for (i = 0; i < Size + 2; i++) {
unsigned int i;
for (i = 0; i < (Size + 2u); i++)
UART_Command.Buffer[i] ^= Obfuscation[i % 16]; UART_Command.Buffer[i] ^= Obfuscation[i % 16];
}
CRC = UART_Command.Buffer[Size] | (UART_Command.Buffer[Size + 1] << 8); CRC = UART_Command.Buffer[Size] | (UART_Command.Buffer[Size + 1] << 8);

View File

@@ -142,6 +142,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
SYSTEM_DelayMs(60); SYSTEM_DelayMs(60);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (Beep) switch (Beep)
{ {
case BEEP_880HZ_60MS_TRIPLE_BEEP: case BEEP_880HZ_60MS_TRIPLE_BEEP:
@@ -181,6 +184,8 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
break; break;
} }
#pragma GCC diagnostic pop
SYSTEM_DelayMs(Duration); SYSTEM_DelayMs(Duration);
BK4819_EnterTxMute(); BK4819_EnterTxMute();
SYSTEM_DelayMs(20); SYSTEM_DelayMs(20);

View File

@@ -281,54 +281,7 @@ const uint8_t BITMAP_TDR2[12] =
0b00110001 0b00110001
}; };
#endif #endif
/*
const uint8_t BITMAP_SC1[8] =
{ // "I"
0b01000001,
0b01000001,
0b01111111,
0b01111111,
0b01111111,
0b01000001,
0b01000001,
0b00000000
};
const uint8_t BITMAP_SC2[8] =
{ // "II"
0b01000001,
0b01111111,
0b01111111,
0b01000001,
0b01111111,
0b01111111,
0b01000001,
0b00000000
};
*/
/*
const uint8_t BITMAP_SC1[7] =
{ // "1"
0b01000000,
0b01000000,
0b01000110,
0b01111111,
0b01000000,
0b01000000,
0b00000000
};
const uint8_t BITMAP_SC2[7] =
{ // "2"
0b01000010,
0b01100001,
0b01010001,
0b01001001,
0b01001001,
0b01000110,
0b00000000
};
*/
const uint8_t BITMAP_Antenna[5] = const uint8_t BITMAP_Antenna[5] =
{ {
0b00000011, 0b00000011,

View File

@@ -46,11 +46,6 @@ extern const uint8_t BITMAP_TDR2[12];
extern const uint8_t BITMAP_NOAA[12]; extern const uint8_t BITMAP_NOAA[12];
#endif #endif
//extern const uint8_t BITMAP_SC1[8];
//extern const uint8_t BITMAP_SC2[8];
//extern const uint8_t BITMAP_SC1[7];
//extern const uint8_t BITMAP_SC2[7];
extern const uint8_t BITMAP_Antenna[5]; extern const uint8_t BITMAP_Antenna[5];
extern const uint8_t BITMAP_AntennaLevel1[3]; extern const uint8_t BITMAP_AntennaLevel1[3];
extern const uint8_t BITMAP_AntennaLevel2[3]; extern const uint8_t BITMAP_AntennaLevel2[3];

View File

@@ -687,7 +687,8 @@ void BOARD_EEPROM_Init(void)
// 0F18..0F1F // 0F18..0F1F
EEPROM_ReadBuffer(0x0F18, Data, 8); EEPROM_ReadBuffer(0x0F18, Data, 8);
gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false; // gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false;
gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 3) ? Data[0] : false; // we now have 'all' channel scan option
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
const unsigned int j = 1 + (i * 3); const unsigned int j = 1 + (i * 3);

View File

@@ -134,9 +134,9 @@ void ADC_Configure(ADC_Config_t *pAdc)
; ;
if (SARADC_IE == 0) { if (SARADC_IE == 0) {
NVIC_DisableIRQ(DP32_SARADC_IRQn); NVIC_DisableIRQ((IRQn_Type)DP32_SARADC_IRQn);
} else { } else {
NVIC_EnableIRQ(DP32_SARADC_IRQn); NVIC_EnableIRQ((IRQn_Type)DP32_SARADC_IRQn);
} }
} }

View File

@@ -24,6 +24,8 @@ static void AES_Setup_ENC_CBC(bool IsDecrypt, const void *pKey, const void *pIv)
const uint32_t *pK = (const uint32_t *)pKey; const uint32_t *pK = (const uint32_t *)pKey;
const uint32_t *pI = (const uint32_t *)pIv; const uint32_t *pI = (const uint32_t *)pIv;
(void)IsDecrypt; // unused
AES_CR = (AES_CR & ~AES_CR_EN_MASK) | AES_CR_EN_BITS_DISABLE; AES_CR = (AES_CR & ~AES_CR_EN_MASK) | AES_CR_EN_BITS_DISABLE;
AES_CR = AES_CR_CHMOD_BITS_CBC; AES_CR = AES_CR_CHMOD_BITS_CBC;
AES_KEYR3 = pK[0]; AES_KEYR3 = pK[0];

View File

@@ -602,8 +602,8 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
{ // make the RX bandwidth the same with weak signals { // make the RX bandwidth the same with weak signals
val = val =
(0u << 15) | // 0 (0u << 15) | // 0
(5u << 12) | // *3 RF filter bandwidth (4u << 12) | // *3 RF filter bandwidth
(5u << 9) | // *0 RF filter bandwidth when signal is weak (4u << 9) | // *0 RF filter bandwidth when signal is weak
(6u << 6) | // *0 AFTxLPF2 filter Band Width (6u << 6) | // *0 AFTxLPF2 filter Band Width
(2u << 4) | // 2 BW Mode Selection (2u << 4) | // 2 BW Mode Selection
(1u << 3) | // 1 (1u << 3) | // 1
@@ -614,7 +614,7 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
{ // with weak RX signals the RX bandwidth is reduced { // with weak RX signals the RX bandwidth is reduced
val = // 0x3028); // 0 011 000 000 10 1 0 00 val = // 0x3028); // 0 011 000 000 10 1 0 00
(0u << 15) | // 0 (0u << 15) | // 0
(5u << 12) | // *3 RF filter bandwidth (4u << 12) | // *3 RF filter bandwidth
(2u << 9) | // *0 RF filter bandwidth when signal is weak (2u << 9) | // *0 RF filter bandwidth when signal is weak
(6u << 6) | // *0 AFTxLPF2 filter Band Width (6u << 6) | // *0 AFTxLPF2 filter Band Width
(2u << 4) | // 2 BW Mode Selection (2u << 4) | // 2 BW Mode Selection
@@ -629,8 +629,8 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
{ {
val = val =
(0u << 15) | // 0 (0u << 15) | // 0
(5u << 12) | // *4 RF filter bandwidth (4u << 12) | // *4 RF filter bandwidth
(5u << 9) | // *0 RF filter bandwidth when signal is weak (4u << 9) | // *0 RF filter bandwidth when signal is weak
(0u << 6) | // *1 AFTxLPF2 filter Band Width (0u << 6) | // *1 AFTxLPF2 filter Band Width
(0u << 4) | // 0 BW Mode Selection (0u << 4) | // 0 BW Mode Selection
(1u << 3) | // 1 (1u << 3) | // 1
@@ -641,7 +641,7 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
{ {
val = // 0x4048); // 0 100 000 001 00 1 0 00 val = // 0x4048); // 0 100 000 001 00 1 0 00
(0u << 15) | // 0 (0u << 15) | // 0
(5u << 12) | // *4 RF filter bandwidth (4u << 12) | // *4 RF filter bandwidth
(2u << 9) | // *0 RF filter bandwidth when signal is weak (2u << 9) | // *0 RF filter bandwidth when signal is weak
(0u << 6) | // *1 AFTxLPF2 filter Band Width (0u << 6) | // *1 AFTxLPF2 filter Band Width
(0u << 4) | // 0 BW Mode Selection (0u << 4) | // 0 BW Mode Selection
@@ -738,7 +738,7 @@ void BK4819_SetupSquelch(
// //
BK4819_WriteRegister(BK4819_REG_70, 0); BK4819_WriteRegister(BK4819_REG_70, 0);
// Glitch threshold for Squelch // Glitch threshold for Squelch = close
// //
// 0 ~ 255 // 0 ~ 255
// //
@@ -748,47 +748,49 @@ void BK4819_SetupSquelch(
// //
// <15:14> 1 ??? // <15:14> 1 ???
// //
// <13:11> 5 Squelch = 1 Delay Setting // <13:11> 5 Squelch = open Delay Setting
// 0 ~ 7 // 0 ~ 7
// //
// <10:9> 7 Squelch = 0 Delay Setting // <10:9> 7 Squelch = close Delay Setting
// 0 ~ 3 // 0 ~ 3
// //
// <8> 0 ??? // <8> 0 ???
// //
// <7:0> 8 Glitch threshold for Squelch = 1 // <7:0> 8 Glitch threshold for Squelch = open
// 0 ~ 255 // 0 ~ 255
// //
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000 BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
#ifndef ENABLE_FASTER_CHANNEL_SCAN #ifndef ENABLE_FASTER_CHANNEL_SCAN
// original // original (*)
(1u << 14) | // 1 ??? (1u << 14) | // 1 ???
(5u << 11) | // 5 squelch = 1 delay .. 0 ~ 7 (3u << 11) | // *5 squelch = open delay .. 0 ~ 7
(3u << 9) | // 3 squelch = 0 delay .. 0 ~ 3 (2u << 9) | // *3 squelch = close delay .. 0 ~ 3
SquelchOpenGlitchThresh); // 0 ~ 255 SquelchOpenGlitchThresh); // 0 ~ 255
#else #else
// faster (but twitchier) // faster (but twitchier)
(1u << 14) | // 1 ??? (1u << 14) | // 1 ???
SquelchOpenGlitchThresh); // 0 ~ 255 (2u << 11) | // *5 squelch = open delay .. 0 ~ 7
(1u << 9) | // *3 squelch = close delay .. 0 ~ 3
SquelchOpenGlitchThresh); // 0 ~ 255
#endif #endif
// REG_4F // REG_4F
// //
// <14:8> 47 Ex-noise threshold for Squelch = 0 // <14:8> 47 Ex-noise threshold for Squelch = close
// 0 ~ 127 // 0 ~ 127
// //
// <7> ??? // <7> ???
// //
// <6:0> 46 Ex-noise threshold for Squelch = 1 // <6:0> 46 Ex-noise threshold for Squelch = open
// 0 ~ 127 // 0 ~ 127
// //
BK4819_WriteRegister(BK4819_REG_4F, ((uint16_t)SquelchCloseNoiseThresh << 8) | SquelchOpenNoiseThresh); BK4819_WriteRegister(BK4819_REG_4F, ((uint16_t)SquelchCloseNoiseThresh << 8) | SquelchOpenNoiseThresh);
// REG_78 // REG_78
// //
// <15:8> 72 RSSI threshold for Squelch = 1 0.5dB/step // <15:8> 72 RSSI threshold for Squelch = open 0.5dB/step
// //
// <7:0> 70 RSSI threshold for Squelch = 0 0.5dB/step // <7:0> 70 RSSI threshold for Squelch = close 0.5dB/step
// //
BK4819_WriteRegister(BK4819_REG_78, ((uint16_t)SquelchOpenRSSIThresh << 8) | SquelchCloseRSSIThresh); BK4819_WriteRegister(BK4819_REG_78, ((uint16_t)SquelchOpenRSSIThresh << 8) | SquelchCloseRSSIThresh);
@@ -1002,6 +1004,42 @@ void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch)
BK4819_WriteRegister(BK4819_REG_71, scale_freq(Frequency)); BK4819_WriteRegister(BK4819_REG_71, scale_freq(Frequency));
} }
void BK4819_PlaySingleTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level, const bool play_speaker)
{
BK4819_EnterTxMute();
if (play_speaker)
{
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
BK4819_SetAF(BK4819_AF_BEEP);
}
else
BK4819_SetAF(BK4819_AF_MUTE);
// level 0 ~ 127
// BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
// BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | (28u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_EnableTXLink();
SYSTEM_DelayMs(50);
BK4819_WriteRegister(BK4819_REG_71, scale_freq(tone_Hz));
BK4819_ExitTxMute();
SYSTEM_DelayMs(delay);
BK4819_EnterTxMute();
if (play_speaker)
{
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
BK4819_SetAF(BK4819_AF_MUTE);
}
BK4819_WriteRegister(BK4819_REG_70, 0x0000);
BK4819_WriteRegister(BK4819_REG_30, 0xC1FE);
}
void BK4819_EnterTxMute(void) void BK4819_EnterTxMute(void)
{ {
BK4819_WriteRegister(BK4819_REG_50, 0xBB20); BK4819_WriteRegister(BK4819_REG_50, 0xBB20);
@@ -1285,7 +1323,7 @@ void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency)
// set the tone amplitude // set the tone amplitude
// //
// BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_MASK_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); // BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_MASK_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_MASK_ENABLE_TONE1 | (50u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_MASK_ENABLE_TONE1 | (28u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_WriteRegister(BK4819_REG_71, scale_freq(Frequency)); BK4819_WriteRegister(BK4819_REG_71, scale_freq(Frequency));
@@ -1629,7 +1667,9 @@ void BK4819_PlayRoger(void)
BK4819_EnterTxMute(); BK4819_EnterTxMute();
BK4819_SetAF(BK4819_AF_MUTE); BK4819_SetAF(BK4819_AF_MUTE);
BK4819_WriteRegister(BK4819_REG_70, 0xE000); // 1110 0000 0000 0000
// BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | (28u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_EnableTXLink(); BK4819_EnableTXLink();
SYSTEM_DelayMs(50); SYSTEM_DelayMs(50);

View File

@@ -102,6 +102,7 @@ void BK4819_DisableVox(void);
void BK4819_DisableDTMF(void); void BK4819_DisableDTMF(void);
void BK4819_EnableDTMF(void); void BK4819_EnableDTMF(void);
void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch); void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch);
void BK4819_PlaySingleTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level, const bool play_speaker);
void BK4819_EnterTxMute(void); void BK4819_EnterTxMute(void);
void BK4819_ExitTxMute(void); void BK4819_ExitTxMute(void);
void BK4819_Sleep(void); void BK4819_Sleep(void);

View File

@@ -58,10 +58,10 @@ enum GPIOC_PINS {
GPIOC_PIN_PTT = 5 GPIOC_PIN_PTT = 5
}; };
void GPIO_ClearBit(volatile uint32_t *pReg, uint8_t Bit); void GPIO_ClearBit(volatile uint32_t *pReg, uint8_t Bit);
uint8_t GPIO_CheckBit(volatile uint32_t *pReg, uint8_t Bit); uint8_t GPIO_CheckBit(volatile uint32_t *pReg, uint8_t Bit);
void GPIO_FlipBit(volatile uint32_t *pReg, uint8_t Bit); void GPIO_FlipBit( volatile uint32_t *pReg, uint8_t Bit);
void GPIO_SetBit(volatile uint32_t *pReg, uint8_t Bit); void GPIO_SetBit( volatile uint32_t *pReg, uint8_t Bit);
#endif #endif

View File

@@ -22,76 +22,74 @@
#include "driver/i2c.h" #include "driver/i2c.h"
#include "misc.h" #include "misc.h"
KEY_Code_t gKeyReading0 = KEY_INVALID; KEY_Code_t gKeyReading0 = KEY_INVALID;
KEY_Code_t gKeyReading1 = KEY_INVALID; KEY_Code_t gKeyReading1 = KEY_INVALID;
uint16_t gDebounceCounter; uint16_t gDebounceCounter = 0;
bool gWasFKeyPressed; bool gWasFKeyPressed = false;
static const struct { static const struct {
// Using a 16 bit pre-calculated shift and invert is cheaper
// than using 8 bit and doing shift and invert in code.
uint16_t set_to_zero_mask;
//We are very fortunate. // Using a 16 bit pre-calculated shift and invert is cheaper
//The key and pin defines fit together in a single u8, // than using 8 bit and doing shift and invert in code.
//making this very efficient uint16_t set_to_zero_mask;
struct {
uint8_t key : 5; //Key 23 is highest // We are very fortunate.
uint8_t pin : 3; //Pin 6 is highest // The key and pin defines fit together in a single u8, making this very efficient
} pins[4]; struct {
} keyboard[5] = { uint8_t key : 5; // Key 23 is highest
/* Zero row */ uint8_t pin : 3; // Pin 6 is highest
{ } pins[4];
//Set to zero to handle special case of nothing pulled down.
.set_to_zero_mask = ~(0), } keyboard[] = {
.pins = {
{ .key = KEY_SIDE1, .pin = GPIOA_PIN_KEYBOARD_0}, { // Zero row
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1}, // Set to zero to handle special case of nothing pulled down
/* Duplicate to fill the array with valid values */ .set_to_zero_mask = 0xffff,
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1}, .pins = {
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1}, { .key = KEY_SIDE1, .pin = GPIOA_PIN_KEYBOARD_0},
} { .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
},
/* First row */ // Duplicate to fill the array with valid values
{ { .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1},
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_4), { .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1}
.pins = { }
{ .key = KEY_MENU, .pin = GPIOA_PIN_KEYBOARD_0}, },
{ .key = KEY_1, .pin = GPIOA_PIN_KEYBOARD_1}, { // First row
{ .key = KEY_4, .pin = GPIOA_PIN_KEYBOARD_2}, .set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_4) & 0xffff,
{ .key = KEY_7, .pin = GPIOA_PIN_KEYBOARD_3}, .pins = {
} { .key = KEY_MENU, .pin = GPIOA_PIN_KEYBOARD_0},
}, { .key = KEY_1, .pin = GPIOA_PIN_KEYBOARD_1},
/* Second row */ { .key = KEY_4, .pin = GPIOA_PIN_KEYBOARD_2},
{ { .key = KEY_7, .pin = GPIOA_PIN_KEYBOARD_3}
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_5), }
.pins = { },
{ .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0}, { // Second row
{ .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1}, .set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_5) & 0xffff,
{ .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2}, .pins = {
{ .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3}, { .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0},
} { .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1},
}, { .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2},
/* Third row */ { .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3}
{ }
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_6), },
.pins = { { // Third row
{ .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0}, .set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_6) & 0xffff,
{ .key = KEY_3 , .pin = GPIOA_PIN_KEYBOARD_1}, .pins = {
{ .key = KEY_6 , .pin = GPIOA_PIN_KEYBOARD_2}, { .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0},
{ .key = KEY_9 , .pin = GPIOA_PIN_KEYBOARD_3}, { .key = KEY_3 , .pin = GPIOA_PIN_KEYBOARD_1},
} { .key = KEY_6 , .pin = GPIOA_PIN_KEYBOARD_2},
}, { .key = KEY_9 , .pin = GPIOA_PIN_KEYBOARD_3}
/* Fourth row */ }
{ },
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_7), { // Fourth row
.pins = { .set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_7) & 0xffff,
{ .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0}, .pins = {
{ .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1}, { .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0},
{ .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2}, { .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1},
{ .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3}, { .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2},
} { .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3}
}, }
}
}; };
KEY_Code_t KEYBOARD_Poll(void) KEY_Code_t KEYBOARD_Poll(void)
@@ -101,42 +99,48 @@ KEY_Code_t KEYBOARD_Poll(void)
// if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT)) // if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
// return KEY_PTT; // return KEY_PTT;
// ***************** // *****************
for(int j = 0; j < ARRAY_SIZE(keyboard); j++) {
//Set all high
GPIOA->DATA |= 1 << GPIOA_PIN_KEYBOARD_4 |
1 << GPIOA_PIN_KEYBOARD_5 |
1 << GPIOA_PIN_KEYBOARD_6 |
1 << GPIOA_PIN_KEYBOARD_7 ;
//Clear the pin we are selecting
GPIOA->DATA &= keyboard[j].set_to_zero_mask;
//Wait for the pins to stabilize. 1 works for me. for (unsigned int j = 0; j < ARRAY_SIZE(keyboard); j++)
SYSTICK_DelayUs(2); {
uint16_t reg;
// Read all 4 GPIO pins at once // Set all high
uint16_t reg = GPIOA->DATA; GPIOA->DATA |= 1u << GPIOA_PIN_KEYBOARD_4 |
for(int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++) 1u << GPIOA_PIN_KEYBOARD_5 |
{ 1u << GPIOA_PIN_KEYBOARD_6 |
uint16_t mask = 1 << keyboard[j].pins[i].pin; 1u << GPIOA_PIN_KEYBOARD_7;
if(! (reg & mask)) {
Key = keyboard[j].pins[i].key;
break;
}
}
if (Key != KEY_INVALID) // Clear the pin we are selecting
break; GPIOA->DATA &= keyboard[j].set_to_zero_mask;
}
//Create I2C stop condition. Since we might have toggled I2C pins. // Wait for the pins to stabilize
//This leaves GPIOA_PIN_KEYBOARD_4 and GPIOA_PIN_KEYBOARD_5 high SYSTICK_DelayUs(1);
I2C_Stop();
// Read all 4 GPIO pins at once
reg = GPIOA->DATA;
for (unsigned int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++)
{
const uint16_t mask = 1u << keyboard[j].pins[i].pin;
if (!(reg & mask))
{
Key = keyboard[j].pins[i].key;
break;
}
}
if (Key != KEY_INVALID)
break;
}
// Create I2C stop condition since we might have toggled I2C pins
// This leaves GPIOA_PIN_KEYBOARD_4 and GPIOA_PIN_KEYBOARD_5 high
I2C_Stop();
// Reset VOICE pins // Reset VOICE pins
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6); GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7); GPIO_SetBit( &GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
return Key; return Key;
} }

View File

@@ -21,30 +21,28 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
enum KEY_Code_t { typedef enum {
KEY_0 = 0, KEY_INVALID = 0,
KEY_1 = 1, KEY_0,
KEY_2 = 2, KEY_1,
KEY_3 = 3, KEY_2,
KEY_4 = 4, KEY_3,
KEY_5 = 5, KEY_4,
KEY_6 = 6, KEY_5,
KEY_7 = 7, KEY_6,
KEY_8 = 8, KEY_7,
KEY_9 = 9, KEY_8,
KEY_MENU = 10, KEY_9,
KEY_UP = 11, KEY_MENU,
KEY_DOWN = 12, KEY_UP,
KEY_EXIT = 13, KEY_DOWN,
KEY_STAR = 14, KEY_EXIT,
KEY_F = 15, KEY_STAR,
KEY_PTT = 21, KEY_F,
KEY_SIDE2 = 22, KEY_PTT,
KEY_SIDE1 = 23, KEY_SIDE2,
KEY_INVALID = 255 KEY_SIDE1
}; } KEY_Code_t;
typedef enum KEY_Code_t KEY_Code_t;
extern KEY_Code_t gKeyReading0; extern KEY_Code_t gKeyReading0;
extern KEY_Code_t gKeyReading1; extern KEY_Code_t gKeyReading1;

View File

@@ -93,9 +93,9 @@ void SPI_Configure(volatile SPI_Port_t *pPort, SPI_Config_t *pConfig)
if (pPort->IE) { if (pPort->IE) {
if (pPort == SPI0) { if (pPort == SPI0) {
NVIC_EnableIRQ(DP32_SPI0_IRQn); NVIC_EnableIRQ((IRQn_Type)DP32_SPI0_IRQn);
} else if (pPort == SPI1) { } else if (pPort == SPI1) {
NVIC_EnableIRQ(DP32_SPI1_IRQn); NVIC_EnableIRQ((IRQn_Type)DP32_SPI1_IRQn);
} }
} }
} }

View File

@@ -123,6 +123,7 @@ void ST7565_FillScreen(uint8_t Value)
ST7565_Init(false); ST7565_Init(false);
SPI_ToggleMasterMode(&SPI0->CR, false); SPI_ToggleMasterMode(&SPI0->CR, false);
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
unsigned int j; unsigned int j;
@@ -135,6 +136,7 @@ void ST7565_FillScreen(uint8_t Value)
} }
SPI_WaitForUndocumentedTxFifoStatusBit(); SPI_WaitForUndocumentedTxFifoStatusBit();
} }
SPI_ToggleMasterMode(&SPI0->CR, true); SPI_ToggleMasterMode(&SPI0->CR, true);
} }
@@ -152,6 +154,8 @@ void ST7565_Init(const bool full)
SYSTEM_DelayMs(120); SYSTEM_DelayMs(120);
} }
else
SPI_ToggleMasterMode(&SPI0->CR, false);
ST7565_WriteByte(0xA2); // bias 9 ST7565_WriteByte(0xA2); // bias 9
ST7565_WriteByte(0xC0); // com normal ST7565_WriteByte(0xC0); // com normal
@@ -164,9 +168,10 @@ void ST7565_Init(const bool full)
ST7565_WriteByte(0x24); // ST7565_WriteByte(0x24); //
ST7565_WriteByte(0x81); // volume first ? ST7565_WriteByte(0x81); // volume first ?
ST7565_WriteByte(0x1f); // contrast ?
if (full) if (full)
{ {
ST7565_WriteByte(0x1f); // contrast ?
ST7565_WriteByte(0x2B); // power control ? ST7565_WriteByte(0x2B); // power control ?
SYSTEM_DelayMs(1); SYSTEM_DelayMs(1);
@@ -181,11 +186,11 @@ void ST7565_Init(const bool full)
ST7565_WriteByte(0x2F); // ST7565_WriteByte(0x2F); //
SYSTEM_DelayMs(40); SYSTEM_DelayMs(40);
ST7565_WriteByte(0x40); // start line ?
ST7565_WriteByte(0xAF); // display on ?
} }
ST7565_WriteByte(0x40); // start line ?
ST7565_WriteByte(0xAF); // display on ?
SPI_WaitForUndocumentedTxFifoStatusBit(); SPI_WaitForUndocumentedTxFifoStatusBit();
SPI_ToggleMasterMode(&SPI0->CR, true); SPI_ToggleMasterMode(&SPI0->CR, true);

460
font.c
View File

@@ -19,6 +19,7 @@
//const uint8_t gFontBig[95][16] = //const uint8_t gFontBig[95][16] =
const uint8_t gFontBig[95][15] = const uint8_t gFontBig[95][15] =
{ {
#if 0
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' ' {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' '
{0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!' {0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!'
{0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"' {0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"'
@@ -114,6 +115,103 @@ const uint8_t gFontBig[95][15] =
{0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00}, // , 0x00}, // '|' {0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00}, // , 0x00}, // '|'
{0x00, 0x08, 0x08, 0x78, 0xF0, 0x80, 0x80, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00}, // , 0x00}, // '}' {0x00, 0x08, 0x08, 0x78, 0xF0, 0x80, 0x80, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00}, // , 0x00}, // '}'
{0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->' {0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->'
#else
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00},
{0x00, 0x0F, 0x1F, 0x00, 0x00, 0x1F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x20, 0xF8, 0xF8, 0x20, 0xF8, 0xF8, 0x20, 0x00, 0x02, 0x0F, 0x0F, 0x02, 0x0F, 0x0F, 0x02},
{0x70, 0xF8, 0x88, 0x8E, 0x8E, 0x98, 0x10, 0x00, 0x04, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07},
{0x30, 0x30, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x00, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x0C, 0x0C},
{0x80, 0xD8, 0x7C, 0xE4, 0xBC, 0xD8, 0x40, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08},
{0x00, 0x10, 0x1F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0xF0, 0xF8, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0C, 0x08, 0x00},
{0x00, 0x00, 0x04, 0x0C, 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0C, 0x07, 0x03, 0x00},
{0x00, 0x80, 0xA0, 0xE0, 0xC0, 0xE0, 0xA0, 0x80, 0x00, 0x00, 0x02, 0x03, 0x01, 0x03, 0x02},
{0x00, 0x80, 0x80, 0xE0, 0xE0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1E, 0x0E, 0x00, 0x00},
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x00, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00},
{0xF8, 0xFC, 0x84, 0xC4, 0x64, 0xFC, 0xF8, 0x00, 0x07, 0x0F, 0x09, 0x08, 0x08, 0x0F, 0x07},
{0x00, 0x10, 0x18, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08},
{0x18, 0x1C, 0x04, 0x84, 0xC4, 0x7C, 0x38, 0x00, 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08},
{0x18, 0x1C, 0x44, 0x44, 0x44, 0xFC, 0xB8, 0x00, 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0x80, 0xC0, 0x60, 0x30, 0x18, 0xFC, 0xFC, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x0F},
{0x7C, 0x7C, 0x44, 0x44, 0x44, 0xC4, 0x84, 0x00, 0x04, 0x0C, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0xF0, 0xF8, 0x4C, 0x44, 0x44, 0xC4, 0x80, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0x04, 0x04, 0x04, 0x84, 0xE4, 0x7C, 0x1C, 0x00, 0x00, 0x00, 0x0E, 0x0F, 0x01, 0x00, 0x00},
{0xB8, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0x78, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, 0x00, 0x00, 0x08, 0x08, 0x08, 0x0C, 0x07, 0x03},
{0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0E, 0x06, 0x00, 0x00},
{0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, 0x00, 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x08},
{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02},
{0x00, 0x08, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x08, 0x0C, 0x06, 0x03, 0x01, 0x00},
{0x38, 0x3C, 0x04, 0x84, 0xC4, 0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00},
{0xF0, 0xF8, 0x08, 0xC8, 0xC8, 0xF8, 0xF0, 0x00, 0x07, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x01},
{0xF8, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0x1C, 0x18, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0E, 0x06},
{0xFC, 0xFC, 0x04, 0x04, 0x0C, 0xF8, 0xF0, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x0C, 0x07, 0x03},
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08},
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xF8, 0xFC, 0x04, 0x84, 0x84, 0x9C, 0x98, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0xFC, 0xFC, 0x40, 0x40, 0x40, 0xFC, 0xFC, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00},
{0x00, 0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, 0x06, 0x0E, 0x08, 0x08, 0x0F, 0x07, 0x00},
{0xFC, 0xFC, 0xE0, 0x30, 0x18, 0x0C, 0x04, 0x00, 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08},
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08},
{0xFC, 0xFC, 0x18, 0x70, 0x18, 0xFC, 0xFC, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
{0xFC, 0xFC, 0x60, 0xC0, 0x80, 0xFC, 0xFC, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0F},
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, 0x00, 0x07, 0x0F, 0x08, 0x0C, 0x0C, 0x1F, 0x17},
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, 0x00, 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08},
{0x38, 0x7C, 0x44, 0x44, 0x44, 0xCC, 0x88, 0x00, 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0x00, 0x04, 0x04, 0xFC, 0xFC, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00},
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0x7C, 0xFC, 0x80, 0x00, 0x80, 0xFC, 0x7C, 0x00, 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00},
{0xFC, 0xFC, 0x00, 0x80, 0x00, 0xFC, 0xFC, 0x00, 0x0F, 0x0F, 0x06, 0x03, 0x06, 0x0F, 0x0F},
{0x0C, 0x3C, 0xF0, 0xC0, 0xF0, 0x3C, 0x0C, 0x00, 0x0C, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0x0C},
{0x00, 0x3C, 0x7C, 0xC0, 0xC0, 0x7C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00},
{0x04, 0x04, 0x84, 0xC4, 0x64, 0x3C, 0x1C, 0x00, 0x0E, 0x0F, 0x09, 0x08, 0x08, 0x08, 0x08},
{0x00, 0x00, 0xFC, 0xFC, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x00},
{0x38, 0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E},
{0x00, 0x00, 0x04, 0x04, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x00},
{0x08, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20},
{0x00, 0x00, 0x03, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, 0xC0, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F},
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x60, 0x40, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0C, 0x04},
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xFC, 0xFC, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F},
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x07, 0x0F, 0x09, 0x09, 0x09, 0x09, 0x01},
{0x20, 0x20, 0xF8, 0xFC, 0x24, 0x24, 0x04, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00},
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, 0x00, 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F},
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
{0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, 0x30, 0x70, 0x40, 0x40, 0x7F, 0x3F},
{0xFC, 0xFC, 0x00, 0x80, 0xC0, 0x60, 0x20, 0x00, 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08},
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00},
{0xE0, 0xE0, 0x20, 0xE0, 0x20, 0xE0, 0xC0, 0x00, 0x0F, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x0F},
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x7F, 0x7F, 0x08, 0x08, 0x08, 0x0F, 0x07},
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x7F, 0x7F},
{0xE0, 0xE0, 0x60, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x08, 0x09, 0x09, 0x09, 0x09, 0x0F, 0x06},
{0x20, 0x20, 0xFC, 0xFC, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08},
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F},
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00},
{0xE0, 0xE0, 0x00, 0x80, 0x00, 0xE0, 0xE0, 0x00, 0x07, 0x0F, 0x08, 0x0F, 0x08, 0x0F, 0x07},
{0x60, 0xE0, 0x80, 0x00, 0x80, 0xE0, 0x60, 0x00, 0x0C, 0x0E, 0x03, 0x01, 0x03, 0x0E, 0x0C},
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F},
{0x20, 0x20, 0x20, 0xA0, 0xE0, 0x60, 0x20, 0x00, 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08},
{0x00, 0x00, 0x40, 0xF8, 0xBC, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08},
{0x00, 0x00, 0x00, 0xBC, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00},
{0x00, 0x04, 0x04, 0xBC, 0xF8, 0x40, 0x00, 0x00, 0x00, 0x08, 0x08, 0x0F, 0x07, 0x00, 0x00},
{0x08, 0x0C, 0x04, 0x0C, 0x08, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
#endif
}; };
#if 0 #if 0
@@ -132,7 +230,7 @@ const uint8_t gFontBig[95][15] =
{0x00, 0xF0, 0xF8, 0xB8, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0xB8, 0xF0, 0xE0, 0x00, 0x11, 0x33, 0x77, 0x67, 0x66, 0x66, 0x66, 0x76, 0x33, 0x3F, 0x1F, 0x07}, {0x00, 0xF0, 0xF8, 0xB8, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0xB8, 0xF0, 0xE0, 0x00, 0x11, 0x33, 0x77, 0x67, 0x66, 0x66, 0x66, 0x76, 0x33, 0x3F, 0x1F, 0x07},
{0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00} {0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}
}; };
#else #elif 0
// VCR font // VCR font
const uint8_t gFontBigDigits[11][26] = const uint8_t gFontBigDigits[11][26] =
{ {
@@ -148,6 +246,22 @@ const uint8_t gFontBig[95][15] =
{0x00, 0x00, 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0x86, 0xFC, 0xF8, 0x00, 0x00, 0x00, 0x18, 0x38, 0x71, 0x61, 0x61, 0x61, 0x61, 0x71, 0x3F, 0x1F, 0x00}, {0x00, 0x00, 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0x86, 0xFC, 0xF8, 0x00, 0x00, 0x00, 0x18, 0x38, 0x71, 0x61, 0x61, 0x61, 0x61, 0x71, 0x3F, 0x1F, 0x00},
{0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00} {0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}
}; };
#else
// Terminus font
const uint8_t gFontBigDigits[11][26] =
{
{0x00, 0x00, 0xFC, 0xFE, 0xFE, 0x06, 0x86, 0xC6, 0xE6, 0xFE, 0xFE, 0xFC, 0x00, 0x00, 0x00, 0x3F, 0x7F, 0x7F, 0x67, 0x63, 0x61, 0x60, 0x7F, 0x7F, 0x3F, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x60, 0x60, 0x00, 0x00},
{0x00, 0x00, 0x1C, 0x1E, 0x1E, 0x06, 0x06, 0x06, 0x86, 0xFE, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x60, 0x70, 0x78, 0x7C, 0x6E, 0x67, 0x63, 0x61, 0x60, 0x60, 0x00},
{0x00, 0x00, 0x0C, 0x0E, 0x0E, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x30, 0x70, 0x70, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3E, 0x00},
{0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x7F, 0x7F, 0x7F, 0x00},
{0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x86, 0x00, 0x00, 0x00, 0x30, 0x70, 0x70, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, 0x00},
{0x00, 0x00, 0xF8, 0xFC, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x80, 0x00, 0x00, 0x00, 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, 0x00},
{0x00, 0x00, 0x0E, 0x0E, 0x0E, 0x06, 0x06, 0x86, 0xE6, 0xFE, 0x7E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x7F, 0x7F, 0x03, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x7C, 0xFE, 0xFE, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x3F, 0x7F, 0x7F, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3F, 0x00},
{0x00, 0x00, 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, 0x00, 0x00, 0x00, 0x01, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x7F, 0x3F, 0x1F, 0x00},
{0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}
};
#endif #endif
/* /*
const uint8_t gFontSmallDigits[11][7] = const uint8_t gFontSmallDigits[11][7] =
@@ -165,174 +279,6 @@ const uint8_t gFontSmallDigits[11][7] =
{0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00} // '-' {0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00} // '-'
}; };
*/ */
#ifdef ENABLE_SPECTRUM
const uint8_t gFont3x5[160][3] = {
{0x00, 0x00, 0x00}, // 32 - space
{0x00, 0x17, 0x00}, // 33 - exclam
{0x03, 0x00, 0x03}, // 34 - quotedbl
{0x1f, 0x0a, 0x1f}, // 35 - numbersign
{0x0a, 0x1f, 0x05}, // 36 - dollar
{0x09, 0x04, 0x12}, // 37 - percent
{0x0f, 0x17, 0x1c}, // 38 - ampersand
{0x00, 0x03, 0x00}, // 39 - quotesingle
{0x00, 0x0e, 0x11}, // 40 - parenleft
{0x11, 0x0e, 0x00}, // 41 - parenright
{0x05, 0x02, 0x05}, // 42 - asterisk
{0x04, 0x0e, 0x04}, // 43 - plus
{0x10, 0x08, 0x00}, // 44 - comma
{0x04, 0x04, 0x04}, // 45 - hyphen
{0x00, 0x10, 0x00}, // 46 - period
{0x18, 0x04, 0x03}, // 47 - slash
{0x1e, 0x11, 0x0f}, // 48 - zero
{0x02, 0x1f, 0x00}, // 49 - one
{0x19, 0x15, 0x12}, // 50 - two
{0x11, 0x15, 0x0a}, // 51 - three
{0x07, 0x04, 0x1f}, // 52 - four
{0x17, 0x15, 0x09}, // 53 - five
{0x1e, 0x15, 0x1d}, // 54 - six
{0x19, 0x05, 0x03}, // 55 - seven
{0x1f, 0x15, 0x1f}, // 56 - eight
{0x17, 0x15, 0x0f}, // 57 - nine
{0x00, 0x0a, 0x00}, // 58 - colon
{0x10, 0x0a, 0x00}, // 59 - semicolon
{0x04, 0x0a, 0x11}, // 60 - less
{0x0a, 0x0a, 0x0a}, // 61 - equal
{0x11, 0x0a, 0x04}, // 62 - greater
{0x01, 0x15, 0x03}, // 63 - question
{0x0e, 0x15, 0x16}, // 64 - at
{0x1e, 0x05, 0x1e}, // 65 - A
{0x1f, 0x15, 0x0a}, // 66 - B
{0x0e, 0x11, 0x11}, // 67 - C
{0x1f, 0x11, 0x0e}, // 68 - D
{0x1f, 0x15, 0x15}, // 69 - E
{0x1f, 0x05, 0x05}, // 70 - F
{0x0e, 0x15, 0x1d}, // 71 - G
{0x1f, 0x04, 0x1f}, // 72 - H
{0x11, 0x1f, 0x11}, // 73 - I
{0x08, 0x10, 0x0f}, // 74 - J
{0x1f, 0x04, 0x1b}, // 75 - K
{0x1f, 0x10, 0x10}, // 76 - L
{0x1f, 0x06, 0x1f}, // 77 - M
{0x1f, 0x0e, 0x1f}, // 78 - N
{0x0e, 0x11, 0x0e}, // 79 - O
{0x1f, 0x05, 0x02}, // 80 - P
{0x0e, 0x19, 0x1e}, // 81 - Q
{0x1f, 0x0d, 0x16}, // 82 - R
{0x12, 0x15, 0x09}, // 83 - S
{0x01, 0x1f, 0x01}, // 84 - T
{0x0f, 0x10, 0x1f}, // 85 - U
{0x07, 0x18, 0x07}, // 86 - V
{0x1f, 0x0c, 0x1f}, // 87 - W
{0x1b, 0x04, 0x1b}, // 88 - X
{0x03, 0x1c, 0x03}, // 89 - Y
{0x19, 0x15, 0x13}, // 90 - Z
{0x1f, 0x11, 0x11}, // 91 - bracketleft
{0x02, 0x04, 0x08}, // 92 - backslash
{0x11, 0x11, 0x1f}, // 93 - bracketright
{0x02, 0x01, 0x02}, // 94 - asciicircum
{0x10, 0x10, 0x10}, // 95 - underscore
{0x01, 0x02, 0x00}, // 96 - grave
{0x1a, 0x16, 0x1c}, // 97 - a
{0x1f, 0x12, 0x0c}, // 98 - b
{0x0c, 0x12, 0x12}, // 99 - c
{0x0c, 0x12, 0x1f}, // 100 - d
{0x0c, 0x1a, 0x16}, // 101 - e
{0x04, 0x1e, 0x05}, // 102 - f
{0x0c, 0x2a, 0x1e}, // 103 - g
{0x1f, 0x02, 0x1c}, // 104 - h
{0x00, 0x1d, 0x00}, // 105 - i
{0x10, 0x20, 0x1d}, // 106 - j
{0x1f, 0x0c, 0x12}, // 107 - k
{0x11, 0x1f, 0x10}, // 108 - l
{0x1e, 0x0e, 0x1e}, // 109 - m
{0x1e, 0x02, 0x1c}, // 110 - n
{0x0c, 0x12, 0x0c}, // 111 - o
{0x3e, 0x12, 0x0c}, // 112 - p
{0x0c, 0x12, 0x3e}, // 113 - q
{0x1c, 0x02, 0x02}, // 114 - r
{0x14, 0x1e, 0x0a}, // 115 - s
{0x02, 0x1f, 0x12}, // 116 - t
{0x0e, 0x10, 0x1e}, // 117 - u
{0x0e, 0x18, 0x0e}, // 118 - v
{0x1e, 0x1c, 0x1e}, // 119 - w
{0x12, 0x0c, 0x12}, // 120 - x
{0x06, 0x28, 0x1e}, // 121 - y
{0x1a, 0x1e, 0x16}, // 122 - z
{0x04, 0x1b, 0x11}, // 123 - braceleft
{0x00, 0x1b, 0x00}, // 124 - bar
{0x11, 0x1b, 0x04}, // 125 - braceright
{0x02, 0x03, 0x01}, // 126 - asciitilde
{0x00, 0x00, 0x00}, // 127 - empty
{0x00, 0x00, 0x00}, // 128 - empty
{0x00, 0x00, 0x00}, // 129 - empty
{0x00, 0x00, 0x00}, // 130 - empty
{0x00, 0x00, 0x00}, // 131 - empty
{0x00, 0x00, 0x00}, // 132 - empty
{0x00, 0x00, 0x00}, // 133 - empty
{0x00, 0x00, 0x00}, // 134 - empty
{0x00, 0x00, 0x00}, // 135 - empty
{0x00, 0x00, 0x00}, // 136 - empty
{0x00, 0x00, 0x00}, // 137 - empty
{0x00, 0x00, 0x00}, // 138 - empty
{0x00, 0x00, 0x00}, // 139 - empty
{0x00, 0x00, 0x00}, // 140 - empty
{0x00, 0x00, 0x00}, // 141 - empty
{0x00, 0x00, 0x00}, // 142 - empty
{0x00, 0x00, 0x00}, // 143 - empty
{0x00, 0x00, 0x00}, // 144 - empty
{0x00, 0x00, 0x00}, // 145 - empty
{0x00, 0x00, 0x00}, // 146 - empty
{0x00, 0x00, 0x00}, // 147 - empty
{0x00, 0x00, 0x00}, // 148 - empty
{0x00, 0x00, 0x00}, // 149 - empty
{0x00, 0x00, 0x00}, // 150 - empty
{0x00, 0x00, 0x00}, // 151 - empty
{0x00, 0x00, 0x00}, // 152 - empty
{0x00, 0x00, 0x00}, // 153 - empty
{0x00, 0x00, 0x00}, // 154 - empty
{0x00, 0x00, 0x00}, // 155 - empty
{0x00, 0x00, 0x00}, // 156 - empty
{0x00, 0x00, 0x00}, // 157 - empty
{0x00, 0x00, 0x00}, // 158 - empty
{0x00, 0x00, 0x00}, // 159 - empty
{0x00, 0x00, 0x00}, // 160 - empty
{0x00, 0x1d, 0x00}, // 161 - exclamdown
{0x0e, 0x1b, 0x0a}, // 162 - cent
{0x14, 0x1f, 0x15}, // 163 - sterling
{0x15, 0x0e, 0x15}, // 164 - currency
{0x0b, 0x1c, 0x0b}, // 165 - yen
{0x00, 0x1b, 0x00}, // 166 - brokenbar
{0x14, 0x1b, 0x05}, // 167 - section
{0x01, 0x00, 0x01}, // 168 - dieresis
{0x02, 0x05, 0x05}, // 169 - copyright
{0x16, 0x15, 0x17}, // 170 - ordfeminine
{0x02, 0x05, 0x00}, // 171 - guillemotleft
{0x02, 0x02, 0x06}, // 172 - logicalnot
{0x04, 0x04, 0x00}, // 173 - softhyphen
{0x07, 0x03, 0x04}, // 174 - registered
{0x01, 0x01, 0x01}, // 175 - macron
{0x02, 0x05, 0x02}, // 176 - degree
{0x12, 0x17, 0x12}, // 177 - plusminus
{0x01, 0x07, 0x04}, // 178 - twosuperior
{0x05, 0x07, 0x07}, // 179 - threesuperior
{0x00, 0x02, 0x01}, // 180 - acute
{0x1f, 0x08, 0x07}, // 181 - mu
{0x02, 0x1d, 0x1f}, // 182 - paragraph
{0x0e, 0x0e, 0x0e}, // 183 - periodcentered
{0x10, 0x14, 0x08}, // 184 - cedilla
{0x00, 0x07, 0x00}, // 185 - onesuperior
{0x12, 0x15, 0x12}, // 186 - ordmasculine
{0x00, 0x05, 0x02}, // 187 - guillemotright
{0x03, 0x08, 0x18}, // 188 - onequarter
{0x0b, 0x18, 0x10}, // 189 - onehalf
{0x03, 0x0b, 0x18}, // 190 - threequarters
{0x18, 0x15, 0x10}, // 191 - questiondown
};
#endif
const uint8_t gFontSmall[95][6] = const uint8_t gFontSmall[95][6] =
{ {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' ' {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
@@ -502,10 +448,10 @@ const uint8_t gFontSmall[95][6] =
{0x00, 0x03, 0x07, 0x06, 0x00, 0x00}, {0x00, 0x03, 0x07, 0x06, 0x00, 0x00},
{0x20, 0x76, 0x56, 0x56, 0x7E, 0x3C}, {0x20, 0x76, 0x56, 0x56, 0x7E, 0x3C},
{0x7F, 0x7F, 0x6C, 0x6C, 0x7C, 0x38}, {0x7F, 0x7F, 0x6C, 0x6C, 0x7C, 0x38},
{0x3C, 0x7E, 0x66, 0x66, 0x66, 0x24}, {0x38, 0x7C, 0x6C, 0x6C, 0x6C, 0x00},
{0x38, 0x7C, 0x6C, 0x6C, 0x7F, 0x7F}, {0x38, 0x7C, 0x6C, 0x6C, 0x7F, 0x7F},
{0x3C, 0x7E, 0x56, 0x56, 0x5E, 0x0C}, {0x3C, 0x7E, 0x56, 0x56, 0x5E, 0x0C},
{0x7C, 0x7E, 0x36, 0x36, 0x06, 0x00}, {0x7E, 0x7F, 0x1B, 0x1B, 0x02, 0x00},
{0x0C, 0x5E, 0x56, 0x56, 0x7E, 0x3C}, {0x0C, 0x5E, 0x56, 0x56, 0x7E, 0x3C},
{0x7F, 0x7F, 0x0C, 0x0C, 0x7C, 0x78}, {0x7F, 0x7F, 0x0C, 0x0C, 0x7C, 0x78},
{0x00, 0x00, 0x7A, 0x7A, 0x00, 0x00}, {0x00, 0x00, 0x7A, 0x7A, 0x00, 0x00},
@@ -516,7 +462,7 @@ const uint8_t gFontSmall[95][6] =
{0x7C, 0x7C, 0x0C, 0x0C, 0x7C, 0x78}, {0x7C, 0x7C, 0x0C, 0x0C, 0x7C, 0x78},
{0x3C, 0x7E, 0x66, 0x66, 0x7E, 0x3C}, {0x3C, 0x7E, 0x66, 0x66, 0x7E, 0x3C},
{0x7E, 0x7E, 0x36, 0x36, 0x3E, 0x1C}, {0x7E, 0x7E, 0x36, 0x36, 0x3E, 0x1C},
{0x1C, 0x3E, 0x36, 0x3E, 0x7E, 0x40}, {0x1C, 0x3E, 0x36, 0x7E, 0x7E, 0x60},
{0x7C, 0x7C, 0x0C, 0x0C, 0x18, 0x00}, {0x7C, 0x7C, 0x0C, 0x0C, 0x18, 0x00},
{0x4C, 0x5E, 0x56, 0x56, 0x76, 0x20}, {0x4C, 0x5E, 0x56, 0x56, 0x76, 0x20},
{0x3F, 0x7F, 0x6C, 0x6C, 0x60, 0x00}, {0x3F, 0x7F, 0x6C, 0x6C, 0x60, 0x00},
@@ -524,11 +470,177 @@ const uint8_t gFontSmall[95][6] =
{0x0C, 0x3C, 0x70, 0x70, 0x3C, 0x0C}, {0x0C, 0x3C, 0x70, 0x70, 0x3C, 0x0C},
{0x3C, 0x7C, 0x30, 0x30, 0x7C, 0x3C}, {0x3C, 0x7C, 0x30, 0x30, 0x7C, 0x3C},
{0x44, 0x6C, 0x38, 0x38, 0x6C, 0x44}, {0x44, 0x6C, 0x38, 0x38, 0x6C, 0x44},
{0x06, 0x6E, 0x6C, 0x6C, 0x7E, 0x3E}, {0x06, 0x6E, 0x68, 0x68, 0x7E, 0x3E},
{0x66, 0x76, 0x7E, 0x6E, 0x66, 0x00}, {0x66, 0x76, 0x7E, 0x6E, 0x66, 0x00},
{0x08, 0x3E, 0x77, 0x41, 0x00, 0x00}, {0x08, 0x3E, 0x77, 0x41, 0x00, 0x00},
{0x00, 0x00, 0x7F, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x7F, 0x00, 0x00, 0x00},
{0x00, 0x41, 0x77, 0x3E, 0x08, 0x00}, {0x00, 0x41, 0x77, 0x3E, 0x08, 0x00},
{0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00}, {0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00}
};
#endif
#ifdef ENABLE_SPECTRUM
const uint8_t gFont3x5[160][3] =
{
{0x00, 0x00, 0x00}, // 32 - space
{0x00, 0x17, 0x00}, // 33 - exclam
{0x03, 0x00, 0x03}, // 34 - quotedbl
{0x1f, 0x0a, 0x1f}, // 35 - numbersign
{0x0a, 0x1f, 0x05}, // 36 - dollar
{0x09, 0x04, 0x12}, // 37 - percent
{0x0f, 0x17, 0x1c}, // 38 - ampersand
{0x00, 0x03, 0x00}, // 39 - quotesingle
{0x00, 0x0e, 0x11}, // 40 - parenleft
{0x11, 0x0e, 0x00}, // 41 - parenright
{0x05, 0x02, 0x05}, // 42 - asterisk
{0x04, 0x0e, 0x04}, // 43 - plus
{0x10, 0x08, 0x00}, // 44 - comma
{0x04, 0x04, 0x04}, // 45 - hyphen
{0x00, 0x10, 0x00}, // 46 - period
{0x18, 0x04, 0x03}, // 47 - slash
{0x1e, 0x11, 0x0f}, // 48 - zero
{0x02, 0x1f, 0x00}, // 49 - one
{0x19, 0x15, 0x12}, // 50 - two
{0x11, 0x15, 0x0a}, // 51 - three
{0x07, 0x04, 0x1f}, // 52 - four
{0x17, 0x15, 0x09}, // 53 - five
{0x1e, 0x15, 0x1d}, // 54 - six
{0x19, 0x05, 0x03}, // 55 - seven
{0x1f, 0x15, 0x1f}, // 56 - eight
{0x17, 0x15, 0x0f}, // 57 - nine
{0x00, 0x0a, 0x00}, // 58 - colon
{0x10, 0x0a, 0x00}, // 59 - semicolon
{0x04, 0x0a, 0x11}, // 60 - less
{0x0a, 0x0a, 0x0a}, // 61 - equal
{0x11, 0x0a, 0x04}, // 62 - greater
{0x01, 0x15, 0x03}, // 63 - question
{0x0e, 0x15, 0x16}, // 64 - at
{0x1e, 0x05, 0x1e}, // 65 - A
{0x1f, 0x15, 0x0a}, // 66 - B
{0x0e, 0x11, 0x11}, // 67 - C
{0x1f, 0x11, 0x0e}, // 68 - D
{0x1f, 0x15, 0x15}, // 69 - E
{0x1f, 0x05, 0x05}, // 70 - F
{0x0e, 0x15, 0x1d}, // 71 - G
{0x1f, 0x04, 0x1f}, // 72 - H
{0x11, 0x1f, 0x11}, // 73 - I
{0x08, 0x10, 0x0f}, // 74 - J
{0x1f, 0x04, 0x1b}, // 75 - K
{0x1f, 0x10, 0x10}, // 76 - L
{0x1f, 0x06, 0x1f}, // 77 - M
{0x1f, 0x0e, 0x1f}, // 78 - N
{0x0e, 0x11, 0x0e}, // 79 - O
{0x1f, 0x05, 0x02}, // 80 - P
{0x0e, 0x19, 0x1e}, // 81 - Q
{0x1f, 0x0d, 0x16}, // 82 - R
{0x12, 0x15, 0x09}, // 83 - S
{0x01, 0x1f, 0x01}, // 84 - T
{0x0f, 0x10, 0x1f}, // 85 - U
{0x07, 0x18, 0x07}, // 86 - V
{0x1f, 0x0c, 0x1f}, // 87 - W
{0x1b, 0x04, 0x1b}, // 88 - X
{0x03, 0x1c, 0x03}, // 89 - Y
{0x19, 0x15, 0x13}, // 90 - Z
{0x1f, 0x11, 0x11}, // 91 - bracketleft
{0x02, 0x04, 0x08}, // 92 - backslash
{0x11, 0x11, 0x1f}, // 93 - bracketright
{0x02, 0x01, 0x02}, // 94 - asciicircum
{0x10, 0x10, 0x10}, // 95 - underscore
{0x01, 0x02, 0x00}, // 96 - grave
{0x1a, 0x16, 0x1c}, // 97 - a
{0x1f, 0x12, 0x0c}, // 98 - b
{0x0c, 0x12, 0x12}, // 99 - c
{0x0c, 0x12, 0x1f}, // 100 - d
{0x0c, 0x1a, 0x16}, // 101 - e
{0x04, 0x1e, 0x05}, // 102 - f
{0x0c, 0x2a, 0x1e}, // 103 - g
{0x1f, 0x02, 0x1c}, // 104 - h
{0x00, 0x1d, 0x00}, // 105 - i
{0x10, 0x20, 0x1d}, // 106 - j
{0x1f, 0x0c, 0x12}, // 107 - k
{0x11, 0x1f, 0x10}, // 108 - l
{0x1e, 0x0e, 0x1e}, // 109 - m
{0x1e, 0x02, 0x1c}, // 110 - n
{0x0c, 0x12, 0x0c}, // 111 - o
{0x3e, 0x12, 0x0c}, // 112 - p
{0x0c, 0x12, 0x3e}, // 113 - q
{0x1c, 0x02, 0x02}, // 114 - r
{0x14, 0x1e, 0x0a}, // 115 - s
{0x02, 0x1f, 0x12}, // 116 - t
{0x0e, 0x10, 0x1e}, // 117 - u
{0x0e, 0x18, 0x0e}, // 118 - v
{0x1e, 0x1c, 0x1e}, // 119 - w
{0x12, 0x0c, 0x12}, // 120 - x
{0x06, 0x28, 0x1e}, // 121 - y
{0x1a, 0x1e, 0x16}, // 122 - z
{0x04, 0x1b, 0x11}, // 123 - braceleft
{0x00, 0x1b, 0x00}, // 124 - bar
{0x11, 0x1b, 0x04}, // 125 - braceright
{0x02, 0x03, 0x01}, // 126 - asciitilde
{0x00, 0x00, 0x00}, // 127 - empty
{0x00, 0x00, 0x00}, // 128 - empty
{0x00, 0x00, 0x00}, // 129 - empty
{0x00, 0x00, 0x00}, // 130 - empty
{0x00, 0x00, 0x00}, // 131 - empty
{0x00, 0x00, 0x00}, // 132 - empty
{0x00, 0x00, 0x00}, // 133 - empty
{0x00, 0x00, 0x00}, // 134 - empty
{0x00, 0x00, 0x00}, // 135 - empty
{0x00, 0x00, 0x00}, // 136 - empty
{0x00, 0x00, 0x00}, // 137 - empty
{0x00, 0x00, 0x00}, // 138 - empty
{0x00, 0x00, 0x00}, // 139 - empty
{0x00, 0x00, 0x00}, // 140 - empty
{0x00, 0x00, 0x00}, // 141 - empty
{0x00, 0x00, 0x00}, // 142 - empty
{0x00, 0x00, 0x00}, // 143 - empty
{0x00, 0x00, 0x00}, // 144 - empty
{0x00, 0x00, 0x00}, // 145 - empty
{0x00, 0x00, 0x00}, // 146 - empty
{0x00, 0x00, 0x00}, // 147 - empty
{0x00, 0x00, 0x00}, // 148 - empty
{0x00, 0x00, 0x00}, // 149 - empty
{0x00, 0x00, 0x00}, // 150 - empty
{0x00, 0x00, 0x00}, // 151 - empty
{0x00, 0x00, 0x00}, // 152 - empty
{0x00, 0x00, 0x00}, // 153 - empty
{0x00, 0x00, 0x00}, // 154 - empty
{0x00, 0x00, 0x00}, // 155 - empty
{0x00, 0x00, 0x00}, // 156 - empty
{0x00, 0x00, 0x00}, // 157 - empty
{0x00, 0x00, 0x00}, // 158 - empty
{0x00, 0x00, 0x00}, // 159 - empty
{0x00, 0x00, 0x00}, // 160 - empty
{0x00, 0x1d, 0x00}, // 161 - exclamdown
{0x0e, 0x1b, 0x0a}, // 162 - cent
{0x14, 0x1f, 0x15}, // 163 - sterling
{0x15, 0x0e, 0x15}, // 164 - currency
{0x0b, 0x1c, 0x0b}, // 165 - yen
{0x00, 0x1b, 0x00}, // 166 - brokenbar
{0x14, 0x1b, 0x05}, // 167 - section
{0x01, 0x00, 0x01}, // 168 - dieresis
{0x02, 0x05, 0x05}, // 169 - copyright
{0x16, 0x15, 0x17}, // 170 - ordfeminine
{0x02, 0x05, 0x00}, // 171 - guillemotleft
{0x02, 0x02, 0x06}, // 172 - logicalnot
{0x04, 0x04, 0x00}, // 173 - softhyphen
{0x07, 0x03, 0x04}, // 174 - registered
{0x01, 0x01, 0x01}, // 175 - macron
{0x02, 0x05, 0x02}, // 176 - degree
{0x12, 0x17, 0x12}, // 177 - plusminus
{0x01, 0x07, 0x04}, // 178 - twosuperior
{0x05, 0x07, 0x07}, // 179 - threesuperior
{0x00, 0x02, 0x01}, // 180 - acute
{0x1f, 0x08, 0x07}, // 181 - mu
{0x02, 0x1d, 0x1f}, // 182 - paragraph
{0x0e, 0x0e, 0x0e}, // 183 - periodcentered
{0x10, 0x14, 0x08}, // 184 - cedilla
{0x00, 0x07, 0x00}, // 185 - onesuperior
{0x12, 0x15, 0x12}, // 186 - ordmasculine
{0x00, 0x05, 0x02}, // 187 - guillemotright
{0x03, 0x08, 0x18}, // 188 - onequarter
{0x0b, 0x18, 0x10}, // 189 - onehalf
{0x03, 0x0b, 0x18}, // 190 - threequarters
{0x18, 0x15, 0x10}, // 191 - questiondown
}; };
#endif #endif

View File

@@ -204,6 +204,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
DTMF_Reply(); DTMF_Reply();
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE);
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
if (gAlarmState != ALARM_STATE_OFF) if (gAlarmState != ALARM_STATE_OFF)
{ {

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

14
init.c
View File

@@ -30,21 +30,17 @@ void DATA_Init(void);
void BSS_Init(void) void BSS_Init(void)
{ {
uint32_t *pBss; uint32_t *pBss;
for (pBss = __bss_start__; pBss < __bss_end__; pBss++)
for (pBss = __bss_start__; pBss < __bss_end__; pBss++) {
*pBss = 0; *pBss = 0;
}
} }
void DATA_Init(void) void DATA_Init(void)
{ {
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start; volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
volatile uint32_t *pDataFlash = (volatile uint32_t *)flash_data_start; volatile uint32_t *pDataFlash = (volatile uint32_t *)flash_data_start;
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start; uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
uint32_t i; unsigned int i;
for (i = 0; i < Size / 4; i++) { for (i = 0; i < (Size / 4); i++)
*pDataRam++ = *pDataFlash++; *pDataRam++ = *pDataFlash++;
}
} }

14
main.c
View File

@@ -174,12 +174,14 @@ void Main(void)
} }
} }
if (gEeprom.POWER_ON_PASSWORD < 1000000) #ifdef ENABLE_PWRON_PASSWORD
{ if (gEeprom.POWER_ON_PASSWORD < 1000000)
bIsInLockScreen = true; {
UI_DisplayLock(); bIsInLockScreen = true;
bIsInLockScreen = false; UI_DisplayLock();
} bIsInLockScreen = false;
}
#endif
BOOT_ProcessMode(BootMode); BOOT_ProcessMode(BootMode);

18
misc.h
View File

@@ -24,24 +24,20 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif #endif
#define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST) #define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST)
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST) #define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL) #define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
#ifdef ENABLE_NOAA #define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST) #define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
#define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
#endif
enum { enum {
MR_CHANNEL_FIRST = 0, MR_CHANNEL_FIRST = 0,
MR_CHANNEL_LAST = 199u, MR_CHANNEL_LAST = 199u,
FREQ_CHANNEL_FIRST = 200u, FREQ_CHANNEL_FIRST = 200u,
FREQ_CHANNEL_LAST = 206u, FREQ_CHANNEL_LAST = 206u,
#ifdef ENABLE_NOAA NOAA_CHANNEL_FIRST = 207u,
NOAA_CHANNEL_FIRST = 207u, NOAA_CHANNEL_LAST = 216u,
NOAA_CHANNEL_LAST = 216u,
#endif
LAST_CHANNEL LAST_CHANNEL
}; };

127
radio.c
View File

@@ -51,7 +51,7 @@ bool RADIO_CheckValidChannel(uint16_t Channel, bool bCheckScanList, uint8_t VFO)
uint8_t PriorityCh1; uint8_t PriorityCh1;
uint8_t PriorityCh2; uint8_t PriorityCh2;
if (!IS_MR_CHANNEL(Channel)) if (Channel > MR_CHANNEL_LAST)
return false; return false;
Attributes = gMR_ChannelAttributes[Channel]; Attributes = gMR_ChannelAttributes[Channel];
@@ -176,7 +176,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
} }
#endif #endif
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ {
Channel = RADIO_FindNextChannel(Channel, RADIO_CHANNEL_UP, false, VFO); Channel = RADIO_FindNextChannel(Channel, RADIO_CHANNEL_UP, false, VFO);
if (Channel == 0xFF) if (Channel == 0xFF)
@@ -200,7 +200,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
uint8_t Index; uint8_t Index;
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ {
Channel = gEeprom.FreqChannel[VFO]; Channel = gEeprom.FreqChannel[VFO];
gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO]; gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO];
@@ -218,7 +218,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
Band = BAND6_400MHz; Band = BAND6_400MHz;
} }
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ {
gEeprom.VfoInfo[VFO].Band = Band; gEeprom.VfoInfo[VFO].Band = Band;
gEeprom.VfoInfo[VFO].SCANLIST1_PARTICIPATION = !!(Attributes & MR_CH_SCANLIST1); gEeprom.VfoInfo[VFO].SCANLIST1_PARTICIPATION = !!(Attributes & MR_CH_SCANLIST1);
@@ -235,7 +235,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
gEeprom.VfoInfo[VFO].SCANLIST2_PARTICIPATION = bParticipation2; gEeprom.VfoInfo[VFO].SCANLIST2_PARTICIPATION = bParticipation2;
gEeprom.VfoInfo[VFO].CHANNEL_SAVE = Channel; gEeprom.VfoInfo[VFO].CHANNEL_SAVE = Channel;
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
Base = Channel * 16; Base = Channel * 16;
else else
Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16); Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16);
@@ -332,12 +332,12 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (Data[5] == 0xFF) if (Data[5] == 0xFF)
{ {
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false; gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false;
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = 0; gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
} }
else else
{ {
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = !!((Data[5] >> 0) & 1u); gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = ((Data[5] >> 0) & 1u) ? true : false;
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = ((Data[5] >> 1) & 3u); gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = ((Data[5] >> 1) & 7u);
} }
// *************** // ***************
@@ -380,13 +380,13 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (Frequency >= 10800000 && Frequency < 13600000) if (Frequency >= 10800000 && Frequency < 13600000)
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF; gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
else else
if (!IS_MR_CHANNEL(Channel)) if (Channel > MR_CHANNEL_LAST)
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency, 0); gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency, 0);
RADIO_ApplyOffset(pRadio); RADIO_ApplyOffset(pRadio);
memset(gEeprom.VfoInfo[VFO].Name, 0, sizeof(gEeprom.VfoInfo[VFO].Name)); memset(gEeprom.VfoInfo[VFO].Name, 0, sizeof(gEeprom.VfoInfo[VFO].Name));
if (IS_MR_CHANNEL(Channel)) if (Channel < MR_CHANNEL_LAST)
{ // 16 bytes allocated to the channel name but only 10 used, the rest are 0's { // 16 bytes allocated to the channel name but only 10 used, the rest are 0's
EEPROM_ReadBuffer(0x0F50 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 0, 8); EEPROM_ReadBuffer(0x0F50 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 0, 8);
EEPROM_ReadBuffer(0x0F58 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 8, 2); EEPROM_ReadBuffer(0x0F58 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 8, 2);
@@ -426,22 +426,27 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
{ {
uint8_t Txp[3]; uint8_t Txp[3];
FREQUENCY_Band_t Band = FREQUENCY_GetBand(pInfo->pRX->Frequency); FREQUENCY_Band_t Band;
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
// *******************************
// squelch
Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
if (gEeprom.SQUELCH_LEVEL == 0) if (gEeprom.SQUELCH_LEVEL == 0)
{ // squelch == 0 (off) { // squelch == 0 (off)
pInfo->SquelchOpenRSSIThresh = 0; pInfo->SquelchOpenRSSIThresh = 0; // 0 ~ 255
pInfo->SquelchOpenNoiseThresh = 127; pInfo->SquelchOpenNoiseThresh = 127; // 127 ~ 0
pInfo->SquelchCloseGlitchThresh = 255; pInfo->SquelchCloseGlitchThresh = 255; // 255 ~ 0
pInfo->SquelchCloseRSSIThresh = 0; pInfo->SquelchCloseRSSIThresh = 0; // 0 ~ 255
pInfo->SquelchCloseNoiseThresh = 127; pInfo->SquelchCloseNoiseThresh = 127; // 127 ~ 0
pInfo->SquelchOpenGlitchThresh = 255; pInfo->SquelchOpenGlitchThresh = 255; // 255 ~ 0
} }
else else
{ // squelch >= 1 { // squelch >= 1
Base += gEeprom.SQUELCH_LEVEL; // my squelch-1 Base += gEeprom.SQUELCH_LEVEL; // my eeprom squelch-1
// VHF UHF // VHF UHF
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10 EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1); // 40 5 EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1); // 40 5
@@ -452,6 +457,13 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90 EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100 EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
uint16_t rssi_open = pInfo->SquelchOpenRSSIThresh;
uint16_t rssi_close = pInfo->SquelchCloseRSSIThresh;
uint16_t noise_open = pInfo->SquelchOpenNoiseThresh;
uint16_t noise_close = pInfo->SquelchCloseNoiseThresh;
uint16_t glitch_open = pInfo->SquelchOpenGlitchThresh;
uint16_t glitch_close = pInfo->SquelchCloseGlitchThresh;
#if ENABLE_SQUELCH_MORE_SENSITIVE #if ENABLE_SQUELCH_MORE_SENSITIVE
// make squelch a little more sensitive // make squelch a little more sensitive
// //
@@ -459,23 +471,47 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
// //
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values // note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9; #if 0
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9; rssi_open = (rssi_open * 8) / 9;
noise_open = (noise_open * 9) / 8;
glitch_open = (glitch_open * 9) / 8;
#else
// even more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
rssi_open = (rssi_open * 1) / 2;
noise_open = (noise_open * 2) / 1;
glitch_open = (glitch_open * 2) / 1;
#endif
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8; #else
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8; // more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
rssi_open = (rssi_open * 3) / 4;
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8; noise_open = (noise_open * 4) / 3;
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8; glitch_open = (glitch_open * 4) / 3;
#endif #endif
if (pInfo->SquelchOpenNoiseThresh > 127) rssi_close = (rssi_open * 9) / 10;
pInfo->SquelchOpenNoiseThresh = 127; noise_close = (noise_open * 10) / 9;
glitch_close = (glitch_open * 10) / 9;
if (pInfo->SquelchCloseNoiseThresh > 127) // ensure the 'close' threshold is lower than the 'open' threshold
pInfo->SquelchCloseNoiseThresh = 127; if (rssi_close == rssi_open && rssi_close > 0)
rssi_close--;
if (noise_close == noise_open && noise_close < 127)
noise_close++;
if (glitch_close == glitch_open && glitch_close < 255)
glitch_close++;
pInfo->SquelchOpenRSSIThresh = (rssi_open > 255) ? 255 : rssi_open;
pInfo->SquelchCloseRSSIThresh = (rssi_close > 255) ? 255 : rssi_close;
pInfo->SquelchOpenNoiseThresh = (noise_open > 127) ? 127 : noise_open;
pInfo->SquelchCloseNoiseThresh = (noise_close > 127) ? 127 : noise_close;
pInfo->SquelchOpenGlitchThresh = (glitch_open > 255) ? 255 : glitch_open;
pInfo->SquelchCloseGlitchThresh = (glitch_close > 255) ? 255 : glitch_close;
} }
// *******************************
// output power
Band = FREQUENCY_GetBand(pInfo->pTX->Frequency); Band = FREQUENCY_GetBand(pInfo->pTX->Frequency);
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->OUTPUT_POWER * 3), Txp, 3); EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->OUTPUT_POWER * 3), Txp, 3);
@@ -488,6 +524,8 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
(frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2, (frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2,
frequencyBandTable[Band].upper, frequencyBandTable[Band].upper,
pInfo->pTX->Frequency); pInfo->pTX->Frequency);
// *******************************
} }
void RADIO_ApplyOffset(VFO_Info_t *pInfo) void RADIO_ApplyOffset(VFO_Info_t *pInfo)
@@ -543,6 +581,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false); BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (Bandwidth) switch (Bandwidth)
{ {
default: default:
@@ -558,6 +599,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
break; break;
} }
#pragma GCC diagnostic pop
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false); BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
BK4819_SetupPowerAmplifier(0, 0); BK4819_SetupPowerAmplifier(0, 0);
@@ -792,6 +835,9 @@ void RADIO_SetTxParameters(void)
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false); BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (Bandwidth) switch (Bandwidth)
{ {
default: default:
@@ -807,6 +853,8 @@ void RADIO_SetTxParameters(void)
break; break;
} }
#pragma GCC diagnostic pop
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency); BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
// TX compressor // TX compressor
@@ -1032,8 +1080,12 @@ void RADIO_SendEndOfTransmission(void)
if (gEeprom.ROGER == ROGER_MODE_MDC) if (gEeprom.ROGER == ROGER_MODE_MDC)
BK4819_PlayRogerMDC(); BK4819_PlayRogerMDC();
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
BK4819_PlaySingleTone(2475, 250, 28, gEeprom.DTMF_SIDE_TONE);
if (gDTMF_CallState == DTMF_CALL_STATE_NONE && if (gDTMF_CallState == DTMF_CALL_STATE_NONE &&
(gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN || 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 { // end-of-tx
if (gEeprom.DTMF_SIDE_TONE) if (gEeprom.DTMF_SIDE_TONE)
{ {
@@ -1045,15 +1097,14 @@ void RADIO_SendEndOfTransmission(void)
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE); BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
BK4819_PlayDTMFString( BK4819_PlayDTMFString(
gEeprom.DTMF_DOWN_CODE, gEeprom.DTMF_DOWN_CODE,
0, 0,
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME, gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
gEeprom.DTMF_HASH_CODE_PERSIST_TIME, gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
gEeprom.DTMF_CODE_PERSIST_TIME, gEeprom.DTMF_CODE_PERSIST_TIME,
gEeprom.DTMF_CODE_INTERVAL_TIME); gEeprom.DTMF_CODE_INTERVAL_TIME);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = false; gEnableSpeaker = false;
} }

View File

@@ -44,7 +44,8 @@ enum PTT_ID_t {
PTT_ID_OFF = 0, // OFF PTT_ID_OFF = 0, // OFF
PTT_ID_TX_UP, // BEGIN OF TX PTT_ID_TX_UP, // BEGIN OF TX
PTT_ID_TX_DOWN, // END OF TX PTT_ID_TX_DOWN, // END OF TX
PTT_ID_BOTH // BOTH PTT_ID_BOTH, // BOTH
PTT_ID_APOLLO // Apolo quindar tones
}; };
typedef enum PTT_ID_t PTT_ID_t; typedef enum PTT_ID_t PTT_ID_t;

View File

@@ -77,20 +77,20 @@ void SystickHandler(void)
if (gCurrentFunction == FUNCTION_POWER_SAVE) if (gCurrentFunction == FUNCTION_POWER_SAVE)
DECREMENT_AND_TRIGGER(gPowerSave_10ms, gPowerSaveCountdownExpired); DECREMENT_AND_TRIGGER(gPowerSave_10ms, gPowerSaveCountdownExpired);
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE) if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch); DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch);
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT) if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
if (gCurrentFunction != FUNCTION_RECEIVE) if (gCurrentFunction != FUNCTION_RECEIVE)
DECREMENT_AND_TRIGGER(gNOAA_Countdown_10ms, gScheduleNOAA); DECREMENT_AND_TRIGGER(gNOAA_Countdown_10ms, gScheduleNOAA);
#endif #endif
if (gScanState != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING) if (gScanStateDir != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING)
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT) if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
DECREMENT_AND_TRIGGER(ScanPauseDelayIn_10ms, gScheduleScanListen); DECREMENT_AND_TRIGGER(gScanPauseDelayIn_10ms, gScheduleScanListen);
DECREMENT_AND_TRIGGER(gTailNoteEliminationCountdown_10ms, gFlagTailNoteEliminationComplete); DECREMENT_AND_TRIGGER(gTailNoteEliminationCountdown_10ms, gFlagTailNoteEliminationComplete);

View File

@@ -117,8 +117,10 @@ void SETTINGS_SaveSettings(void)
EEPROM_WriteBuffer(0x0E90, State); EEPROM_WriteBuffer(0x0E90, State);
memset(Password, 0xFF, sizeof(Password)); memset(Password, 0xFF, sizeof(Password));
Password[0] = gEeprom.POWER_ON_PASSWORD; #ifdef ENABLE_PWRON_PASSWORD
EEPROM_WriteBuffer(0x0E98, State); Password[0] = gEeprom.POWER_ON_PASSWORD;
#endif
EEPROM_WriteBuffer(0x0E98, Password);
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
@@ -184,10 +186,6 @@ void SETTINGS_SaveSettings(void)
EEPROM_WriteBuffer(0x0F40, State); EEPROM_WriteBuffer(0x0F40, State);
} }
void SETTINGS_LoadChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO)
{
}
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode) void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
@@ -197,13 +195,13 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
const uint16_t OffsetMR = Channel * 16; const uint16_t OffsetMR = Channel * 16;
uint16_t OffsetVFO = OffsetMR; uint16_t OffsetVFO = OffsetMR;
if (!IS_MR_CHANNEL(Channel)) if (Channel > MR_CHANNEL_LAST)
{ // it's a VFO, not a channel { // it's a VFO, not a channel
OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90; OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90;
OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32; OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32;
} }
if (Mode >= 2 || !IS_MR_CHANNEL(Channel)) if (Mode >= 2 || Channel > MR_CHANNEL_LAST)
{ // copy VFO to a channel { // copy VFO to a channel
uint8_t State[8]; uint8_t State[8];
@@ -221,15 +219,16 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
| (pVFO->OUTPUT_POWER << 2) | (pVFO->OUTPUT_POWER << 2)
| (pVFO->CHANNEL_BANDWIDTH << 1) | (pVFO->CHANNEL_BANDWIDTH << 1)
| (pVFO->FrequencyReverse << 0); | (pVFO->FrequencyReverse << 0);
State[5] = (pVFO->DTMF_PTT_ID_TX_MODE << 1) | (pVFO->DTMF_DECODING_ENABLE << 0); State[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1) | ((pVFO->DTMF_DECODING_ENABLE & 1u) << 0);
State[6] = pVFO->STEP_SETTING; State[6] = pVFO->STEP_SETTING;
State[7] = pVFO->SCRAMBLING_TYPE; State[7] = pVFO->SCRAMBLING_TYPE;
EEPROM_WriteBuffer(OffsetVFO + 8, State); EEPROM_WriteBuffer(OffsetVFO + 8, State);
SETTINGS_UpdateChannel(Channel, pVFO, true); SETTINGS_UpdateChannel(Channel, pVFO, true);
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ { // it's a memory channel
#ifndef ENABLE_KEEP_MEM_NAME #ifndef ENABLE_KEEP_MEM_NAME
// clear/reset the channel name // clear/reset the channel name
//memset(&State, 0xFF, sizeof(State)); //memset(&State, 0xFF, sizeof(State));
@@ -262,7 +261,7 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
uint8_t Attributes = 0xFF; // default attributes uint8_t Attributes = 0xFF; // default attributes
uint16_t Offset = 0x0D60 + (Channel & ~7u); uint16_t Offset = 0x0D60 + (Channel & ~7u);
Attributes &= ~MR_CH_COMPAND; // default to '0' = compander disabled Attributes &= (uint8_t)(~MR_CH_COMPAND); // default to '0' = compander disabled
EEPROM_ReadBuffer(Offset, State, sizeof(State)); EEPROM_ReadBuffer(Offset, State, sizeof(State));
@@ -280,8 +279,9 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
gMR_ChannelAttributes[Channel] = Attributes; gMR_ChannelAttributes[Channel] = Attributes;
// #ifndef ENABLE_KEEP_MEM_NAME // #ifndef ENABLE_KEEP_MEM_NAME
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ { // it's a memory channel
const uint16_t OffsetMR = Channel * 16; const uint16_t OffsetMR = Channel * 16;
if (!keep) if (!keep)
{ // clear/reset the channel name { // clear/reset the channel name

View File

@@ -21,7 +21,7 @@
char gInputBox[8]; char gInputBox[8];
uint8_t gInputBoxIndex; uint8_t gInputBoxIndex;
void INPUTBOX_Append(char Digit) void INPUTBOX_Append(const KEY_Code_t Digit)
{ {
if (gInputBoxIndex >= sizeof(gInputBox)) if (gInputBoxIndex >= sizeof(gInputBox))
return; return;
@@ -29,6 +29,7 @@ void INPUTBOX_Append(char Digit)
if (gInputBoxIndex == 0) if (gInputBoxIndex == 0)
memset(gInputBox, 10, sizeof(gInputBox)); memset(gInputBox, 10, sizeof(gInputBox));
gInputBox[gInputBoxIndex++] = Digit; if (Digit >= KEY_0 && Digit != KEY_INVALID)
gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0);
} }

View File

@@ -19,10 +19,12 @@
#include <stdint.h> #include <stdint.h>
#include "driver/keyboard.h"
extern char gInputBox[8]; extern char gInputBox[8];
extern uint8_t gInputBoxIndex; extern uint8_t gInputBoxIndex;
void INPUTBOX_Append(char Digit); void INPUTBOX_Append(const KEY_Code_t Digit);
#endif #endif

View File

@@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#ifdef ENABLE_PWRON_PASSWORD
#include <string.h> #include <string.h>
#include "ARMCM0.h" #include "ARMCM0.h"
@@ -156,3 +158,5 @@ void UI_DisplayLock(void)
} }
} }
} }
#endif

View File

@@ -17,7 +17,9 @@
#ifndef UI_LOCK_H #ifndef UI_LOCK_H
#define UI_LOCK_H #define UI_LOCK_H
void UI_DisplayLock(void); #ifdef ENABLE_PWRON_PASSWORD
void UI_DisplayLock(void);
#endif
#endif #endif

View File

@@ -14,6 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
#pragma GCC diagnostic pop
#include <string.h> #include <string.h>
#include <stdlib.h> // abs() #include <stdlib.h> // abs()
@@ -42,6 +46,9 @@ center_line_t center_line = CENTER_LINE_NONE;
void UI_drawBars(uint8_t *p, const unsigned int level) void UI_drawBars(uint8_t *p, const unsigned int level)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (level) switch (level)
{ {
default: default:
@@ -54,6 +61,8 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
case 0: break; case 0: break;
} }
#pragma GCC diagnostic pop
} }
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
@@ -214,6 +223,8 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
{ {
#ifdef ENABLE_RSSI_BAR #ifdef ENABLE_RSSI_BAR
(void)vfo; // unused
// optional larger RSSI dBm, S-point and bar level // optional larger RSSI dBm, S-point and bar level
if (center_line != CENTER_LINE_RSSI) if (center_line != CENTER_LINE_RSSI)
@@ -333,13 +344,13 @@ void UI_DisplayMain(void)
for (vfo_num = 0; vfo_num < 2; vfo_num++) for (vfo_num = 0; vfo_num < 2; vfo_num++)
{ {
const unsigned int line = (vfo_num == 0) ? line0 : line1; const unsigned int line = (vfo_num == 0) ? line0 : line1;
uint8_t channel = gEeprom.TX_VFO; unsigned int channel = gEeprom.TX_VFO;
// uint8_t tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO; // unsigned int tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
const bool same_vfo = (channel == vfo_num) ? true : false; const bool same_vfo = (channel == vfo_num) ? true : false;
uint8_t *p_line0 = gFrameBuffer[line + 0]; uint8_t *p_line0 = gFrameBuffer[line + 0];
uint8_t *p_line1 = gFrameBuffer[line + 1]; uint8_t *p_line1 = gFrameBuffer[line + 1];
uint8_t mode = 0; unsigned int mode = 0;
uint8_t state; unsigned int state;
if (single_vfo) if (single_vfo)
{ // we're in single VFO mode - screen is dedicated to just one VFO { // we're in single VFO mode - screen is dedicated to just one VFO
@@ -457,7 +468,7 @@ void UI_DisplayMain(void)
} }
} }
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) if (gEeprom.ScreenChannel[vfo_num] <= MR_CHANNEL_LAST)
{ // channel mode { // channel mode
const unsigned int x = 2; const unsigned int x = 2;
const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num) ? false : true; const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num) ? false : true;
@@ -508,7 +519,7 @@ void UI_DisplayMain(void)
if (state != VFO_STATE_NORMAL) if (state != VFO_STATE_NORMAL)
{ {
const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"}; const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"};
if (state >= 0 && state < ARRAY_SIZE(state_list)) if (state < ARRAY_SIZE(state_list))
UI_PrintString(state_list[state], 31, 0, line, 8); UI_PrintString(state_list[state], 31, 0, line, 8);
} }
else else
@@ -528,8 +539,8 @@ void UI_DisplayMain(void)
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency; frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
} }
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) if (gEeprom.ScreenChannel[vfo_num] <= MR_CHANNEL_LAST)
{ // channel mode { // it's a channel
// show the channel symbols // show the channel symbols
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]]; const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
@@ -546,6 +557,9 @@ void UI_DisplayMain(void)
#endif #endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gEeprom.CHANNEL_DISPLAY_MODE) switch (gEeprom.CHANNEL_DISPLAY_MODE)
{ {
case MDF_FREQUENCY: // show the channel frequency case MDF_FREQUENCY: // show the channel frequency
@@ -595,6 +609,8 @@ void UI_DisplayMain(void)
break; break;
} }
#pragma GCC diagnostic pop
} }
else else
{ // frequency mode { // frequency mode
@@ -660,7 +676,7 @@ void UI_DisplayMain(void)
const FREQ_Config_t *pConfig = (mode == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX; const FREQ_Config_t *pConfig = (mode == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
const unsigned int code_type = pConfig->CodeType; const unsigned int code_type = pConfig->CodeType;
const char *code_list[] = {"", "CT", "DCS", "DCR"}; const char *code_list[] = {"", "CT", "DCS", "DCR"};
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list)) if (code_type < ARRAY_SIZE(code_list))
strcpy(String, code_list[code_type]); strcpy(String, code_list[code_type]);
} }
UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, line + 1); UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, line + 1);
@@ -669,7 +685,7 @@ void UI_DisplayMain(void)
{ // show the TX power { // show the TX power
const char pwr_list[] = "LMH"; const char pwr_list[] = "LMH";
const unsigned int i = gEeprom.VfoInfo[vfo_num].OUTPUT_POWER; const unsigned int i = gEeprom.VfoInfo[vfo_num].OUTPUT_POWER;
String[0] = (i >= 0 && i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0'; String[0] = (i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
String[1] = '\0'; String[1] = '\0';
UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, line + 1); UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, line + 1);
} }

View File

@@ -240,12 +240,13 @@ const char gSubMenu_D_RSP[4][11] =
"BOTH" "BOTH"
}; };
const char gSubMenu_PTT_ID[4][7] = const char gSubMenu_PTT_ID[5][15] =
{ {
"OFF", "OFF",
"KEY UP", "KEY\nUP",
"KEY DN", "KEY\nDOWN",
"BOTH" "KEY\nUP+DOWN",
"APOLLO\nQUINDAR"
}; };
const char gSubMenu_PONMSG[4][8] = const char gSubMenu_PONMSG[4][8] =
@@ -436,6 +437,9 @@ void UI_DisplayMenu(void)
bool already_printed = false; bool already_printed = false;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gMenuCursor) switch (gMenuCursor)
{ {
case MENU_SQL: case MENU_SQL:
@@ -806,6 +810,8 @@ void UI_DisplayMenu(void)
} }
} }
#pragma GCC diagnostic pop
if (!already_printed) if (!already_printed)
{ // we now do multi-line text in a single string { // we now do multi-line text in a single string

View File

@@ -139,7 +139,7 @@ extern const char gSubMenu_MDF[4][15];
extern const char gSubMenu_AL_MOD[2][5]; extern const char gSubMenu_AL_MOD[2][5];
#endif #endif
extern const char gSubMenu_D_RSP[4][11]; extern const char gSubMenu_D_RSP[4][11];
extern const char gSubMenu_PTT_ID[4][7]; extern const char gSubMenu_PTT_ID[5][15];
extern const char gSubMenu_PONMSG[4][8]; extern const char gSubMenu_PONMSG[4][8];
extern const char gSubMenu_ROGER[3][9]; extern const char gSubMenu_ROGER[3][9];
extern const char gSubMenu_RESET[2][4]; extern const char gSubMenu_RESET[2][4];

View File

@@ -94,23 +94,25 @@ void UI_DisplayStatus(const bool test_display)
else else
#endif #endif
// SCAN indicator // SCAN indicator
if (gScanState != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display) if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
{ {
if (gEeprom.SCAN_LIST_DEFAULT == 0) if (gNextMrChannel <= MR_CHANNEL_LAST)
// memmove(line + x, BITMAP_SC1, sizeof(BITMAP_SC1)); { // channel mode
UI_PrintStringSmallBuffer("1", line + x); if (gEeprom.SCAN_LIST_DEFAULT == 0)
UI_PrintStringSmallBuffer("1", line + x);
else
if (gEeprom.SCAN_LIST_DEFAULT == 1)
UI_PrintStringSmallBuffer("2", line + x);
else
if (gEeprom.SCAN_LIST_DEFAULT == 2)
UI_PrintStringSmallBuffer("*", line + x);
}
else else
if (gEeprom.SCAN_LIST_DEFAULT == 1) { // frequency mode
// memmove(line + x, BITMAP_SC2, sizeof(BITMAP_SC2)); UI_PrintStringSmallBuffer("S", line + x);
UI_PrintStringSmallBuffer("2", line + x); }
else
if (gEeprom.SCAN_LIST_DEFAULT == 2)
// memmove(line + x, BITMAP_SCA, sizeof(BITMAP_SCA));
UI_PrintStringSmallBuffer("*", line + x);
// x1 = x + sizeof(BITMAP_SC1);
x1 = x + 7; x1 = x + 7;
} }
// x += sizeof(BITMAP_SC1);
x += 7; // font character width x += 7; // font character width
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE

View File

@@ -84,7 +84,7 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
gInputBoxIndex = 0; gInputBoxIndex = 0;
gIsInSubMenu = false; gIsInSubMenu = false;
gCssScanMode = CSS_SCAN_MODE_OFF; gCssScanMode = CSS_SCAN_MODE_OFF;
gScanState = SCAN_OFF; gScanStateDir = SCAN_OFF;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFM_ScanState = FM_SCAN_OFF; gFM_ScanState = FM_SCAN_OFF;
#endif #endif

Binary file not shown.

Binary file not shown.