diff --git a/Makefile b/Makefile
index e129f22..6ad18ba 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ ENABLE_VOICE := 0
ENABLE_VOX := 1
ENABLE_ALARM := 0
ENABLE_TX1750 := 0
+ENABLE_PWRON_PASSWORD := 0
ENABLE_BIG_FREQ := 1
ENABLE_SMALL_BOLD := 1
ENABLE_KEEP_MEM_NAME := 1
@@ -29,7 +30,7 @@ ENABLE_CODE_SCAN_TIMEOUT := 0
ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_MORE_SENSITIVE := 1
-#ENABLE_FASTER_CHANNEL_SCAN := 0
+ENABLE_FASTER_CHANNEL_SCAN := 1
ENABLE_RSSI_BAR := 1
ENABLE_AUDIO_BAR := 1
ENABLE_COPY_CHAN_TO_VFO := 1
@@ -137,7 +138,9 @@ ifeq ($(ENABLE_FMRADIO),1)
endif
OBJS += ui/helper.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/menu.o
OBJS += ui/scanner.o
@@ -157,6 +160,7 @@ AS = arm-none-eabi-gcc
CC =
LD = arm-none-eabi-gcc
+
ifeq ($(ENABLE_CLANG),0)
CC += arm-none-eabi-gcc
# Use GCC's linker to avoid undefined symbol errors
@@ -186,24 +190,27 @@ endif
CFLAGS =
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=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=gnu11 -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=gnu11 -MMD
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
endif
ifeq ($(ENABLE_LTO),1)
CFLAGS += -flto=2
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
endif
# May cause unhelpful build failures
#CFLAGS += -Wpadded
+# catch any and all warnings
+#CFLAGS += -Wextra
+
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
@@ -246,6 +253,9 @@ endif
ifeq ($(ENABLE_TX1750),1)
CFLAGS += -DENABLE_TX1750
endif
+ifeq ($(ENABLE_PWRON_PASSWORD),1)
+ CFLAGS += -DENABLE_PWRON_PASSWORD
+endif
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
CFLAGS += -DENABLE_KEEP_MEM_NAME
endif
@@ -319,13 +329,13 @@ endif
LDFLAGS += --specs=nano.specs
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
endif
ifeq ($(DEBUG),1)
ASFLAGS += -g
- CFLAGS += -g
+ CFLAGS += -g
LDFLAGS += -g
endif
diff --git a/README.md b/README.md
index c1e39b9..bc8ee80 100644
--- a/README.md
+++ b/README.md
@@ -33,27 +33,31 @@ Anyway, have fun.
# Radio performance
-Please note that the Quansheng uv-k radios are not professional quality transceivers, their
-performance is strictly limited, somewhat below that of a decent transceiver. The RX front
-end has no track-tuned band pass filtering at all, and so are wide band/wide open to any
-and all signals over a wide frequency range.
-Using the radio in high intensity RF environments will nearly always destroy your reception,
-the receiver simply doesn't have a great dynamic range, 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.
+Please note that the Quansheng UV-Kx radios are not professional quality transceivers, their
+performance is strictly limited. The RX front end has no track-tuned band pass filtering
+at all, and so are wide band/wide open to any and all signals over a large frequency range.
-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
-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) ..
```
-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_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_AIRCOPY := 0 easier to just enter frequency with butts
ENABLE_FMRADIO := 0 WBFM VHF broadcast band receiver
@@ -62,6 +66,7 @@ ENABLE_VOICE := 0 want to hear voices ?
ENABLE_VOX := 0
ENABLE_ALARM := 0 TX alarms
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_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
@@ -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_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_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_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')
@@ -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 '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 '*' .. 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
@@ -178,13 +183,13 @@ You may obtain a copy of the License at
# Example changes/updates
-
-
-
+
+
+
Video showing the AM fix working ..
-
+
diff --git a/am_fix.c b/am_fix.c
index 51c11ae..09d67e9 100644
--- a/am_fix.c
+++ b/am_fix.c
@@ -475,7 +475,7 @@
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];
// sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]);
diff --git a/app/action.c b/app/action.c
index 7036ebd..fe07b1d 100644
--- a/app/action.c
+++ b/app/action.c
@@ -84,11 +84,11 @@ void ACTION_Monitor(void)
gMonitor = false;
- if (gScanState != SCAN_OFF)
+ if (gScanStateDir != SCAN_OFF)
{
- ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
- gScheduleScanListen = false;
- gScanPauseMode = true;
+ gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
+ gScheduleScanListen = false;
+ gScanPauseMode = true;
}
#ifdef ENABLE_NOAA
@@ -182,23 +182,36 @@ void ACTION_Scan(bool bRestart)
{
GUI_SelectNextDisplay(DISPLAY_MAIN);
- if (gScanState != SCAN_OFF)
- {
- #if 1
+ if (gScanStateDir != SCAN_OFF)
+ { // already scanning
+
+ if (gNextMrChannel <= MR_CHANNEL_LAST)
+ { // channel mode
+
// keep scanning but toggle between scan lists
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;
- #else
+ }
+ else
+ { // stop scanning
+
SCANNER_Stop();
#ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
#endif
- #endif
+ }
}
else
- {
- CHANNEL_Next(true, 1);
+ { // start scanning
+
+ CHANNEL_Next(true, SCAN_FWD);
#ifdef ENABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
@@ -215,9 +228,16 @@ void ACTION_Scan(bool bRestart)
}
}
else
- if (!bRestart)
- { // keep scanning but toggle between scan lists
+// if (!bRestart)
+ 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;
+
+ // jump to the next channel
+ CHANNEL_Next(true, gScanStateDir);
+ gScanPauseDelayIn_10ms = 1;
+ gScheduleScanListen = false;
+
gUpdateStatus = true;
}
else
@@ -313,6 +333,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed)
{
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
+
if (gDTMF_InputIndex > 0)
{
gDTMF_InputBox[--gDTMF_InputIndex] = '-';
diff --git a/app/app.c b/app/app.c
index 025544d..e1006ab 100644
--- a/app/app.c
+++ b/app/app.c
@@ -95,15 +95,15 @@ static void APP_CheckForIncoming(void)
// squelch is open
- if (gScanState == SCAN_OFF)
+ if (gScanStateDir == SCAN_OFF)
{ // not RF scanning
if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE)
{ // CTCSS/DTS scanning
- ScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms;
- gScheduleScanListen = false;
- gRxReceptionMode = RX_MODE_DETECTED;
+ gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms;
+ gScheduleScanListen = false;
+ gRxReceptionMode = RX_MODE_DETECTED;
}
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
@@ -166,8 +166,8 @@ static void APP_CheckForIncoming(void)
return;
}
- ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
- gScheduleScanListen = false;
+ gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
+ gScheduleScanListen = false;
}
gRxReceptionMode = RX_MODE_DETECTED;
@@ -200,7 +200,7 @@ static void APP_HandleIncoming(void)
return;
}
- bFlag = (gScanState == SCAN_OFF && gCurrentCodeType == CODE_TYPE_OFF);
+ bFlag = (gScanStateDir == SCAN_OFF && gCurrentCodeType == CODE_TYPE_OFF);
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gNOAACountdown_10ms > 0)
@@ -224,7 +224,7 @@ static void APP_HandleIncoming(void)
if (!bFlag)
return;
- if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
+ if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
{ // not scanning
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
{ // DTMF DCD is enabled
@@ -268,7 +268,7 @@ static void APP_HandleReceive(void)
goto Skip;
}
- if (gScanState != SCAN_OFF && IS_FREQ_CHANNEL(gNextMrChannel))
+ if (gScanStateDir != SCAN_OFF && IS_FREQ_CHANNEL(gNextMrChannel))
{
if (g_SquelchLost)
return;
@@ -399,7 +399,7 @@ Skip:
gUpdateDisplay = true;
- if (gScanState != SCAN_OFF)
+ if (gScanStateDir != SCAN_OFF)
{
switch (gEeprom.SCAN_RESUME_MODE)
{
@@ -407,8 +407,8 @@ Skip:
break;
case SCAN_RESUME_CO:
- ScanPauseDelayIn_10ms = scan_pause_delay_in_7_10ms;
- gScheduleScanListen = false;
+ gScanPauseDelayIn_10ms = scan_pause_delay_in_7_10ms;
+ gScheduleScanListen = false;
break;
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)
BACKLIGHT_TurnOn();
- if (gScanState != SCAN_OFF)
+ if (gScanStateDir != SCAN_OFF)
{
switch (gEeprom.SCAN_RESUME_MODE)
{
case SCAN_RESUME_TO:
if (!gScanPauseMode)
{
- ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
- gScheduleScanListen = false;
- gScanPauseMode = true;
+ gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
+ gScheduleScanListen = false;
+ gScanPauseMode = true;
}
break;
case SCAN_RESUME_CO:
case SCAN_RESUME_SE:
- ScanPauseDelayIn_10ms = 0;
- gScheduleScanListen = false;
+ gScanPauseDelayIn_10ms = 0;
+ gScheduleScanListen = false;
break;
}
@@ -527,7 +527,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
if (gCssScanMode != CSS_SCAN_MODE_OFF)
gCssScanMode = CSS_SCAN_MODE_FOUND;
- if (gScanState == SCAN_OFF &&
+ if (gScanStateDir == SCAN_OFF &&
gCssScanMode == CSS_SCAN_MODE_OFF &&
gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
{ // 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)
{
- gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanState);
+ gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
RADIO_SetupRegisters(true);
-// ScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
- ScanPauseDelayIn_10ms = 10; // 100ms .. it don't like any faster :(
+ #ifdef ENABLE_FASTER_CHANNEL_SCAN
+ gScanPauseDelayIn_10ms = 9; // 90ms
+ #else
+ gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
+ #endif
bScanKeepFrequency = false;
gUpdateDisplay = true;
@@ -647,6 +650,9 @@ static void MR_NextChannel(void)
if (enabled)
{
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (gCurrentScanList)
{
case SCAN_NEXT_CHAN_SCANLIST1:
@@ -657,7 +663,7 @@ static void MR_NextChannel(void)
if (RADIO_CheckValidChannel(chan1, false, 0))
{
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
- gNextMrChannel = chan1;
+ gNextMrChannel = chan1;
break;
}
}
@@ -680,7 +686,7 @@ static void MR_NextChannel(void)
// {
// chan = (gEeprom.RX_VFO + 1) & 1u;
// chan = gEeprom.ScreenChannel[chan];
-// if (IS_MR_CHANNEL(chan))
+// if (chan <= MR_CHANNEL_LAST)
// {
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
// gNextMrChannel = chan;
@@ -695,11 +701,13 @@ static void MR_NextChannel(void)
chan = 0xff;
break;
}
+
+ #pragma GCC diagnostic pop
}
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)
{ // no valid channel found
@@ -722,9 +730,9 @@ static void MR_NextChannel(void)
}
#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
- ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
+ gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
#endif
bScanKeepFrequency = false;
@@ -971,7 +979,7 @@ void APP_EndTransmission(void)
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
return;
- if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
+ if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
return;
if (gVOX_NoiseDetected)
@@ -1063,9 +1071,9 @@ void APP_Update(void)
#endif
#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
- if (gScreenToDisplay != DISPLAY_SCANNER && gScanState != SCAN_OFF && gScheduleScanListen && !gPttIsPressed)
+ if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed)
#endif
{ // scanning
@@ -1074,14 +1082,14 @@ void APP_Update(void)
if (gCurrentFunction == FUNCTION_INCOMING)
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
else
- FREQ_NextChannel();
+ FREQ_NextChannel(); // switch to next frequency
}
else
{
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
else
- MR_NextChannel();
+ MR_NextChannel(); // switch to next channel
}
gScanPauseMode = false;
@@ -1124,7 +1132,7 @@ void APP_Update(void)
if (gScheduleDualWatch)
#endif
{
- if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
+ if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
{
if (!gPttIsPressed &&
#ifdef ENABLE_FMRADIO
@@ -1174,7 +1182,7 @@ void APP_Update(void)
gPttIsPressed ||
gKeyBeingHeld ||
gEeprom.BATTERY_SAVE == 0 ||
- gScanState != SCAN_OFF ||
+ gScanStateDir != SCAN_OFF ||
gCssScanMode != CSS_SCAN_MODE_OFF ||
gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
@@ -1199,7 +1207,7 @@ void APP_Update(void)
gPttIsPressed ||
gKeyBeingHeld ||
gEeprom.BATTERY_SAVE == 0 ||
- gScanState != SCAN_OFF ||
+ gScanStateDir != SCAN_OFF ||
gCssScanMode != CSS_SCAN_MODE_OFF ||
gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
@@ -1233,7 +1241,7 @@ void APP_Update(void)
#endif
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF &&
- gScanState == SCAN_OFF &&
+ gScanStateDir == SCAN_OFF &&
gCssScanMode == CSS_SCAN_MODE_OFF)
{ // dual watch mode, toggle between the two VFO's
DUALWATCH_Alternate();
@@ -1247,7 +1255,7 @@ void APP_Update(void)
gRxIdleMode = false; // RX is awake
}
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
updateRSSI(gEeprom.RX_VFO);
@@ -1371,7 +1379,7 @@ void APP_CheckKeys(void)
Key == KEY_DOWN ||
Key == KEY_EXIT ||
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;
APP_ProcessKey(Key, true, true);
@@ -1812,9 +1820,9 @@ void APP_TimeSlice500ms(void)
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
#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
- 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
{
bool exit_menu = false;
@@ -2034,32 +2042,32 @@ void APP_TimeSlice500ms(void)
}
#endif
-void CHANNEL_Next(bool bFlag, int8_t Direction)
+void CHANNEL_Next(const bool bFlag, const int8_t scan_direction)
{
RADIO_SelectVfos();
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
- gScanState = Direction;
+ gScanStateDir = scan_direction;
- if (IS_MR_CHANNEL(gNextMrChannel))
- {
+ if (gNextMrChannel <= MR_CHANNEL_LAST)
+ { // channel mode
if (bFlag)
gRestoreMrChannel = gNextMrChannel;
MR_NextChannel();
}
else
- {
+ { // frequency mode
if (bFlag)
gRestoreFrequency = gRxVfo->freq_config_RX.Frequency;
FREQ_NextChannel();
}
- ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
- gScheduleScanListen = false;
- gRxReceptionMode = RX_MODE_NONE;
- gScanPauseMode = false;
- bScanKeepFrequency = false;
+ gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
+ gScheduleScanListen = false;
+ gRxReceptionMode = RX_MODE_NONE;
+ gScanPauseMode = false;
+ bScanKeepFrequency = false;
}
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_MENU)
{
- if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
+ if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
{ // FREQ/CTCSS/DCS scanning
if (bKeyPressed && !bKeyHeld)
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;
if (Key == KEY_SIDE2)
- {
+ { // transmit 1750Hz tone
Code = 0xFE;
}
else
{
- Code = DTMF_GetCharacter(Key);
+ Code = DTMF_GetCharacter(Key - KEY_0);
if (Code == 0xFF)
goto Skip;
+
+ // transmit DTMF keys
}
if (!bKeyPressed || bKeyHeld)
diff --git a/app/app.h b/app/app.h
index 8d029b0..6f958da 100644
--- a/app/app.h
+++ b/app/app.h
@@ -29,7 +29,7 @@ extern const uint8_t orig_mixer;
extern const uint8_t orig_pga;
void APP_EndTransmission(void);
-void CHANNEL_Next(bool bFlag, int8_t Direction);
+void CHANNEL_Next(const bool bFlag, const int8_t scan_direction);
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step);
void APP_Update(void);
diff --git a/app/dtmf.c b/app/dtmf.c
index ffb9241..b5135ff 100644
--- a/app/dtmf.c
+++ b/app/dtmf.c
@@ -184,7 +184,7 @@ void DTMF_HandleRequest(void)
if (!gDTMF_RX_pending)
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
DTMF_clear_RX();
return;
@@ -331,6 +331,9 @@ void DTMF_HandleRequest(void)
gUpdateDisplay = true;
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (gEeprom.DTMF_DECODE_RESPONSE)
{
case DTMF_DEC_RESPONSE_BOTH:
@@ -348,6 +351,8 @@ void DTMF_HandleRequest(void)
break;
}
+ #pragma GCC diagnostic pop
+
if (gDTMF_IsGroupCall)
gDTMF_ReplyState = DTMF_REPLY_NONE;
}
@@ -385,8 +390,9 @@ void DTMF_Reply(void)
default:
case DTMF_REPLY_NONE:
- if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
- gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
+ if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
+ 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)
{
gDTMF_ReplyState = DTMF_REPLY_NONE;
diff --git a/app/generic.c b/app/generic.c
index ad7f479..82e8f10 100644
--- a/app/generic.c
+++ b/app/generic.c
@@ -154,7 +154,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
return;
}
- if (gScanState != SCAN_OFF)
+ if (gScanStateDir != SCAN_OFF)
{
SCANNER_Stop();
diff --git a/app/main.c b/app/main.c
index 0213afe..50dada8 100644
--- a/app/main.c
+++ b/app/main.c
@@ -37,6 +37,9 @@
#include "settings.h"
#include "ui/inputbox.h"
#include "ui/ui.h"
+#ifdef ENABLE_SPECTRUM
+// #include "app/spectrum.h"
+#endif
void toggle_chan_scanlist(void)
{ // toggle the selected channels scanlist setting
@@ -71,8 +74,15 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
uint8_t Vfo = gEeprom.TX_VFO;
if (gScreenToDisplay == DISPLAY_MENU)
+ {
+// if (beep)
+ gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
+ }
+// if (beep)
+ gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
+
switch (Key)
{
case KEY_0:
@@ -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))
// #endif
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
- { // user is entering frequency
+ { // user is entering a frequency
uint32_t Frequency;
@@ -488,7 +498,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
if (!gFmRadioMode)
#endif
{
- if (gScanState == SCAN_OFF)
+ if (gScanStateDir == SCAN_OFF)
{
if (gInputBoxIndex == 0)
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)
{
+ if (bKeyPressed && !bKeyHeld)
+ // menu key pressed
+ gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
+
if (bKeyHeld)
{ // 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 (gScanState != SCAN_OFF)
+ if (gScanStateDir != SCAN_OFF)
{
if (gCurrentFunction != FUNCTION_INCOMING ||
gRxReceptionMode == RX_MODE_NONE ||
- ScanPauseDelayIn_10ms == 0)
+ gScanPauseDelayIn_10ms == 0)
{ // scan is running (not paused)
return;
}
@@ -611,14 +625,10 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
const bool bFlag = (gInputBoxIndex == 0);
gInputBoxIndex = 0;
- gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
-
if (bFlag)
{
gFlagRefreshSetting = true;
-
gRequestDisplayScreen = DISPLAY_MENU;
-
#ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_MENU;
#endif
@@ -640,7 +650,8 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
}
if (bKeyHeld || !bKeyPressed)
- {
+ { // long press
+
if (bKeyHeld || bKeyPressed)
{
if (!bKeyHeld)
@@ -655,9 +666,9 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
}
#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
- if (gScanState == SCAN_OFF)
+ if (gScanStateDir == SCAN_OFF)
#endif
{
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;
}
- if (gScanState == SCAN_OFF)
+ if (gScanStateDir == SCAN_OFF)
{
#ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(Channel))
@@ -796,7 +807,10 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
return;
}
+ // jump to the next channel
CHANNEL_Next(false, Direction);
+ gScanPauseDelayIn_10ms = 1;
+ gScheduleScanListen = false;
gPttWasReleased = true;
}
@@ -816,7 +830,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{
if (!bKeyHeld)
{
- const char Character = DTMF_GetCharacter(Key);
+ const char Character = DTMF_GetCharacter(Key - KEY_0);
if (Character != 0xFF)
{ // add key to DTMF string
DTMF_Append(Character);
@@ -835,7 +849,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// TODO: ???
if (Key > KEY_PTT)
{
- Key = KEY_SIDE2;
+ Key = KEY_SIDE2; // what's this doing ???
}
switch (Key)
diff --git a/app/menu.c b/app/menu.c
index 45ec8a5..a94b098 100644
--- a/app/menu.c
+++ b/app/menu.c
@@ -86,8 +86,8 @@ void MENU_StartCssScan(int8_t Direction)
MENU_SelectNextCode();
- ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
- gScheduleScanListen = false;
+ gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
+ gScheduleScanListen = false;
}
void MENU_StopCssScan(void)
@@ -408,6 +408,9 @@ void MENU_AcceptSetting(void)
gRequestSaveChannel = 1;
return;
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
case MENU_T_CTCS:
pConfig = &gTxVfo->freq_config_TX;
case MENU_R_CTCS:
@@ -436,6 +439,8 @@ void MENU_AcceptSetting(void)
gRequestSaveChannel = 1;
return;
+ #pragma GCC diagnostic pop
+
case MENU_SFT_D:
gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection;
gRequestSaveChannel = 1;
@@ -819,7 +824,7 @@ void MENU_SelectNextCode(void)
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;
}
@@ -1193,6 +1198,9 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (!gIsInSubMenu)
{
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (gInputBoxIndex)
{
case 2:
@@ -1224,6 +1232,8 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
break;
}
+ #pragma GCC diagnostic pop
+
gInputBoxIndex = 0;
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;
- if (IS_MR_CHANNEL(Value))
+ if (Value <= MR_CHANNEL_LAST)
{
#ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key;
@@ -1661,6 +1671,9 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
VFO = 0;
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (gMenuCursor)
{
case MENU_DEL_CH:
@@ -1681,6 +1694,8 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
return;
}
+ #pragma GCC diagnostic pop
+
Channel = RADIO_FindNextChannel(gSubMenuSelection + Direction, Direction, bCheckScanList, VFO);
if (Channel != 0xFF)
gSubMenuSelection = Channel;
diff --git a/app/scanner.c b/app/scanner.c
index b203ad4..91367a7 100644
--- a/app/scanner.c
+++ b/app/scanner.c
@@ -37,11 +37,11 @@ uint32_t gScanFrequency;
bool gScanPauseMode;
SCAN_CssState_t gScanCssState;
volatile bool gScheduleScanListen = true;
-volatile uint16_t ScanPauseDelayIn_10ms;
+volatile uint16_t gScanPauseDelayIn_10ms;
uint8_t gScanProgressIndicator;
uint8_t gScanHitCount;
bool gScanUseCssResult;
-int8_t gScanState;
+int8_t gScanStateDir;
bool bScanKeepFrequency;
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;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
+
INPUTBOX_Append(Key);
+
gRequestDisplayScreen = DISPLAY_SCANNER;
if (gInputBoxIndex < 3)
@@ -65,9 +67,9 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
}
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
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;
gScanChannel = gTxVfo->CHANNEL_SAVE;
@@ -247,7 +249,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
gTxVfo->freq_config_TX.Code = gScanCssResultCode;
}
- if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
+ if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
{
Channel = gScanChannel;
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
@@ -424,11 +426,11 @@ void SCANNER_Stop(void)
{
const uint8_t Previous = gRestoreMrChannel;
- gScanState = SCAN_OFF;
+ gScanStateDir = SCAN_OFF;
if (!bScanKeepFrequency)
{
- if (IS_MR_CHANNEL(gNextMrChannel))
+ if (gNextMrChannel <= MR_CHANNEL_LAST)
{
gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous;
@@ -446,7 +448,7 @@ void SCANNER_Stop(void)
return;
}
- if (!IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE))
+ if (gRxVfo->CHANNEL_SAVE > MR_CHANNEL_LAST)
{
RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
diff --git a/app/scanner.h b/app/scanner.h
index 9a6b17d..8730ea6 100644
--- a/app/scanner.h
+++ b/app/scanner.h
@@ -32,7 +32,9 @@ typedef enum SCAN_CssState_t SCAN_CssState_t;
enum
{
- SCAN_OFF = 0,
+ SCAN_REV = -1,
+ SCAN_OFF = 0,
+ SCAN_FWD = +1
};
extern DCS_CodeType_t gScanCssResultType;
@@ -46,11 +48,11 @@ extern uint32_t gScanFrequency;
extern bool gScanPauseMode;
extern SCAN_CssState_t gScanCssState;
extern volatile bool gScheduleScanListen;
-extern volatile uint16_t ScanPauseDelayIn_10ms;
+extern volatile uint16_t gScanPauseDelayIn_10ms;
extern uint8_t gScanProgressIndicator;
extern uint8_t gScanHitCount;
extern bool gScanUseCssResult;
-extern int8_t gScanState;
+extern int8_t gScanStateDir;
extern bool bScanKeepFrequency;
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
diff --git a/app/uart.c b/app/uart.c
index c109419..61d1ac5 100644
--- a/app/uart.c
+++ b/app/uart.c
@@ -48,7 +48,7 @@ typedef struct {
} Header_t;
typedef struct {
- uint8_t Padding[2];
+ uint8_t Padding[2];
uint16_t ID;
} Footer_t;
@@ -60,10 +60,10 @@ typedef struct {
typedef struct {
Header_t Header;
struct {
- char Version[16];
- bool bHasCustomAesKey;
- bool bIsInLockScreen;
- uint8_t Padding[2];
+ char Version[16];
+ bool bHasCustomAesKey;
+ bool bIsInLockScreen;
+ uint8_t Padding[2];
uint32_t Challenge[4];
} Data;
} REPLY_0514_t;
@@ -71,8 +71,8 @@ typedef struct {
typedef struct {
Header_t Header;
uint16_t Offset;
- uint8_t Size;
- uint8_t Padding;
+ uint8_t Size;
+ uint8_t Padding;
uint32_t Timestamp;
} CMD_051B_t;
@@ -80,19 +80,19 @@ typedef struct {
Header_t Header;
struct {
uint16_t Offset;
- uint8_t Size;
- uint8_t Padding;
- uint8_t Data[128];
+ uint8_t Size;
+ uint8_t Padding;
+ uint8_t Data[128];
} Data;
} REPLY_051B_t;
typedef struct {
Header_t Header;
uint16_t Offset;
- uint8_t Size;
- bool bAllowPassword;
+ uint8_t Size;
+ bool bAllowPassword;
uint32_t Timestamp;
- uint8_t Data[0];
+ uint8_t Data[0];
} CMD_051D_t;
typedef struct {
@@ -106,8 +106,8 @@ typedef struct {
Header_t Header;
struct {
uint16_t RSSI;
- uint8_t ExNoiseIndicator;
- uint8_t GlitchIndicator;
+ uint8_t ExNoiseIndicator;
+ uint8_t GlitchIndicator;
} Data;
} REPLY_0527_t;
@@ -137,7 +137,10 @@ typedef struct {
uint32_t Timestamp;
} 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
{
@@ -157,12 +160,11 @@ static void SendReply(void *pReply, uint16_t Size)
{
Header_t Header;
Footer_t Footer;
- uint8_t *pBytes;
- uint16_t i;
if (bIsEncrypted)
{
- pBytes = (uint8_t *)pReply;
+ uint8_t *pBytes = (uint8_t *)pReply;
+ unsigned int i;
for (i = 0; i < Size; i++)
pBytes[i] ^= Obfuscation[i % 16];
}
@@ -171,6 +173,7 @@ static void SendReply(void *pReply, uint16_t Size)
Header.Size = Size;
UART_Send(&Header, sizeof(Header));
UART_Send(pReply, Size);
+
if (bIsEncrypted)
{
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)
{
- uint8_t i;
- uint32_t IV[4];
+ unsigned int i;
+ uint32_t IV[4];
IV[0] = 0;
IV[1] = 0;
IV[2] = 0;
IV[3] = 0;
+
AES_Encrypt(pKey, IV, pIn, IV, true);
+
for (i = 0; i < 4; i++)
if (IV[i] != pResponse[i])
return true;
@@ -254,10 +259,10 @@ static void CMD_051B(const uint8_t *pBuffer)
#endif
memset(&Reply, 0, sizeof(Reply));
- Reply.Header.ID = 0x051C;
+ Reply.Header.ID = 0x051C;
Reply.Header.Size = pCmd->Size + 4;
Reply.Data.Offset = pCmd->Offset;
- Reply.Data.Size = pCmd->Size;
+ Reply.Data.Size = pCmd->Size;
if (bHasCustomAesKey)
bLocked = gIsLocked;
@@ -294,7 +299,7 @@ static void CMD_051D(const uint8_t *pBuffer)
if (!bIsLocked)
{
- uint16_t i;
+ unsigned int i;
for (i = 0; i < (pCmd->Size / 8); i++)
{
const uint16_t Offset = pCmd->Offset + (i * 8U);
@@ -331,23 +336,25 @@ static void CMD_0529(void)
{
REPLY_0529_t Reply;
- Reply.Header.ID = 0x52A;
+ Reply.Header.ID = 0x52A;
Reply.Header.Size = sizeof(Reply.Data);
+
// Original doesn't actually send current!
BOARD_ADC_GetBatteryInfo(&Reply.Data.Voltage, &Reply.Data.Current);
+
SendReply(&Reply, sizeof(Reply));
}
static void CMD_052D(const uint8_t *pBuffer)
{
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
- REPLY_052D_t Reply;
- bool bIsLocked;
+ REPLY_052D_t Reply;
+ bool bIsLocked;
#ifdef ENABLE_FMRADIO
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
#endif
- Reply.Header.ID = 0x052E;
+ Reply.Header.ID = 0x052E;
Reply.Header.Size = sizeof(Reply.Data);
bIsLocked = bHasCustomAesKey;
@@ -413,15 +420,13 @@ static void CMD_052F(const uint8_t *pBuffer)
bool UART_IsCommandAvailable(void)
{
- uint16_t DmaLength;
- uint16_t CommandLength;
uint16_t Index;
uint16_t TailIndex;
uint16_t Size;
uint16_t CRC;
- uint16_t i;
+ uint16_t CommandLength;
+ uint16_t DmaLength = DMA_CH0->ST & 0xFFFU;
- DmaLength = DMA_CH0->ST & 0xFFFU;
while (1)
{
if (gUART_WriteIndex == DmaLength)
@@ -450,7 +455,7 @@ bool UART_IsCommandAvailable(void)
Index = DMA_INDEX(gUART_WriteIndex, 2);
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;
return false;
@@ -495,9 +500,12 @@ bool UART_IsCommandAvailable(void)
bIsEncrypted = true;
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];
-
+ }
+
CRC = UART_Command.Buffer[Size] | (UART_Command.Buffer[Size + 1] << 8);
return (CRC_Calculate(UART_Command.Buffer, Size) != CRC) ? false : true;
diff --git a/audio.c b/audio.c
index 671d386..b46fd44 100644
--- a/audio.c
+++ b/audio.c
@@ -142,6 +142,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
SYSTEM_DelayMs(60);
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (Beep)
{
case BEEP_880HZ_60MS_TRIPLE_BEEP:
@@ -181,6 +184,8 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
break;
}
+ #pragma GCC diagnostic pop
+
SYSTEM_DelayMs(Duration);
BK4819_EnterTxMute();
SYSTEM_DelayMs(20);
diff --git a/bitmaps.c b/bitmaps.c
index 9bc4252..38ae540 100644
--- a/bitmaps.c
+++ b/bitmaps.c
@@ -281,54 +281,7 @@ const uint8_t BITMAP_TDR2[12] =
0b00110001
};
#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] =
{
0b00000011,
diff --git a/bitmaps.h b/bitmaps.h
index ab0d979..310ff60 100644
--- a/bitmaps.h
+++ b/bitmaps.h
@@ -46,11 +46,6 @@ extern const uint8_t BITMAP_TDR2[12];
extern const uint8_t BITMAP_NOAA[12];
#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_AntennaLevel1[3];
extern const uint8_t BITMAP_AntennaLevel2[3];
diff --git a/board.c b/board.c
index 259b0a5..a632726 100644
--- a/board.c
+++ b/board.c
@@ -687,7 +687,8 @@ void BOARD_EEPROM_Init(void)
// 0F18..0F1F
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++)
{
const unsigned int j = 1 + (i * 3);
diff --git a/driver/adc.c b/driver/adc.c
index 6f0214b..bde01f0 100644
--- a/driver/adc.c
+++ b/driver/adc.c
@@ -134,9 +134,9 @@ void ADC_Configure(ADC_Config_t *pAdc)
;
if (SARADC_IE == 0) {
- NVIC_DisableIRQ(DP32_SARADC_IRQn);
+ NVIC_DisableIRQ((IRQn_Type)DP32_SARADC_IRQn);
} else {
- NVIC_EnableIRQ(DP32_SARADC_IRQn);
+ NVIC_EnableIRQ((IRQn_Type)DP32_SARADC_IRQn);
}
}
diff --git a/driver/aes.c b/driver/aes.c
index 17a3990..6a8b5c0 100644
--- a/driver/aes.c
+++ b/driver/aes.c
@@ -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 *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_CHMOD_BITS_CBC;
AES_KEYR3 = pK[0];
diff --git a/driver/bk4819.c b/driver/bk4819.c
index aa96c20..0d921d7 100644
--- a/driver/bk4819.c
+++ b/driver/bk4819.c
@@ -602,8 +602,8 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
{ // make the RX bandwidth the same with weak signals
val =
(0u << 15) | // 0
- (5u << 12) | // *3 RF filter bandwidth
- (5u << 9) | // *0 RF filter bandwidth when signal is weak
+ (4u << 12) | // *3 RF filter bandwidth
+ (4u << 9) | // *0 RF filter bandwidth when signal is weak
(6u << 6) | // *0 AFTxLPF2 filter Band Width
(2u << 4) | // 2 BW Mode Selection
(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
val = // 0x3028); // 0 011 000 000 10 1 0 00
(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
(6u << 6) | // *0 AFTxLPF2 filter Band Width
(2u << 4) | // 2 BW Mode Selection
@@ -629,8 +629,8 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
{
val =
(0u << 15) | // 0
- (5u << 12) | // *4 RF filter bandwidth
- (5u << 9) | // *0 RF filter bandwidth when signal is weak
+ (4u << 12) | // *4 RF filter bandwidth
+ (4u << 9) | // *0 RF filter bandwidth when signal is weak
(0u << 6) | // *1 AFTxLPF2 filter Band Width
(0u << 4) | // 0 BW Mode Selection
(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
(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
(0u << 6) | // *1 AFTxLPF2 filter Band Width
(0u << 4) | // 0 BW Mode Selection
@@ -738,7 +738,7 @@ void BK4819_SetupSquelch(
//
BK4819_WriteRegister(BK4819_REG_70, 0);
- // Glitch threshold for Squelch
+ // Glitch threshold for Squelch = close
//
// 0 ~ 255
//
@@ -748,47 +748,49 @@ void BK4819_SetupSquelch(
//
// <15:14> 1 ???
//
- // <13:11> 5 Squelch = 1 Delay Setting
+ // <13:11> 5 Squelch = open Delay Setting
// 0 ~ 7
//
- // <10:9> 7 Squelch = 0 Delay Setting
+ // <10:9> 7 Squelch = close Delay Setting
// 0 ~ 3
//
// <8> 0 ???
//
- // <7:0> 8 Glitch threshold for Squelch = 1
+ // <7:0> 8 Glitch threshold for Squelch = open
// 0 ~ 255
//
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
#ifndef ENABLE_FASTER_CHANNEL_SCAN
- // original
- (1u << 14) | // 1 ???
- (5u << 11) | // 5 squelch = 1 delay .. 0 ~ 7
- (3u << 9) | // 3 squelch = 0 delay .. 0 ~ 3
- SquelchOpenGlitchThresh); // 0 ~ 255
+ // original (*)
+ (1u << 14) | // 1 ???
+ (3u << 11) | // *5 squelch = open delay .. 0 ~ 7
+ (2u << 9) | // *3 squelch = close delay .. 0 ~ 3
+ SquelchOpenGlitchThresh); // 0 ~ 255
#else
// faster (but twitchier)
- (1u << 14) | // 1 ???
- SquelchOpenGlitchThresh); // 0 ~ 255
+ (1u << 14) | // 1 ???
+ (2u << 11) | // *5 squelch = open delay .. 0 ~ 7
+ (1u << 9) | // *3 squelch = close delay .. 0 ~ 3
+ SquelchOpenGlitchThresh); // 0 ~ 255
#endif
// REG_4F
//
- // <14:8> 47 Ex-noise threshold for Squelch = 0
+ // <14:8> 47 Ex-noise threshold for Squelch = close
// 0 ~ 127
//
// <7> ???
//
- // <6:0> 46 Ex-noise threshold for Squelch = 1
+ // <6:0> 46 Ex-noise threshold for Squelch = open
// 0 ~ 127
//
BK4819_WriteRegister(BK4819_REG_4F, ((uint16_t)SquelchCloseNoiseThresh << 8) | SquelchOpenNoiseThresh);
// 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);
@@ -1002,6 +1004,42 @@ void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch)
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)
{
BK4819_WriteRegister(BK4819_REG_50, 0xBB20);
@@ -1285,7 +1323,7 @@ void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency)
// 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 | (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));
@@ -1629,7 +1667,9 @@ void BK4819_PlayRoger(void)
BK4819_EnterTxMute();
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();
SYSTEM_DelayMs(50);
diff --git a/driver/bk4819.h b/driver/bk4819.h
index 352bbf5..736b171 100644
--- a/driver/bk4819.h
+++ b/driver/bk4819.h
@@ -102,6 +102,7 @@ void BK4819_DisableVox(void);
void BK4819_DisableDTMF(void);
void BK4819_EnableDTMF(void);
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_ExitTxMute(void);
void BK4819_Sleep(void);
diff --git a/driver/gpio.h b/driver/gpio.h
index a6e6158..0d9f1d0 100644
--- a/driver/gpio.h
+++ b/driver/gpio.h
@@ -58,10 +58,10 @@ enum GPIOC_PINS {
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);
-void GPIO_FlipBit(volatile uint32_t *pReg, uint8_t Bit);
-void GPIO_SetBit(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);
#endif
diff --git a/driver/keyboard.c b/driver/keyboard.c
index 7ce7ee1..c6af554 100644
--- a/driver/keyboard.c
+++ b/driver/keyboard.c
@@ -22,76 +22,74 @@
#include "driver/i2c.h"
#include "misc.h"
-KEY_Code_t gKeyReading0 = KEY_INVALID;
-KEY_Code_t gKeyReading1 = KEY_INVALID;
-uint16_t gDebounceCounter;
-bool gWasFKeyPressed;
+KEY_Code_t gKeyReading0 = KEY_INVALID;
+KEY_Code_t gKeyReading1 = KEY_INVALID;
+uint16_t gDebounceCounter = 0;
+bool gWasFKeyPressed = false;
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.
- //The key and pin defines fit together in a single u8,
- //making this very efficient
- struct {
- uint8_t key : 5; //Key 23 is highest
- uint8_t pin : 3; //Pin 6 is highest
- } pins[4];
-} keyboard[5] = {
- /* Zero row */
- {
- //Set to zero to handle special case of nothing pulled down.
- .set_to_zero_mask = ~(0),
- .pins = {
- { .key = KEY_SIDE1, .pin = GPIOA_PIN_KEYBOARD_0},
- { .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
- /* Duplicate to fill the array with valid values */
- { .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
- { .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
- }
- },
- /* First row */
- {
- .set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_4),
- .pins = {
- { .key = KEY_MENU, .pin = GPIOA_PIN_KEYBOARD_0},
- { .key = KEY_1, .pin = GPIOA_PIN_KEYBOARD_1},
- { .key = KEY_4, .pin = GPIOA_PIN_KEYBOARD_2},
- { .key = KEY_7, .pin = GPIOA_PIN_KEYBOARD_3},
- }
- },
- /* Second row */
- {
- .set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_5),
- .pins = {
- { .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0},
- { .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1},
- { .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2},
- { .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3},
- }
- },
- /* Third row */
- {
- .set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_6),
- .pins = {
- { .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0},
- { .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),
- .pins = {
- { .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0},
- { .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1},
- { .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2},
- { .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3},
- }
- },
+ // 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.
+ // The key and pin defines fit together in a single u8, making this very efficient
+ struct {
+ uint8_t key : 5; // Key 23 is highest
+ uint8_t pin : 3; // Pin 6 is highest
+ } pins[4];
+
+} keyboard[] = {
+
+ { // Zero row
+ // Set to zero to handle special case of nothing pulled down
+ .set_to_zero_mask = 0xffff,
+ .pins = {
+ { .key = KEY_SIDE1, .pin = GPIOA_PIN_KEYBOARD_0},
+ { .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
+
+ // Duplicate to fill the array with valid values
+ { .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1},
+ { .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1}
+ }
+ },
+ { // First row
+ .set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_4) & 0xffff,
+ .pins = {
+ { .key = KEY_MENU, .pin = GPIOA_PIN_KEYBOARD_0},
+ { .key = KEY_1, .pin = GPIOA_PIN_KEYBOARD_1},
+ { .key = KEY_4, .pin = GPIOA_PIN_KEYBOARD_2},
+ { .key = KEY_7, .pin = GPIOA_PIN_KEYBOARD_3}
+ }
+ },
+ { // Second row
+ .set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_5) & 0xffff,
+ .pins = {
+ { .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0},
+ { .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1},
+ { .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2},
+ { .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3}
+ }
+ },
+ { // Third row
+ .set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_6) & 0xffff,
+ .pins = {
+ { .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0},
+ { .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 = ~(1u << GPIOA_PIN_KEYBOARD_7) & 0xffff,
+ .pins = {
+ { .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0},
+ { .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1},
+ { .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2},
+ { .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3}
+ }
+ }
};
KEY_Code_t KEYBOARD_Poll(void)
@@ -100,43 +98,49 @@ KEY_Code_t KEYBOARD_Poll(void)
// if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_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.
- SYSTICK_DelayUs(2);
+ for (unsigned int j = 0; j < ARRAY_SIZE(keyboard); j++)
+ {
+ uint16_t reg;
- // Read all 4 GPIO pins at once
- uint16_t reg = GPIOA->DATA;
- for(int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++)
- {
- uint16_t mask = 1 << keyboard[j].pins[i].pin;
- if(! (reg & mask)) {
- Key = keyboard[j].pins[i].key;
- break;
- }
- }
+ // Set all high
+ GPIOA->DATA |= 1u << GPIOA_PIN_KEYBOARD_4 |
+ 1u << GPIOA_PIN_KEYBOARD_5 |
+ 1u << GPIOA_PIN_KEYBOARD_6 |
+ 1u << GPIOA_PIN_KEYBOARD_7;
- if (Key != KEY_INVALID)
- break;
- }
+ // Clear the pin we are selecting
+ GPIOA->DATA &= keyboard[j].set_to_zero_mask;
- //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();
+ // Wait for the pins to stabilize
+ SYSTICK_DelayUs(1);
+
+ // 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
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;
}
diff --git a/driver/keyboard.h b/driver/keyboard.h
index 36a5d3c..78c1a4f 100644
--- a/driver/keyboard.h
+++ b/driver/keyboard.h
@@ -21,30 +21,28 @@
#include
#include
-enum KEY_Code_t {
- KEY_0 = 0,
- KEY_1 = 1,
- KEY_2 = 2,
- KEY_3 = 3,
- KEY_4 = 4,
- KEY_5 = 5,
- KEY_6 = 6,
- KEY_7 = 7,
- KEY_8 = 8,
- KEY_9 = 9,
- KEY_MENU = 10,
- KEY_UP = 11,
- KEY_DOWN = 12,
- KEY_EXIT = 13,
- KEY_STAR = 14,
- KEY_F = 15,
- KEY_PTT = 21,
- KEY_SIDE2 = 22,
- KEY_SIDE1 = 23,
- KEY_INVALID = 255
-};
-
-typedef enum KEY_Code_t KEY_Code_t;
+typedef enum {
+ KEY_INVALID = 0,
+ KEY_0,
+ KEY_1,
+ KEY_2,
+ KEY_3,
+ KEY_4,
+ KEY_5,
+ KEY_6,
+ KEY_7,
+ KEY_8,
+ KEY_9,
+ KEY_MENU,
+ KEY_UP,
+ KEY_DOWN,
+ KEY_EXIT,
+ KEY_STAR,
+ KEY_F,
+ KEY_PTT,
+ KEY_SIDE2,
+ KEY_SIDE1
+} KEY_Code_t;
extern KEY_Code_t gKeyReading0;
extern KEY_Code_t gKeyReading1;
diff --git a/driver/spi.c b/driver/spi.c
index 9fb5e02..4a1a279 100644
--- a/driver/spi.c
+++ b/driver/spi.c
@@ -93,9 +93,9 @@ void SPI_Configure(volatile SPI_Port_t *pPort, SPI_Config_t *pConfig)
if (pPort->IE) {
if (pPort == SPI0) {
- NVIC_EnableIRQ(DP32_SPI0_IRQn);
+ NVIC_EnableIRQ((IRQn_Type)DP32_SPI0_IRQn);
} else if (pPort == SPI1) {
- NVIC_EnableIRQ(DP32_SPI1_IRQn);
+ NVIC_EnableIRQ((IRQn_Type)DP32_SPI1_IRQn);
}
}
}
diff --git a/driver/st7565.c b/driver/st7565.c
index dd4061a..c2ccd3f 100644
--- a/driver/st7565.c
+++ b/driver/st7565.c
@@ -123,6 +123,7 @@ void ST7565_FillScreen(uint8_t Value)
ST7565_Init(false);
SPI_ToggleMasterMode(&SPI0->CR, false);
+
for (i = 0; i < 8; i++)
{
unsigned int j;
@@ -135,6 +136,7 @@ void ST7565_FillScreen(uint8_t Value)
}
SPI_WaitForUndocumentedTxFifoStatusBit();
}
+
SPI_ToggleMasterMode(&SPI0->CR, true);
}
@@ -152,6 +154,8 @@ void ST7565_Init(const bool full)
SYSTEM_DelayMs(120);
}
+ else
+ SPI_ToggleMasterMode(&SPI0->CR, false);
ST7565_WriteByte(0xA2); // bias 9
ST7565_WriteByte(0xC0); // com normal
@@ -164,9 +168,10 @@ void ST7565_Init(const bool full)
ST7565_WriteByte(0x24); //
ST7565_WriteByte(0x81); // volume first ?
+ ST7565_WriteByte(0x1f); // contrast ?
+
if (full)
{
- ST7565_WriteByte(0x1f); // contrast ?
ST7565_WriteByte(0x2B); // power control ?
SYSTEM_DelayMs(1);
@@ -181,11 +186,11 @@ void ST7565_Init(const bool full)
ST7565_WriteByte(0x2F); //
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_ToggleMasterMode(&SPI0->CR, true);
diff --git a/font.c b/font.c
index f5d563f..3d0e3b2 100644
--- a/font.c
+++ b/font.c
@@ -19,6 +19,7 @@
//const uint8_t gFontBig[95][16] =
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, 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}, // '"'
@@ -114,7 +115,104 @@ const uint8_t gFontBig[95][15] =
{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}, // '}'
{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
// original font
@@ -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, 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
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, 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
/*
const uint8_t gFontSmallDigits[11][7] =
@@ -165,174 +279,6 @@ const uint8_t gFontSmallDigits[11][7] =
{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] =
{
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
@@ -502,10 +448,10 @@ const uint8_t gFontSmall[95][6] =
{0x00, 0x03, 0x07, 0x06, 0x00, 0x00},
{0x20, 0x76, 0x56, 0x56, 0x7E, 0x3C},
{0x7F, 0x7F, 0x6C, 0x6C, 0x7C, 0x38},
- {0x3C, 0x7E, 0x66, 0x66, 0x66, 0x24},
+ {0x38, 0x7C, 0x6C, 0x6C, 0x6C, 0x00},
{0x38, 0x7C, 0x6C, 0x6C, 0x7F, 0x7F},
{0x3C, 0x7E, 0x56, 0x56, 0x5E, 0x0C},
- {0x7C, 0x7E, 0x36, 0x36, 0x06, 0x00},
+ {0x7E, 0x7F, 0x1B, 0x1B, 0x02, 0x00},
{0x0C, 0x5E, 0x56, 0x56, 0x7E, 0x3C},
{0x7F, 0x7F, 0x0C, 0x0C, 0x7C, 0x78},
{0x00, 0x00, 0x7A, 0x7A, 0x00, 0x00},
@@ -516,7 +462,7 @@ const uint8_t gFontSmall[95][6] =
{0x7C, 0x7C, 0x0C, 0x0C, 0x7C, 0x78},
{0x3C, 0x7E, 0x66, 0x66, 0x7E, 0x3C},
{0x7E, 0x7E, 0x36, 0x36, 0x3E, 0x1C},
- {0x1C, 0x3E, 0x36, 0x3E, 0x7E, 0x40},
+ {0x1C, 0x3E, 0x36, 0x7E, 0x7E, 0x60},
{0x7C, 0x7C, 0x0C, 0x0C, 0x18, 0x00},
{0x4C, 0x5E, 0x56, 0x56, 0x76, 0x20},
{0x3F, 0x7F, 0x6C, 0x6C, 0x60, 0x00},
@@ -524,11 +470,177 @@ const uint8_t gFontSmall[95][6] =
{0x0C, 0x3C, 0x70, 0x70, 0x3C, 0x0C},
{0x3C, 0x7C, 0x30, 0x30, 0x7C, 0x3C},
{0x44, 0x6C, 0x38, 0x38, 0x6C, 0x44},
- {0x06, 0x6E, 0x6C, 0x6C, 0x7E, 0x3E},
+ {0x06, 0x6E, 0x68, 0x68, 0x7E, 0x3E},
{0x66, 0x76, 0x7E, 0x6E, 0x66, 0x00},
{0x08, 0x3E, 0x77, 0x41, 0x00, 0x00},
{0x00, 0x00, 0x7F, 0x00, 0x00, 0x00},
{0x00, 0x41, 0x77, 0x3E, 0x08, 0x00},
- {0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00},
+ {0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00}
};
-#endif
\ No newline at end of file
+#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
diff --git a/functions.c b/functions.c
index a302208..cd02ab1 100644
--- a/functions.c
+++ b/functions.c
@@ -204,6 +204,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
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 (gAlarmState != ALARM_STATE_OFF)
{
diff --git a/AM_fix.mp4 b/images/AM_fix.mp4
similarity index 100%
rename from AM_fix.mp4
rename to images/AM_fix.mp4
diff --git a/image1.png b/images/image1.png
similarity index 100%
rename from image1.png
rename to images/image1.png
diff --git a/image2.png b/images/image2.png
similarity index 100%
rename from image2.png
rename to images/image2.png
diff --git a/image3.png b/images/image3.png
similarity index 100%
rename from image3.png
rename to images/image3.png
diff --git a/init.c b/init.c
index fc9d2d2..dffc39a 100644
--- a/init.c
+++ b/init.c
@@ -30,21 +30,17 @@ void DATA_Init(void);
void BSS_Init(void)
{
uint32_t *pBss;
-
- for (pBss = __bss_start__; pBss < __bss_end__; pBss++) {
+ for (pBss = __bss_start__; pBss < __bss_end__; pBss++)
*pBss = 0;
- }
}
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;
- uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
- uint32_t i;
+ uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
+ unsigned int i;
- for (i = 0; i < Size / 4; i++) {
+ for (i = 0; i < (Size / 4); i++)
*pDataRam++ = *pDataFlash++;
- }
}
-
diff --git a/main.c b/main.c
index 7df450b..a7d82f2 100644
--- a/main.c
+++ b/main.c
@@ -174,12 +174,14 @@ void Main(void)
}
}
- if (gEeprom.POWER_ON_PASSWORD < 1000000)
- {
- bIsInLockScreen = true;
- UI_DisplayLock();
- bIsInLockScreen = false;
- }
+ #ifdef ENABLE_PWRON_PASSWORD
+ if (gEeprom.POWER_ON_PASSWORD < 1000000)
+ {
+ bIsInLockScreen = true;
+ UI_DisplayLock();
+ bIsInLockScreen = false;
+ }
+ #endif
BOOT_ProcessMode(BootMode);
diff --git a/misc.h b/misc.h
index d19c28e..9a5b0c0 100644
--- a/misc.h
+++ b/misc.h
@@ -24,24 +24,20 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
-#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_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
+#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_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
-#ifdef ENABLE_NOAA
- #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)
-#endif
+#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)
enum {
MR_CHANNEL_FIRST = 0,
MR_CHANNEL_LAST = 199u,
FREQ_CHANNEL_FIRST = 200u,
FREQ_CHANNEL_LAST = 206u,
- #ifdef ENABLE_NOAA
- NOAA_CHANNEL_FIRST = 207u,
- NOAA_CHANNEL_LAST = 216u,
- #endif
+ NOAA_CHANNEL_FIRST = 207u,
+ NOAA_CHANNEL_LAST = 216u,
LAST_CHANNEL
};
diff --git a/radio.c b/radio.c
index 8d3f212..38dd1b5 100644
--- a/radio.c
+++ b/radio.c
@@ -51,7 +51,7 @@ bool RADIO_CheckValidChannel(uint16_t Channel, bool bCheckScanList, uint8_t VFO)
uint8_t PriorityCh1;
uint8_t PriorityCh2;
- if (!IS_MR_CHANNEL(Channel))
+ if (Channel > MR_CHANNEL_LAST)
return false;
Attributes = gMR_ChannelAttributes[Channel];
@@ -176,7 +176,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
}
#endif
- if (IS_MR_CHANNEL(Channel))
+ if (Channel <= MR_CHANNEL_LAST)
{
Channel = RADIO_FindNextChannel(Channel, RADIO_CHANNEL_UP, false, VFO);
if (Channel == 0xFF)
@@ -200,7 +200,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
uint8_t Index;
- if (IS_MR_CHANNEL(Channel))
+ if (Channel <= MR_CHANNEL_LAST)
{
Channel = 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;
}
- if (IS_MR_CHANNEL(Channel))
+ if (Channel <= MR_CHANNEL_LAST)
{
gEeprom.VfoInfo[VFO].Band = Band;
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].CHANNEL_SAVE = Channel;
- if (IS_MR_CHANNEL(Channel))
+ if (Channel <= MR_CHANNEL_LAST)
Base = Channel * 16;
else
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)
{
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
{
- gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = !!((Data[5] >> 0) & 1u);
- gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = ((Data[5] >> 1) & 3u);
+ gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = ((Data[5] >> 0) & 1u) ? true : false;
+ 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)
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
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);
RADIO_ApplyOffset(pRadio);
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
EEPROM_ReadBuffer(0x0F50 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 0, 8);
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)
{
uint8_t Txp[3];
- FREQUENCY_Band_t Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
- uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
+ FREQUENCY_Band_t Band;
+
+ // *******************************
+ // squelch
+
+ Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
+ uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
if (gEeprom.SQUELCH_LEVEL == 0)
{ // squelch == 0 (off)
- pInfo->SquelchOpenRSSIThresh = 0;
- pInfo->SquelchOpenNoiseThresh = 127;
- pInfo->SquelchCloseGlitchThresh = 255;
+ pInfo->SquelchOpenRSSIThresh = 0; // 0 ~ 255
+ pInfo->SquelchOpenNoiseThresh = 127; // 127 ~ 0
+ pInfo->SquelchCloseGlitchThresh = 255; // 255 ~ 0
- pInfo->SquelchCloseRSSIThresh = 0;
- pInfo->SquelchCloseNoiseThresh = 127;
- pInfo->SquelchOpenGlitchThresh = 255;
+ pInfo->SquelchCloseRSSIThresh = 0; // 0 ~ 255
+ pInfo->SquelchCloseNoiseThresh = 127; // 127 ~ 0
+ pInfo->SquelchOpenGlitchThresh = 255; // 255 ~ 0
}
else
{ // squelch >= 1
- Base += gEeprom.SQUELCH_LEVEL; // my squelch-1
+ Base += gEeprom.SQUELCH_LEVEL; // my eeprom squelch-1
// VHF UHF
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
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 + 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
// 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
- pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9;
- pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9;
+ #if 0
+ 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;
- pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
-
- pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
- pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
+ #else
+ // more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
+ rssi_open = (rssi_open * 3) / 4;
+ noise_open = (noise_open * 4) / 3;
+ glitch_open = (glitch_open * 4) / 3;
#endif
- if (pInfo->SquelchOpenNoiseThresh > 127)
- pInfo->SquelchOpenNoiseThresh = 127;
+ rssi_close = (rssi_open * 9) / 10;
+ noise_close = (noise_open * 10) / 9;
+ glitch_close = (glitch_open * 10) / 9;
- if (pInfo->SquelchCloseNoiseThresh > 127)
- pInfo->SquelchCloseNoiseThresh = 127;
+ // ensure the 'close' threshold is lower than the 'open' threshold
+ 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);
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].upper,
pInfo->pTX->Frequency);
+
+ // *******************************
}
void RADIO_ApplyOffset(VFO_Info_t *pInfo)
@@ -543,6 +581,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (Bandwidth)
{
default:
@@ -558,6 +599,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
break;
}
+ #pragma GCC diagnostic pop
+
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
BK4819_SetupPowerAmplifier(0, 0);
@@ -792,6 +835,9 @@ void RADIO_SetTxParameters(void)
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (Bandwidth)
{
default:
@@ -807,6 +853,8 @@ void RADIO_SetTxParameters(void)
break;
}
+ #pragma GCC diagnostic pop
+
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
// TX compressor
@@ -1032,8 +1080,12 @@ void RADIO_SendEndOfTransmission(void)
if (gEeprom.ROGER == ROGER_MODE_MDC)
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 &&
- (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
if (gEeprom.DTMF_SIDE_TONE)
{
@@ -1045,15 +1097,14 @@ void RADIO_SendEndOfTransmission(void)
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
BK4819_PlayDTMFString(
- gEeprom.DTMF_DOWN_CODE,
- 0,
- gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
- gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
- gEeprom.DTMF_CODE_PERSIST_TIME,
- gEeprom.DTMF_CODE_INTERVAL_TIME);
-
+ gEeprom.DTMF_DOWN_CODE,
+ 0,
+ gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
+ gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
+ gEeprom.DTMF_CODE_PERSIST_TIME,
+ gEeprom.DTMF_CODE_INTERVAL_TIME);
+
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
-
gEnableSpeaker = false;
}
diff --git a/radio.h b/radio.h
index 66f1536..e1d03da 100644
--- a/radio.h
+++ b/radio.h
@@ -44,7 +44,8 @@ enum PTT_ID_t {
PTT_ID_OFF = 0, // OFF
PTT_ID_TX_UP, // BEGIN 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;
diff --git a/scheduler.c b/scheduler.c
index 03cf9a2..d056fa2 100644
--- a/scheduler.c
+++ b/scheduler.c
@@ -77,20 +77,20 @@ void SystickHandler(void)
if (gCurrentFunction == FUNCTION_POWER_SAVE)
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)
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch);
#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 (gCurrentFunction != FUNCTION_RECEIVE)
DECREMENT_AND_TRIGGER(gNOAA_Countdown_10ms, gScheduleNOAA);
#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)
- DECREMENT_AND_TRIGGER(ScanPauseDelayIn_10ms, gScheduleScanListen);
+ DECREMENT_AND_TRIGGER(gScanPauseDelayIn_10ms, gScheduleScanListen);
DECREMENT_AND_TRIGGER(gTailNoteEliminationCountdown_10ms, gFlagTailNoteEliminationComplete);
diff --git a/settings.c b/settings.c
index 8bec24b..1910c55 100644
--- a/settings.c
+++ b/settings.c
@@ -117,8 +117,10 @@ void SETTINGS_SaveSettings(void)
EEPROM_WriteBuffer(0x0E90, State);
memset(Password, 0xFF, sizeof(Password));
- Password[0] = gEeprom.POWER_ON_PASSWORD;
- EEPROM_WriteBuffer(0x0E98, State);
+ #ifdef ENABLE_PWRON_PASSWORD
+ Password[0] = gEeprom.POWER_ON_PASSWORD;
+ #endif
+ EEPROM_WriteBuffer(0x0E98, Password);
#ifdef ENABLE_VOICE
memset(State, 0xFF, sizeof(State));
@@ -184,10 +186,6 @@ void SETTINGS_SaveSettings(void)
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)
{
#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;
uint16_t OffsetVFO = OffsetMR;
- if (!IS_MR_CHANNEL(Channel))
+ if (Channel > MR_CHANNEL_LAST)
{ // it's a VFO, not a channel
OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90;
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
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->CHANNEL_BANDWIDTH << 1)
| (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[7] = pVFO->SCRAMBLING_TYPE;
EEPROM_WriteBuffer(OffsetVFO + 8, State);
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
// clear/reset the channel name
//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
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));
@@ -280,8 +279,9 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
gMR_ChannelAttributes[Channel] = Attributes;
// #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;
if (!keep)
{ // clear/reset the channel name
diff --git a/ui/inputbox.c b/ui/inputbox.c
index bc98197..e352cce 100644
--- a/ui/inputbox.c
+++ b/ui/inputbox.c
@@ -21,7 +21,7 @@
char gInputBox[8];
uint8_t gInputBoxIndex;
-void INPUTBOX_Append(char Digit)
+void INPUTBOX_Append(const KEY_Code_t Digit)
{
if (gInputBoxIndex >= sizeof(gInputBox))
return;
@@ -29,6 +29,7 @@ void INPUTBOX_Append(char Digit)
if (gInputBoxIndex == 0)
memset(gInputBox, 10, sizeof(gInputBox));
- gInputBox[gInputBoxIndex++] = Digit;
+ if (Digit >= KEY_0 && Digit != KEY_INVALID)
+ gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0);
}
diff --git a/ui/inputbox.h b/ui/inputbox.h
index be01fe9..d7a6d2e 100644
--- a/ui/inputbox.h
+++ b/ui/inputbox.h
@@ -19,10 +19,12 @@
#include
+#include "driver/keyboard.h"
+
extern char gInputBox[8];
extern uint8_t gInputBoxIndex;
-void INPUTBOX_Append(char Digit);
+void INPUTBOX_Append(const KEY_Code_t Digit);
#endif
diff --git a/ui/lock.c b/ui/lock.c
index ea5e87f..1dca0a2 100644
--- a/ui/lock.c
+++ b/ui/lock.c
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#ifdef ENABLE_PWRON_PASSWORD
+
#include
#include "ARMCM0.h"
@@ -156,3 +158,5 @@ void UI_DisplayLock(void)
}
}
}
+
+#endif
diff --git a/ui/lock.h b/ui/lock.h
index 4ad4f49..e42758d 100644
--- a/ui/lock.h
+++ b/ui/lock.h
@@ -17,7 +17,9 @@
#ifndef UI_LOCK_H
#define UI_LOCK_H
-void UI_DisplayLock(void);
+#ifdef ENABLE_PWRON_PASSWORD
+ void UI_DisplayLock(void);
+#endif
#endif
diff --git a/ui/main.c b/ui/main.c
index 3f2c910..c829cf3 100644
--- a/ui/main.c
+++ b/ui/main.c
@@ -14,6 +14,10 @@
* limitations under the License.
*/
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+ #pragma GCC diagnostic pop
+
#include
#include // abs()
@@ -42,6 +46,9 @@ center_line_t center_line = CENTER_LINE_NONE;
void UI_drawBars(uint8_t *p, const unsigned int level)
{
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (level)
{
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 0: break;
}
+
+ #pragma GCC diagnostic pop
}
#ifdef ENABLE_AUDIO_BAR
@@ -214,6 +223,8 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
{
#ifdef ENABLE_RSSI_BAR
+ (void)vfo; // unused
+
// optional larger RSSI dBm, S-point and bar level
if (center_line != CENTER_LINE_RSSI)
@@ -333,13 +344,13 @@ void UI_DisplayMain(void)
for (vfo_num = 0; vfo_num < 2; vfo_num++)
{
const unsigned int line = (vfo_num == 0) ? line0 : line1;
- uint8_t channel = gEeprom.TX_VFO;
-// uint8_t tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
+ unsigned int channel = 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;
uint8_t *p_line0 = gFrameBuffer[line + 0];
uint8_t *p_line1 = gFrameBuffer[line + 1];
- uint8_t mode = 0;
- uint8_t state;
+ unsigned int mode = 0;
+ unsigned int state;
if (single_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
const unsigned int x = 2;
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)
{
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);
}
else
@@ -528,8 +539,8 @@ void UI_DisplayMain(void)
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
}
- if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
- { // channel mode
+ if (gEeprom.ScreenChannel[vfo_num] <= MR_CHANNEL_LAST)
+ { // it's a channel
// show the channel symbols
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
@@ -546,6 +557,9 @@ void UI_DisplayMain(void)
#endif
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (gEeprom.CHANNEL_DISPLAY_MODE)
{
case MDF_FREQUENCY: // show the channel frequency
@@ -595,6 +609,8 @@ void UI_DisplayMain(void)
break;
}
+
+ #pragma GCC diagnostic pop
}
else
{ // 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 unsigned int code_type = pConfig->CodeType;
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]);
}
UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, line + 1);
@@ -669,7 +685,7 @@ void UI_DisplayMain(void)
{ // show the TX power
const char pwr_list[] = "LMH";
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';
UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, line + 1);
}
diff --git a/ui/menu.c b/ui/menu.c
index 424e137..03984b7 100644
--- a/ui/menu.c
+++ b/ui/menu.c
@@ -240,12 +240,13 @@ const char gSubMenu_D_RSP[4][11] =
"BOTH"
};
-const char gSubMenu_PTT_ID[4][7] =
+const char gSubMenu_PTT_ID[5][15] =
{
"OFF",
- "KEY UP",
- "KEY DN",
- "BOTH"
+ "KEY\nUP",
+ "KEY\nDOWN",
+ "KEY\nUP+DOWN",
+ "APOLLO\nQUINDAR"
};
const char gSubMenu_PONMSG[4][8] =
@@ -436,6 +437,9 @@ void UI_DisplayMenu(void)
bool already_printed = false;
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
+
switch (gMenuCursor)
{
case MENU_SQL:
@@ -806,6 +810,8 @@ void UI_DisplayMenu(void)
}
}
+ #pragma GCC diagnostic pop
+
if (!already_printed)
{ // we now do multi-line text in a single string
diff --git a/ui/menu.h b/ui/menu.h
index d4d96fa..157b3d2 100644
--- a/ui/menu.h
+++ b/ui/menu.h
@@ -139,7 +139,7 @@ extern const char gSubMenu_MDF[4][15];
extern const char gSubMenu_AL_MOD[2][5];
#endif
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_ROGER[3][9];
extern const char gSubMenu_RESET[2][4];
diff --git a/ui/status.c b/ui/status.c
index 0927afa..690354c 100644
--- a/ui/status.c
+++ b/ui/status.c
@@ -94,23 +94,25 @@ void UI_DisplayStatus(const bool test_display)
else
#endif
// 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)
-// memmove(line + x, BITMAP_SC1, sizeof(BITMAP_SC1));
- UI_PrintStringSmallBuffer("1", line + x);
+ if (gNextMrChannel <= MR_CHANNEL_LAST)
+ { // channel mode
+ 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
- if (gEeprom.SCAN_LIST_DEFAULT == 1)
-// memmove(line + x, BITMAP_SC2, sizeof(BITMAP_SC2));
- 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);
+ { // frequency mode
+ UI_PrintStringSmallBuffer("S", line + x);
+ }
x1 = x + 7;
}
-// x += sizeof(BITMAP_SC1);
x += 7; // font character width
#ifdef ENABLE_VOICE
diff --git a/ui/ui.c b/ui/ui.c
index 750a7ca..b370182 100644
--- a/ui/ui.c
+++ b/ui/ui.c
@@ -84,7 +84,7 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
gInputBoxIndex = 0;
gIsInSubMenu = false;
gCssScanMode = CSS_SCAN_MODE_OFF;
- gScanState = SCAN_OFF;
+ gScanStateDir = SCAN_OFF;
#ifdef ENABLE_FMRADIO
gFM_ScanState = FM_SCAN_OFF;
#endif
diff --git a/utils/uv-k5_small_bold.bin b/utils/uv-k5_small_bold.bin
index c845fb4..552b4ca 100644
Binary files a/utils/uv-k5_small_bold.bin and b/utils/uv-k5_small_bold.bin differ
diff --git a/utils/uv-k5_small_bold.fon b/utils/uv-k5_small_bold.fon
index f7f5b4b..e489372 100644
Binary files a/utils/uv-k5_small_bold.fon and b/utils/uv-k5_small_bold.fon differ