Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43f4790f5b | ||
|
|
43ccce33da | ||
|
|
b2839de2a5 | ||
|
|
5397b3ee88 | ||
|
|
9a0a75446a | ||
|
|
f25e0230f0 | ||
|
|
16c908f0bf | ||
|
|
9c7d6a38e5 | ||
|
|
ec5e9dde66 | ||
|
|
5c346c8466 | ||
|
|
40d09591b3 | ||
|
|
bd9f337a5b | ||
|
|
cb05a5881f | ||
|
|
6b44659419 | ||
|
|
81f18aa281 | ||
|
|
410c0e47cb | ||
|
|
2372949eb9 | ||
|
|
0cf4e1fe36 | ||
|
|
9b2ce88a72 | ||
|
|
a23f359735 | ||
|
|
b343993a72 | ||
|
|
4d8db8f0b9 | ||
|
|
609df5f279 | ||
|
|
e042b21e65 | ||
|
|
d632698428 | ||
|
|
eba4bf9c80 | ||
|
|
56fc929921 | ||
|
|
2cff29e6db | ||
|
|
ced053ba63 | ||
|
|
a6324ffcf8 | ||
|
|
6e7f8b1877 | ||
|
|
74a9adcdbd | ||
|
|
4a05e69e19 | ||
|
|
1cfb59fa38 | ||
|
|
bee4a8c41a | ||
|
|
fe949d2ae3 | ||
|
|
292181a9a6 | ||
|
|
654145bd07 | ||
|
|
5900d46edb | ||
|
|
1dbe874240 | ||
|
|
eea1756dc0 | ||
|
|
32fad129cc | ||
|
|
6a8c7d5b37 | ||
|
|
efca16088b | ||
|
|
814e5edb07 | ||
|
|
abfcf15aca | ||
|
|
a113d41c1a | ||
|
|
b26b1fab95 | ||
|
|
2242c4097a | ||
|
|
74c37451bf | ||
|
|
59c4c4dcd3 | ||
|
|
eec8e22e41 | ||
|
|
429ac36ffe | ||
|
|
567b0cfa83 | ||
|
|
f4b637b51a | ||
|
|
5f2e069437 | ||
|
|
9d990f7e67 | ||
|
|
eaccdab1d4 | ||
|
|
6e2ba5c214 | ||
|
|
4d808de2ac | ||
|
|
8fb9825ad8 | ||
|
|
4b17aa6d3f |
97
Makefile
97
Makefile
@@ -3,6 +3,7 @@
|
|||||||
# 0 = disable
|
# 0 = disable
|
||||||
# 1 = enable
|
# 1 = enable
|
||||||
#
|
#
|
||||||
|
ENABLE_CLANG := 0
|
||||||
ENABLE_SWD := 0
|
ENABLE_SWD := 0
|
||||||
ENABLE_OVERLAY := 0
|
ENABLE_OVERLAY := 0
|
||||||
ENABLE_LTO := 1
|
ENABLE_LTO := 1
|
||||||
@@ -11,8 +12,10 @@ ENABLE_AIRCOPY := 0
|
|||||||
ENABLE_FMRADIO := 1
|
ENABLE_FMRADIO := 1
|
||||||
ENABLE_NOAA := 0
|
ENABLE_NOAA := 0
|
||||||
ENABLE_VOICE := 0
|
ENABLE_VOICE := 0
|
||||||
ENABLE_ALARM := 1
|
ENABLE_VOX := 1
|
||||||
|
ENABLE_ALARM := 0
|
||||||
ENABLE_TX1750 := 0
|
ENABLE_TX1750 := 0
|
||||||
|
ENABLE_PWRON_PASSWORD := 0
|
||||||
ENABLE_BIG_FREQ := 1
|
ENABLE_BIG_FREQ := 1
|
||||||
ENABLE_SMALL_BOLD := 1
|
ENABLE_SMALL_BOLD := 1
|
||||||
ENABLE_KEEP_MEM_NAME := 1
|
ENABLE_KEEP_MEM_NAME := 1
|
||||||
@@ -20,20 +23,18 @@ ENABLE_WIDE_RX := 1
|
|||||||
ENABLE_TX_WHEN_AM := 0
|
ENABLE_TX_WHEN_AM := 0
|
||||||
ENABLE_F_CAL_MENU := 0
|
ENABLE_F_CAL_MENU := 0
|
||||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||||
ENABLE_MAIN_KEY_HOLD := 1
|
|
||||||
ENABLE_BOOT_BEEPS := 0
|
ENABLE_BOOT_BEEPS := 0
|
||||||
ENABLE_COMPANDER := 1
|
|
||||||
ENABLE_SHOW_CHARGE_LEVEL := 1
|
ENABLE_SHOW_CHARGE_LEVEL := 1
|
||||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||||
ENABLE_CODE_SCAN_TIMEOUT := 0
|
ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||||
ENABLE_AM_FIX := 1
|
ENABLE_AM_FIX := 1
|
||||||
ENABLE_AM_FIX_SHOW_DATA := 0
|
ENABLE_AM_FIX_SHOW_DATA := 0
|
||||||
ENABLE_SQUELCH_LOWER := 0
|
ENABLE_SQUELCH_MORE_SENSITIVE := 1
|
||||||
ENABLE_FASTER_CHANNEL_SCAN := 1
|
ENABLE_FASTER_CHANNEL_SCAN := 1
|
||||||
ENABLE_RSSI_BAR := 1
|
ENABLE_RSSI_BAR := 1
|
||||||
ENABLE_AUDIO_BAR := 1
|
ENABLE_AUDIO_BAR := 1
|
||||||
|
ENABLE_COPY_CHAN_TO_VFO := 1
|
||||||
ENABLE_SPECTRUM := 1
|
ENABLE_SPECTRUM := 1
|
||||||
#ENABLE_COPY_CHAN_TO_VFO := 1
|
|
||||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||||
#ENABLE_BAND_SCOPE := 1
|
#ENABLE_BAND_SCOPE := 1
|
||||||
|
|
||||||
@@ -41,7 +42,12 @@ ENABLE_SPECTRUM := 1
|
|||||||
|
|
||||||
TARGET = firmware
|
TARGET = firmware
|
||||||
|
|
||||||
ifeq ($(ENABLE_LTO), 1)
|
ifeq ($(ENABLE_CLANG),1)
|
||||||
|
# GCC's linker, ld, doesn't understand LLVM's generated bytecode
|
||||||
|
ENABLE_LTO := 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO),1)
|
||||||
# can't have LTO and OVERLAY enabled at same time
|
# can't have LTO and OVERLAY enabled at same time
|
||||||
ENABLE_OVERLAY := 0
|
ENABLE_OVERLAY := 0
|
||||||
endif
|
endif
|
||||||
@@ -132,7 +138,9 @@ ifeq ($(ENABLE_FMRADIO),1)
|
|||||||
endif
|
endif
|
||||||
OBJS += ui/helper.o
|
OBJS += ui/helper.o
|
||||||
OBJS += ui/inputbox.o
|
OBJS += ui/inputbox.o
|
||||||
OBJS += ui/lock.o
|
ifeq ($(ENABLE_PWRON_PASSWORD),1)
|
||||||
|
OBJS += ui/lock.o
|
||||||
|
endif
|
||||||
OBJS += ui/main.o
|
OBJS += ui/main.o
|
||||||
OBJS += ui/menu.o
|
OBJS += ui/menu.o
|
||||||
OBJS += ui/scanner.o
|
OBJS += ui/scanner.o
|
||||||
@@ -149,8 +157,21 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
AS = arm-none-eabi-gcc
|
AS = arm-none-eabi-gcc
|
||||||
CC = arm-none-eabi-gcc
|
|
||||||
|
CC =
|
||||||
LD = arm-none-eabi-gcc
|
LD = arm-none-eabi-gcc
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_CLANG),0)
|
||||||
|
CC += arm-none-eabi-gcc
|
||||||
|
# Use GCC's linker to avoid undefined symbol errors
|
||||||
|
# LD += arm-none-eabi-gcc
|
||||||
|
else
|
||||||
|
# May need to adjust this to match your system
|
||||||
|
CC += clang --sysroot=/usr/arm-none-eabi --target=arm-none-eabi
|
||||||
|
# Bloats binaries to 512MB
|
||||||
|
# LD = ld.lld
|
||||||
|
endif
|
||||||
|
|
||||||
OBJCOPY = arm-none-eabi-objcopy
|
OBJCOPY = arm-none-eabi-objcopy
|
||||||
SIZE = arm-none-eabi-size
|
SIZE = arm-none-eabi-size
|
||||||
|
|
||||||
@@ -166,16 +187,30 @@ ifeq ($(ENABLE_OVERLAY),1)
|
|||||||
ASFLAGS += -DENABLE_OVERLAY
|
ASFLAGS += -DENABLE_OVERLAY
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
CFLAGS =
|
||||||
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD
|
ifeq ($(ENABLE_CLANG),0)
|
||||||
#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=c11 -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
|
||||||
ifeq ($(ENABLE_LTO), 1)
|
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
|
||||||
# CFLAGS += -flto
|
else
|
||||||
CFLAGS += -flto=2
|
# 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
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO),1)
|
||||||
|
CFLAGS += -flto=2
|
||||||
|
else
|
||||||
|
# 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 += -DPRINTF_INCLUDE_CONFIG_H
|
||||||
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
||||||
|
|
||||||
@@ -209,12 +244,18 @@ endif
|
|||||||
ifeq ($(ENABLE_VOICE),1)
|
ifeq ($(ENABLE_VOICE),1)
|
||||||
CFLAGS += -DENABLE_VOICE
|
CFLAGS += -DENABLE_VOICE
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_VOX),1)
|
||||||
|
CFLAGS += -DENABLE_VOX
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_ALARM),1)
|
ifeq ($(ENABLE_ALARM),1)
|
||||||
CFLAGS += -DENABLE_ALARM
|
CFLAGS += -DENABLE_ALARM
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_TX1750),1)
|
ifeq ($(ENABLE_TX1750),1)
|
||||||
CFLAGS += -DENABLE_TX1750
|
CFLAGS += -DENABLE_TX1750
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_PWRON_PASSWORD),1)
|
||||||
|
CFLAGS += -DENABLE_PWRON_PASSWORD
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
|
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
|
||||||
CFLAGS += -DENABLE_KEEP_MEM_NAME
|
CFLAGS += -DENABLE_KEEP_MEM_NAME
|
||||||
endif
|
endif
|
||||||
@@ -230,15 +271,9 @@ endif
|
|||||||
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
||||||
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_MAIN_KEY_HOLD),1)
|
|
||||||
CFLAGS += -DENABLE_MAIN_KEY_HOLD
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_BOOT_BEEPS),1)
|
ifeq ($(ENABLE_BOOT_BEEPS),1)
|
||||||
CFLAGS += -DENABLE_BOOT_BEEPS
|
CFLAGS += -DENABLE_BOOT_BEEPS
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_COMPANDER),1)
|
|
||||||
CFLAGS += -DENABLE_COMPANDER
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_SHOW_CHARGE_LEVEL),1)
|
ifeq ($(ENABLE_SHOW_CHARGE_LEVEL),1)
|
||||||
CFLAGS += -DENABLE_SHOW_CHARGE_LEVEL
|
CFLAGS += -DENABLE_SHOW_CHARGE_LEVEL
|
||||||
endif
|
endif
|
||||||
@@ -282,11 +317,25 @@ ifeq ($(ENABLE_BAND_SCOPE),1)
|
|||||||
CFLAGS += -DENABLE_BAND_SCOPE
|
CFLAGS += -DENABLE_BAND_SCOPE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
LDFLAGS =
|
||||||
|
ifeq ($(ENABLE_CLANG),0)
|
||||||
|
LDFLAGS += -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
||||||
|
else
|
||||||
|
# Fix warning about implied executable stack
|
||||||
|
LDFLAGS += -z noexecstack -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Use newlib-nano instead of newlib
|
||||||
|
LDFLAGS += --specs=nano.specs
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO),0)
|
||||||
|
# Throw away unneeded func/data sections like LTO does
|
||||||
|
LDFLAGS += -Wl,--gc-sections
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
ASFLAGS += -g
|
ASFLAGS += -g
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
LDFLAGS += -g
|
LDFLAGS += -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
100
README.md
100
README.md
@@ -33,33 +33,40 @@ Anyway, have fun.
|
|||||||
|
|
||||||
# Radio performance
|
# Radio performance
|
||||||
|
|
||||||
Please note that the Quansheng uv-k radios are not professional quality transceivers, their
|
Please note that the Quansheng UV-Kx radios are not professional quality transceivers, their
|
||||||
performance is strictly limited, somewhat below that of a decent transceiver. The RX front
|
performance is strictly limited. The RX front end has no track-tuned band pass filtering
|
||||||
end has no track-tuned band pass filtering at all, and so are wide band/wide open to any
|
at all, and so are wide band/wide open to any and all signals over a large frequency range.
|
||||||
and all signals over a wide frequency range.
|
|
||||||
Using the radio in high intensity RF environments will nearly always destroy your reception,
|
|
||||||
the receiver simply doesn't have a great dynamic range, which means distorted AM audio with
|
|
||||||
strong received signals, there is nothing more anyone can do in firmware/software to stop that
|
|
||||||
happening once the RX gain adjustment I do (AM fix) reaches the hardwares limit.
|
|
||||||
|
|
||||||
Saying that, they are nice toys for the price, fun to play with.
|
Using the radio in high intensity RF environments will most likely make reception anything but
|
||||||
|
easy (AM mode will suffer far more than FM ever will), the receiver simply doesn't have a
|
||||||
|
great dynamic range, which results in distorted AM audio with stronger RX'ed signals.
|
||||||
|
There is nothing more anyone can do in firmware/software to improve that, once the RX gain
|
||||||
|
adjustment I do (AM fix) reaches the hardwares limit, your AM RX audio will be all but
|
||||||
|
non-existant (just like Quansheng's firmware).
|
||||||
|
On the other hand, FM RX audio will/should be fine.
|
||||||
|
|
||||||
|
But, they are nice toys for the price, fun to play with.
|
||||||
|
|
||||||
# User customization
|
# User customization
|
||||||
|
|
||||||
You can customize the firmware by enabling/disabling various compile options.
|
You can customize the firmware by enabling/disabling various compile options, this allows
|
||||||
|
us to remove certain firmware features in order to make room in the flash for others.
|
||||||
You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) ..
|
You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) ..
|
||||||
|
|
||||||
```
|
```
|
||||||
|
ENABLE_CLANG := 0 **experimental, builds with clang instead of gcc (LTO will be disabled if you enable this)
|
||||||
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
|
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
|
||||||
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed
|
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed
|
||||||
ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (overlay will be disabled if you enable this)
|
ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this)
|
||||||
ENABLE_UART := 1 without this you can't configure radio via PC !
|
ENABLE_UART := 1 without this you can't configure radio via PC !
|
||||||
ENABLE_AIRCOPY := 0 easier to just enter frequency with butts
|
ENABLE_AIRCOPY := 0 easier to just enter frequency with butts
|
||||||
ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver
|
ENABLE_FMRADIO := 0 WBFM VHF broadcast band receiver
|
||||||
ENABLE_NOAA := 0 everything NOAA (only of any use in the USA)
|
ENABLE_NOAA := 0 everything NOAA (only of any use in the USA)
|
||||||
ENABLE_VOICE := 0 want to hear voices ?
|
ENABLE_VOICE := 0 want to hear voices ?
|
||||||
|
ENABLE_VOX := 0
|
||||||
ENABLE_ALARM := 0 TX alarms
|
ENABLE_ALARM := 0 TX alarms
|
||||||
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
|
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
|
||||||
|
ENABLE_PWRON_PASSWORD := 1 power-on password stuff
|
||||||
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
|
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
|
||||||
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
|
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
|
||||||
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
|
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
|
||||||
@@ -67,23 +74,31 @@ ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-
|
|||||||
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
|
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
|
||||||
ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu
|
ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu
|
||||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
||||||
ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead just hold down keys 0-9 to access the secondary butt functions
|
|
||||||
ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up
|
ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up
|
||||||
ENABLE_COMPANDER := 0 this is broken, don't bother with it for now .. compander option (per channel)
|
|
||||||
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
|
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
|
||||||
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
||||||
ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan)
|
ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan)
|
||||||
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
|
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
|
||||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
||||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
ENABLE_SQUELCH_MORE_SENSITIVE := 0 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
||||||
ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy
|
ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy
|
||||||
ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
|
ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
|
||||||
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
|
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
|
||||||
#ENABLE_COPY_CHAN_TO_VFO := 1 not yet implemented - copy the current channel into the VFO
|
ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M')
|
||||||
#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
|
#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
|
||||||
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# New/modified function keys
|
||||||
|
|
||||||
|
* 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
|
||||||
|
* Long-press '5' .. Toggle selected channel scanlist setting .. if NOAA is disabled in Makefile
|
||||||
|
*
|
||||||
|
* Long-press '*' .. Start scanning, then toggles the scanning between scanlists 1, 2 or ALL channels
|
||||||
|
|
||||||
# Some changes made from the Quansheng firmware
|
# Some changes made from the Quansheng firmware
|
||||||
|
|
||||||
* Various Quansheng firmware bugs fixed
|
* Various Quansheng firmware bugs fixed
|
||||||
@@ -103,28 +118,38 @@ arm-none-eabi GCC version 10.3.1 is recommended, which is the current version on
|
|||||||
Other versions may generate a flash file that is too big.
|
Other versions may generate a flash file that is too big.
|
||||||
You can get an appropriate version from: https://developer.arm.com/downloads/-/gnu-rm
|
You can get an appropriate version from: https://developer.arm.com/downloads/-/gnu-rm
|
||||||
|
|
||||||
|
clang may be used but isn't fully supported. Resulting binaries may also be bigger.
|
||||||
|
You can get it from: https://releases.llvm.org/download.html
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
|
|
||||||
To build the firmware, you need to fetch the submodules and then run make:
|
If you have docker installed you can use `compile-with-docker.bat`, the output files are created in `compiled-firmware` folder. This method gives significantly smaller binaries, I've seen differences up to 1kb, so it can fit more functionalities this way. The challange can be (or not) installing the docker itself.
|
||||||
```
|
|
||||||
git submodule update --init --recursive --depth=1
|
|
||||||
make
|
|
||||||
```
|
|
||||||
|
|
||||||
To compile directly in windows without the need of a linux virtual machine:
|
|
||||||
|
|
||||||
```
|
To compile directly in windows:
|
||||||
1. Download and install "gcc-arm-none-eabi-10.3-2021.10-win32.exe" from https://developer.arm.com/downloads/-/gnu-rm
|
|
||||||
2. Download and install "gnu_make-3.81.exe" from https://gnuwin32.sourceforge.net/packages/make.htm
|
|
||||||
|
|
||||||
3. You may (or not) need to manualy add gcc path to you OS environment PATH.
|
1. Open windows command line and run:
|
||||||
ie add C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin
|
```
|
||||||
|
winget install -e -h git.git Python.Python.3.8 GnuWin32.Make
|
||||||
4. You may (or not) need to reboot your PC after installing the above
|
winget install -e -h Arm.GnuArmEmbeddedToolchain -v "10 2021.10"
|
||||||
```
|
```
|
||||||
|
2. Close command line, open a new one and run:
|
||||||
Then you can run 'win_make.bat' from the directory you saved this source code too.
|
```
|
||||||
You may need to edit the bat file (path to make.exe) depending on where you installed the above two packages too.
|
pip install --user --upgrade pip
|
||||||
|
pip install crcmod
|
||||||
|
mkdir c:\projects & cd /D c:/projects
|
||||||
|
git clone https://github.com/egzumer/uv-k5-firmware-custom.git
|
||||||
|
```
|
||||||
|
3. From now on you can build the firmware by going to `c:\projects\uv-k5-firmware-custom` and running `win_make.bat` or by running a command line:
|
||||||
|
```
|
||||||
|
cd /D c:\projects\uv-k5-firmware-custom
|
||||||
|
win_make.bat
|
||||||
|
```
|
||||||
|
4. To reset the repository and pull new changes run (!!! it will delete all your changes !!!):
|
||||||
|
```
|
||||||
|
cd /D c:\projects\uv-k5-firmware-custom
|
||||||
|
git reset --hard & git clean -fd & git pull
|
||||||
|
```
|
||||||
|
|
||||||
I've left some notes in the win_make.bat file to maybe help with stuff.
|
I've left some notes in the win_make.bat file to maybe help with stuff.
|
||||||
|
|
||||||
@@ -132,6 +157,7 @@ I've left some notes in the win_make.bat file to maybe help with stuff.
|
|||||||
|
|
||||||
Many thanks to various people on Telegram for putting up with me during this effort and helping:
|
Many thanks to various people on Telegram for putting up with me during this effort and helping:
|
||||||
|
|
||||||
|
* [OneOfEleven](https://github.com/OneOfEleven)
|
||||||
* [DualTachyon](https://github.com/DualTachyon)
|
* [DualTachyon](https://github.com/DualTachyon)
|
||||||
* [Mikhail](https://github.com/fagci)
|
* [Mikhail](https://github.com/fagci)
|
||||||
* [Andrej](https://github.com/Tunas1337)
|
* [Andrej](https://github.com/Tunas1337)
|
||||||
@@ -165,13 +191,13 @@ You may obtain a copy of the License at
|
|||||||
# Example changes/updates
|
# Example changes/updates
|
||||||
|
|
||||||
<p float="left">
|
<p float="left">
|
||||||
<img src="/image1.png" width=300 />
|
<img src="/images/image1.png" width=300 />
|
||||||
<img src="/image2.png" width=300 />
|
<img src="/images/image2.png" width=300 />
|
||||||
<img src="/image3.png" width=300 />
|
<img src="/images/image3.png" width=300 />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Video showing the AM fix working ..
|
Video showing the AM fix working ..
|
||||||
|
|
||||||
<video src="/AM_fix.mp4"></video>
|
<video src="/images/AM_fix.mp4"></video>
|
||||||
|
|
||||||
<video src="https://github.com/OneOfEleven/uv-k5-firmware-custom/assets/51590168/2a3a9cdc-97da-4966-bf0d-1ce6ad09779c"></video>
|
<video src="https://github.com/OneOfEleven/uv-k5-firmware-custom/assets/51590168/2a3a9cdc-97da-4966-bf0d-1ce6ad09779c"></video>
|
||||||
|
|||||||
314
am_fix.c
314
am_fix.c
@@ -34,20 +34,9 @@
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#if 1
|
uint16_t reg_val;
|
||||||
// bitfields take up less flash bytes
|
int8_t gain_dB;
|
||||||
uint8_t lna_short:2; // 0 ~ 3
|
} __attribute__((packed)) t_gain_table;
|
||||||
uint8_t lna:3; // 0 ~ 7
|
|
||||||
uint8_t mixer:2; // 0 ~ 3
|
|
||||||
uint8_t pga:3; // 0 ~ 7
|
|
||||||
#else
|
|
||||||
uint8_t lna_short; // 0 ~ 3
|
|
||||||
uint8_t lna; // 0 ~ 7
|
|
||||||
uint8_t mixer; // 0 ~ 3
|
|
||||||
uint8_t pga; // 0 ~ 7
|
|
||||||
#endif
|
|
||||||
} t_gain_table;
|
|
||||||
//} __attribute__((packed)) t_gain_table;
|
|
||||||
|
|
||||||
// REG_10 AGC gain table
|
// REG_10 AGC gain table
|
||||||
//
|
//
|
||||||
@@ -97,141 +86,140 @@
|
|||||||
// if I don't add the brackets, reading the table returns unexpected/different values !!!
|
// if I don't add the brackets, reading the table returns unexpected/different values !!!
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
//// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
||||||
static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
// static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
||||||
static const int16_t lna_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 0};
|
// static const int16_t lna_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 0};
|
||||||
static const int16_t mixer_dB[] = { ( -8), ( -6), ( -3), 0};
|
// static const int16_t mixer_dB[] = { ( -8), ( -6), ( -3), 0};
|
||||||
static const int16_t pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
// static const int16_t pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
||||||
|
|
||||||
// lookup table is hugely easier than writing code to do the same
|
// lookup table is hugely easier than writing code to do the same
|
||||||
//
|
//
|
||||||
static const t_gain_table gain_table[] =
|
static const t_gain_table gain_table[] =
|
||||||
{
|
{
|
||||||
{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original
|
{0x035E, -17}, // 0 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
|
|
||||||
// test table that lets me manually set the lna-short register
|
// test table that lets me manually set the lna-short register
|
||||||
// to measure it's actual dB change using an RF signal generator
|
// to measure it's actual dB change using an RF signal generator
|
||||||
|
|
||||||
{0, 2, 3, 6}, // 1 .. -33dB -14dB 0dB -3dB .. -50dB
|
{0x005E, -50}, // 1 .. 0 2 3 6 .. -33dB -14dB 0dB -3dB .. -50dB
|
||||||
{1, 2, 3, 6}, // 2 .. -30dB -14dB 0dB -3dB .. -47dB
|
{0x015E, -47}, // 2 .. 1 2 3 6 .. -30dB -14dB 0dB -3dB .. -47dB
|
||||||
{2, 2, 3, 6}, // 3 .. -24dB -14dB 0dB -3dB .. -41dB
|
{0x025E, -41}, // 3 .. 2 2 3 6 .. -24dB -14dB 0dB -3dB .. -41dB
|
||||||
{3, 2, 3, 6} // 4 .. 0dB -14dB 0dB -3dB .. -17dB
|
{0x035E, -17} // 4 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned int original_index = 1;
|
static const unsigned int original_index = 1;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
{0, 0, 0, 0}, // 1 .. -33dB -24dB -8dB -33dB .. -98dB
|
{0x0000, -98}, // 1 .. 0 0 0 0 .. -33dB -24dB -8dB -33dB .. -98dB
|
||||||
{0, 0, 1, 0}, // 2 .. -33dB -24dB -6dB -33dB .. -96dB
|
{0x0008, -96}, // 2 .. 0 0 1 0 .. -33dB -24dB -6dB -33dB .. -96dB
|
||||||
{1, 0, 0, 0}, // 3 .. -30dB -24dB -8dB -33dB .. -95dB
|
{0x0100, -95}, // 3 .. 1 0 0 0 .. -30dB -24dB -8dB -33dB .. -95dB
|
||||||
{0, 1, 0, 0}, // 4 .. -33dB -19dB -8dB -33dB .. -93dB
|
{0x0020, -93}, // 4 .. 0 1 0 0 .. -33dB -19dB -8dB -33dB .. -93dB
|
||||||
{0, 0, 0, 1}, // 5 .. -33dB -24dB -8dB -27dB .. -92dB
|
{0x0001, -92}, // 5 .. 0 0 0 1 .. -33dB -24dB -8dB -27dB .. -92dB
|
||||||
{0, 1, 1, 0}, // 6 .. -33dB -19dB -6dB -33dB .. -91dB
|
{0x0028, -91}, // 6 .. 0 1 1 0 .. -33dB -19dB -6dB -33dB .. -91dB
|
||||||
{0, 0, 1, 1}, // 7 .. -33dB -24dB -6dB -27dB .. -90dB
|
{0x0009, -90}, // 7 .. 0 0 1 1 .. -33dB -24dB -6dB -27dB .. -90dB
|
||||||
{1, 0, 0, 1}, // 8 .. -30dB -24dB -8dB -27dB .. -89dB
|
{0x0101, -89}, // 8 .. 1 0 0 1 .. -30dB -24dB -8dB -27dB .. -89dB
|
||||||
{0, 1, 2, 0}, // 9 .. -33dB -19dB -3dB -33dB .. -88dB
|
{0x0030, -88}, // 9 .. 0 1 2 0 .. -33dB -19dB -3dB -33dB .. -88dB
|
||||||
{1, 0, 3, 0}, // 10 .. -30dB -24dB 0dB -33dB .. -87dB
|
{0x0118, -87}, // 10 .. 1 0 3 0 .. -30dB -24dB 0dB -33dB .. -87dB
|
||||||
{0, 0, 0, 2}, // 11 .. -33dB -24dB -8dB -21dB .. -86dB
|
{0x0002, -86}, // 11 .. 0 0 0 2 .. -33dB -24dB -8dB -21dB .. -86dB
|
||||||
{1, 1, 2, 0}, // 12 .. -30dB -19dB -3dB -33dB .. -85dB
|
{0x0130, -85}, // 12 .. 1 1 2 0 .. -30dB -19dB -3dB -33dB .. -85dB
|
||||||
{0, 0, 3, 1}, // 13 .. -33dB -24dB 0dB -27dB .. -84dB
|
{0x0019, -84}, // 13 .. 0 0 3 1 .. -33dB -24dB 0dB -27dB .. -84dB
|
||||||
{0, 3, 0, 0}, // 14 .. -33dB -9dB -8dB -33dB .. -83dB
|
{0x0060, -83}, // 14 .. 0 3 0 0 .. -33dB -9dB -8dB -33dB .. -83dB
|
||||||
{1, 1, 3, 0}, // 15 .. -30dB -19dB 0dB -33dB .. -82dB
|
{0x0138, -82}, // 15 .. 1 1 3 0 .. -30dB -19dB 0dB -33dB .. -82dB
|
||||||
{1, 0, 3, 1}, // 16 .. -30dB -24dB 0dB -27dB .. -81dB
|
{0x0119, -81}, // 16 .. 1 0 3 1 .. -30dB -24dB 0dB -27dB .. -81dB
|
||||||
{0, 2, 3, 0}, // 17 .. -33dB -14dB 0dB -33dB .. -80dB
|
{0x0058, -80}, // 17 .. 0 2 3 0 .. -33dB -14dB 0dB -33dB .. -80dB
|
||||||
{1, 2, 0, 1}, // 18 .. -30dB -14dB -8dB -27dB .. -79dB
|
{0x0141, -79}, // 18 .. 1 2 0 1 .. -30dB -14dB -8dB -27dB .. -79dB
|
||||||
{0, 3, 2, 0}, // 19 .. -33dB -9dB -3dB -33dB .. -78dB
|
{0x0070, -78}, // 19 .. 0 3 2 0 .. -33dB -9dB -3dB -33dB .. -78dB
|
||||||
{1, 4, 0, 0}, // 20 .. -30dB -6dB -8dB -33dB .. -77dB
|
{0x0180, -77}, // 20 .. 1 4 0 0 .. -30dB -6dB -8dB -33dB .. -77dB
|
||||||
{1, 1, 3, 1}, // 21 .. -30dB -19dB 0dB -27dB .. -76dB
|
{0x0139, -76}, // 21 .. 1 1 3 1 .. -30dB -19dB 0dB -27dB .. -76dB
|
||||||
{0, 0, 2, 3}, // 22 .. -33dB -24dB -3dB -15dB .. -75dB
|
{0x0013, -75}, // 22 .. 0 0 2 3 .. -33dB -24dB -3dB -15dB .. -75dB
|
||||||
{1, 3, 0, 1}, // 23 .. -30dB -9dB -8dB -27dB .. -74dB
|
{0x0161, -74}, // 23 .. 1 3 0 1 .. -30dB -9dB -8dB -27dB .. -74dB
|
||||||
{1, 6, 0, 0}, // 24 .. -30dB -2dB -8dB -33dB .. -73dB
|
{0x01C0, -73}, // 24 .. 1 6 0 0 .. -30dB -2dB -8dB -33dB .. -73dB
|
||||||
{0, 7, 1, 0}, // 25 .. -33dB 0dB -6dB -33dB .. -72dB
|
{0x00E8, -72}, // 25 .. 0 7 1 0 .. -33dB 0dB -6dB -33dB .. -72dB
|
||||||
{0, 6, 2, 0}, // 26 .. -33dB -2dB -3dB -33dB .. -71dB
|
{0x00D0, -71}, // 26 .. 0 6 2 0 .. -33dB -2dB -3dB -33dB .. -71dB
|
||||||
{2, 1, 3, 1}, // 27 .. -24dB -19dB 0dB -27dB .. -70dB
|
{0x0239, -70}, // 27 .. 2 1 3 1 .. -24dB -19dB 0dB -27dB .. -70dB
|
||||||
{0, 3, 1, 2}, // 28 .. -33dB -9dB -6dB -21dB .. -69dB
|
{0x006A, -69}, // 28 .. 0 3 1 2 .. -33dB -9dB -6dB -21dB .. -69dB
|
||||||
{0, 0, 0, 6}, // 29 .. -33dB -24dB -8dB -3dB .. -68dB
|
{0x0006, -68}, // 29 .. 0 0 0 6 .. -33dB -24dB -8dB -3dB .. -68dB
|
||||||
{0, 5, 2, 1}, // 30 .. -33dB -4dB -3dB -27dB .. -67dB
|
{0x00B1, -67}, // 30 .. 0 5 2 1 .. -33dB -4dB -3dB -27dB .. -67dB
|
||||||
{0, 0, 1, 6}, // 31 .. -33dB -24dB -6dB -3dB .. -66dB
|
{0x000E, -66}, // 31 .. 0 0 1 6 .. -33dB -24dB -6dB -3dB .. -66dB
|
||||||
{1, 2, 3, 2}, // 32 .. -30dB -14dB 0dB -21dB .. -65dB
|
{0x015A, -65}, // 32 .. 1 2 3 2 .. -30dB -14dB 0dB -21dB .. -65dB
|
||||||
{2, 1, 1, 3}, // 33 .. -24dB -19dB -6dB -15dB .. -64dB
|
{0x022B, -64}, // 33 .. 2 1 1 3 .. -24dB -19dB -6dB -15dB .. -64dB
|
||||||
{1, 7, 3, 0}, // 34 .. -30dB 0dB 0dB -33dB .. -63dB
|
{0x01F8, -63}, // 34 .. 1 7 3 0 .. -30dB 0dB 0dB -33dB .. -63dB
|
||||||
{1, 3, 0, 3}, // 35 .. -30dB -9dB -8dB -15dB .. -62dB
|
{0x0163, -62}, // 35 .. 1 3 0 3 .. -30dB -9dB -8dB -15dB .. -62dB
|
||||||
{0, 1, 2, 5}, // 36 .. -33dB -19dB -3dB -6dB .. -61dB
|
{0x0035, -61}, // 36 .. 0 1 2 5 .. -33dB -19dB -3dB -6dB .. -61dB
|
||||||
{2, 0, 2, 4}, // 37 .. -24dB -24dB -3dB -9dB .. -60dB
|
{0x0214, -60}, // 37 .. 2 0 2 4 .. -24dB -24dB -3dB -9dB .. -60dB
|
||||||
{1, 6, 3, 1}, // 38 .. -30dB -2dB 0dB -27dB .. -59dB
|
{0x01D9, -59}, // 38 .. 1 6 3 1 .. -30dB -2dB 0dB -27dB .. -59dB
|
||||||
{1, 2, 0, 5}, // 39 .. -30dB -14dB -8dB -6dB .. -58dB
|
{0x0145, -58}, // 39 .. 1 2 0 5 .. -30dB -14dB -8dB -6dB .. -58dB
|
||||||
{2, 5, 0, 2}, // 40 .. -24dB -4dB -8dB -21dB .. -57dB
|
{0x02A2, -57}, // 40 .. 2 5 0 2 .. -24dB -4dB -8dB -21dB .. -57dB
|
||||||
{2, 6, 2, 1}, // 41 .. -24dB -2dB -3dB -27dB .. -56dB
|
{0x02D1, -56}, // 41 .. 2 6 2 1 .. -24dB -2dB -3dB -27dB .. -56dB
|
||||||
{0, 5, 2, 3}, // 42 .. -33dB -4dB -3dB -15dB .. -55dB
|
{0x00B3, -55}, // 42 .. 0 5 2 3 .. -33dB -4dB -3dB -15dB .. -55dB
|
||||||
{2, 0, 2, 6}, // 43 .. -24dB -24dB -3dB -3dB .. -54dB
|
{0x0216, -54}, // 43 .. 2 0 2 6 .. -24dB -24dB -3dB -3dB .. -54dB
|
||||||
{0, 3, 0, 6}, // 44 .. -33dB -9dB -8dB -3dB .. -53dB
|
{0x0066, -53}, // 44 .. 0 3 0 6 .. -33dB -9dB -8dB -3dB .. -53dB
|
||||||
{0, 6, 0, 4}, // 45 .. -33dB -2dB -8dB -9dB .. -52dB
|
{0x00C4, -52}, // 45 .. 0 6 0 4 .. -33dB -2dB -8dB -9dB .. -52dB
|
||||||
{0, 3, 1, 6}, // 46 .. -33dB -9dB -6dB -3dB .. -51dB
|
{0x006E, -51}, // 46 .. 0 3 1 6 .. -33dB -9dB -6dB -3dB .. -51dB
|
||||||
{1, 2, 3, 5}, // 47 .. -30dB -14dB 0dB -6dB .. -50dB
|
{0x015D, -50}, // 47 .. 1 2 3 5 .. -30dB -14dB 0dB -6dB .. -50dB
|
||||||
{0, 5, 1, 5}, // 48 .. -33dB -4dB -6dB -6dB .. -49dB
|
{0x00AD, -49}, // 48 .. 0 5 1 5 .. -33dB -4dB -6dB -6dB .. -49dB
|
||||||
{0, 3, 3, 5}, // 49 .. -33dB -9dB 0dB -6dB .. -48dB
|
{0x007D, -48}, // 49 .. 0 3 3 5 .. -33dB -9dB 0dB -6dB .. -48dB
|
||||||
{0, 6, 2, 4}, // 50 .. -33dB -2dB -3dB -9dB .. -47dB
|
{0x00D4, -47}, // 50 .. 0 6 2 4 .. -33dB -2dB -3dB -9dB .. -47dB
|
||||||
{1, 5, 2, 4}, // 51 .. -30dB -4dB -3dB -9dB .. -46dB
|
{0x01B4, -46}, // 51 .. 1 5 2 4 .. -30dB -4dB -3dB -9dB .. -46dB
|
||||||
{3, 0, 1, 3}, // 52 .. 0dB -24dB -6dB -15dB .. -45dB
|
{0x030B, -45}, // 52 .. 3 0 1 3 .. 0dB -24dB -6dB -15dB .. -45dB
|
||||||
{0, 6, 1, 6}, // 53 .. -33dB -2dB -6dB -3dB .. -44dB
|
{0x00CE, -44}, // 53 .. 0 6 1 6 .. -33dB -2dB -6dB -3dB .. -44dB
|
||||||
{1, 5, 2, 5}, // 54 .. -30dB -4dB -3dB -6dB .. -43dB
|
{0x01B5, -43}, // 54 .. 1 5 2 5 .. -30dB -4dB -3dB -6dB .. -43dB
|
||||||
{0, 4, 2, 7}, // 55 .. -33dB -6dB -3dB 0dB .. -42dB
|
{0x0097, -42}, // 55 .. 0 4 2 7 .. -33dB -6dB -3dB 0dB .. -42dB
|
||||||
{2, 2, 2, 7}, // 56 .. -24dB -14dB -3dB 0dB .. -41dB
|
{0x0257, -41}, // 56 .. 2 2 2 7 .. -24dB -14dB -3dB 0dB .. -41dB
|
||||||
{2, 5, 2, 4}, // 57 .. -24dB -4dB -3dB -9dB .. -40dB
|
{0x02B4, -40}, // 57 .. 2 5 2 4 .. -24dB -4dB -3dB -9dB .. -40dB
|
||||||
{2, 3, 3, 5}, // 58 .. -24dB -9dB 0dB -6dB .. -39dB
|
{0x027D, -39}, // 58 .. 2 3 3 5 .. -24dB -9dB 0dB -6dB .. -39dB
|
||||||
{1, 6, 3, 5}, // 59 .. -30dB -2dB 0dB -6dB .. -38dB
|
{0x01DD, -38}, // 59 .. 1 6 3 5 .. -30dB -2dB 0dB -6dB .. -38dB
|
||||||
{2, 5, 1, 6}, // 60 .. -24dB -4dB -6dB -3dB .. -37dB
|
{0x02AE, -37}, // 60 .. 2 5 1 6 .. -24dB -4dB -6dB -3dB .. -37dB
|
||||||
{3, 3, 3, 1}, // 61 .. 0dB -9dB 0dB -27dB .. -36dB
|
{0x0379, -36}, // 61 .. 3 3 3 1 .. 0dB -9dB 0dB -27dB .. -36dB
|
||||||
{3, 2, 3, 2}, // 62 .. 0dB -14dB 0dB -21dB .. -35dB
|
{0x035A, -35}, // 62 .. 3 2 3 2 .. 0dB -14dB 0dB -21dB .. -35dB
|
||||||
{2, 5, 2, 6}, // 63 .. -24dB -4dB -3dB -3dB .. -34dB
|
{0x02B6, -34}, // 63 .. 2 5 2 6 .. -24dB -4dB -3dB -3dB .. -34dB
|
||||||
{3, 0, 1, 6}, // 64 .. 0dB -24dB -6dB -3dB .. -33dB
|
{0x030E, -33}, // 64 .. 3 0 1 6 .. 0dB -24dB -6dB -3dB .. -33dB
|
||||||
{3, 0, 0, 7}, // 65 .. 0dB -24dB -8dB 0dB .. -32dB
|
{0x0307, -32}, // 65 .. 3 0 0 7 .. 0dB -24dB -8dB 0dB .. -32dB
|
||||||
{2, 5, 3, 6}, // 66 .. -24dB -4dB 0dB -3dB .. -31dB
|
{0x02BE, -31}, // 66 .. 2 5 3 6 .. -24dB -4dB 0dB -3dB .. -31dB
|
||||||
{3, 3, 3, 2}, // 67 .. 0dB -9dB 0dB -21dB .. -30dB
|
{0x037A, -30}, // 67 .. 3 3 3 2 .. 0dB -9dB 0dB -21dB .. -30dB
|
||||||
{2, 6, 3, 6}, // 68 .. -24dB -2dB 0dB -3dB .. -29dB
|
{0x02DE, -29}, // 68 .. 2 6 3 6 .. -24dB -2dB 0dB -3dB .. -29dB
|
||||||
{3, 2, 0, 5}, // 69 .. 0dB -14dB -8dB -6dB .. -28dB
|
{0x0345, -28}, // 69 .. 3 2 0 5 .. 0dB -14dB -8dB -6dB .. -28dB
|
||||||
{3, 5, 0, 3}, // 70 .. 0dB -4dB -8dB -15dB .. -27dB
|
{0x03A3, -27}, // 70 .. 3 5 0 3 .. 0dB -4dB -8dB -15dB .. -27dB
|
||||||
{3, 3, 0, 4}, // 71 .. 0dB -9dB -8dB -9dB .. -26dB
|
{0x0364, -26}, // 71 .. 3 3 0 4 .. 0dB -9dB -8dB -9dB .. -26dB
|
||||||
{3, 1, 1, 7}, // 72 .. 0dB -19dB -6dB 0dB .. -25dB
|
{0x032F, -25}, // 72 .. 3 1 1 7 .. 0dB -19dB -6dB 0dB .. -25dB
|
||||||
{3, 4, 2, 3}, // 73 .. 0dB -6dB -3dB -15dB .. -24dB
|
{0x0393, -24}, // 73 .. 3 4 2 3 .. 0dB -6dB -3dB -15dB .. -24dB
|
||||||
{3, 4, 0, 4}, // 74 .. 0dB -6dB -8dB -9dB .. -23dB
|
{0x0384, -23}, // 74 .. 3 4 0 4 .. 0dB -6dB -8dB -9dB .. -23dB
|
||||||
{3, 2, 0, 7}, // 75 .. 0dB -14dB -8dB 0dB .. -22dB
|
{0x0347, -22}, // 75 .. 3 2 0 7 .. 0dB -14dB -8dB 0dB .. -22dB
|
||||||
{3, 7, 1, 3}, // 76 .. 0dB 0dB -6dB -15dB .. -21dB
|
{0x03EB, -21}, // 76 .. 3 7 1 3 .. 0dB 0dB -6dB -15dB .. -21dB
|
||||||
{3, 6, 2, 3}, // 77 .. 0dB -2dB -3dB -15dB .. -20dB
|
{0x03D3, -20}, // 77 .. 3 6 2 3 .. 0dB -2dB -3dB -15dB .. -20dB
|
||||||
{3, 5, 3, 3}, // 78 .. 0dB -4dB 0dB -15dB .. -19dB
|
{0x03BB, -19}, // 78 .. 3 5 3 3 .. 0dB -4dB 0dB -15dB .. -19dB
|
||||||
{3, 3, 3, 4}, // 79 .. 0dB -9dB 0dB -9dB .. -18dB
|
{0x037C, -18}, // 79 .. 3 3 3 4 .. 0dB -9dB 0dB -9dB .. -18dB
|
||||||
{3, 2, 3, 6}, // 80 .. 0dB -14dB 0dB -3dB .. -17dB original
|
{0x035E, -17}, // 80 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||||
{3, 6, 0, 5}, // 81 .. 0dB -2dB -8dB -6dB .. -16dB
|
{0x03C5, -16}, // 81 .. 3 6 0 5 .. 0dB -2dB -8dB -6dB .. -16dB
|
||||||
{3, 7, 1, 4}, // 82 .. 0dB 0dB -6dB -9dB .. -15dB
|
{0x03EC, -15}, // 82 .. 3 7 1 4 .. 0dB 0dB -6dB -9dB .. -15dB
|
||||||
{3, 2, 3, 7}, // 83 .. 0dB -14dB 0dB 0dB .. -14dB
|
{0x035F, -14}, // 83 .. 3 2 3 7 .. 0dB -14dB 0dB 0dB .. -14dB
|
||||||
{3, 6, 0, 6}, // 84 .. 0dB -2dB -8dB -3dB .. -13dB
|
{0x03C6, -13}, // 84 .. 3 6 0 6 .. 0dB -2dB -8dB -3dB .. -13dB
|
||||||
{3, 3, 2, 7}, // 85 .. 0dB -9dB -3dB 0dB .. -12dB
|
{0x0377, -12}, // 85 .. 3 3 2 7 .. 0dB -9dB -3dB 0dB .. -12dB
|
||||||
{3, 7, 0, 6}, // 86 .. 0dB 0dB -8dB -3dB .. -11dB
|
{0x03E6, -11}, // 86 .. 3 7 0 6 .. 0dB 0dB -8dB -3dB .. -11dB
|
||||||
{3, 5, 3, 5}, // 87 .. 0dB -4dB 0dB -6dB .. -10dB
|
{0x03BD, -10}, // 87 .. 3 5 3 5 .. 0dB -4dB 0dB -6dB .. -10dB
|
||||||
{3, 7, 2, 5}, // 88 .. 0dB 0dB -3dB -6dB .. -9dB
|
{0x03F5, -9}, // 88 .. 3 7 2 5 .. 0dB 0dB -3dB -6dB .. -9dB
|
||||||
{3, 6, 3, 5}, // 89 .. 0dB -2dB 0dB -6dB .. -8dB
|
{0x03DD, -8}, // 89 .. 3 6 3 5 .. 0dB -2dB 0dB -6dB .. -8dB
|
||||||
{3, 5, 2, 7}, // 90 .. 0dB -4dB -3dB 0dB .. -7dB
|
{0x03B7, -7}, // 90 .. 3 5 2 7 .. 0dB -4dB -3dB 0dB .. -7dB
|
||||||
{3, 7, 2, 6}, // 91 .. 0dB 0dB -3dB -3dB .. -6dB
|
{0x03F6, -6}, // 91 .. 3 7 2 6 .. 0dB 0dB -3dB -3dB .. -6dB
|
||||||
{3, 6, 2, 7}, // 92 .. 0dB -2dB -3dB 0dB .. -5dB
|
{0x03D7, -5}, // 92 .. 3 6 2 7 .. 0dB -2dB -3dB 0dB .. -5dB
|
||||||
{3, 5, 3, 7}, // 93 .. 0dB -4dB 0dB 0dB .. -4dB
|
{0x03BF, -4}, // 93 .. 3 5 3 7 .. 0dB -4dB 0dB 0dB .. -4dB
|
||||||
{3, 7, 2, 7}, // 94 .. 0dB 0dB -3dB 0dB .. -3dB
|
{0x03F7, -3}, // 94 .. 3 7 2 7 .. 0dB 0dB -3dB 0dB .. -3dB
|
||||||
{3, 6, 3, 7}, // 95 .. 0dB -2dB 0dB 0dB .. -2dB
|
{0x03DF, -2}, // 95 .. 3 6 3 7 .. 0dB -2dB 0dB 0dB .. -2dB
|
||||||
{3, 7, 3, 7} // 96 .. 0dB 0dB 0dB 0dB .. 0dB
|
{0x03FF, 0} // 96 .. 3 7 3 7 .. 0dB 0dB 0dB 0dB .. 0dB
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned int original_index = 80;
|
static const unsigned int original_index = 80;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// total RF gain for each table index
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
int8_t gain_dB[ARRAY_SIZE(gain_table)] = {0};
|
// display update rate
|
||||||
|
static const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
||||||
// display update rate
|
unsigned int counter = 0;
|
||||||
const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
#endif
|
||||||
unsigned int counter = 0;
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
// user manually sets the table index .. used to calibrate the desired dB gain table
|
// user manually sets the table index .. used to calibrate the desired dB gain table
|
||||||
@@ -274,13 +262,6 @@
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// pre-compute the total gain for each table index .. saves doing it in real time
|
|
||||||
for (i = 0; i < ARRAY_SIZE(gain_table); i++)
|
|
||||||
{
|
|
||||||
const t_gain_table gains = gain_table[i];
|
|
||||||
gain_dB[i] = lna_short_dB[gains.lna_short] + lna_dB[gains.lna] + mixer_dB[gains.mixer] + pga_dB[gains.pga];
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{ // set a maximum gain to use
|
{ // set a maximum gain to use
|
||||||
// const int16_t max_gain_dB = gain_dB[original_index];
|
// const int16_t max_gain_dB = gain_dB[original_index];
|
||||||
@@ -288,7 +269,8 @@
|
|||||||
|
|
||||||
max_index = ARRAY_SIZE(gain_table);
|
max_index = ARRAY_SIZE(gain_table);
|
||||||
while (--max_index > 1)
|
while (--max_index > 1)
|
||||||
if (gain_dB[max_index] <= max_gain_dB)
|
// if (gain_dB[max_index] <= max_gain_dB)
|
||||||
|
if (gain_table[max_index].gain_dB <= max_gain_dB)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -300,7 +282,9 @@
|
|||||||
void AM_fix_reset(const int vfo)
|
void AM_fix_reset(const int vfo)
|
||||||
{ // reset the AM fixer upper
|
{ // reset the AM fixer upper
|
||||||
|
|
||||||
counter = 0;
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
counter = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
prev_rssi[vfo] = 0;
|
prev_rssi[vfo] = 0;
|
||||||
|
|
||||||
@@ -334,7 +318,9 @@
|
|||||||
case FUNCTION_TRANSMIT:
|
case FUNCTION_TRANSMIT:
|
||||||
case FUNCTION_BAND_SCOPE:
|
case FUNCTION_BAND_SCOPE:
|
||||||
case FUNCTION_POWER_SAVE:
|
case FUNCTION_POWER_SAVE:
|
||||||
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// only adjust stuff if we're in one of these modes
|
// only adjust stuff if we're in one of these modes
|
||||||
@@ -345,14 +331,16 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter > 0)
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
{
|
if (counter > 0)
|
||||||
if (++counter >= display_update_rate)
|
{
|
||||||
{ // trigger a display update
|
if (++counter >= display_update_rate)
|
||||||
counter = 0;
|
{ // trigger a display update
|
||||||
gUpdateDisplay = true;
|
counter = 0;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
{ // sample the current RSSI level
|
{ // sample the current RSSI level
|
||||||
// average it with the previous rssi (a bit of noise/spike immunity)
|
// average it with the previous rssi (a bit of noise/spike immunity)
|
||||||
@@ -361,11 +349,14 @@
|
|||||||
prev_rssi[vfo] = new_rssi;
|
prev_rssi[vfo] = new_rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // save the corrected RSSI level
|
// save the corrected RSSI level
|
||||||
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
{
|
||||||
const int16_t new_rssi = rssi - rssi_gain_diff[vfo];
|
const int16_t new_rssi = rssi - rssi_gain_diff[vfo];
|
||||||
if (gCurrentRSSI[vfo] != new_rssi)
|
if (gCurrentRSSI[vfo] != new_rssi)
|
||||||
{
|
{
|
||||||
gCurrentRSSI[vfo] = new_rssi;
|
gCurrentRSSI[vfo] = new_rssi;
|
||||||
|
|
||||||
if (counter == 0)
|
if (counter == 0)
|
||||||
{ // trigger a display update
|
{ // trigger a display update
|
||||||
counter = 1;
|
counter = 1;
|
||||||
@@ -373,6 +364,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
// user is manually adjusting a gain register - don't do anything automatically
|
// user is manually adjusting a gain register - don't do anything automatically
|
||||||
@@ -405,10 +399,12 @@
|
|||||||
if (diff_dB >= 10)
|
if (diff_dB >= 10)
|
||||||
{ // jump immediately to a new gain setting
|
{ // jump immediately to a new gain setting
|
||||||
// this greatly speeds up initial gain reduction (but reduces noise/spike immunity)
|
// this greatly speeds up initial gain reduction (but reduces noise/spike immunity)
|
||||||
const int16_t desired_gain_dB = (int16_t)gain_dB[index] - diff_dB + 8; // get no closer than 8dB (bit of noise/spike immunity)
|
|
||||||
|
const int16_t desired_gain_dB = (int16_t)gain_table[index].gain_dB - diff_dB + 8; // get no closer than 8dB (bit of noise/spike immunity)
|
||||||
|
|
||||||
// scan the table to see what index to jump straight too
|
// scan the table to see what index to jump straight too
|
||||||
while (index > 1)
|
while (index > 1)
|
||||||
if (gain_dB[--index] <= desired_gain_dB)
|
if (gain_table[--index].gain_dB <= desired_gain_dB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//index = (gain_table_index[vfo] + index) / 2; // easy does it
|
//index = (gain_table_index[vfo] + index) / 2; // easy does it
|
||||||
@@ -455,33 +451,35 @@
|
|||||||
// remember the new table index
|
// remember the new table index
|
||||||
gain_table_index_prev[vfo] = index;
|
gain_table_index_prev[vfo] = index;
|
||||||
|
|
||||||
const t_gain_table gains = gain_table[index];
|
BK4819_WriteRegister(BK4819_REG_13, gain_table[index].reg_val);
|
||||||
BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
|
||||||
|
|
||||||
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
||||||
|
|
||||||
// RF gain difference from original QS setting
|
// RF gain difference from original QS setting
|
||||||
rssi_gain_diff[vfo] = ((int16_t)gain_dB[index] - gain_dB[original_index]) * 2;
|
rssi_gain_diff[vfo] = ((int16_t)gain_table[index].gain_dB - gain_table[original_index].gain_dB) * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the corrected RSSI level
|
// save the corrected RSSI level
|
||||||
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||||
|
|
||||||
if (counter == 0)
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
{
|
if (counter == 0)
|
||||||
counter = 1;
|
{
|
||||||
gUpdateDisplay = true;
|
counter = 1;
|
||||||
}
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
|
||||||
void AM_fix_print_data(const int vfo, char *s)
|
void AM_fix_print_data(const int vfo, char *s)
|
||||||
{
|
{
|
||||||
if (s != NULL)
|
if (s != NULL && vfo >= 0 && vfo < (int)ARRAY_SIZE(gain_table_index))
|
||||||
{
|
{
|
||||||
const unsigned int index = gain_table_index[vfo];
|
const unsigned int index = gain_table_index[vfo];
|
||||||
sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_dB[index], prev_rssi[vfo]);
|
// sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||||
|
sprintf(s, "%2u %4ddB %3u", index, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||||
counter = 0;
|
counter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
95
app/action.c
95
app/action.c
@@ -84,11 +84,11 @@ void ACTION_Monitor(void)
|
|||||||
|
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
if (gScanStateDir != SCAN_OFF)
|
||||||
{
|
{
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
gScanPauseMode = true;
|
gScanPauseMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
@@ -182,17 +182,36 @@ void ACTION_Scan(bool bRestart)
|
|||||||
{
|
{
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
if (gScanStateDir != SCAN_OFF)
|
||||||
{
|
{ // already scanning
|
||||||
SCANNER_Stop();
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
{ // channel mode
|
||||||
#endif
|
|
||||||
|
// 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
|
||||||
|
{ // stop scanning
|
||||||
|
|
||||||
|
SCANNER_Stop();
|
||||||
|
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // start scanning
|
||||||
CHANNEL_Next(true, 1);
|
|
||||||
|
CHANNEL_Next(true, SCAN_FWD);
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||||
@@ -200,7 +219,7 @@ void ACTION_Scan(bool bRestart)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// clear the other vfo's rssi level (to hide the antenna symbol)
|
// clear the other vfo's rssi level (to hide the antenna symbol)
|
||||||
gVFO_RSSI_bar_level[gEeprom.RX_CHANNEL == 0] = 0;
|
gVFO_RSSI_bar_level[(gEeprom.RX_VFO + 1) & 1u] = 0;
|
||||||
|
|
||||||
// let the user see DW is not active
|
// let the user see DW is not active
|
||||||
gDualWatchActive = false;
|
gDualWatchActive = false;
|
||||||
@@ -209,9 +228,20 @@ void ACTION_Scan(bool bRestart)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!bRestart)
|
// if (!bRestart)
|
||||||
{ // scanning
|
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
|
||||||
|
{ // stop scanning
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
SCANNER_Stop();
|
SCANNER_Stop();
|
||||||
@@ -224,19 +254,21 @@ void ACTION_Scan(bool bRestart)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACTION_Vox(void)
|
#ifdef ENABLE_VOX
|
||||||
{
|
void ACTION_Vox(void)
|
||||||
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
{
|
||||||
gRequestSaveSettings = true;
|
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
||||||
gFlagReconfigureVfos = true;
|
gRequestSaveSettings = true;
|
||||||
#ifdef ENABLE_VOICE
|
gFlagReconfigureVfos = true;
|
||||||
gAnotherVoiceID = VOICE_ID_VOX;
|
#ifdef ENABLE_VOICE
|
||||||
#endif
|
gAnotherVoiceID = VOICE_ID_VOX;
|
||||||
gUpdateStatus = true;
|
#endif
|
||||||
}
|
gUpdateStatus = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
static void ACTION_AlarmOr1750(bool b1750)
|
static void ACTION_AlarmOr1750(const bool b1750)
|
||||||
{
|
{
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
@@ -252,7 +284,7 @@ void ACTION_Vox(void)
|
|||||||
|
|
||||||
gFlagPrepareTX = true;
|
gFlagPrepareTX = true;
|
||||||
|
|
||||||
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -268,7 +300,9 @@ void ACTION_Vox(void)
|
|||||||
FM_TurnOff();
|
FM_TurnOff();
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
@@ -299,6 +333,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed)
|
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed)
|
||||||
{
|
{
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (gDTMF_InputIndex > 0)
|
if (gDTMF_InputIndex > 0)
|
||||||
{
|
{
|
||||||
gDTMF_InputBox[--gDTMF_InputIndex] = '-';
|
gDTMF_InputBox[--gDTMF_InputIndex] = '-';
|
||||||
@@ -369,7 +404,9 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
ACTION_Scan(true);
|
ACTION_Scan(true);
|
||||||
break;
|
break;
|
||||||
case ACTION_OPT_VOX:
|
case ACTION_OPT_VOX:
|
||||||
ACTION_Vox();
|
#ifdef ENABLE_VOX
|
||||||
|
ACTION_Vox();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ACTION_OPT_ALARM:
|
case ACTION_OPT_ALARM:
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
void ACTION_Power(void);
|
void ACTION_Power(void);
|
||||||
void ACTION_Monitor(void);
|
void ACTION_Monitor(void);
|
||||||
void ACTION_Scan(bool bFlag);
|
void ACTION_Scan(bool bFlag);
|
||||||
void ACTION_Vox(void);
|
#ifdef ENABLE_VOX
|
||||||
|
void ACTION_Vox(void);
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
//static void ACTION_AlarmOr1750(bool b1750)
|
//static void ACTION_AlarmOr1750(bool b1750)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
508
app/app.c
508
app/app.c
@@ -95,15 +95,15 @@ static void APP_CheckForIncoming(void)
|
|||||||
|
|
||||||
// squelch is open
|
// squelch is open
|
||||||
|
|
||||||
if (gScanState == SCAN_OFF)
|
if (gScanStateDir == SCAN_OFF)
|
||||||
{ // not RF scanning
|
{ // not RF scanning
|
||||||
|
|
||||||
if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE)
|
if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE)
|
||||||
{ // CTCSS/DTS scanning
|
{ // CTCSS/DTS scanning
|
||||||
|
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
gRxReceptionMode = RX_MODE_DETECTED;
|
gRxReceptionMode = RX_MODE_DETECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
||||||
@@ -122,7 +122,7 @@ static void APP_CheckForIncoming(void)
|
|||||||
FUNCTION_Select(FUNCTION_INCOMING);
|
FUNCTION_Select(FUNCTION_INCOMING);
|
||||||
//gUpdateDisplay = true;
|
//gUpdateDisplay = true;
|
||||||
|
|
||||||
updateRSSI(gEeprom.RX_CHANNEL);
|
updateRSSI(gEeprom.RX_VFO);
|
||||||
gUpdateRSSI = true;
|
gUpdateRSSI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ static void APP_CheckForIncoming(void)
|
|||||||
FUNCTION_Select(FUNCTION_INCOMING);
|
FUNCTION_Select(FUNCTION_INCOMING);
|
||||||
//gUpdateDisplay = true;
|
//gUpdateDisplay = true;
|
||||||
|
|
||||||
updateRSSI(gEeprom.RX_CHANNEL);
|
updateRSSI(gEeprom.RX_VFO);
|
||||||
gUpdateRSSI = true;
|
gUpdateRSSI = true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -152,7 +152,7 @@ static void APP_CheckForIncoming(void)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // RF scanning
|
||||||
if (gRxReceptionMode != RX_MODE_NONE)
|
if (gRxReceptionMode != RX_MODE_NONE)
|
||||||
{
|
{
|
||||||
if (gCurrentFunction != FUNCTION_INCOMING)
|
if (gCurrentFunction != FUNCTION_INCOMING)
|
||||||
@@ -160,15 +160,14 @@ static void APP_CheckForIncoming(void)
|
|||||||
FUNCTION_Select(FUNCTION_INCOMING);
|
FUNCTION_Select(FUNCTION_INCOMING);
|
||||||
//gUpdateDisplay = true;
|
//gUpdateDisplay = true;
|
||||||
|
|
||||||
updateRSSI(gEeprom.RX_CHANNEL);
|
updateRSSI(gEeprom.RX_VFO);
|
||||||
gUpdateRSSI = true;
|
gUpdateRSSI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gRxReceptionMode = RX_MODE_DETECTED;
|
gRxReceptionMode = RX_MODE_DETECTED;
|
||||||
@@ -178,7 +177,7 @@ static void APP_CheckForIncoming(void)
|
|||||||
FUNCTION_Select(FUNCTION_INCOMING);
|
FUNCTION_Select(FUNCTION_INCOMING);
|
||||||
//gUpdateDisplay = true;
|
//gUpdateDisplay = true;
|
||||||
|
|
||||||
updateRSSI(gEeprom.RX_CHANNEL);
|
updateRSSI(gEeprom.RX_VFO);
|
||||||
gUpdateRSSI = true;
|
gUpdateRSSI = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,7 +200,7 @@ static void APP_HandleIncoming(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bFlag = (gScanState == SCAN_OFF && gCurrentCodeType == CODE_TYPE_OFF);
|
bFlag = (gScanStateDir == SCAN_OFF && gCurrentCodeType == CODE_TYPE_OFF);
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gNOAACountdown_10ms > 0)
|
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gNOAACountdown_10ms > 0)
|
||||||
@@ -225,7 +224,7 @@ static void APP_HandleIncoming(void)
|
|||||||
if (!bFlag)
|
if (!bFlag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{ // not scanning
|
{ // not scanning
|
||||||
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
|
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||||
{ // DTMF DCD is enabled
|
{ // DTMF DCD is enabled
|
||||||
@@ -269,7 +268,7 @@ static void APP_HandleReceive(void)
|
|||||||
goto Skip;
|
goto Skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF && IS_FREQ_CHANNEL(gNextMrChannel))
|
if (gScanStateDir != SCAN_OFF && IS_FREQ_CHANNEL(gNextMrChannel))
|
||||||
{
|
{
|
||||||
if (g_SquelchLost)
|
if (g_SquelchLost)
|
||||||
return;
|
return;
|
||||||
@@ -400,7 +399,7 @@ Skip:
|
|||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
if (gScanStateDir != SCAN_OFF)
|
||||||
{
|
{
|
||||||
switch (gEeprom.SCAN_RESUME_MODE)
|
switch (gEeprom.SCAN_RESUME_MODE)
|
||||||
{
|
{
|
||||||
@@ -408,8 +407,8 @@ Skip:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SCAN_RESUME_CO:
|
case SCAN_RESUME_CO:
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_7_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_7_10ms;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCAN_RESUME_SE:
|
case SCAN_RESUME_SE:
|
||||||
@@ -468,7 +467,7 @@ static void APP_HandleFunction(void)
|
|||||||
|
|
||||||
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||||
{
|
{
|
||||||
const unsigned int chan = gEeprom.RX_CHANNEL;
|
const unsigned int chan = gEeprom.RX_VFO;
|
||||||
// const unsigned int chan = gRxVfo->CHANNEL_SAVE;
|
// const unsigned int chan = gRxVfo->CHANNEL_SAVE;
|
||||||
|
|
||||||
if (gSetting_KILLED)
|
if (gSetting_KILLED)
|
||||||
@@ -486,26 +485,26 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
|||||||
|
|
||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
|
|
||||||
if (gSetting_backlight_on_rx)
|
if (gSetting_backlight_on_tx_rx >= 2)
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
if (gScanStateDir != SCAN_OFF)
|
||||||
{
|
{
|
||||||
switch (gEeprom.SCAN_RESUME_MODE)
|
switch (gEeprom.SCAN_RESUME_MODE)
|
||||||
{
|
{
|
||||||
case SCAN_RESUME_TO:
|
case SCAN_RESUME_TO:
|
||||||
if (!gScanPauseMode)
|
if (!gScanPauseMode)
|
||||||
{
|
{
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
gScanPauseMode = true;
|
gScanPauseMode = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCAN_RESUME_CO:
|
case SCAN_RESUME_CO:
|
||||||
case SCAN_RESUME_SE:
|
case SCAN_RESUME_SE:
|
||||||
ScanPauseDelayIn_10ms = 0;
|
gScanPauseDelayIn_10ms = 0;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,6 +518,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
|||||||
gRxVfo->pRX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
gRxVfo->pRX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||||
gRxVfo->pTX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
gRxVfo->pTX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||||
gEeprom.ScreenChannel[chan] = gRxVfo->CHANNEL_SAVE;
|
gEeprom.ScreenChannel[chan] = gRxVfo->CHANNEL_SAVE;
|
||||||
|
|
||||||
gNOAA_Countdown_10ms = 500; // 5 sec
|
gNOAA_Countdown_10ms = 500; // 5 sec
|
||||||
gScheduleNOAA = false;
|
gScheduleNOAA = false;
|
||||||
}
|
}
|
||||||
@@ -527,7 +527,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
|||||||
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
gCssScanMode = CSS_SCAN_MODE_FOUND;
|
gCssScanMode = CSS_SCAN_MODE_FOUND;
|
||||||
|
|
||||||
if (gScanState == SCAN_OFF &&
|
if (gScanStateDir == SCAN_OFF &&
|
||||||
gCssScanMode == CSS_SCAN_MODE_OFF &&
|
gCssScanMode == CSS_SCAN_MODE_OFF &&
|
||||||
gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||||
{ // not scanning, dual watch is enabled
|
{ // not scanning, dual watch is enabled
|
||||||
@@ -574,9 +574,9 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
|||||||
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
// if (gVoiceWriteIndex == 0)
|
if (gVoiceWriteIndex == 0) // AM/FM RX mode will be set when the voice has finished
|
||||||
#endif
|
#endif
|
||||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM); // no need, set it now
|
||||||
|
|
||||||
FUNCTION_Select(Function);
|
FUNCTION_Select(Function);
|
||||||
|
|
||||||
@@ -623,14 +623,17 @@ uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
|
|||||||
|
|
||||||
static void FREQ_NextChannel(void)
|
static void FREQ_NextChannel(void)
|
||||||
{
|
{
|
||||||
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanState);
|
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
|
||||||
|
|
||||||
RADIO_ApplyOffset(gRxVfo);
|
RADIO_ApplyOffset(gRxVfo);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
// ScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||||
ScanPauseDelayIn_10ms = 10; // 100ms
|
gScanPauseDelayIn_10ms = 9; // 90ms
|
||||||
|
#else
|
||||||
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
bScanKeepFrequency = false;
|
bScanKeepFrequency = false;
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
@@ -639,83 +642,97 @@ static void FREQ_NextChannel(void)
|
|||||||
static void MR_NextChannel(void)
|
static void MR_NextChannel(void)
|
||||||
{
|
{
|
||||||
static unsigned int prev_mr_chan = 0;
|
static unsigned int prev_mr_chan = 0;
|
||||||
const bool enabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT];
|
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
|
||||||
const unsigned int chan1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT];
|
const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||||
const unsigned int chan2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT];
|
const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||||
const unsigned int prev_chan = gNextMrChannel;
|
const unsigned int prev_chan = gNextMrChannel;
|
||||||
unsigned int chan = 0;
|
unsigned int chan = 0;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (gCurrentScanList)
|
switch (gCurrentScanList)
|
||||||
{
|
{
|
||||||
case SCAN_NEXT_CHAN_SCANLIST1:
|
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||||
prev_mr_chan = gNextMrChannel;
|
prev_mr_chan = gNextMrChannel;
|
||||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
|
||||||
|
if (chan1 >= 0)
|
||||||
{
|
{
|
||||||
//gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||||
gNextMrChannel = chan1;
|
{
|
||||||
break;
|
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||||
|
gNextMrChannel = chan1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case SCAN_NEXT_CHAN_SCANLIST2:
|
case SCAN_NEXT_CHAN_SCANLIST2:
|
||||||
if (RADIO_CheckValidChannel(chan2, false, 0))
|
if (chan2 >= 0)
|
||||||
{
|
{
|
||||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||||
gNextMrChannel = chan2;
|
{
|
||||||
break;
|
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||||
|
gNextMrChannel = chan2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this bit doesn't work at all - yet :(
|
// this bit doesn't yet work if the other VFO is a frequency
|
||||||
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||||
|
// dual watch is enabled - include the other VFO in the scan
|
||||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||||
{
|
// {
|
||||||
// chan = (gEeprom.RX_CHANNEL + 1) & 1u;
|
// chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||||
// chan = gEeprom.MrChannel[chan];
|
|
||||||
// chan = gEeprom.ScreenChannel[chan];
|
// chan = gEeprom.ScreenChannel[chan];
|
||||||
// chan = gEeprom.VfoInfo[chan].CHANNEL_SAVE;
|
// if (chan <= MR_CHANNEL_LAST)
|
||||||
// chan = 14;
|
|
||||||
// if (RADIO_CheckValidChannel(chan, false, 0))
|
|
||||||
// {
|
// {
|
||||||
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||||
// gNextMrChannel = chan;
|
// gNextMrChannel = chan;
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case SCAN_NEXT_CHAN_MR:
|
case SCAN_NEXT_CHAN_MR:
|
||||||
gCurrentScanList = SCAN_NEXT_CHAN_MR;
|
gCurrentScanList = SCAN_NEXT_CHAN_MR;
|
||||||
gNextMrChannel = prev_mr_chan;
|
gNextMrChannel = prev_mr_chan;
|
||||||
chan = 0xffffffff;
|
chan = 0xff;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enabled || chan == 0xffffffff)
|
if (!enabled || chan == 0xff)
|
||||||
{
|
{
|
||||||
chan = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
|
chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
|
||||||
if (chan == 0xFF)
|
if (chan == 0xFF)
|
||||||
return;
|
{ // no valid channel found
|
||||||
|
|
||||||
|
chan = MR_CHANNEL_FIRST;
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
|
||||||
gNextMrChannel = chan;
|
gNextMrChannel = chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev_chan != gNextMrChannel)
|
if (gNextMrChannel != prev_chan)
|
||||||
{
|
{
|
||||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
|
gEeprom.MrChannel[ gEeprom.RX_VFO] = gNextMrChannel;
|
||||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
|
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gNextMrChannel;
|
||||||
|
|
||||||
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||||
ScanPauseDelayIn_10ms = 8; // 80ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
gScanPauseDelayIn_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||||
#else
|
#else
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bScanKeepFrequency = false;
|
bScanKeepFrequency = false;
|
||||||
@@ -739,11 +756,11 @@ static void DUALWATCH_Alternate(void)
|
|||||||
if (gIsNoaaMode)
|
if (gIsNoaaMode)
|
||||||
{
|
{
|
||||||
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||||
gEeprom.RX_CHANNEL = (gEeprom.RX_CHANNEL + 1) & 1;
|
gEeprom.RX_VFO = (gEeprom.RX_VFO + 1) & 1;
|
||||||
else
|
else
|
||||||
gEeprom.RX_CHANNEL = 0;
|
gEeprom.RX_VFO = 0;
|
||||||
|
|
||||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||||
|
|
||||||
if (gEeprom.VfoInfo[0].CHANNEL_SAVE >= NOAA_CHANNEL_FIRST)
|
if (gEeprom.VfoInfo[0].CHANNEL_SAVE >= NOAA_CHANNEL_FIRST)
|
||||||
NOAA_IncreaseChannel();
|
NOAA_IncreaseChannel();
|
||||||
@@ -751,8 +768,8 @@ static void DUALWATCH_Alternate(void)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{ // toggle between VFO's
|
{ // toggle between VFO's
|
||||||
gEeprom.RX_CHANNEL = (gEeprom.RX_CHANNEL + 1) & 1;
|
gEeprom.RX_VFO = (gEeprom.RX_VFO + 1) & 1;
|
||||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||||
|
|
||||||
if (!gDualWatchActive)
|
if (!gDualWatchActive)
|
||||||
{ // let the user see DW is active
|
{ // let the user see DW is active
|
||||||
@@ -851,36 +868,38 @@ void APP_CheckRadioInterrupts(void)
|
|||||||
if (interrupt_status_bits & BK4819_REG_02_CTCSS_FOUND)
|
if (interrupt_status_bits & BK4819_REG_02_CTCSS_FOUND)
|
||||||
g_CTCSS_Lost = false;
|
g_CTCSS_Lost = false;
|
||||||
|
|
||||||
if (interrupt_status_bits & BK4819_REG_02_VOX_LOST)
|
#ifdef ENABLE_VOX
|
||||||
{
|
if (interrupt_status_bits & BK4819_REG_02_VOX_LOST)
|
||||||
g_VOX_Lost = true;
|
|
||||||
gVoxPauseCountdown = 10;
|
|
||||||
|
|
||||||
if (gEeprom.VOX_SWITCH)
|
|
||||||
{
|
{
|
||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && !gRxIdleMode)
|
g_VOX_Lost = true;
|
||||||
{
|
gVoxPauseCountdown = 10;
|
||||||
gPowerSave_10ms = power_save2_10ms;
|
|
||||||
gPowerSaveCountdownExpired = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && (gScheduleDualWatch || gDualWatchCountdown_10ms < dual_watch_count_after_vox_10ms))
|
if (gEeprom.VOX_SWITCH)
|
||||||
{
|
{
|
||||||
gDualWatchCountdown_10ms = dual_watch_count_after_vox_10ms;
|
if (gCurrentFunction == FUNCTION_POWER_SAVE && !gRxIdleMode)
|
||||||
gScheduleDualWatch = false;
|
{
|
||||||
|
gPowerSave_10ms = power_save2_10ms;
|
||||||
|
gPowerSaveCountdownExpired = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// let the user see DW is not active
|
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && (gScheduleDualWatch || gDualWatchCountdown_10ms < dual_watch_count_after_vox_10ms))
|
||||||
gDualWatchActive = false;
|
{
|
||||||
gUpdateStatus = true;
|
gDualWatchCountdown_10ms = dual_watch_count_after_vox_10ms;
|
||||||
|
gScheduleDualWatch = false;
|
||||||
|
|
||||||
|
// let the user see DW is not active
|
||||||
|
gDualWatchActive = false;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (interrupt_status_bits & BK4819_REG_02_VOX_FOUND)
|
if (interrupt_status_bits & BK4819_REG_02_VOX_FOUND)
|
||||||
{
|
{
|
||||||
g_VOX_Lost = false;
|
g_VOX_Lost = false;
|
||||||
gVoxPauseCountdown = 0;
|
gVoxPauseCountdown = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (interrupt_status_bits & BK4819_REG_02_SQUELCH_LOST)
|
if (interrupt_status_bits & BK4819_REG_02_SQUELCH_LOST)
|
||||||
{
|
{
|
||||||
@@ -935,83 +954,85 @@ void APP_EndTransmission(void)
|
|||||||
RADIO_SetupRegisters(false);
|
RADIO_SetupRegisters(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void APP_HandleVox(void)
|
#ifdef ENABLE_VOX
|
||||||
{
|
static void APP_HandleVox(void)
|
||||||
if (gSetting_KILLED)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (gVoxResumeCountdown == 0)
|
|
||||||
{
|
{
|
||||||
if (gVoxPauseCountdown)
|
if (gSetting_KILLED)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_VOX_Lost = false;
|
|
||||||
gVoxPauseCountdown = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
if (gVoxResumeCountdown == 0)
|
||||||
if (gFmRadioMode)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (gVOX_NoiseDetected)
|
|
||||||
{
|
|
||||||
if (g_VOX_Lost)
|
|
||||||
gVoxStopCountdown_10ms = vox_stop_count_down_10ms;
|
|
||||||
else
|
|
||||||
if (gVoxStopCountdown_10ms == 0)
|
|
||||||
gVOX_NoiseDetected = false;
|
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT && !gPttIsPressed && !gVOX_NoiseDetected)
|
|
||||||
{
|
{
|
||||||
if (gFlagEndTransmission)
|
if (gVoxPauseCountdown)
|
||||||
{
|
return;
|
||||||
//if (gCurrentFunction != FUNCTION_FOREGROUND)
|
}
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
else
|
||||||
}
|
{
|
||||||
else
|
g_VOX_Lost = false;
|
||||||
{
|
gVoxPauseCountdown = 0;
|
||||||
APP_EndTransmission();
|
}
|
||||||
|
|
||||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
#ifdef ENABLE_FMRADIO
|
||||||
|
if (gFmRadioMode)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gVOX_NoiseDetected)
|
||||||
|
{
|
||||||
|
if (g_VOX_Lost)
|
||||||
|
gVoxStopCountdown_10ms = vox_stop_count_down_10ms;
|
||||||
|
else
|
||||||
|
if (gVoxStopCountdown_10ms == 0)
|
||||||
|
gVOX_NoiseDetected = false;
|
||||||
|
|
||||||
|
if (gCurrentFunction == FUNCTION_TRANSMIT && !gPttIsPressed && !gVOX_NoiseDetected)
|
||||||
|
{
|
||||||
|
if (gFlagEndTransmission)
|
||||||
{
|
{
|
||||||
//if (gCurrentFunction != FUNCTION_FOREGROUND)
|
//if (gCurrentFunction != FUNCTION_FOREGROUND)
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
{
|
||||||
|
APP_EndTransmission();
|
||||||
|
|
||||||
|
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||||
|
{
|
||||||
|
//if (gCurrentFunction != FUNCTION_FOREGROUND)
|
||||||
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
gFlagEndTransmission = false;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
gUpdateStatus = true;
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
gFlagEndTransmission = false;
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_VOX_Lost)
|
if (g_VOX_Lost)
|
||||||
{
|
|
||||||
gVOX_NoiseDetected = true;
|
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT && gSerialConfigCountDown_500ms == 0)
|
|
||||||
{
|
{
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
gVOX_NoiseDetected = true;
|
||||||
RADIO_PrepareTX();
|
|
||||||
gUpdateDisplay = true;
|
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||||
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
|
||||||
|
if (gCurrentFunction != FUNCTION_TRANSMIT && gSerialConfigCountDown_500ms == 0)
|
||||||
|
{
|
||||||
|
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||||
|
RADIO_PrepareTX();
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
void APP_Update(void)
|
void APP_Update(void)
|
||||||
{
|
{
|
||||||
@@ -1050,24 +1071,25 @@ void APP_Update(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScanState != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0)
|
if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0)
|
||||||
#else
|
#else
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScanState != SCAN_OFF && gScheduleScanListen && !gPttIsPressed)
|
if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed)
|
||||||
#endif
|
#endif
|
||||||
{
|
{ // scanning
|
||||||
|
|
||||||
if (IS_FREQ_CHANNEL(gNextMrChannel))
|
if (IS_FREQ_CHANNEL(gNextMrChannel))
|
||||||
{
|
{
|
||||||
if (gCurrentFunction == FUNCTION_INCOMING)
|
if (gCurrentFunction == FUNCTION_INCOMING)
|
||||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||||
else
|
else
|
||||||
FREQ_NextChannel();
|
FREQ_NextChannel(); // switch to next frequency
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
||||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||||
else
|
else
|
||||||
MR_NextChannel();
|
MR_NextChannel(); // switch to next channel
|
||||||
}
|
}
|
||||||
|
|
||||||
gScanPauseMode = false;
|
gScanPauseMode = false;
|
||||||
@@ -1110,7 +1132,7 @@ void APP_Update(void)
|
|||||||
if (gScheduleDualWatch)
|
if (gScheduleDualWatch)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{
|
{
|
||||||
if (!gPttIsPressed &&
|
if (!gPttIsPressed &&
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -1145,8 +1167,10 @@ void APP_Update(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gEeprom.VOX_SWITCH)
|
#ifdef ENABLE_VOX
|
||||||
APP_HandleVox();
|
if (gEeprom.VOX_SWITCH)
|
||||||
|
APP_HandleVox();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gSchedulePowerSave)
|
if (gSchedulePowerSave)
|
||||||
{
|
{
|
||||||
@@ -1158,7 +1182,7 @@ void APP_Update(void)
|
|||||||
gPttIsPressed ||
|
gPttIsPressed ||
|
||||||
gKeyBeingHeld ||
|
gKeyBeingHeld ||
|
||||||
gEeprom.BATTERY_SAVE == 0 ||
|
gEeprom.BATTERY_SAVE == 0 ||
|
||||||
gScanState != SCAN_OFF ||
|
gScanStateDir != SCAN_OFF ||
|
||||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||||
gScreenToDisplay != DISPLAY_MAIN ||
|
gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
@@ -1183,7 +1207,7 @@ void APP_Update(void)
|
|||||||
gPttIsPressed ||
|
gPttIsPressed ||
|
||||||
gKeyBeingHeld ||
|
gKeyBeingHeld ||
|
||||||
gEeprom.BATTERY_SAVE == 0 ||
|
gEeprom.BATTERY_SAVE == 0 ||
|
||||||
gScanState != SCAN_OFF ||
|
gScanStateDir != SCAN_OFF ||
|
||||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||||
gScreenToDisplay != DISPLAY_MAIN ||
|
gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
@@ -1211,10 +1235,14 @@ void APP_Update(void)
|
|||||||
{
|
{
|
||||||
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
||||||
|
|
||||||
if (gEeprom.VOX_SWITCH)
|
#ifdef ENABLE_VOX
|
||||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
if (gEeprom.VOX_SWITCH)
|
||||||
|
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF &&
|
||||||
|
gScanStateDir == SCAN_OFF &&
|
||||||
|
gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{ // dual watch mode, toggle between the two VFO's
|
{ // dual watch mode, toggle between the two VFO's
|
||||||
DUALWATCH_Alternate();
|
DUALWATCH_Alternate();
|
||||||
|
|
||||||
@@ -1227,10 +1255,10 @@ void APP_Update(void)
|
|||||||
gRxIdleMode = false; // RX is awake
|
gRxIdleMode = false; // RX is awake
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gUpdateRSSI)
|
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gUpdateRSSI)
|
||||||
{ // dual watch mode, go back to sleep
|
{ // dual watch mode, go back to sleep
|
||||||
|
|
||||||
updateRSSI(gEeprom.RX_CHANNEL);
|
updateRSSI(gEeprom.RX_VFO);
|
||||||
|
|
||||||
// go back to sleep
|
// go back to sleep
|
||||||
|
|
||||||
@@ -1350,11 +1378,8 @@ void APP_CheckKeys(void)
|
|||||||
Key == KEY_UP ||
|
Key == KEY_UP ||
|
||||||
Key == KEY_DOWN ||
|
Key == KEY_DOWN ||
|
||||||
Key == KEY_EXIT ||
|
Key == KEY_EXIT ||
|
||||||
Key == KEY_MENU
|
Key == KEY_MENU ||
|
||||||
#ifdef ENABLE_MAIN_KEY_HOLD
|
(Key >= KEY_0 && Key <= KEY_9)) // keys 0-9 can be held down to bypass pressing the F-Key
|
||||||
|| Key <= KEY_9 // keys 0-9 can be held down to bypass pressing the F-Key
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
gKeyBeingHeld = true;
|
gKeyBeingHeld = true;
|
||||||
APP_ProcessKey(Key, true, true);
|
APP_ProcessKey(Key, true, true);
|
||||||
@@ -1390,8 +1415,9 @@ void APP_TimeSlice10ms(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
|
// if (gEeprom.VfoInfo[gEeprom.RX_VFO].AM_mode && gSetting_AM_fix)
|
||||||
AM_fix_10ms(gEeprom.RX_CHANNEL);
|
if (gRxVfo->AM_mode && gSetting_AM_fix)
|
||||||
|
AM_fix_10ms(gEeprom.RX_VFO);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (UART_IsCommandAvailable())
|
if (UART_IsCommandAvailable())
|
||||||
@@ -1445,11 +1471,13 @@ void APP_TimeSlice10ms(void)
|
|||||||
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0)
|
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0)
|
||||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
|
|
||||||
if (gVoxResumeCountdown > 0)
|
#ifdef ENABLE_VOX
|
||||||
gVoxResumeCountdown--;
|
if (gVoxResumeCountdown > 0)
|
||||||
|
gVoxResumeCountdown--;
|
||||||
|
|
||||||
if (gVoxPauseCountdown > 0)
|
if (gVoxPauseCountdown > 0)
|
||||||
gVoxPauseCountdown--;
|
gVoxPauseCountdown--;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
{
|
{
|
||||||
@@ -1699,12 +1727,18 @@ void APP_TimeSlice500ms(void)
|
|||||||
|
|
||||||
if (gDTMF_RX_live_timeout > 0)
|
if (gDTMF_RX_live_timeout > 0)
|
||||||
{
|
{
|
||||||
if (--gDTMF_RX_live_timeout == 0)
|
#ifdef ENABLE_RSSI_BAR
|
||||||
|
if (center_line == CENTER_LINE_DTMF_DEC ||
|
||||||
|
center_line == CENTER_LINE_NONE) // wait till the center line is free for us to use before timing out
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (gDTMF_RX_live[0] != 0)
|
if (--gDTMF_RX_live_timeout == 0)
|
||||||
{
|
{
|
||||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
if (gDTMF_RX_live[0] != 0)
|
||||||
gUpdateDisplay = true;
|
{
|
||||||
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1771,7 +1805,7 @@ void APP_TimeSlice500ms(void)
|
|||||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
{
|
{
|
||||||
if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||||
updateRSSI(gEeprom.RX_CHANNEL);
|
updateRSSI(gEeprom.RX_VFO);
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF)
|
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
@@ -1786,9 +1820,9 @@ void APP_TimeSlice500ms(void)
|
|||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
|
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
if (gScanState == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
if (gScanStateDir == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
||||||
#else
|
#else
|
||||||
if (gScanState == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
bool exit_menu = false;
|
bool exit_menu = false;
|
||||||
@@ -1961,9 +1995,9 @@ void APP_TimeSlice500ms(void)
|
|||||||
gCurrentFunction != FUNCTION_TRANSMIT &&
|
gCurrentFunction != FUNCTION_TRANSMIT &&
|
||||||
gCurrentFunction != FUNCTION_RECEIVE)
|
gCurrentFunction != FUNCTION_RECEIVE)
|
||||||
{
|
{
|
||||||
if (gDTMF_AUTO_RESET_TIME > 0)
|
if (gDTMF_auto_reset_time_500ms > 0)
|
||||||
{
|
{
|
||||||
if (--gDTMF_AUTO_RESET_TIME == 0)
|
if (--gDTMF_auto_reset_time_500ms == 0)
|
||||||
{
|
{
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
@@ -1985,6 +2019,7 @@ void APP_TimeSlice500ms(void)
|
|||||||
static void ALARM_Off(void)
|
static void ALARM_Off(void)
|
||||||
{
|
{
|
||||||
gAlarmState = ALARM_STATE_OFF;
|
gAlarmState = ALARM_STATE_OFF;
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
|
|
||||||
@@ -1994,43 +2029,45 @@ void APP_TimeSlice500ms(void)
|
|||||||
RADIO_EnableCxCSS();
|
RADIO_EnableCxCSS();
|
||||||
}
|
}
|
||||||
|
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
SYSTEM_DelayMs(5);
|
SYSTEM_DelayMs(5);
|
||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void CHANNEL_Next(bool bFlag, int8_t Direction)
|
void CHANNEL_Next(const bool bFlag, const int8_t scan_direction)
|
||||||
{
|
{
|
||||||
RADIO_SelectVfos();
|
RADIO_SelectVfos();
|
||||||
|
|
||||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||||
gScanState = Direction;
|
gScanStateDir = scan_direction;
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||||
{
|
{ // channel mode
|
||||||
if (bFlag)
|
if (bFlag)
|
||||||
gRestoreMrChannel = gNextMrChannel;
|
gRestoreMrChannel = gNextMrChannel;
|
||||||
MR_NextChannel();
|
MR_NextChannel();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // frequency mode
|
||||||
if (bFlag)
|
if (bFlag)
|
||||||
gRestoreFrequency = gRxVfo->freq_config_RX.Frequency;
|
gRestoreFrequency = gRxVfo->freq_config_RX.Frequency;
|
||||||
FREQ_NextChannel();
|
FREQ_NextChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
gRxReceptionMode = RX_MODE_NONE;
|
gRxReceptionMode = RX_MODE_NONE;
|
||||||
gScanPauseMode = false;
|
gScanPauseMode = false;
|
||||||
bScanKeepFrequency = false;
|
bScanKeepFrequency = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||||
@@ -2054,17 +2091,6 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (gEeprom.AUTO_KEYPAD_LOCK)
|
if (gEeprom.AUTO_KEYPAD_LOCK)
|
||||||
gKeyLockCountdown = 30; // 15 seconds
|
gKeyLockCountdown = 30; // 15 seconds
|
||||||
|
|
||||||
if (Key == KEY_EXIT && bKeyPressed && bKeyHeld && gDTMF_RX_live[0] != 0)
|
|
||||||
{ // clear the live DTMF decoder if the EXIT key is held
|
|
||||||
if (gDTMF_RX_live[0] != 0)
|
|
||||||
{
|
|
||||||
gDTMF_RX_live_timeout = 0;
|
|
||||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed)
|
||||||
{
|
{
|
||||||
if (gFlagSaveVfo)
|
if (gFlagSaveVfo)
|
||||||
@@ -2089,10 +2115,10 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
if (gFlagSaveChannel)
|
if (gFlagSaveChannel)
|
||||||
{
|
{
|
||||||
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gFlagSaveChannel);
|
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_VFO, gTxVfo, gFlagSaveChannel);
|
||||||
gFlagSaveChannel = false;
|
gFlagSaveChannel = false;
|
||||||
|
|
||||||
RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, VFO_CONFIGURE);
|
RADIO_ConfigureChannel(gEeprom.TX_VFO, VFO_CONFIGURE);
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
@@ -2100,11 +2126,24 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (Key != KEY_PTT)
|
||||||
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
|
if (Key == KEY_EXIT && bKeyHeld)
|
||||||
|
{ // exit key held pressed
|
||||||
|
|
||||||
|
// clear the live DTMF decoder
|
||||||
|
if (gDTMF_RX_live[0] != 0)
|
||||||
|
{
|
||||||
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
gDTMF_RX_live_timeout = 0;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
||||||
gMenuCountdown = menu_timeout_500ms;
|
gMenuCountdown = menu_timeout_500ms;
|
||||||
|
|
||||||
BACKLIGHT_TurnOn();
|
|
||||||
|
|
||||||
if (gDTMF_DecodeRingCountdown_500ms > 0)
|
if (gDTMF_DecodeRingCountdown_500ms > 0)
|
||||||
{ // cancel the ringing
|
{ // cancel the ringing
|
||||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||||
@@ -2129,8 +2168,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!bKeyHeld)
|
if (!bKeyHeld)
|
||||||
{
|
{ // keypad is locked, tell the user
|
||||||
// keypad is locked, tell the user
|
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
gKeypadLocked = 4; // 2 seconds
|
gKeypadLocked = 4; // 2 seconds
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
@@ -2160,25 +2198,28 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
Key != KEY_STAR &&
|
Key != KEY_STAR &&
|
||||||
Key != KEY_MENU)
|
Key != KEY_MENU)
|
||||||
{
|
{
|
||||||
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
{ // frequency or CTCSS/DCS scanning
|
{ // FREQ/CTCSS/DCS scanning
|
||||||
if (bKeyPressed && !bKeyHeld)
|
if (bKeyPressed && !bKeyHeld)
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gPttWasPressed && Key == KEY_PTT)
|
if (Key == KEY_PTT)
|
||||||
{
|
{
|
||||||
bFlag = bKeyHeld;
|
if (gPttWasPressed)
|
||||||
if (!bKeyPressed)
|
|
||||||
{
|
{
|
||||||
bFlag = true;
|
bFlag = bKeyHeld;
|
||||||
gPttWasPressed = false;
|
if (!bKeyPressed)
|
||||||
|
{
|
||||||
|
bFlag = true;
|
||||||
|
gPttWasPressed = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (gPttWasReleased && Key != KEY_PTT)
|
if (gPttWasReleased)
|
||||||
{
|
{
|
||||||
if (bKeyHeld)
|
if (bKeyHeld)
|
||||||
bFlag = true;
|
bFlag = true;
|
||||||
@@ -2215,14 +2256,16 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
char Code;
|
char Code;
|
||||||
|
|
||||||
if (Key == KEY_SIDE2)
|
if (Key == KEY_SIDE2)
|
||||||
{
|
{ // transmit 1750Hz tone
|
||||||
Code = 0xFE;
|
Code = 0xFE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Code = DTMF_GetCharacter(Key);
|
Code = DTMF_GetCharacter(Key - KEY_0);
|
||||||
if (Code == 0xFF)
|
if (Code == 0xFF)
|
||||||
goto Skip;
|
goto Skip;
|
||||||
|
|
||||||
|
// transmit DTMF keys
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bKeyPressed || bKeyHeld)
|
if (!bKeyPressed || bKeyHeld)
|
||||||
@@ -2260,10 +2303,12 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
else
|
else
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if ((!bKeyHeld && bKeyPressed) || (gAlarmState == ALARM_STATE_TX1750 && bKeyHeld && !bKeyPressed))
|
||||||
{
|
{
|
||||||
ALARM_Off();
|
ALARM_Off();
|
||||||
|
|
||||||
|
// TODO: fix side key 1750, you have to press it twice to restart the tone :(
|
||||||
|
|
||||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||||
{
|
{
|
||||||
//if (gCurrentFunction != FUNCTION_FOREGROUND)
|
//if (gCurrentFunction != FUNCTION_FOREGROUND)
|
||||||
@@ -2275,6 +2320,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (Key == KEY_PTT)
|
if (Key == KEY_PTT)
|
||||||
gPttWasPressed = true;
|
gPttWasPressed = true;
|
||||||
else
|
else
|
||||||
|
if (!bKeyHeld)
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2287,9 +2333,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
case DISPLAY_MAIN:
|
case DISPLAY_MAIN:
|
||||||
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
|
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
|
||||||
|
|
||||||
#ifdef ENABLE_MAIN_KEY_HOLD
|
bKeyHeld = false; // allow the channel setting to be saved
|
||||||
bKeyHeld = false; // allow the channel setting to be saved
|
|
||||||
#endif
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2395,7 +2439,7 @@ Skip:
|
|||||||
{
|
{
|
||||||
if (!bKeyHeld)
|
if (!bKeyHeld)
|
||||||
{
|
{
|
||||||
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gRequestSaveChannel);
|
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_VFO, gTxVfo, gRequestSaveChannel);
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||||
if (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere
|
if (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere
|
||||||
@@ -2420,7 +2464,7 @@ Skip:
|
|||||||
RADIO_ConfigureChannel(1, gVfoConfigureMode);
|
RADIO_ConfigureChannel(1, gVfoConfigureMode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, gVfoConfigureMode);
|
RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
|
||||||
|
|
||||||
if (gRequestDisplayScreen == DISPLAY_INVALID)
|
if (gRequestDisplayScreen == DISPLAY_INVALID)
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
@@ -2440,7 +2484,7 @@ Skip:
|
|||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
gDTMF_AUTO_RESET_TIME = 0;
|
gDTMF_auto_reset_time_500ms = 0;
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||||
gDTMF_TxStopCountdown_500ms = 0;
|
gDTMF_TxStopCountdown_500ms = 0;
|
||||||
gDTMF_IsTx = false;
|
gDTMF_IsTx = false;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ extern const uint8_t orig_mixer;
|
|||||||
extern const uint8_t orig_pga;
|
extern const uint8_t orig_pga;
|
||||||
|
|
||||||
void APP_EndTransmission(void);
|
void APP_EndTransmission(void);
|
||||||
void CHANNEL_Next(bool bFlag, int8_t Direction);
|
void CHANNEL_Next(const bool bFlag, const int8_t scan_direction);
|
||||||
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
|
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
|
||||||
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step);
|
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step);
|
||||||
void APP_Update(void);
|
void APP_Update(void);
|
||||||
|
|||||||
21
app/dtmf.c
21
app/dtmf.c
@@ -54,8 +54,8 @@ char gDTMF_Caller[4];
|
|||||||
char gDTMF_Callee[4];
|
char gDTMF_Callee[4];
|
||||||
DTMF_State_t gDTMF_State;
|
DTMF_State_t gDTMF_State;
|
||||||
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||||
uint8_t gDTMFChosenContact;
|
uint8_t gDTMF_chosen_contact;
|
||||||
uint8_t gDTMF_AUTO_RESET_TIME;
|
uint8_t gDTMF_auto_reset_time_500ms;
|
||||||
DTMF_CallState_t gDTMF_CallState;
|
DTMF_CallState_t gDTMF_CallState;
|
||||||
DTMF_ReplyState_t gDTMF_ReplyState;
|
DTMF_ReplyState_t gDTMF_ReplyState;
|
||||||
DTMF_CallMode_t gDTMF_CallMode;
|
DTMF_CallMode_t gDTMF_CallMode;
|
||||||
@@ -184,7 +184,7 @@ void DTMF_HandleRequest(void)
|
|||||||
if (!gDTMF_RX_pending)
|
if (!gDTMF_RX_pending)
|
||||||
return; // nothing new received
|
return; // nothing new received
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
{ // we're busy scanning
|
{ // we're busy scanning
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
return;
|
return;
|
||||||
@@ -331,6 +331,9 @@ void DTMF_HandleRequest(void)
|
|||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (gEeprom.DTMF_DECODE_RESPONSE)
|
switch (gEeprom.DTMF_DECODE_RESPONSE)
|
||||||
{
|
{
|
||||||
case DTMF_DEC_RESPONSE_BOTH:
|
case DTMF_DEC_RESPONSE_BOTH:
|
||||||
@@ -348,6 +351,8 @@ void DTMF_HandleRequest(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
if (gDTMF_IsGroupCall)
|
if (gDTMF_IsGroupCall)
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||||
}
|
}
|
||||||
@@ -385,8 +390,9 @@ void DTMF_Reply(void)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
case DTMF_REPLY_NONE:
|
case DTMF_REPLY_NONE:
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
||||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO ||
|
||||||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
||||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
||||||
{
|
{
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||||
@@ -403,13 +409,12 @@ void DTMF_Reply(void)
|
|||||||
if (pString == NULL)
|
if (pString == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Delay = gEeprom.DTMF_PRELOAD_TIME;
|
Delay = (gEeprom.DTMF_PRELOAD_TIME < 200) ? 200 : gEeprom.DTMF_PRELOAD_TIME;
|
||||||
|
|
||||||
if (gEeprom.DTMF_SIDE_TONE)
|
if (gEeprom.DTMF_SIDE_TONE)
|
||||||
{ // the will also hear the transmitted tones
|
{ // the user will also hear the transmitted tones
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
Delay = (gEeprom.DTMF_PRELOAD_TIME < 60) ? 60 : gEeprom.DTMF_PRELOAD_TIME;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSTEM_DelayMs(Delay);
|
SYSTEM_DelayMs(Delay);
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ extern char gDTMF_Caller[4];
|
|||||||
extern char gDTMF_Callee[4];
|
extern char gDTMF_Callee[4];
|
||||||
extern DTMF_State_t gDTMF_State;
|
extern DTMF_State_t gDTMF_State;
|
||||||
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||||
extern uint8_t gDTMFChosenContact;
|
extern uint8_t gDTMF_chosen_contact;
|
||||||
extern uint8_t gDTMF_AUTO_RESET_TIME;
|
extern uint8_t gDTMF_auto_reset_time_500ms;
|
||||||
extern DTMF_CallState_t gDTMF_CallState;
|
extern DTMF_CallState_t gDTMF_CallState;
|
||||||
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
||||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
extern DTMF_CallMode_t gDTMF_CallMode;
|
||||||
|
|||||||
@@ -52,12 +52,22 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (!bKeyPressed)
|
if (!bKeyPressed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
if (gScreenToDisplay != DISPLAY_MENU &&
|
||||||
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
gScreenToDisplay != DISPLAY_FM &&
|
||||||
#endif
|
#ifdef ENABLE_FMRADIO
|
||||||
|
!gFmRadioMode &&
|
||||||
|
#endif
|
||||||
|
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
|
{ // toggle the keyboad lock
|
||||||
|
|
||||||
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
#ifdef ENABLE_VOICE
|
||||||
gRequestSaveSettings = true;
|
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
||||||
|
|
||||||
|
gRequestSaveSettings = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -127,7 +137,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gFlagEndTransmission = false;
|
gFlagEndTransmission = false;
|
||||||
gVOX_NoiseDetected = false;
|
#ifdef ENABLE_VOX
|
||||||
|
gVOX_NoiseDetected = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||||
@@ -142,7 +154,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
if (gScanStateDir != SCAN_OFF)
|
||||||
{
|
{
|
||||||
SCANNER_Stop();
|
SCANNER_Stop();
|
||||||
|
|
||||||
|
|||||||
263
app/main.c
263
app/main.c
@@ -28,6 +28,7 @@
|
|||||||
#include "app/spectrum.h"
|
#include "app/spectrum.h"
|
||||||
#endif
|
#endif
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
#include "board.h"
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
#include "dtmf.h"
|
#include "dtmf.h"
|
||||||
#include "frequencies.h"
|
#include "frequencies.h"
|
||||||
@@ -36,11 +37,51 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#ifdef ENABLE_SPECTRUM
|
||||||
|
// #include "app/spectrum.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void toggle_chan_scanlist(void)
|
||||||
|
{ // toggle the selected channels scanlist setting
|
||||||
|
|
||||||
|
if (gScreenToDisplay == DISPLAY_SCANNER || !IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gTxVfo->SCANLIST1_PARTICIPATION)
|
||||||
|
{
|
||||||
|
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
||||||
|
gTxVfo->SCANLIST1_PARTICIPATION = 0;
|
||||||
|
else
|
||||||
|
gTxVfo->SCANLIST2_PARTICIPATION = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
||||||
|
gTxVfo->SCANLIST2_PARTICIPATION = 0;
|
||||||
|
else
|
||||||
|
gTxVfo->SCANLIST1_PARTICIPATION = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||||
|
|
||||||
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
|
gFlagResetVfos = true;
|
||||||
|
}
|
||||||
|
|
||||||
static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||||
{
|
{
|
||||||
uint8_t Band;
|
uint8_t Band;
|
||||||
uint8_t Vfo = gEeprom.TX_CHANNEL;
|
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)
|
switch (Key)
|
||||||
{
|
{
|
||||||
@@ -50,7 +91,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
// TODO: do something useful with the key
|
// TODO: make use of this function key
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -101,7 +142,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
|
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
|
||||||
else
|
else
|
||||||
gEeprom.TX_CHANNEL = (Vfo == 0);
|
gEeprom.TX_VFO = (Vfo + 1) & 1u;
|
||||||
|
|
||||||
gRequestSaveSettings = 1;
|
gRequestSaveSettings = 1;
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
@@ -123,8 +164,8 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
uint8_t Channel;
|
uint8_t Channel;
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{
|
{ // swap to frequency mode
|
||||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO];
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||||
#endif
|
#endif
|
||||||
@@ -133,9 +174,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 0);
|
Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 0);
|
||||||
if (Channel != 0xFF)
|
if (Channel != 0xFF)
|
||||||
{
|
{ // swap to channel mode
|
||||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
gEeprom.ScreenChannel[Vfo] = Channel;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||||
@@ -169,47 +210,31 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
case KEY_5:
|
case KEY_5:
|
||||||
if(beep) {
|
if(beep) {
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
|
|
||||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{
|
{
|
||||||
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_CHANNEL];
|
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_VFO];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO];
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
gRequestSaveVFO = true;
|
gRequestSaveVFO = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
#elif defined(ENABLE_SPECTRUM)
|
#elif defined(ENABLE_SPECTRUM)
|
||||||
APP_RunSpectrum();
|
APP_RunSpectrum();
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// toggle scanlist-1 and scanlist 2
|
#ifdef ENABLE_VOX
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
toggle_chan_scanlist();
|
||||||
{
|
#endif
|
||||||
if (gTxVfo->SCANLIST1_PARTICIPATION)
|
|
||||||
{
|
|
||||||
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
|
||||||
gTxVfo->SCANLIST1_PARTICIPATION = 0;
|
|
||||||
else
|
|
||||||
gTxVfo->SCANLIST2_PARTICIPATION = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
|
||||||
gTxVfo->SCANLIST2_PARTICIPATION = 0;
|
|
||||||
else
|
|
||||||
gTxVfo->SCANLIST1_PARTICIPATION = 1;
|
|
||||||
}
|
|
||||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE;
|
|
||||||
gFlagResetVfos = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_6:
|
case KEY_6:
|
||||||
@@ -217,7 +242,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_7:
|
case KEY_7:
|
||||||
ACTION_Vox();
|
#ifdef ENABLE_VOX
|
||||||
|
ACTION_Vox();
|
||||||
|
#else
|
||||||
|
toggle_chan_scanlist();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_8:
|
case KEY_8:
|
||||||
@@ -259,45 +288,36 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (bKeyHeld)
|
if (bKeyHeld)
|
||||||
{ // key held down
|
{ // key held down
|
||||||
|
|
||||||
#ifdef ENABLE_MAIN_KEY_HOLD
|
if (bKeyPressed)
|
||||||
if (bKeyPressed)
|
{
|
||||||
|
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||||
{
|
{
|
||||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
if (gInputBoxIndex > 0)
|
||||||
{
|
{ // delete any inputted chars
|
||||||
if (gInputBoxIndex > 0)
|
gInputBoxIndex = 0;
|
||||||
{ // delete any inputted chars
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
gInputBoxIndex = 0;
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
gWasFKeyPressed = false;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
|
|
||||||
processFKeyFunction(Key, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
|
||||||
|
processFKeyFunction(Key, false);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_MAIN_KEY_HOLD
|
if (bKeyPressed)
|
||||||
if (bKeyPressed)
|
{ // key is pressed
|
||||||
{ // key is pressed
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed
|
return; // don't use the key till it's released
|
||||||
return; // don't use the key till it's released
|
}
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (!bKeyPressed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!gWasFKeyPressed)
|
if (!gWasFKeyPressed)
|
||||||
{ // F-key wasn't pressed
|
{ // F-key wasn't pressed
|
||||||
|
|
||||||
const uint8_t Vfo = gEeprom.TX_CHANNEL;
|
const uint8_t Vfo = gEeprom.TX_VFO;
|
||||||
|
|
||||||
gKeyInputCountdown = key_input_timeout_500ms;
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
|
|
||||||
@@ -345,7 +365,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
// #endif
|
// #endif
|
||||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{ // user is entering frequency
|
{ // user is entering a frequency
|
||||||
|
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
@@ -478,7 +498,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (!gFmRadioMode)
|
if (!gFmRadioMode)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (gScanState == SCAN_OFF)
|
if (gScanStateDir == SCAN_OFF)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex == 0)
|
if (gInputBoxIndex == 0)
|
||||||
return;
|
return;
|
||||||
@@ -528,11 +548,16 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||||
{
|
{
|
||||||
|
if (bKeyPressed && !bKeyHeld)
|
||||||
|
// menu key pressed
|
||||||
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (bKeyHeld)
|
if (bKeyHeld)
|
||||||
{ // menu key held down (long press)
|
{ // menu key held down (long press)
|
||||||
|
|
||||||
if (bKeyPressed)
|
if (bKeyPressed)
|
||||||
{
|
{ // long press MENU key
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex > 0)
|
if (gInputBoxIndex > 0)
|
||||||
@@ -544,54 +569,51 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: long press M-key
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||||
{ // copy channel to VFO
|
|
||||||
int channel = -1;
|
|
||||||
int vfo = -1;
|
|
||||||
//int selected = -1;
|
|
||||||
|
|
||||||
if (IS_FREQ_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
if (gEeprom.VFO_OPEN && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{ // VFO mode
|
{
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
|
||||||
{ // other VFO is in channel mode
|
if (gScanStateDir != SCAN_OFF)
|
||||||
channel = gTxVfo->CHANNEL_SAVE;
|
{
|
||||||
vfo = gRxVfo->CHANNEL_SAVE;
|
if (gCurrentFunction != FUNCTION_INCOMING ||
|
||||||
|
gRxReceptionMode == RX_MODE_NONE ||
|
||||||
|
gScanPauseDelayIn_10ms == 0)
|
||||||
|
{ // scan is running (not paused)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const unsigned int vfo = get_rx_VFO();
|
||||||
|
|
||||||
|
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo]))
|
||||||
|
{ // copy channel to VFO, then swap to the VFO
|
||||||
|
|
||||||
|
const unsigned int channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
|
||||||
|
|
||||||
|
gEeprom.ScreenChannel[vfo] = channel;
|
||||||
|
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel;
|
||||||
|
gEeprom.TX_VFO = vfo;
|
||||||
|
|
||||||
|
RADIO_SelectVfos();
|
||||||
|
RADIO_ApplyOffset(gRxVfo);
|
||||||
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
|
//SETTINGS_SaveChannel(channel, gEeprom.RX_VFO, gRxVfo, 1);
|
||||||
|
|
||||||
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
{
|
||||||
{ // VFO mode
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
|
||||||
{ // other VFO is in channel mode
|
|
||||||
channel = gRxVfo->CHANNEL_SAVE;
|
|
||||||
vfo = gTxVfo->CHANNEL_SAVE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel >= 0 && vfo >= 0)
|
|
||||||
{ // copy the channel into the VFO
|
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: finish this
|
|
||||||
|
|
||||||
//gEeprom.RX_CHANNEL = () & 1; // swap to the VFO
|
|
||||||
|
|
||||||
|
|
||||||
// gRequestSaveVFO = true;
|
|
||||||
// gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
// gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,14 +625,10 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
const bool bFlag = (gInputBoxIndex == 0);
|
const bool bFlag = (gInputBoxIndex == 0);
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
|
|
||||||
if (bFlag)
|
if (bFlag)
|
||||||
{
|
{
|
||||||
gFlagRefreshSetting = true;
|
gFlagRefreshSetting = true;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_MENU;
|
gAnotherVoiceID = VOICE_ID_MENU;
|
||||||
#endif
|
#endif
|
||||||
@@ -632,7 +650,8 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bKeyHeld || !bKeyPressed)
|
if (bKeyHeld || !bKeyPressed)
|
||||||
{
|
{ // long press
|
||||||
|
|
||||||
if (bKeyHeld || bKeyPressed)
|
if (bKeyHeld || bKeyPressed)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld)
|
if (!bKeyHeld)
|
||||||
@@ -642,13 +661,14 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ACTION_Scan(false);
|
ACTION_Scan(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (gScanState == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
#else
|
#else
|
||||||
if (gScanState == SCAN_OFF)
|
if (gScanStateDir == SCAN_OFF)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
gKeyInputCountdown = key_input_timeout_500ms;
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
@@ -697,7 +717,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||||
{
|
{
|
||||||
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL];
|
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
||||||
|
|
||||||
if (bKeyHeld || !bKeyPressed)
|
if (bKeyHeld || !bKeyPressed)
|
||||||
{
|
{
|
||||||
@@ -731,7 +751,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScanState == SCAN_OFF)
|
if (gScanStateDir == SCAN_OFF)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
if (IS_NOT_NOAA_CHANNEL(Channel))
|
||||||
@@ -762,8 +782,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
if (Channel == Next)
|
if (Channel == Next)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Next;
|
gEeprom.MrChannel[gEeprom.TX_VFO] = Next;
|
||||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Next;
|
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Next;
|
||||||
|
|
||||||
if (!bKeyHeld)
|
if (!bKeyHeld)
|
||||||
{
|
{
|
||||||
@@ -776,9 +796,9 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
|
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_VFO] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
|
||||||
gEeprom.NoaaChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.NoaaChannel[gEeprom.TX_VFO] = Channel;
|
||||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -787,7 +807,10 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// jump to the next channel
|
||||||
CHANNEL_Next(false, Direction);
|
CHANNEL_Next(false, Direction);
|
||||||
|
gScanPauseDelayIn_10ms = 1;
|
||||||
|
gScheduleScanListen = false;
|
||||||
|
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
}
|
}
|
||||||
@@ -807,7 +830,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
if (!bKeyHeld)
|
if (!bKeyHeld)
|
||||||
{
|
{
|
||||||
const char Character = DTMF_GetCharacter(Key);
|
const char Character = DTMF_GetCharacter(Key - KEY_0);
|
||||||
if (Character != 0xFF)
|
if (Character != 0xFF)
|
||||||
{ // add key to DTMF string
|
{ // add key to DTMF string
|
||||||
DTMF_Append(Character);
|
DTMF_Append(Character);
|
||||||
@@ -826,7 +849,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
// TODO: ???
|
// TODO: ???
|
||||||
if (Key > KEY_PTT)
|
if (Key > KEY_PTT)
|
||||||
{
|
{
|
||||||
Key = KEY_SIDE2;
|
Key = KEY_SIDE2; // what's this doing ???
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Key)
|
switch (Key)
|
||||||
|
|||||||
197
app/menu.c
197
app/menu.c
@@ -47,26 +47,33 @@
|
|||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void writeXtalFreqCal(const int32_t value)
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
{
|
void writeXtalFreqCal(const int32_t value, const bool update_eeprom)
|
||||||
struct
|
|
||||||
{
|
{
|
||||||
int16_t BK4819_XtalFreqLow;
|
BK4819_WriteRegister(BK4819_REG_3B, 22656 + value);
|
||||||
uint16_t EEPROM_1F8A;
|
|
||||||
uint16_t EEPROM_1F8C;
|
|
||||||
uint8_t VOLUME_GAIN;
|
|
||||||
uint8_t DAC_GAIN;
|
|
||||||
} __attribute__((packed)) Misc;
|
|
||||||
|
|
||||||
gEeprom.BK4819_XTAL_FREQ_LOW = value;
|
if (update_eeprom)
|
||||||
BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW);
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int16_t BK4819_XtalFreqLow;
|
||||||
|
uint16_t EEPROM_1F8A;
|
||||||
|
uint16_t EEPROM_1F8C;
|
||||||
|
uint8_t VOLUME_GAIN;
|
||||||
|
uint8_t DAC_GAIN;
|
||||||
|
} __attribute__((packed)) misc;
|
||||||
|
|
||||||
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
gEeprom.BK4819_XTAL_FREQ_LOW = value;
|
||||||
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
|
||||||
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
|
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
||||||
Misc.BK4819_XtalFreqLow = gEeprom.BK4819_XTAL_FREQ_LOW;
|
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
||||||
EEPROM_WriteBuffer(0x1F88, &Misc);
|
//
|
||||||
}
|
EEPROM_ReadBuffer(0x1F88, &misc, 8);
|
||||||
|
misc.BK4819_XtalFreqLow = value;
|
||||||
|
EEPROM_WriteBuffer(0x1F88, &misc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MENU_StartCssScan(int8_t Direction)
|
void MENU_StartCssScan(int8_t Direction)
|
||||||
{
|
{
|
||||||
@@ -79,8 +86,8 @@ void MENU_StartCssScan(int8_t Direction)
|
|||||||
|
|
||||||
MENU_SelectNextCode();
|
MENU_SelectNextCode();
|
||||||
|
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MENU_StopCssScan(void)
|
void MENU_StopCssScan(void)
|
||||||
@@ -192,12 +199,11 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
case MENU_ABR_ON_TX_RX:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_Compand) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_RX_TX) - 1;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
case MENU_AM_FIX_TEST1:
|
case MENU_AM_FIX_TEST1:
|
||||||
@@ -212,7 +218,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
case MENU_MIC_BAR:
|
case MENU_MIC_BAR:
|
||||||
#endif
|
#endif
|
||||||
case MENU_ABR_ON_RX:
|
|
||||||
case MENU_BCL:
|
case MENU_BCL:
|
||||||
case MENU_BEEP:
|
case MENU_BEEP:
|
||||||
case MENU_AUTOLK:
|
case MENU_AUTOLK:
|
||||||
@@ -246,7 +251,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_TOT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_TOT) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
|
case MENU_VOX:
|
||||||
|
#endif
|
||||||
case MENU_RP_STE:
|
case MENU_RP_STE:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = 10;
|
*pMax = 10;
|
||||||
@@ -277,7 +284,8 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
*pMin = 1;
|
*pMin = 0;
|
||||||
|
// *pMax = 1;
|
||||||
*pMax = 2;
|
*pMax = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -291,11 +299,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOL:
|
|
||||||
*pMin = 0;
|
|
||||||
*pMax = 2300;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
||||||
@@ -405,6 +408,9 @@ void MENU_AcceptSetting(void)
|
|||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
case MENU_T_CTCS:
|
case MENU_T_CTCS:
|
||||||
pConfig = &gTxVfo->freq_config_TX;
|
pConfig = &gTxVfo->freq_config_TX;
|
||||||
case MENU_R_CTCS:
|
case MENU_R_CTCS:
|
||||||
@@ -433,6 +439,8 @@ void MENU_AcceptSetting(void)
|
|||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
case MENU_SFT_D:
|
case MENU_SFT_D:
|
||||||
gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection;
|
gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection;
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
@@ -469,7 +477,7 @@ void MENU_AcceptSetting(void)
|
|||||||
#if 0
|
#if 0
|
||||||
gEeprom.MrChannel[0] = gSubMenuSelection;
|
gEeprom.MrChannel[0] = gSubMenuSelection;
|
||||||
#else
|
#else
|
||||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = gSubMenuSelection;
|
gEeprom.MrChannel[gEeprom.TX_VFO] = gSubMenuSelection;
|
||||||
#endif
|
#endif
|
||||||
gRequestSaveChannel = 2;
|
gRequestSaveChannel = 2;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
@@ -489,7 +497,7 @@ void MENU_AcceptSetting(void)
|
|||||||
// save the channel name
|
// save the channel name
|
||||||
memset(gTxVfo->Name, 0, sizeof(gTxVfo->Name));
|
memset(gTxVfo->Name, 0, sizeof(gTxVfo->Name));
|
||||||
memmove(gTxVfo->Name, edit, 10);
|
memmove(gTxVfo->Name, edit, 10);
|
||||||
SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_CHANNEL, gTxVfo, 3);
|
SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_VFO, gTxVfo, 3);
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -497,21 +505,23 @@ void MENU_AcceptSetting(void)
|
|||||||
gEeprom.BATTERY_SAVE = gSubMenuSelection;
|
gEeprom.BATTERY_SAVE = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
case MENU_VOX:
|
||||||
if (gEeprom.VOX_SWITCH)
|
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
||||||
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
if (gEeprom.VOX_SWITCH)
|
||||||
BOARD_EEPROM_LoadMoreSettings();
|
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
||||||
gFlagReconfigureVfos = true;
|
BOARD_EEPROM_LoadMoreSettings();
|
||||||
gUpdateStatus = true;
|
gFlagReconfigureVfos = true;
|
||||||
break;
|
gUpdateStatus = true;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case MENU_ABR:
|
case MENU_ABR:
|
||||||
gEeprom.BACKLIGHT = gSubMenuSelection;
|
gEeprom.BACKLIGHT = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_ABR_ON_RX:
|
case MENU_ABR_ON_TX_RX:
|
||||||
gSetting_backlight_on_rx = gSubMenuSelection;
|
gSetting_backlight_on_tx_rx = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
@@ -595,22 +605,20 @@ void MENU_AcceptSetting(void)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
gTxVfo->Compander = gSubMenuSelection;
|
||||||
gTxVfo->Compander = gSubMenuSelection;
|
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE;
|
gFlagResetVfos = true;
|
||||||
gFlagResetVfos = true;
|
// gRequestSaveChannel = 1;
|
||||||
// gRequestSaveChannel = 1;
|
return;
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case MENU_1_CALL:
|
case MENU_1_CALL:
|
||||||
gEeprom.CHAN_1_CALL = gSubMenuSelection;
|
gEeprom.CHAN_1_CALL = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection - 1;
|
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@@ -628,7 +636,7 @@ void MENU_AcceptSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
case MENU_D_HOLD:
|
||||||
gEeprom.DTMF_AUTO_RESET_TIME = gSubMenuSelection;
|
gEeprom.DTMF_auto_reset_time = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
@@ -640,12 +648,6 @@ void MENU_AcceptSetting(void)
|
|||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_VOL:
|
|
||||||
if(gF_LOCK) {
|
|
||||||
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
gSetting_battery_text = gSubMenuSelection;
|
gSetting_battery_text = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
@@ -667,7 +669,7 @@ void MENU_AcceptSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_LIST:
|
case MENU_D_LIST:
|
||||||
gDTMFChosenContact = gSubMenuSelection - 1;
|
gDTMF_chosen_contact = gSubMenuSelection - 1;
|
||||||
if (gIsDtmfContactValid)
|
if (gIsDtmfContactValid)
|
||||||
{
|
{
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
@@ -757,14 +759,29 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
case MENU_F_CALI:
|
case MENU_F_CALI:
|
||||||
writeXtalFreqCal(gSubMenuSelection);
|
writeXtalFreqCal(gSubMenuSelection, true);
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case MENU_BATCAL:
|
case MENU_BATCAL:
|
||||||
gBatteryCalibration[3] = gSubMenuSelection;
|
{
|
||||||
|
uint16_t buf[4];
|
||||||
|
|
||||||
|
gBatteryCalibration[0] = (520ul * gSubMenuSelection) / 760; // 5.20V empty, blinking above this value, reduced functionality below
|
||||||
|
gBatteryCalibration[1] = (700ul * gSubMenuSelection) / 760; // 7.00V, ~5%, 1 bars above this value
|
||||||
|
gBatteryCalibration[2] = (745ul * gSubMenuSelection) / 760; // 7.45V, ~17%, 2 bars above this value
|
||||||
|
gBatteryCalibration[3] = gSubMenuSelection; // 7.6V, ~29%, 3 bars above this value
|
||||||
|
gBatteryCalibration[4] = (788ul * gSubMenuSelection) / 760; // 7.88V, ~65%, 4 bars above this value
|
||||||
|
gBatteryCalibration[5] = 2300;
|
||||||
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
||||||
|
|
||||||
|
EEPROM_ReadBuffer( 0x1F48, buf, sizeof(buf));
|
||||||
|
buf[0] = gBatteryCalibration[4];
|
||||||
|
buf[1] = gBatteryCalibration[5];
|
||||||
|
EEPROM_WriteBuffer(0x1F48, buf);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gRequestSaveSettings = true;
|
gRequestSaveSettings = true;
|
||||||
@@ -807,7 +824,7 @@ void MENU_SelectNextCode(void)
|
|||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
ScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
gScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
@@ -909,21 +926,23 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
#if 0
|
#if 0
|
||||||
gSubMenuSelection = gEeprom.MrChannel[0];
|
gSubMenuSelection = gEeprom.MrChannel[0];
|
||||||
#else
|
#else
|
||||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL];
|
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_MEM_NAME:
|
case MENU_MEM_NAME:
|
||||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL];
|
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_SAVE:
|
case MENU_SAVE:
|
||||||
gSubMenuSelection = gEeprom.BATTERY_SAVE;
|
gSubMenuSelection = gEeprom.BATTERY_SAVE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
|
case MENU_VOX:
|
||||||
break;
|
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case MENU_ABR:
|
case MENU_ABR:
|
||||||
gSubMenuSelection = gEeprom.BACKLIGHT;
|
gSubMenuSelection = gEeprom.BACKLIGHT;
|
||||||
@@ -932,8 +951,8 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
|
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_ABR_ON_RX:
|
case MENU_ABR_ON_TX_RX:
|
||||||
gSubMenuSelection = gSetting_backlight_on_rx;
|
gSubMenuSelection = gSetting_backlight_on_tx_rx;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
@@ -996,18 +1015,16 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
gSubMenuSelection = gTxVfo->Compander;
|
||||||
gSubMenuSelection = gTxVfo->Compander;
|
return;
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case MENU_1_CALL:
|
case MENU_1_CALL:
|
||||||
gSubMenuSelection = gEeprom.CHAN_1_CALL;
|
gSubMenuSelection = gEeprom.CHAN_1_CALL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT + 1;
|
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_SLIST1:
|
case MENU_SLIST1:
|
||||||
@@ -1033,7 +1050,7 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
case MENU_D_HOLD:
|
||||||
gSubMenuSelection = gEeprom.DTMF_AUTO_RESET_TIME;
|
gSubMenuSelection = gEeprom.DTMF_auto_reset_time;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
@@ -1044,10 +1061,6 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOL:
|
|
||||||
gSubMenuSelection = gBatteryCalibration[3];
|
|
||||||
return;
|
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
gSubMenuSelection = gSetting_battery_text;
|
gSubMenuSelection = gSetting_battery_text;
|
||||||
return;
|
return;
|
||||||
@@ -1057,7 +1070,7 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_LIST:
|
case MENU_D_LIST:
|
||||||
gSubMenuSelection = gDTMFChosenContact + 1;
|
gSubMenuSelection = gDTMF_chosen_contact + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
@@ -1098,7 +1111,7 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
#if 0
|
#if 0
|
||||||
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[0], 1, false, 1);
|
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[0], 1, false, 1);
|
||||||
#else
|
#else
|
||||||
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 1);
|
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 1);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1185,6 +1198,9 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
if (!gIsInSubMenu)
|
if (!gIsInSubMenu)
|
||||||
{
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (gInputBoxIndex)
|
switch (gInputBoxIndex)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
@@ -1216,6 +1232,8 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
@@ -1261,7 +1279,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Value))
|
if (Value <= MR_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
@@ -1653,6 +1671,9 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
|
|
||||||
VFO = 0;
|
VFO = 0;
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (gMenuCursor)
|
switch (gMenuCursor)
|
||||||
{
|
{
|
||||||
case MENU_DEL_CH:
|
case MENU_DEL_CH:
|
||||||
@@ -1673,6 +1694,8 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
Channel = RADIO_FindNextChannel(gSubMenuSelection + Direction, Direction, bCheckScanList, VFO);
|
Channel = RADIO_FindNextChannel(gSubMenuSelection + Direction, Direction, bCheckScanList, VFO);
|
||||||
if (Channel != 0xFF)
|
if (Channel != 0xFF)
|
||||||
gSubMenuSelection = Channel;
|
gSubMenuSelection = Channel;
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
#include "driver/keyboard.h"
|
#include "driver/keyboard.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
|
void writeXtalFreqCal(const int32_t value, const bool update_eeprom);
|
||||||
|
#endif
|
||||||
|
|
||||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
|
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
|
||||||
void MENU_AcceptSetting(void);
|
void MENU_AcceptSetting(void);
|
||||||
void MENU_SelectNextCode(void);
|
void MENU_SelectNextCode(void);
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ uint32_t gScanFrequency;
|
|||||||
bool gScanPauseMode;
|
bool gScanPauseMode;
|
||||||
SCAN_CssState_t gScanCssState;
|
SCAN_CssState_t gScanCssState;
|
||||||
volatile bool gScheduleScanListen = true;
|
volatile bool gScheduleScanListen = true;
|
||||||
volatile uint16_t ScanPauseDelayIn_10ms;
|
volatile uint16_t gScanPauseDelayIn_10ms;
|
||||||
uint8_t gScanProgressIndicator;
|
uint8_t gScanProgressIndicator;
|
||||||
uint8_t gScanHitCount;
|
uint8_t gScanHitCount;
|
||||||
bool gScanUseCssResult;
|
bool gScanUseCssResult;
|
||||||
int8_t gScanState;
|
int8_t gScanStateDir;
|
||||||
bool bScanKeepFrequency;
|
bool bScanKeepFrequency;
|
||||||
|
|
||||||
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||||
@@ -53,7 +53,9 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
uint16_t Channel;
|
uint16_t Channel;
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
INPUTBOX_Append(Key);
|
INPUTBOX_Append(Key);
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||||
|
|
||||||
if (gInputBoxIndex < 3)
|
if (gInputBoxIndex < 3)
|
||||||
@@ -65,9 +67,9 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||||
|
if (Channel <= MR_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
@@ -193,7 +195,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
gScannerEditState = 1;
|
gScannerEditState = 1;
|
||||||
gScanChannel = gTxVfo->CHANNEL_SAVE;
|
gScanChannel = gTxVfo->CHANNEL_SAVE;
|
||||||
@@ -247,19 +249,19 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
|||||||
gTxVfo->freq_config_TX.Code = gScanCssResultCode;
|
gTxVfo->freq_config_TX.Code = gScanCssResultCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
Channel = gScanChannel;
|
Channel = gScanChannel;
|
||||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST;
|
Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST;
|
||||||
gEeprom.FreqChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.FreqChannel[gEeprom.TX_VFO] = Channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
gTxVfo->CHANNEL_SAVE = Channel;
|
gTxVfo->CHANNEL_SAVE = Channel;
|
||||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||||
#endif
|
#endif
|
||||||
@@ -412,7 +414,9 @@ void SCANNER_Start(void)
|
|||||||
g_CDCSS_Lost = false;
|
g_CDCSS_Lost = false;
|
||||||
gCDCSSCodeType = 0;
|
gCDCSSCodeType = 0;
|
||||||
g_CTCSS_Lost = false;
|
g_CTCSS_Lost = false;
|
||||||
g_VOX_Lost = false;
|
#ifdef ENABLE_VOX
|
||||||
|
g_VOX_Lost = false;
|
||||||
|
#endif
|
||||||
g_SquelchLost = false;
|
g_SquelchLost = false;
|
||||||
gScannerEditState = 0;
|
gScannerEditState = 0;
|
||||||
gScanProgressIndicator = 0;
|
gScanProgressIndicator = 0;
|
||||||
@@ -422,16 +426,16 @@ void SCANNER_Stop(void)
|
|||||||
{
|
{
|
||||||
const uint8_t Previous = gRestoreMrChannel;
|
const uint8_t Previous = gRestoreMrChannel;
|
||||||
|
|
||||||
gScanState = SCAN_OFF;
|
gScanStateDir = SCAN_OFF;
|
||||||
|
|
||||||
if (!bScanKeepFrequency)
|
if (!bScanKeepFrequency)
|
||||||
{
|
{
|
||||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gRestoreMrChannel;
|
gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
|
||||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = Previous;
|
gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous;
|
||||||
|
|
||||||
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -444,11 +448,11 @@ void SCANNER_Stop(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
if (gRxVfo->CHANNEL_SAVE > MR_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
RADIO_ApplyOffset(gRxVfo);
|
RADIO_ApplyOffset(gRxVfo);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
|
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_VFO, gRxVfo, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ typedef enum SCAN_CssState_t SCAN_CssState_t;
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SCAN_OFF = 0,
|
SCAN_REV = -1,
|
||||||
|
SCAN_OFF = 0,
|
||||||
|
SCAN_FWD = +1
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DCS_CodeType_t gScanCssResultType;
|
extern DCS_CodeType_t gScanCssResultType;
|
||||||
@@ -46,11 +48,11 @@ extern uint32_t gScanFrequency;
|
|||||||
extern bool gScanPauseMode;
|
extern bool gScanPauseMode;
|
||||||
extern SCAN_CssState_t gScanCssState;
|
extern SCAN_CssState_t gScanCssState;
|
||||||
extern volatile bool gScheduleScanListen;
|
extern volatile bool gScheduleScanListen;
|
||||||
extern volatile uint16_t ScanPauseDelayIn_10ms;
|
extern volatile uint16_t gScanPauseDelayIn_10ms;
|
||||||
extern uint8_t gScanProgressIndicator;
|
extern uint8_t gScanProgressIndicator;
|
||||||
extern uint8_t gScanHitCount;
|
extern uint8_t gScanHitCount;
|
||||||
extern bool gScanUseCssResult;
|
extern bool gScanUseCssResult;
|
||||||
extern int8_t gScanState;
|
extern int8_t gScanStateDir;
|
||||||
extern bool bScanKeepFrequency;
|
extern bool bScanKeepFrequency;
|
||||||
|
|
||||||
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||||
|
|||||||
@@ -62,17 +62,17 @@ const char *modulationTypeOptions[] = {" FM", " AM", "USB"};
|
|||||||
const uint8_t modulationTypeTuneSteps[] = {100, 50, 10};
|
const uint8_t modulationTypeTuneSteps[] = {100, 50, 10};
|
||||||
const uint8_t modTypeReg47Values[] = {1, 7, 5};
|
const uint8_t modTypeReg47Values[] = {1, 7, 5};
|
||||||
|
|
||||||
SpectrumSettings settings = {STEPS_64,
|
SpectrumSettings settings = {stepsCount: STEPS_64,
|
||||||
S_STEP_25_0kHz,
|
scanStepIndex: S_STEP_25_0kHz,
|
||||||
80000,
|
frequencyChangeStep: 80000,
|
||||||
3200,
|
scanDelay: 3200,
|
||||||
150,
|
rssiTriggerLevel: 150,
|
||||||
true,
|
backlightState: true,
|
||||||
BK4819_FILTER_BW_WIDE,
|
bw: BK4819_FILTER_BW_WIDE,
|
||||||
BK4819_FILTER_BW_WIDE,
|
listenBw: BK4819_FILTER_BW_WIDE,
|
||||||
false,
|
modulationType: false,
|
||||||
-130,
|
dbMin: -130,
|
||||||
-50};
|
dbMax: -50};
|
||||||
|
|
||||||
uint32_t fMeasure = 0;
|
uint32_t fMeasure = 0;
|
||||||
uint32_t currentFreq, tempFreq;
|
uint32_t currentFreq, tempFreq;
|
||||||
@@ -561,7 +561,7 @@ static void UpdateFreqInput(KEY_Code_t key) {
|
|||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
if (i < freqInputIndex) {
|
if (i < freqInputIndex) {
|
||||||
digitKey = freqInputArr[i];
|
digitKey = freqInputArr[i];
|
||||||
freqInputString[i] = digitKey <= KEY_9 ? '0' + digitKey : '.';
|
freqInputString[i] = digitKey <= KEY_9 ? '0' + digitKey-KEY_0 : '.';
|
||||||
} else {
|
} else {
|
||||||
freqInputString[i] = '-';
|
freqInputString[i] = '-';
|
||||||
}
|
}
|
||||||
@@ -569,14 +569,14 @@ static void UpdateFreqInput(KEY_Code_t key) {
|
|||||||
|
|
||||||
uint32_t base = 100000; // 1MHz in BK units
|
uint32_t base = 100000; // 1MHz in BK units
|
||||||
for (int i = dotIndex - 1; i >= 0; --i) {
|
for (int i = dotIndex - 1; i >= 0; --i) {
|
||||||
tempFreq += freqInputArr[i] * base;
|
tempFreq += (freqInputArr[i]-KEY_0) * base;
|
||||||
base *= 10;
|
base *= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
base = 10000; // 0.1MHz in BK units
|
base = 10000; // 0.1MHz in BK units
|
||||||
if (dotIndex < freqInputIndex) {
|
if (dotIndex < freqInputIndex) {
|
||||||
for (int i = dotIndex + 1; i < freqInputIndex; ++i) {
|
for (int i = dotIndex + 1; i < freqInputIndex; ++i) {
|
||||||
tempFreq += freqInputArr[i] * base;
|
tempFreq += (freqInputArr[i]-KEY_0) * base;
|
||||||
base /= 10;
|
base /= 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1166,7 +1166,7 @@ static void Tick() {
|
|||||||
void APP_RunSpectrum() {
|
void APP_RunSpectrum() {
|
||||||
// TX here coz it always? set to active VFO
|
// TX here coz it always? set to active VFO
|
||||||
currentFreq = initialFreq =
|
currentFreq = initialFreq =
|
||||||
gEeprom.VfoInfo[gEeprom.TX_CHANNEL].pRX->Frequency;
|
gEeprom.VfoInfo[gEeprom.TX_VFO].pRX->Frequency;
|
||||||
|
|
||||||
BackupRegisters();
|
BackupRegisters();
|
||||||
|
|
||||||
|
|||||||
@@ -122,18 +122,17 @@ typedef enum ScanStep {
|
|||||||
} ScanStep;
|
} ScanStep;
|
||||||
|
|
||||||
typedef struct SpectrumSettings {
|
typedef struct SpectrumSettings {
|
||||||
|
uint32_t frequencyChangeStep;
|
||||||
StepsCount stepsCount;
|
StepsCount stepsCount;
|
||||||
ScanStep scanStepIndex;
|
ScanStep scanStepIndex;
|
||||||
uint32_t frequencyChangeStep;
|
|
||||||
uint16_t scanDelay;
|
uint16_t scanDelay;
|
||||||
uint16_t rssiTriggerLevel;
|
uint16_t rssiTriggerLevel;
|
||||||
|
|
||||||
bool backlightState;
|
|
||||||
BK4819_FilterBandwidth_t bw;
|
BK4819_FilterBandwidth_t bw;
|
||||||
BK4819_FilterBandwidth_t listenBw;
|
BK4819_FilterBandwidth_t listenBw;
|
||||||
ModulationType modulationType;
|
|
||||||
int dbMin;
|
int dbMin;
|
||||||
int dbMax;
|
int dbMax;
|
||||||
|
ModulationType modulationType;
|
||||||
|
bool backlightState;
|
||||||
} SpectrumSettings;
|
} SpectrumSettings;
|
||||||
|
|
||||||
typedef struct KeyboardState {
|
typedef struct KeyboardState {
|
||||||
@@ -161,8 +160,8 @@ typedef struct RegisterSpec {
|
|||||||
typedef struct PeakInfo {
|
typedef struct PeakInfo {
|
||||||
uint16_t t;
|
uint16_t t;
|
||||||
uint16_t rssi;
|
uint16_t rssi;
|
||||||
uint8_t i;
|
|
||||||
uint32_t f;
|
uint32_t f;
|
||||||
|
uint8_t i;
|
||||||
} PeakInfo;
|
} PeakInfo;
|
||||||
|
|
||||||
void APP_RunSpectrum(void);
|
void APP_RunSpectrum(void);
|
||||||
|
|||||||
78
app/uart.c
78
app/uart.c
@@ -48,7 +48,7 @@ typedef struct {
|
|||||||
} Header_t;
|
} Header_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t Padding[2];
|
uint8_t Padding[2];
|
||||||
uint16_t ID;
|
uint16_t ID;
|
||||||
} Footer_t;
|
} Footer_t;
|
||||||
|
|
||||||
@@ -60,10 +60,10 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
Header_t Header;
|
Header_t Header;
|
||||||
struct {
|
struct {
|
||||||
char Version[16];
|
char Version[16];
|
||||||
bool bHasCustomAesKey;
|
bool bHasCustomAesKey;
|
||||||
bool bIsInLockScreen;
|
bool bIsInLockScreen;
|
||||||
uint8_t Padding[2];
|
uint8_t Padding[2];
|
||||||
uint32_t Challenge[4];
|
uint32_t Challenge[4];
|
||||||
} Data;
|
} Data;
|
||||||
} REPLY_0514_t;
|
} REPLY_0514_t;
|
||||||
@@ -71,8 +71,8 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
Header_t Header;
|
Header_t Header;
|
||||||
uint16_t Offset;
|
uint16_t Offset;
|
||||||
uint8_t Size;
|
uint8_t Size;
|
||||||
uint8_t Padding;
|
uint8_t Padding;
|
||||||
uint32_t Timestamp;
|
uint32_t Timestamp;
|
||||||
} CMD_051B_t;
|
} CMD_051B_t;
|
||||||
|
|
||||||
@@ -80,19 +80,19 @@ typedef struct {
|
|||||||
Header_t Header;
|
Header_t Header;
|
||||||
struct {
|
struct {
|
||||||
uint16_t Offset;
|
uint16_t Offset;
|
||||||
uint8_t Size;
|
uint8_t Size;
|
||||||
uint8_t Padding;
|
uint8_t Padding;
|
||||||
uint8_t Data[128];
|
uint8_t Data[128];
|
||||||
} Data;
|
} Data;
|
||||||
} REPLY_051B_t;
|
} REPLY_051B_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Header_t Header;
|
Header_t Header;
|
||||||
uint16_t Offset;
|
uint16_t Offset;
|
||||||
uint8_t Size;
|
uint8_t Size;
|
||||||
bool bAllowPassword;
|
bool bAllowPassword;
|
||||||
uint32_t Timestamp;
|
uint32_t Timestamp;
|
||||||
uint8_t Data[0];
|
uint8_t Data[0];
|
||||||
} CMD_051D_t;
|
} CMD_051D_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -106,8 +106,8 @@ typedef struct {
|
|||||||
Header_t Header;
|
Header_t Header;
|
||||||
struct {
|
struct {
|
||||||
uint16_t RSSI;
|
uint16_t RSSI;
|
||||||
uint8_t ExNoiseIndicator;
|
uint8_t ExNoiseIndicator;
|
||||||
uint8_t GlitchIndicator;
|
uint8_t GlitchIndicator;
|
||||||
} Data;
|
} Data;
|
||||||
} REPLY_0527_t;
|
} REPLY_0527_t;
|
||||||
|
|
||||||
@@ -137,7 +137,10 @@ typedef struct {
|
|||||||
uint32_t Timestamp;
|
uint32_t Timestamp;
|
||||||
} CMD_052F_t;
|
} CMD_052F_t;
|
||||||
|
|
||||||
static const uint8_t Obfuscation[16] = { 0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80 };
|
static const uint8_t Obfuscation[16] =
|
||||||
|
{
|
||||||
|
0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80
|
||||||
|
};
|
||||||
|
|
||||||
static union
|
static union
|
||||||
{
|
{
|
||||||
@@ -157,12 +160,11 @@ static void SendReply(void *pReply, uint16_t Size)
|
|||||||
{
|
{
|
||||||
Header_t Header;
|
Header_t Header;
|
||||||
Footer_t Footer;
|
Footer_t Footer;
|
||||||
uint8_t *pBytes;
|
|
||||||
uint16_t i;
|
|
||||||
|
|
||||||
if (bIsEncrypted)
|
if (bIsEncrypted)
|
||||||
{
|
{
|
||||||
pBytes = (uint8_t *)pReply;
|
uint8_t *pBytes = (uint8_t *)pReply;
|
||||||
|
unsigned int i;
|
||||||
for (i = 0; i < Size; i++)
|
for (i = 0; i < Size; i++)
|
||||||
pBytes[i] ^= Obfuscation[i % 16];
|
pBytes[i] ^= Obfuscation[i % 16];
|
||||||
}
|
}
|
||||||
@@ -171,6 +173,7 @@ static void SendReply(void *pReply, uint16_t Size)
|
|||||||
Header.Size = Size;
|
Header.Size = Size;
|
||||||
UART_Send(&Header, sizeof(Header));
|
UART_Send(&Header, sizeof(Header));
|
||||||
UART_Send(pReply, Size);
|
UART_Send(pReply, Size);
|
||||||
|
|
||||||
if (bIsEncrypted)
|
if (bIsEncrypted)
|
||||||
{
|
{
|
||||||
Footer.Padding[0] = Obfuscation[(Size + 0) % 16] ^ 0xFF;
|
Footer.Padding[0] = Obfuscation[(Size + 0) % 16] ^ 0xFF;
|
||||||
@@ -205,14 +208,16 @@ static void SendVersion(void)
|
|||||||
|
|
||||||
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
|
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
unsigned int i;
|
||||||
uint32_t IV[4];
|
uint32_t IV[4];
|
||||||
|
|
||||||
IV[0] = 0;
|
IV[0] = 0;
|
||||||
IV[1] = 0;
|
IV[1] = 0;
|
||||||
IV[2] = 0;
|
IV[2] = 0;
|
||||||
IV[3] = 0;
|
IV[3] = 0;
|
||||||
|
|
||||||
AES_Encrypt(pKey, IV, pIn, IV, true);
|
AES_Encrypt(pKey, IV, pIn, IV, true);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
if (IV[i] != pResponse[i])
|
if (IV[i] != pResponse[i])
|
||||||
return true;
|
return true;
|
||||||
@@ -254,10 +259,10 @@ static void CMD_051B(const uint8_t *pBuffer)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(&Reply, 0, sizeof(Reply));
|
memset(&Reply, 0, sizeof(Reply));
|
||||||
Reply.Header.ID = 0x051C;
|
Reply.Header.ID = 0x051C;
|
||||||
Reply.Header.Size = pCmd->Size + 4;
|
Reply.Header.Size = pCmd->Size + 4;
|
||||||
Reply.Data.Offset = pCmd->Offset;
|
Reply.Data.Offset = pCmd->Offset;
|
||||||
Reply.Data.Size = pCmd->Size;
|
Reply.Data.Size = pCmd->Size;
|
||||||
|
|
||||||
if (bHasCustomAesKey)
|
if (bHasCustomAesKey)
|
||||||
bLocked = gIsLocked;
|
bLocked = gIsLocked;
|
||||||
@@ -294,7 +299,7 @@ static void CMD_051D(const uint8_t *pBuffer)
|
|||||||
|
|
||||||
if (!bIsLocked)
|
if (!bIsLocked)
|
||||||
{
|
{
|
||||||
uint16_t i;
|
unsigned int i;
|
||||||
for (i = 0; i < (pCmd->Size / 8); i++)
|
for (i = 0; i < (pCmd->Size / 8); i++)
|
||||||
{
|
{
|
||||||
const uint16_t Offset = pCmd->Offset + (i * 8U);
|
const uint16_t Offset = pCmd->Offset + (i * 8U);
|
||||||
@@ -331,23 +336,25 @@ static void CMD_0529(void)
|
|||||||
{
|
{
|
||||||
REPLY_0529_t Reply;
|
REPLY_0529_t Reply;
|
||||||
|
|
||||||
Reply.Header.ID = 0x52A;
|
Reply.Header.ID = 0x52A;
|
||||||
Reply.Header.Size = sizeof(Reply.Data);
|
Reply.Header.Size = sizeof(Reply.Data);
|
||||||
|
|
||||||
// Original doesn't actually send current!
|
// Original doesn't actually send current!
|
||||||
BOARD_ADC_GetBatteryInfo(&Reply.Data.Voltage, &Reply.Data.Current);
|
BOARD_ADC_GetBatteryInfo(&Reply.Data.Voltage, &Reply.Data.Current);
|
||||||
|
|
||||||
SendReply(&Reply, sizeof(Reply));
|
SendReply(&Reply, sizeof(Reply));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CMD_052D(const uint8_t *pBuffer)
|
static void CMD_052D(const uint8_t *pBuffer)
|
||||||
{
|
{
|
||||||
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
|
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
|
||||||
REPLY_052D_t Reply;
|
REPLY_052D_t Reply;
|
||||||
bool bIsLocked;
|
bool bIsLocked;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||||
#endif
|
#endif
|
||||||
Reply.Header.ID = 0x052E;
|
Reply.Header.ID = 0x052E;
|
||||||
Reply.Header.Size = sizeof(Reply.Data);
|
Reply.Header.Size = sizeof(Reply.Data);
|
||||||
|
|
||||||
bIsLocked = bHasCustomAesKey;
|
bIsLocked = bHasCustomAesKey;
|
||||||
@@ -385,7 +392,7 @@ static void CMD_052F(const uint8_t *pBuffer)
|
|||||||
|
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
gEeprom.RX_CHANNEL = 0;
|
gEeprom.RX_VFO = 0;
|
||||||
gEeprom.DTMF_SIDE_TONE = false;
|
gEeprom.DTMF_SIDE_TONE = false;
|
||||||
gEeprom.VfoInfo[0].FrequencyReverse = false;
|
gEeprom.VfoInfo[0].FrequencyReverse = false;
|
||||||
gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX;
|
gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX;
|
||||||
@@ -413,15 +420,13 @@ static void CMD_052F(const uint8_t *pBuffer)
|
|||||||
|
|
||||||
bool UART_IsCommandAvailable(void)
|
bool UART_IsCommandAvailable(void)
|
||||||
{
|
{
|
||||||
uint16_t DmaLength;
|
|
||||||
uint16_t CommandLength;
|
|
||||||
uint16_t Index;
|
uint16_t Index;
|
||||||
uint16_t TailIndex;
|
uint16_t TailIndex;
|
||||||
uint16_t Size;
|
uint16_t Size;
|
||||||
uint16_t CRC;
|
uint16_t CRC;
|
||||||
uint16_t i;
|
uint16_t CommandLength;
|
||||||
|
uint16_t DmaLength = DMA_CH0->ST & 0xFFFU;
|
||||||
|
|
||||||
DmaLength = DMA_CH0->ST & 0xFFFU;
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (gUART_WriteIndex == DmaLength)
|
if (gUART_WriteIndex == DmaLength)
|
||||||
@@ -450,7 +455,7 @@ bool UART_IsCommandAvailable(void)
|
|||||||
Index = DMA_INDEX(gUART_WriteIndex, 2);
|
Index = DMA_INDEX(gUART_WriteIndex, 2);
|
||||||
Size = (UART_DMA_Buffer[DMA_INDEX(Index, 1)] << 8) | UART_DMA_Buffer[Index];
|
Size = (UART_DMA_Buffer[DMA_INDEX(Index, 1)] << 8) | UART_DMA_Buffer[Index];
|
||||||
|
|
||||||
if ((Size + 8) > sizeof(UART_DMA_Buffer))
|
if ((Size + 8u) > sizeof(UART_DMA_Buffer))
|
||||||
{
|
{
|
||||||
gUART_WriteIndex = DmaLength;
|
gUART_WriteIndex = DmaLength;
|
||||||
return false;
|
return false;
|
||||||
@@ -495,8 +500,11 @@ bool UART_IsCommandAvailable(void)
|
|||||||
bIsEncrypted = true;
|
bIsEncrypted = true;
|
||||||
|
|
||||||
if (bIsEncrypted)
|
if (bIsEncrypted)
|
||||||
for (i = 0; i < Size + 2; i++)
|
{
|
||||||
|
unsigned int i;
|
||||||
|
for (i = 0; i < (Size + 2u); i++)
|
||||||
UART_Command.Buffer[i] ^= Obfuscation[i % 16];
|
UART_Command.Buffer[i] ^= Obfuscation[i % 16];
|
||||||
|
}
|
||||||
|
|
||||||
CRC = UART_Command.Buffer[Size] | (UART_Command.Buffer[Size + 1] << 8);
|
CRC = UART_Command.Buffer[Size] | (UART_Command.Buffer[Size + 1] << 8);
|
||||||
|
|
||||||
|
|||||||
47
audio.c
47
audio.c
@@ -142,6 +142,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
|
|
||||||
SYSTEM_DelayMs(60);
|
SYSTEM_DelayMs(60);
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (Beep)
|
switch (Beep)
|
||||||
{
|
{
|
||||||
case BEEP_880HZ_60MS_TRIPLE_BEEP:
|
case BEEP_880HZ_60MS_TRIPLE_BEEP:
|
||||||
@@ -181,13 +184,17 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
SYSTEM_DelayMs(Duration);
|
SYSTEM_DelayMs(Duration);
|
||||||
BK4819_EnterTxMute();
|
BK4819_EnterTxMute();
|
||||||
SYSTEM_DelayMs(20);
|
SYSTEM_DelayMs(20);
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
SYSTEM_DelayMs(5);
|
SYSTEM_DelayMs(5);
|
||||||
BK4819_TurnsOffTones_TurnsOnRX();
|
BK4819_TurnsOffTones_TurnsOnRX();
|
||||||
@@ -258,7 +265,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
VoiceID += VOICE_ID_ENG_BASE;
|
VoiceID += VOICE_ID_ENG_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||||
BK4819_SetAF(BK4819_AF_MUTE);
|
BK4819_SetAF(BK4819_AF_MUTE);
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -267,7 +276,11 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gVoxResumeCountdown = 2000;
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 2000;
|
||||||
|
#endif
|
||||||
|
|
||||||
SYSTEM_DelayMs(5);
|
SYSTEM_DelayMs(5);
|
||||||
AUDIO_PlayVoice(VoiceID);
|
AUDIO_PlayVoice(VoiceID);
|
||||||
|
|
||||||
@@ -278,8 +291,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
{
|
{
|
||||||
SYSTEM_DelayMs(Delay * 10);
|
SYSTEM_DelayMs(Delay * 10);
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||||
|
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
@@ -291,7 +306,11 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
|
|
||||||
gVoiceWriteIndex = 0;
|
gVoiceWriteIndex = 0;
|
||||||
gVoiceReadIndex = 0;
|
gVoiceReadIndex = 0;
|
||||||
gVoxResumeCountdown = 80;
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,14 +423,19 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
|
|
||||||
gCountdownToPlayNextVoice_10ms = Delay;
|
gCountdownToPlayNextVoice_10ms = Delay;
|
||||||
gFlagPlayQueuedVoice = false;
|
gFlagPlayQueuedVoice = false;
|
||||||
gVoxResumeCountdown = 2000;
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 2000;
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||||
|
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
@@ -421,7 +445,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
if (!gEnableSpeaker)
|
if (!gEnableSpeaker)
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
gVoiceWriteIndex = 0;
|
gVoiceWriteIndex = 0;
|
||||||
gVoiceReadIndex = 0;
|
gVoiceReadIndex = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
93
bitmaps.c
93
bitmaps.c
@@ -138,27 +138,29 @@ const uint8_t BITMAP_F_Key[6] =
|
|||||||
0b01000001
|
0b01000001
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_VOX[18] =
|
#ifdef ENABLE_VOX
|
||||||
{ // "VOX"
|
const uint8_t BITMAP_VOX[18] =
|
||||||
0b00000000,
|
{ // "VOX"
|
||||||
0b00011111,
|
0b00000000,
|
||||||
0b00100000,
|
0b00011111,
|
||||||
0b01000000,
|
0b00100000,
|
||||||
0b00100000,
|
0b01000000,
|
||||||
0b00011111,
|
0b00100000,
|
||||||
0b00000000,
|
0b00011111,
|
||||||
0b00111110,
|
0b00000000,
|
||||||
0b01000001,
|
0b00111110,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b00111110,
|
0b01000001,
|
||||||
0b00000000,
|
0b00111110,
|
||||||
0b01100011,
|
0b00000000,
|
||||||
0b00010100,
|
0b01100011,
|
||||||
0b00001000,
|
0b00010100,
|
||||||
0b00010100,
|
0b00001000,
|
||||||
0b01100011
|
0b00010100,
|
||||||
};
|
0b01100011
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
const uint8_t BITMAP_WX[12] =
|
const uint8_t BITMAP_WX[12] =
|
||||||
@@ -280,23 +282,6 @@ const uint8_t BITMAP_TDR2[12] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint8_t BITMAP_SC[12] =
|
|
||||||
{ // "SC"
|
|
||||||
0b00000000,
|
|
||||||
0b01000110,
|
|
||||||
0b01001001,
|
|
||||||
0b01001001,
|
|
||||||
0b01001001,
|
|
||||||
0b00110001,
|
|
||||||
|
|
||||||
0b00000000,
|
|
||||||
0b00111110,
|
|
||||||
0b01000001,
|
|
||||||
0b01000001,
|
|
||||||
0b01000001,
|
|
||||||
0b00100010
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t BITMAP_Antenna[5] =
|
const uint8_t BITMAP_Antenna[5] =
|
||||||
{
|
{
|
||||||
0b00000011,
|
0b00000011,
|
||||||
@@ -383,17 +368,7 @@ const uint8_t BITMAP_VFO_NotDefault[8] =
|
|||||||
0b00010100,
|
0b00010100,
|
||||||
0b00001000
|
0b00001000
|
||||||
};
|
};
|
||||||
/*
|
|
||||||
const uint8_t BITMAP_ScanList[6] =
|
|
||||||
{ // diamond symbol
|
|
||||||
0b00001000,
|
|
||||||
0b00011100,
|
|
||||||
0b00111110,
|
|
||||||
0b00111110,
|
|
||||||
0b00011100,
|
|
||||||
0b00001000
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
const uint8_t BITMAP_ScanList1[6] =
|
const uint8_t BITMAP_ScanList1[6] =
|
||||||
{ // 'I' symbol
|
{ // 'I' symbol
|
||||||
0b00000000,
|
0b00000000,
|
||||||
@@ -414,14 +389,12 @@ const uint8_t BITMAP_ScanList2[6] =
|
|||||||
0b01000010
|
0b01000010
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
const uint8_t BITMAP_compand[6] =
|
||||||
const uint8_t BITMAP_compand[6] =
|
{
|
||||||
{
|
0b00000000,
|
||||||
0b00000000,
|
0b00111100,
|
||||||
0b00111100,
|
0b01000010,
|
||||||
0b01000010,
|
0b01000010,
|
||||||
0b01000010,
|
0b01000010,
|
||||||
0b01000010,
|
0b00100100
|
||||||
0b00100100
|
};
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|||||||
11
bitmaps.h
11
bitmaps.h
@@ -21,7 +21,9 @@ extern const uint8_t BITMAP_KeyLock[6];
|
|||||||
|
|
||||||
extern const uint8_t BITMAP_F_Key[6];
|
extern const uint8_t BITMAP_F_Key[6];
|
||||||
|
|
||||||
extern const uint8_t BITMAP_VOX[18];
|
#ifdef ENABLE_VOX
|
||||||
|
extern const uint8_t BITMAP_VOX[18];
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
extern const uint8_t BITMAP_WX[12];
|
extern const uint8_t BITMAP_WX[12];
|
||||||
@@ -44,8 +46,6 @@ extern const uint8_t BITMAP_TDR2[12];
|
|||||||
extern const uint8_t BITMAP_NOAA[12];
|
extern const uint8_t BITMAP_NOAA[12];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const uint8_t BITMAP_SC[12];
|
|
||||||
|
|
||||||
extern const uint8_t BITMAP_Antenna[5];
|
extern const uint8_t BITMAP_Antenna[5];
|
||||||
extern const uint8_t BITMAP_AntennaLevel1[3];
|
extern const uint8_t BITMAP_AntennaLevel1[3];
|
||||||
extern const uint8_t BITMAP_AntennaLevel2[3];
|
extern const uint8_t BITMAP_AntennaLevel2[3];
|
||||||
@@ -59,13 +59,10 @@ extern const uint8_t BITMAP_MARKER[8];
|
|||||||
extern const uint8_t BITMAP_VFO_Default[8];
|
extern const uint8_t BITMAP_VFO_Default[8];
|
||||||
extern const uint8_t BITMAP_VFO_NotDefault[8];
|
extern const uint8_t BITMAP_VFO_NotDefault[8];
|
||||||
|
|
||||||
//extern const uint8_t BITMAP_ScanList[6];
|
|
||||||
extern const uint8_t BITMAP_ScanList1[6];
|
extern const uint8_t BITMAP_ScanList1[6];
|
||||||
extern const uint8_t BITMAP_ScanList2[6];
|
extern const uint8_t BITMAP_ScanList2[6];
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
extern const uint8_t BITMAP_compand[6];
|
||||||
extern const uint8_t BITMAP_compand[6];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
25
board.c
25
board.c
@@ -509,7 +509,7 @@ void BOARD_Init(void)
|
|||||||
BOARD_PORTCON_Init();
|
BOARD_PORTCON_Init();
|
||||||
BOARD_GPIO_Init();
|
BOARD_GPIO_Init();
|
||||||
BOARD_ADC_Init();
|
BOARD_ADC_Init();
|
||||||
ST7565_Init();
|
ST7565_Init(true);
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
BK1080_Init(0, false);
|
BK1080_Init(0, false);
|
||||||
#endif
|
#endif
|
||||||
@@ -532,8 +532,10 @@ void BOARD_EEPROM_Init(void)
|
|||||||
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
||||||
#endif
|
#endif
|
||||||
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
||||||
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
#ifdef ENABLE_VOX
|
||||||
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
||||||
|
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
||||||
|
#endif
|
||||||
gEeprom.MIC_SENSITIVITY = (Data[7] < 5) ? Data[7] : 4;
|
gEeprom.MIC_SENSITIVITY = (Data[7] < 5) ? Data[7] : 4;
|
||||||
|
|
||||||
// 0E78..0E7F
|
// 0E78..0E7F
|
||||||
@@ -614,7 +616,7 @@ void BOARD_EEPROM_Init(void)
|
|||||||
#endif
|
#endif
|
||||||
gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF;
|
gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF;
|
||||||
gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0;
|
gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0;
|
||||||
gEeprom.TX_CHANNEL = (Data[3] < 2) ? Data[3] : 0;
|
gEeprom.TX_VFO = (Data[3] < 2) ? Data[3] : 0;
|
||||||
|
|
||||||
// 0ED0..0ED7
|
// 0ED0..0ED7
|
||||||
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
||||||
@@ -622,7 +624,7 @@ void BOARD_EEPROM_Init(void)
|
|||||||
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
|
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
|
||||||
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
|
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
|
||||||
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
|
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
|
||||||
gEeprom.DTMF_AUTO_RESET_TIME = (Data[4] < 61) ? Data[4] : 5;
|
gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 5) ? Data[4] : 10;
|
||||||
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
||||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
||||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
||||||
@@ -685,7 +687,8 @@ void BOARD_EEPROM_Init(void)
|
|||||||
|
|
||||||
// 0F18..0F1F
|
// 0F18..0F1F
|
||||||
EEPROM_ReadBuffer(0x0F18, Data, 8);
|
EEPROM_ReadBuffer(0x0F18, Data, 8);
|
||||||
gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false;
|
// gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false;
|
||||||
|
gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 3) ? Data[0] : false; // we now have 'all' channel scan option
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
const unsigned int j = 1 + (i * 3);
|
const unsigned int j = 1 + (i * 3);
|
||||||
@@ -705,14 +708,14 @@ void BOARD_EEPROM_Init(void)
|
|||||||
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true;
|
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true;
|
||||||
gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
||||||
gSetting_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false;
|
gSetting_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false;
|
||||||
gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3: 2;
|
gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2;
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
gSetting_mic_bar = (Data[7] & (1u << 4)) ? true : false;
|
gSetting_mic_bar = (Data[7] & (1u << 4)) ? true : false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
|
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
|
||||||
#endif
|
#endif
|
||||||
gSetting_backlight_on_rx = (Data[7] & (1u << 6)) ? true : false;
|
gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u;
|
||||||
|
|
||||||
if (!gEeprom.VFO_OPEN)
|
if (!gEeprom.VFO_OPEN)
|
||||||
{
|
{
|
||||||
@@ -757,8 +760,10 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
|||||||
}
|
}
|
||||||
gBatteryCalibration[5] = 2300;
|
gBatteryCalibration[5] = 2300;
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2);
|
#ifdef ENABLE_VOX
|
||||||
EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2);
|
EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2);
|
||||||
|
EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2);
|
||||||
|
#endif
|
||||||
|
|
||||||
//EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1);
|
//EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1);
|
||||||
//gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15;
|
//gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15;
|
||||||
|
|||||||
@@ -134,9 +134,9 @@ void ADC_Configure(ADC_Config_t *pAdc)
|
|||||||
;
|
;
|
||||||
|
|
||||||
if (SARADC_IE == 0) {
|
if (SARADC_IE == 0) {
|
||||||
NVIC_DisableIRQ(DP32_SARADC_IRQn);
|
NVIC_DisableIRQ((IRQn_Type)DP32_SARADC_IRQn);
|
||||||
} else {
|
} else {
|
||||||
NVIC_EnableIRQ(DP32_SARADC_IRQn);
|
NVIC_EnableIRQ((IRQn_Type)DP32_SARADC_IRQn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
driver/adc.h
11
driver/adc.h
@@ -42,8 +42,10 @@ enum ADC_CH_MASK {
|
|||||||
typedef enum ADC_CH_MASK ADC_CH_MASK;
|
typedef enum ADC_CH_MASK ADC_CH_MASK;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t CLK_SEL;
|
uint16_t EXTTRIG_SEL;
|
||||||
|
uint16_t IE_CHx_EOC;
|
||||||
ADC_CH_MASK CH_SEL;
|
ADC_CH_MASK CH_SEL;
|
||||||
|
uint8_t CLK_SEL;
|
||||||
uint8_t AVG;
|
uint8_t AVG;
|
||||||
uint8_t CONT;
|
uint8_t CONT;
|
||||||
uint8_t MEM_MODE;
|
uint8_t MEM_MODE;
|
||||||
@@ -51,13 +53,12 @@ typedef struct {
|
|||||||
uint8_t SMPL_SETUP;
|
uint8_t SMPL_SETUP;
|
||||||
uint8_t SMPL_WIN;
|
uint8_t SMPL_WIN;
|
||||||
uint8_t ADC_TRIG;
|
uint8_t ADC_TRIG;
|
||||||
uint16_t EXTTRIG_SEL;
|
|
||||||
bool CALIB_OFFSET_VALID;
|
|
||||||
bool CALIB_KD_VALID;
|
|
||||||
uint8_t DMA_EN;
|
uint8_t DMA_EN;
|
||||||
uint16_t IE_CHx_EOC;
|
|
||||||
uint8_t IE_FIFO_HFULL;
|
uint8_t IE_FIFO_HFULL;
|
||||||
uint8_t IE_FIFO_FULL;
|
uint8_t IE_FIFO_FULL;
|
||||||
|
bool CALIB_OFFSET_VALID;
|
||||||
|
bool CALIB_KD_VALID;
|
||||||
|
uint8_t _pad[1];
|
||||||
} ADC_Config_t;
|
} ADC_Config_t;
|
||||||
|
|
||||||
uint8_t ADC_GetChannelNumber(ADC_CH_MASK Mask);
|
uint8_t ADC_GetChannelNumber(ADC_CH_MASK Mask);
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ static void AES_Setup_ENC_CBC(bool IsDecrypt, const void *pKey, const void *pIv)
|
|||||||
const uint32_t *pK = (const uint32_t *)pKey;
|
const uint32_t *pK = (const uint32_t *)pKey;
|
||||||
const uint32_t *pI = (const uint32_t *)pIv;
|
const uint32_t *pI = (const uint32_t *)pIv;
|
||||||
|
|
||||||
|
(void)IsDecrypt; // unused
|
||||||
|
|
||||||
AES_CR = (AES_CR & ~AES_CR_EN_MASK) | AES_CR_EN_BITS_DISABLE;
|
AES_CR = (AES_CR & ~AES_CR_EN_MASK) | AES_CR_EN_BITS_DISABLE;
|
||||||
AES_CR = AES_CR_CHMOD_BITS_CBC;
|
AES_CR = AES_CR_CHMOD_BITS_CBC;
|
||||||
AES_KEYR3 = pK[0];
|
AES_KEYR3 = pK[0];
|
||||||
|
|||||||
1048
driver/bk4819.c
1048
driver/bk4819.c
File diff suppressed because it is too large
Load Diff
@@ -24,22 +24,22 @@
|
|||||||
|
|
||||||
enum BK4819_AF_Type_t
|
enum BK4819_AF_Type_t
|
||||||
{
|
{
|
||||||
BK4819_AF_MUTE = 0u,
|
BK4819_AF_MUTE = 0u, //
|
||||||
BK4819_AF_OPEN = 1u,
|
BK4819_AF_FM = 1u, // FM
|
||||||
BK4819_AF_ALAM = 2u,
|
BK4819_AF_ALAM = 2u, //
|
||||||
BK4819_AF_BEEP = 3u,
|
BK4819_AF_BEEP = 3u, //
|
||||||
BK4819_AF_UNKNOWN1 = 4u,
|
BK4819_AF_BASEBAND1 = 4u, // SSB
|
||||||
BK4819_AF_UNKNOWN2 = 5u,
|
BK4819_AF_BASEBAND2 = 5u, // SSB
|
||||||
BK4819_AF_CTCO = 6u,
|
BK4819_AF_CTCO = 6u, // strange LF audio .. maybe the CTCSS LF line ?
|
||||||
BK4819_AF_AM = 7u,
|
BK4819_AF_AM = 7u, // AM
|
||||||
BK4819_AF_FSKO = 8u,
|
BK4819_AF_FSKO = 8u, // nothing
|
||||||
BK4819_AF_UNKNOWN3 = 9u,
|
BK4819_AF_UNKNOWN3 = 9u, // distorted
|
||||||
BK4819_AF_UNKNOWN4 = 10u,
|
BK4819_AF_UNKNOWN4 = 10u, // nothing at all
|
||||||
BK4819_AF_UNKNOWN5 = 11u,
|
BK4819_AF_UNKNOWN5 = 11u, // distorted
|
||||||
BK4819_AF_UNKNOWN6 = 12u,
|
BK4819_AF_UNKNOWN6 = 12u, // distorted
|
||||||
BK4819_AF_UNKNOWN7 = 13u,
|
BK4819_AF_UNKNOWN7 = 13u, // interesting
|
||||||
BK4819_AF_UNKNOWN8 = 14u,
|
BK4819_AF_UNKNOWN8 = 14u, // interesting
|
||||||
BK4819_AF_UNKNOWN9 = 15u
|
BK4819_AF_UNKNOWN9 = 15u // not a lot
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
||||||
@@ -102,6 +102,7 @@ void BK4819_DisableVox(void);
|
|||||||
void BK4819_DisableDTMF(void);
|
void BK4819_DisableDTMF(void);
|
||||||
void BK4819_EnableDTMF(void);
|
void BK4819_EnableDTMF(void);
|
||||||
void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch);
|
void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch);
|
||||||
|
void BK4819_PlaySingleTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level, const bool play_speaker);
|
||||||
void BK4819_EnterTxMute(void);
|
void BK4819_EnterTxMute(void);
|
||||||
void BK4819_ExitTxMute(void);
|
void BK4819_ExitTxMute(void);
|
||||||
void BK4819_Sleep(void);
|
void BK4819_Sleep(void);
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ enum GPIOC_PINS {
|
|||||||
GPIOC_PIN_PTT = 5
|
GPIOC_PIN_PTT = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
void GPIO_ClearBit(volatile uint32_t *pReg, uint8_t Bit);
|
void GPIO_ClearBit(volatile uint32_t *pReg, uint8_t Bit);
|
||||||
uint8_t GPIO_CheckBit(volatile uint32_t *pReg, uint8_t Bit);
|
uint8_t GPIO_CheckBit(volatile uint32_t *pReg, uint8_t Bit);
|
||||||
void GPIO_FlipBit(volatile uint32_t *pReg, uint8_t Bit);
|
void GPIO_FlipBit( volatile uint32_t *pReg, uint8_t Bit);
|
||||||
void GPIO_SetBit(volatile uint32_t *pReg, uint8_t Bit);
|
void GPIO_SetBit( volatile uint32_t *pReg, uint8_t Bit);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -22,76 +22,74 @@
|
|||||||
#include "driver/i2c.h"
|
#include "driver/i2c.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
KEY_Code_t gKeyReading0 = KEY_INVALID;
|
KEY_Code_t gKeyReading0 = KEY_INVALID;
|
||||||
KEY_Code_t gKeyReading1 = KEY_INVALID;
|
KEY_Code_t gKeyReading1 = KEY_INVALID;
|
||||||
uint16_t gDebounceCounter;
|
uint16_t gDebounceCounter = 0;
|
||||||
bool gWasFKeyPressed;
|
bool gWasFKeyPressed = false;
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
// Using a 16 bit pre-calculated shift and invert is cheaper
|
|
||||||
// than using 8 bit and doing shift and invert in code.
|
|
||||||
uint16_t set_to_zero_mask;
|
|
||||||
|
|
||||||
//We are very fortunate.
|
// Using a 16 bit pre-calculated shift and invert is cheaper
|
||||||
//The key and pin defines fit together in a single u8,
|
// than using 8 bit and doing shift and invert in code.
|
||||||
//making this very efficient
|
uint16_t set_to_zero_mask;
|
||||||
struct {
|
|
||||||
uint8_t key : 5; //Key 23 is highest
|
// We are very fortunate.
|
||||||
uint8_t pin : 3; //Pin 6 is highest
|
// The key and pin defines fit together in a single u8, making this very efficient
|
||||||
} pins[4];
|
struct {
|
||||||
} keyboard[5] = {
|
uint8_t key : 5; // Key 23 is highest
|
||||||
/* Zero row */
|
uint8_t pin : 3; // Pin 6 is highest
|
||||||
{
|
} pins[4];
|
||||||
//Set to zero to handle special case of nothing pulled down.
|
|
||||||
.set_to_zero_mask = ~(0),
|
} keyboard[] = {
|
||||||
.pins = {
|
|
||||||
{ .key = KEY_SIDE1, .pin = GPIOA_PIN_KEYBOARD_0},
|
{ // Zero row
|
||||||
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
|
// Set to zero to handle special case of nothing pulled down
|
||||||
/* Duplicate to fill the array with valid values */
|
.set_to_zero_mask = 0xffff,
|
||||||
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
|
.pins = {
|
||||||
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
|
{ .key = KEY_SIDE1, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
}
|
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
},
|
|
||||||
/* First row */
|
// Duplicate to fill the array with valid values
|
||||||
{
|
{ .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_4),
|
{ .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1}
|
||||||
.pins = {
|
}
|
||||||
{ .key = KEY_MENU, .pin = GPIOA_PIN_KEYBOARD_0},
|
},
|
||||||
{ .key = KEY_1, .pin = GPIOA_PIN_KEYBOARD_1},
|
{ // First row
|
||||||
{ .key = KEY_4, .pin = GPIOA_PIN_KEYBOARD_2},
|
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_4) & 0xffff,
|
||||||
{ .key = KEY_7, .pin = GPIOA_PIN_KEYBOARD_3},
|
.pins = {
|
||||||
}
|
{ .key = KEY_MENU, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
},
|
{ .key = KEY_1, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
/* Second row */
|
{ .key = KEY_4, .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
{
|
{ .key = KEY_7, .pin = GPIOA_PIN_KEYBOARD_3}
|
||||||
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_5),
|
}
|
||||||
.pins = {
|
},
|
||||||
{ .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0},
|
{ // Second row
|
||||||
{ .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1},
|
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_5) & 0xffff,
|
||||||
{ .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2},
|
.pins = {
|
||||||
{ .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3},
|
{ .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
}
|
{ .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
},
|
{ .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
/* Third row */
|
{ .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3}
|
||||||
{
|
}
|
||||||
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_6),
|
},
|
||||||
.pins = {
|
{ // Third row
|
||||||
{ .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0},
|
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_6) & 0xffff,
|
||||||
{ .key = KEY_3 , .pin = GPIOA_PIN_KEYBOARD_1},
|
.pins = {
|
||||||
{ .key = KEY_6 , .pin = GPIOA_PIN_KEYBOARD_2},
|
{ .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
{ .key = KEY_9 , .pin = GPIOA_PIN_KEYBOARD_3},
|
{ .key = KEY_3 , .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
}
|
{ .key = KEY_6 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
},
|
{ .key = KEY_9 , .pin = GPIOA_PIN_KEYBOARD_3}
|
||||||
/* Fourth row */
|
}
|
||||||
{
|
},
|
||||||
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_7),
|
{ // Fourth row
|
||||||
.pins = {
|
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_7) & 0xffff,
|
||||||
{ .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0},
|
.pins = {
|
||||||
{ .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1},
|
{ .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
{ .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2},
|
{ .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
{ .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3},
|
{ .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
}
|
{ .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3}
|
||||||
},
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
KEY_Code_t KEYBOARD_Poll(void)
|
KEY_Code_t KEYBOARD_Poll(void)
|
||||||
@@ -101,42 +99,48 @@ KEY_Code_t KEYBOARD_Poll(void)
|
|||||||
// if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
// if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
// return KEY_PTT;
|
// return KEY_PTT;
|
||||||
|
|
||||||
|
|
||||||
// *****************
|
// *****************
|
||||||
for(int j = 0; j < ARRAY_SIZE(keyboard); j++) {
|
|
||||||
//Set all high
|
|
||||||
GPIOA->DATA |= 1 << GPIOA_PIN_KEYBOARD_4 |
|
|
||||||
1 << GPIOA_PIN_KEYBOARD_5 |
|
|
||||||
1 << GPIOA_PIN_KEYBOARD_6 |
|
|
||||||
1 << GPIOA_PIN_KEYBOARD_7 ;
|
|
||||||
//Clear the pin we are selecting
|
|
||||||
GPIOA->DATA &= keyboard[j].set_to_zero_mask;
|
|
||||||
|
|
||||||
//Wait for the pins to stabilize. 1 works for me.
|
for (unsigned int j = 0; j < ARRAY_SIZE(keyboard); j++)
|
||||||
SYSTICK_DelayUs(2);
|
{
|
||||||
|
uint16_t reg;
|
||||||
|
|
||||||
// Read all 4 GPIO pins at once
|
// Set all high
|
||||||
uint16_t reg = GPIOA->DATA;
|
GPIOA->DATA |= 1u << GPIOA_PIN_KEYBOARD_4 |
|
||||||
for(int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++)
|
1u << GPIOA_PIN_KEYBOARD_5 |
|
||||||
{
|
1u << GPIOA_PIN_KEYBOARD_6 |
|
||||||
uint16_t mask = 1 << keyboard[j].pins[i].pin;
|
1u << GPIOA_PIN_KEYBOARD_7;
|
||||||
if(! (reg & mask)) {
|
|
||||||
Key = keyboard[j].pins[i].key;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Key != KEY_INVALID)
|
// Clear the pin we are selecting
|
||||||
break;
|
GPIOA->DATA &= keyboard[j].set_to_zero_mask;
|
||||||
}
|
|
||||||
|
|
||||||
//Create I2C stop condition. Since we might have toggled I2C pins.
|
// Wait for the pins to stabilize
|
||||||
//This leaves GPIOA_PIN_KEYBOARD_4 and GPIOA_PIN_KEYBOARD_5 high
|
SYSTICK_DelayUs(1);
|
||||||
I2C_Stop();
|
|
||||||
|
// Read all 4 GPIO pins at once
|
||||||
|
reg = GPIOA->DATA;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++)
|
||||||
|
{
|
||||||
|
const uint16_t mask = 1u << keyboard[j].pins[i].pin;
|
||||||
|
if (!(reg & mask))
|
||||||
|
{
|
||||||
|
Key = keyboard[j].pins[i].key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Key != KEY_INVALID)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create I2C stop condition since we might have toggled I2C pins
|
||||||
|
// This leaves GPIOA_PIN_KEYBOARD_4 and GPIOA_PIN_KEYBOARD_5 high
|
||||||
|
I2C_Stop();
|
||||||
|
|
||||||
// Reset VOICE pins
|
// Reset VOICE pins
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
GPIO_SetBit( &GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
||||||
|
|
||||||
return Key;
|
return Key;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,30 +21,28 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
enum KEY_Code_t {
|
typedef enum {
|
||||||
KEY_0 = 0,
|
KEY_INVALID = 0,
|
||||||
KEY_1 = 1,
|
KEY_0,
|
||||||
KEY_2 = 2,
|
KEY_1,
|
||||||
KEY_3 = 3,
|
KEY_2,
|
||||||
KEY_4 = 4,
|
KEY_3,
|
||||||
KEY_5 = 5,
|
KEY_4,
|
||||||
KEY_6 = 6,
|
KEY_5,
|
||||||
KEY_7 = 7,
|
KEY_6,
|
||||||
KEY_8 = 8,
|
KEY_7,
|
||||||
KEY_9 = 9,
|
KEY_8,
|
||||||
KEY_MENU = 10,
|
KEY_9,
|
||||||
KEY_UP = 11,
|
KEY_MENU,
|
||||||
KEY_DOWN = 12,
|
KEY_UP,
|
||||||
KEY_EXIT = 13,
|
KEY_DOWN,
|
||||||
KEY_STAR = 14,
|
KEY_EXIT,
|
||||||
KEY_F = 15,
|
KEY_STAR,
|
||||||
KEY_PTT = 21,
|
KEY_F,
|
||||||
KEY_SIDE2 = 22,
|
KEY_PTT,
|
||||||
KEY_SIDE1 = 23,
|
KEY_SIDE2,
|
||||||
KEY_INVALID = 255
|
KEY_SIDE1
|
||||||
};
|
} KEY_Code_t;
|
||||||
|
|
||||||
typedef enum KEY_Code_t KEY_Code_t;
|
|
||||||
|
|
||||||
extern KEY_Code_t gKeyReading0;
|
extern KEY_Code_t gKeyReading0;
|
||||||
extern KEY_Code_t gKeyReading1;
|
extern KEY_Code_t gKeyReading1;
|
||||||
|
|||||||
@@ -93,9 +93,9 @@ void SPI_Configure(volatile SPI_Port_t *pPort, SPI_Config_t *pConfig)
|
|||||||
|
|
||||||
if (pPort->IE) {
|
if (pPort->IE) {
|
||||||
if (pPort == SPI0) {
|
if (pPort == SPI0) {
|
||||||
NVIC_EnableIRQ(DP32_SPI0_IRQn);
|
NVIC_EnableIRQ((IRQn_Type)DP32_SPI0_IRQn);
|
||||||
} else if (pPort == SPI1) {
|
} else if (pPort == SPI1) {
|
||||||
NVIC_EnableIRQ(DP32_SPI1_IRQn);
|
NVIC_EnableIRQ((IRQn_Type)DP32_SPI1_IRQn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ void ST7565_BlitFullScreen(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// whats the delay for I wonder ? .. it slows down scanning :(
|
// whats the delay for I wonder, it holds things up :(
|
||||||
SYSTEM_DelayMs(20);
|
SYSTEM_DelayMs(20);
|
||||||
#else
|
#else
|
||||||
SYSTEM_DelayMs(1);
|
// SYSTEM_DelayMs(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||||
@@ -119,7 +119,11 @@ void ST7565_FillScreen(uint8_t Value)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
// reset some of the displays settings to try and overcome the radios hardware problem - RF corrupting the display
|
||||||
|
ST7565_Init(false);
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
@@ -132,20 +136,26 @@ void ST7565_FillScreen(uint8_t Value)
|
|||||||
}
|
}
|
||||||
SPI_WaitForUndocumentedTxFifoStatusBit();
|
SPI_WaitForUndocumentedTxFifoStatusBit();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ST7565_Init(void)
|
void ST7565_Init(const bool full)
|
||||||
{
|
{
|
||||||
SPI0_Init();
|
if (full)
|
||||||
|
{
|
||||||
|
SPI0_Init();
|
||||||
|
|
||||||
ST7565_Configure_GPIO_B11();
|
ST7565_Configure_GPIO_B11();
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||||
|
|
||||||
ST7565_WriteByte(0xE2); // internal reset
|
ST7565_WriteByte(0xE2); // internal reset
|
||||||
|
|
||||||
SYSTEM_DelayMs(120);
|
SYSTEM_DelayMs(120);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||||
|
|
||||||
ST7565_WriteByte(0xA2); // bias 9
|
ST7565_WriteByte(0xA2); // bias 9
|
||||||
ST7565_WriteByte(0xC0); // com normal
|
ST7565_WriteByte(0xC0); // com normal
|
||||||
@@ -157,21 +167,26 @@ void ST7565_Init(void)
|
|||||||
ST7565_WriteByte(0xA4); // all points normal
|
ST7565_WriteByte(0xA4); // all points normal
|
||||||
ST7565_WriteByte(0x24); //
|
ST7565_WriteByte(0x24); //
|
||||||
ST7565_WriteByte(0x81); // volume first ?
|
ST7565_WriteByte(0x81); // volume first ?
|
||||||
|
|
||||||
ST7565_WriteByte(0x1f); // contrast ?
|
ST7565_WriteByte(0x1f); // contrast ?
|
||||||
ST7565_WriteByte(0x2B); // power control ?
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(1);
|
if (full)
|
||||||
|
{
|
||||||
|
ST7565_WriteByte(0x2B); // power control ?
|
||||||
|
|
||||||
ST7565_WriteByte(0x2E); // power control ?
|
SYSTEM_DelayMs(1);
|
||||||
|
|
||||||
SYSTEM_DelayMs(1);
|
ST7565_WriteByte(0x2E); // power control ?
|
||||||
|
|
||||||
ST7565_WriteByte(0x2F); //
|
SYSTEM_DelayMs(1);
|
||||||
ST7565_WriteByte(0x2F); //
|
|
||||||
ST7565_WriteByte(0x2F); //
|
|
||||||
ST7565_WriteByte(0x2F); //
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(40);
|
ST7565_WriteByte(0x2F); //
|
||||||
|
ST7565_WriteByte(0x2F); //
|
||||||
|
ST7565_WriteByte(0x2F); //
|
||||||
|
ST7565_WriteByte(0x2F); //
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(40);
|
||||||
|
}
|
||||||
|
|
||||||
ST7565_WriteByte(0x40); // start line ?
|
ST7565_WriteByte(0x40); // start line ?
|
||||||
ST7565_WriteByte(0xAF); // display on ?
|
ST7565_WriteByte(0xAF); // display on ?
|
||||||
@@ -180,7 +195,8 @@ void ST7565_Init(void)
|
|||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||||
|
|
||||||
ST7565_FillScreen(0x00);
|
if (full)
|
||||||
|
ST7565_FillScreen(0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ST7565_Configure_GPIO_B11(void)
|
void ST7565_Configure_GPIO_B11(void)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const u
|
|||||||
void ST7565_BlitFullScreen(void);
|
void ST7565_BlitFullScreen(void);
|
||||||
void ST7565_BlitStatusLine(void);
|
void ST7565_BlitStatusLine(void);
|
||||||
void ST7565_FillScreen(uint8_t Value);
|
void ST7565_FillScreen(uint8_t Value);
|
||||||
void ST7565_Init(void);
|
void ST7565_Init(const bool full);
|
||||||
void ST7565_Configure_GPIO_B11(void);
|
void ST7565_Configure_GPIO_B11(void);
|
||||||
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
||||||
void ST7565_WriteByte(uint8_t Value);
|
void ST7565_WriteByte(uint8_t Value);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ SECTIONS
|
|||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
*(.text.isr) /* .text sections of code */
|
KEEP(*(.text.isr)) /* .text sections of code */
|
||||||
*(.text) /* .text sections of code */
|
*(.text) /* .text sections of code */
|
||||||
*(.text*) /* .text* sections of code */
|
*(.text*) /* .text* sections of code */
|
||||||
*(.rodata) /* .rodata sections */
|
*(.rodata) /* .rodata sections */
|
||||||
|
|||||||
460
font.c
460
font.c
@@ -19,6 +19,7 @@
|
|||||||
//const uint8_t gFontBig[95][16] =
|
//const uint8_t gFontBig[95][16] =
|
||||||
const uint8_t gFontBig[95][15] =
|
const uint8_t gFontBig[95][15] =
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' '
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' '
|
||||||
{0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!'
|
{0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!'
|
||||||
{0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"'
|
{0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"'
|
||||||
@@ -114,6 +115,103 @@ const uint8_t gFontBig[95][15] =
|
|||||||
{0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00}, // , 0x00}, // '|'
|
{0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00}, // , 0x00}, // '|'
|
||||||
{0x00, 0x08, 0x08, 0x78, 0xF0, 0x80, 0x80, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00}, // , 0x00}, // '}'
|
{0x00, 0x08, 0x08, 0x78, 0xF0, 0x80, 0x80, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00}, // , 0x00}, // '}'
|
||||||
{0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->'
|
{0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->'
|
||||||
|
#else
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00},
|
||||||
|
{0x00, 0x0F, 0x1F, 0x00, 0x00, 0x1F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x20, 0xF8, 0xF8, 0x20, 0xF8, 0xF8, 0x20, 0x00, 0x02, 0x0F, 0x0F, 0x02, 0x0F, 0x0F, 0x02},
|
||||||
|
{0x70, 0xF8, 0x88, 0x8E, 0x8E, 0x98, 0x10, 0x00, 0x04, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07},
|
||||||
|
{0x30, 0x30, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x00, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x0C, 0x0C},
|
||||||
|
{0x80, 0xD8, 0x7C, 0xE4, 0xBC, 0xD8, 0x40, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08},
|
||||||
|
{0x00, 0x10, 0x1F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0xF0, 0xF8, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0C, 0x08, 0x00},
|
||||||
|
{0x00, 0x00, 0x04, 0x0C, 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0C, 0x07, 0x03, 0x00},
|
||||||
|
{0x00, 0x80, 0xA0, 0xE0, 0xC0, 0xE0, 0xA0, 0x80, 0x00, 0x00, 0x02, 0x03, 0x01, 0x03, 0x02},
|
||||||
|
{0x00, 0x80, 0x80, 0xE0, 0xE0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1E, 0x0E, 0x00, 0x00},
|
||||||
|
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x00, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00},
|
||||||
|
{0xF8, 0xFC, 0x84, 0xC4, 0x64, 0xFC, 0xF8, 0x00, 0x07, 0x0F, 0x09, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0x00, 0x10, 0x18, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08},
|
||||||
|
{0x18, 0x1C, 0x04, 0x84, 0xC4, 0x7C, 0x38, 0x00, 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08},
|
||||||
|
{0x18, 0x1C, 0x44, 0x44, 0x44, 0xFC, 0xB8, 0x00, 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0x80, 0xC0, 0x60, 0x30, 0x18, 0xFC, 0xFC, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x0F},
|
||||||
|
{0x7C, 0x7C, 0x44, 0x44, 0x44, 0xC4, 0x84, 0x00, 0x04, 0x0C, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0xF0, 0xF8, 0x4C, 0x44, 0x44, 0xC4, 0x80, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0x04, 0x04, 0x04, 0x84, 0xE4, 0x7C, 0x1C, 0x00, 0x00, 0x00, 0x0E, 0x0F, 0x01, 0x00, 0x00},
|
||||||
|
{0xB8, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0x78, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, 0x00, 0x00, 0x08, 0x08, 0x08, 0x0C, 0x07, 0x03},
|
||||||
|
{0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0E, 0x06, 0x00, 0x00},
|
||||||
|
{0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, 0x00, 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x08},
|
||||||
|
{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02},
|
||||||
|
{0x00, 0x08, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x08, 0x0C, 0x06, 0x03, 0x01, 0x00},
|
||||||
|
{0x38, 0x3C, 0x04, 0x84, 0xC4, 0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00},
|
||||||
|
{0xF0, 0xF8, 0x08, 0xC8, 0xC8, 0xF8, 0xF0, 0x00, 0x07, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x01},
|
||||||
|
{0xF8, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
|
||||||
|
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0x1C, 0x18, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0E, 0x06},
|
||||||
|
{0xFC, 0xFC, 0x04, 0x04, 0x0C, 0xF8, 0xF0, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x0C, 0x07, 0x03},
|
||||||
|
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08},
|
||||||
|
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0xF8, 0xFC, 0x04, 0x84, 0x84, 0x9C, 0x98, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0xFC, 0xFC, 0x40, 0x40, 0x40, 0xFC, 0xFC, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
|
||||||
|
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, 0x06, 0x0E, 0x08, 0x08, 0x0F, 0x07, 0x00},
|
||||||
|
{0xFC, 0xFC, 0xE0, 0x30, 0x18, 0x0C, 0x04, 0x00, 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08},
|
||||||
|
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08},
|
||||||
|
{0xFC, 0xFC, 0x18, 0x70, 0x18, 0xFC, 0xFC, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
|
||||||
|
{0xFC, 0xFC, 0x60, 0xC0, 0x80, 0xFC, 0xFC, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0F},
|
||||||
|
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, 0x00, 0x07, 0x0F, 0x08, 0x0C, 0x0C, 0x1F, 0x17},
|
||||||
|
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, 0x00, 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08},
|
||||||
|
{0x38, 0x7C, 0x44, 0x44, 0x44, 0xCC, 0x88, 0x00, 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0x00, 0x04, 0x04, 0xFC, 0xFC, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00},
|
||||||
|
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0x7C, 0xFC, 0x80, 0x00, 0x80, 0xFC, 0x7C, 0x00, 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00},
|
||||||
|
{0xFC, 0xFC, 0x00, 0x80, 0x00, 0xFC, 0xFC, 0x00, 0x0F, 0x0F, 0x06, 0x03, 0x06, 0x0F, 0x0F},
|
||||||
|
{0x0C, 0x3C, 0xF0, 0xC0, 0xF0, 0x3C, 0x0C, 0x00, 0x0C, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0x0C},
|
||||||
|
{0x00, 0x3C, 0x7C, 0xC0, 0xC0, 0x7C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00},
|
||||||
|
{0x04, 0x04, 0x84, 0xC4, 0x64, 0x3C, 0x1C, 0x00, 0x0E, 0x0F, 0x09, 0x08, 0x08, 0x08, 0x08},
|
||||||
|
{0x00, 0x00, 0xFC, 0xFC, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x00},
|
||||||
|
{0x38, 0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E},
|
||||||
|
{0x00, 0x00, 0x04, 0x04, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x00},
|
||||||
|
{0x08, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20},
|
||||||
|
{0x00, 0x00, 0x03, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, 0xC0, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F},
|
||||||
|
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x60, 0x40, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0C, 0x04},
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xFC, 0xFC, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F},
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x07, 0x0F, 0x09, 0x09, 0x09, 0x09, 0x01},
|
||||||
|
{0x20, 0x20, 0xF8, 0xFC, 0x24, 0x24, 0x04, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00},
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, 0x00, 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F},
|
||||||
|
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
|
||||||
|
{0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, 0x30, 0x70, 0x40, 0x40, 0x7F, 0x3F},
|
||||||
|
{0xFC, 0xFC, 0x00, 0x80, 0xC0, 0x60, 0x20, 0x00, 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08},
|
||||||
|
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00},
|
||||||
|
{0xE0, 0xE0, 0x20, 0xE0, 0x20, 0xE0, 0xC0, 0x00, 0x0F, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x0F},
|
||||||
|
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F},
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, 0x00, 0x7F, 0x7F, 0x08, 0x08, 0x08, 0x0F, 0x07},
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x7F, 0x7F},
|
||||||
|
{0xE0, 0xE0, 0x60, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x08, 0x09, 0x09, 0x09, 0x09, 0x0F, 0x06},
|
||||||
|
{0x20, 0x20, 0xFC, 0xFC, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08},
|
||||||
|
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F},
|
||||||
|
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00},
|
||||||
|
{0xE0, 0xE0, 0x00, 0x80, 0x00, 0xE0, 0xE0, 0x00, 0x07, 0x0F, 0x08, 0x0F, 0x08, 0x0F, 0x07},
|
||||||
|
{0x60, 0xE0, 0x80, 0x00, 0x80, 0xE0, 0x60, 0x00, 0x0C, 0x0E, 0x03, 0x01, 0x03, 0x0E, 0x0C},
|
||||||
|
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F},
|
||||||
|
{0x20, 0x20, 0x20, 0xA0, 0xE0, 0x60, 0x20, 0x00, 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08},
|
||||||
|
{0x00, 0x00, 0x40, 0xF8, 0xBC, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08},
|
||||||
|
{0x00, 0x00, 0x00, 0xBC, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00},
|
||||||
|
{0x00, 0x04, 0x04, 0xBC, 0xF8, 0x40, 0x00, 0x00, 0x00, 0x08, 0x08, 0x0F, 0x07, 0x00, 0x00},
|
||||||
|
{0x08, 0x0C, 0x04, 0x0C, 0x08, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -132,7 +230,7 @@ const uint8_t gFontBig[95][15] =
|
|||||||
{0x00, 0xF0, 0xF8, 0xB8, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0xB8, 0xF0, 0xE0, 0x00, 0x11, 0x33, 0x77, 0x67, 0x66, 0x66, 0x66, 0x76, 0x33, 0x3F, 0x1F, 0x07},
|
{0x00, 0xF0, 0xF8, 0xB8, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0xB8, 0xF0, 0xE0, 0x00, 0x11, 0x33, 0x77, 0x67, 0x66, 0x66, 0x66, 0x76, 0x33, 0x3F, 0x1F, 0x07},
|
||||||
{0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}
|
{0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}
|
||||||
};
|
};
|
||||||
#else
|
#elif 0
|
||||||
// VCR font
|
// VCR font
|
||||||
const uint8_t gFontBigDigits[11][26] =
|
const uint8_t gFontBigDigits[11][26] =
|
||||||
{
|
{
|
||||||
@@ -148,6 +246,22 @@ const uint8_t gFontBig[95][15] =
|
|||||||
{0x00, 0x00, 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0x86, 0xFC, 0xF8, 0x00, 0x00, 0x00, 0x18, 0x38, 0x71, 0x61, 0x61, 0x61, 0x61, 0x71, 0x3F, 0x1F, 0x00},
|
{0x00, 0x00, 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0x86, 0xFC, 0xF8, 0x00, 0x00, 0x00, 0x18, 0x38, 0x71, 0x61, 0x61, 0x61, 0x61, 0x71, 0x3F, 0x1F, 0x00},
|
||||||
{0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}
|
{0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
// Terminus font
|
||||||
|
const uint8_t gFontBigDigits[11][26] =
|
||||||
|
{
|
||||||
|
{0x00, 0x00, 0xFC, 0xFE, 0xFE, 0x06, 0x86, 0xC6, 0xE6, 0xFE, 0xFE, 0xFC, 0x00, 0x00, 0x00, 0x3F, 0x7F, 0x7F, 0x67, 0x63, 0x61, 0x60, 0x7F, 0x7F, 0x3F, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x60, 0x60, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x1C, 0x1E, 0x1E, 0x06, 0x06, 0x06, 0x86, 0xFE, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x60, 0x70, 0x78, 0x7C, 0x6E, 0x67, 0x63, 0x61, 0x60, 0x60, 0x00},
|
||||||
|
{0x00, 0x00, 0x0C, 0x0E, 0x0E, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x30, 0x70, 0x70, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3E, 0x00},
|
||||||
|
{0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x7F, 0x7F, 0x7F, 0x00},
|
||||||
|
{0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x86, 0x00, 0x00, 0x00, 0x30, 0x70, 0x70, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, 0x00},
|
||||||
|
{0x00, 0x00, 0xF8, 0xFC, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x80, 0x00, 0x00, 0x00, 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, 0x00},
|
||||||
|
{0x00, 0x00, 0x0E, 0x0E, 0x0E, 0x06, 0x06, 0x86, 0xE6, 0xFE, 0x7E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x7F, 0x7F, 0x03, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x7C, 0xFE, 0xFE, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x3F, 0x7F, 0x7F, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3F, 0x00},
|
||||||
|
{0x00, 0x00, 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, 0x00, 0x00, 0x00, 0x01, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x7F, 0x3F, 0x1F, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
const uint8_t gFontSmallDigits[11][7] =
|
const uint8_t gFontSmallDigits[11][7] =
|
||||||
@@ -165,174 +279,6 @@ const uint8_t gFontSmallDigits[11][7] =
|
|||||||
{0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00} // '-'
|
{0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00} // '-'
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ENABLE_SPECTRUM
|
|
||||||
|
|
||||||
const uint8_t gFont3x5[160][3] = {
|
|
||||||
{0x00, 0x00, 0x00}, // 32 - space
|
|
||||||
{0x00, 0x17, 0x00}, // 33 - exclam
|
|
||||||
{0x03, 0x00, 0x03}, // 34 - quotedbl
|
|
||||||
{0x1f, 0x0a, 0x1f}, // 35 - numbersign
|
|
||||||
{0x0a, 0x1f, 0x05}, // 36 - dollar
|
|
||||||
{0x09, 0x04, 0x12}, // 37 - percent
|
|
||||||
{0x0f, 0x17, 0x1c}, // 38 - ampersand
|
|
||||||
{0x00, 0x03, 0x00}, // 39 - quotesingle
|
|
||||||
{0x00, 0x0e, 0x11}, // 40 - parenleft
|
|
||||||
{0x11, 0x0e, 0x00}, // 41 - parenright
|
|
||||||
{0x05, 0x02, 0x05}, // 42 - asterisk
|
|
||||||
{0x04, 0x0e, 0x04}, // 43 - plus
|
|
||||||
{0x10, 0x08, 0x00}, // 44 - comma
|
|
||||||
{0x04, 0x04, 0x04}, // 45 - hyphen
|
|
||||||
{0x00, 0x10, 0x00}, // 46 - period
|
|
||||||
{0x18, 0x04, 0x03}, // 47 - slash
|
|
||||||
{0x1e, 0x11, 0x0f}, // 48 - zero
|
|
||||||
{0x02, 0x1f, 0x00}, // 49 - one
|
|
||||||
{0x19, 0x15, 0x12}, // 50 - two
|
|
||||||
{0x11, 0x15, 0x0a}, // 51 - three
|
|
||||||
{0x07, 0x04, 0x1f}, // 52 - four
|
|
||||||
{0x17, 0x15, 0x09}, // 53 - five
|
|
||||||
{0x1e, 0x15, 0x1d}, // 54 - six
|
|
||||||
{0x19, 0x05, 0x03}, // 55 - seven
|
|
||||||
{0x1f, 0x15, 0x1f}, // 56 - eight
|
|
||||||
{0x17, 0x15, 0x0f}, // 57 - nine
|
|
||||||
{0x00, 0x0a, 0x00}, // 58 - colon
|
|
||||||
{0x10, 0x0a, 0x00}, // 59 - semicolon
|
|
||||||
{0x04, 0x0a, 0x11}, // 60 - less
|
|
||||||
{0x0a, 0x0a, 0x0a}, // 61 - equal
|
|
||||||
{0x11, 0x0a, 0x04}, // 62 - greater
|
|
||||||
{0x01, 0x15, 0x03}, // 63 - question
|
|
||||||
{0x0e, 0x15, 0x16}, // 64 - at
|
|
||||||
{0x1e, 0x05, 0x1e}, // 65 - A
|
|
||||||
{0x1f, 0x15, 0x0a}, // 66 - B
|
|
||||||
{0x0e, 0x11, 0x11}, // 67 - C
|
|
||||||
{0x1f, 0x11, 0x0e}, // 68 - D
|
|
||||||
{0x1f, 0x15, 0x15}, // 69 - E
|
|
||||||
{0x1f, 0x05, 0x05}, // 70 - F
|
|
||||||
{0x0e, 0x15, 0x1d}, // 71 - G
|
|
||||||
{0x1f, 0x04, 0x1f}, // 72 - H
|
|
||||||
{0x11, 0x1f, 0x11}, // 73 - I
|
|
||||||
{0x08, 0x10, 0x0f}, // 74 - J
|
|
||||||
{0x1f, 0x04, 0x1b}, // 75 - K
|
|
||||||
{0x1f, 0x10, 0x10}, // 76 - L
|
|
||||||
{0x1f, 0x06, 0x1f}, // 77 - M
|
|
||||||
{0x1f, 0x0e, 0x1f}, // 78 - N
|
|
||||||
{0x0e, 0x11, 0x0e}, // 79 - O
|
|
||||||
{0x1f, 0x05, 0x02}, // 80 - P
|
|
||||||
{0x0e, 0x19, 0x1e}, // 81 - Q
|
|
||||||
{0x1f, 0x0d, 0x16}, // 82 - R
|
|
||||||
{0x12, 0x15, 0x09}, // 83 - S
|
|
||||||
{0x01, 0x1f, 0x01}, // 84 - T
|
|
||||||
{0x0f, 0x10, 0x1f}, // 85 - U
|
|
||||||
{0x07, 0x18, 0x07}, // 86 - V
|
|
||||||
{0x1f, 0x0c, 0x1f}, // 87 - W
|
|
||||||
{0x1b, 0x04, 0x1b}, // 88 - X
|
|
||||||
{0x03, 0x1c, 0x03}, // 89 - Y
|
|
||||||
{0x19, 0x15, 0x13}, // 90 - Z
|
|
||||||
{0x1f, 0x11, 0x11}, // 91 - bracketleft
|
|
||||||
{0x02, 0x04, 0x08}, // 92 - backslash
|
|
||||||
{0x11, 0x11, 0x1f}, // 93 - bracketright
|
|
||||||
{0x02, 0x01, 0x02}, // 94 - asciicircum
|
|
||||||
{0x10, 0x10, 0x10}, // 95 - underscore
|
|
||||||
{0x01, 0x02, 0x00}, // 96 - grave
|
|
||||||
{0x1a, 0x16, 0x1c}, // 97 - a
|
|
||||||
{0x1f, 0x12, 0x0c}, // 98 - b
|
|
||||||
{0x0c, 0x12, 0x12}, // 99 - c
|
|
||||||
{0x0c, 0x12, 0x1f}, // 100 - d
|
|
||||||
{0x0c, 0x1a, 0x16}, // 101 - e
|
|
||||||
{0x04, 0x1e, 0x05}, // 102 - f
|
|
||||||
{0x0c, 0x2a, 0x1e}, // 103 - g
|
|
||||||
{0x1f, 0x02, 0x1c}, // 104 - h
|
|
||||||
{0x00, 0x1d, 0x00}, // 105 - i
|
|
||||||
{0x10, 0x20, 0x1d}, // 106 - j
|
|
||||||
{0x1f, 0x0c, 0x12}, // 107 - k
|
|
||||||
{0x11, 0x1f, 0x10}, // 108 - l
|
|
||||||
{0x1e, 0x0e, 0x1e}, // 109 - m
|
|
||||||
{0x1e, 0x02, 0x1c}, // 110 - n
|
|
||||||
{0x0c, 0x12, 0x0c}, // 111 - o
|
|
||||||
{0x3e, 0x12, 0x0c}, // 112 - p
|
|
||||||
{0x0c, 0x12, 0x3e}, // 113 - q
|
|
||||||
{0x1c, 0x02, 0x02}, // 114 - r
|
|
||||||
{0x14, 0x1e, 0x0a}, // 115 - s
|
|
||||||
{0x02, 0x1f, 0x12}, // 116 - t
|
|
||||||
{0x0e, 0x10, 0x1e}, // 117 - u
|
|
||||||
{0x0e, 0x18, 0x0e}, // 118 - v
|
|
||||||
{0x1e, 0x1c, 0x1e}, // 119 - w
|
|
||||||
{0x12, 0x0c, 0x12}, // 120 - x
|
|
||||||
{0x06, 0x28, 0x1e}, // 121 - y
|
|
||||||
{0x1a, 0x1e, 0x16}, // 122 - z
|
|
||||||
{0x04, 0x1b, 0x11}, // 123 - braceleft
|
|
||||||
{0x00, 0x1b, 0x00}, // 124 - bar
|
|
||||||
{0x11, 0x1b, 0x04}, // 125 - braceright
|
|
||||||
{0x02, 0x03, 0x01}, // 126 - asciitilde
|
|
||||||
{0x00, 0x00, 0x00}, // 127 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 128 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 129 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 130 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 131 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 132 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 133 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 134 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 135 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 136 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 137 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 138 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 139 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 140 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 141 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 142 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 143 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 144 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 145 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 146 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 147 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 148 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 149 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 150 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 151 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 152 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 153 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 154 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 155 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 156 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 157 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 158 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 159 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 160 - empty
|
|
||||||
{0x00, 0x1d, 0x00}, // 161 - exclamdown
|
|
||||||
{0x0e, 0x1b, 0x0a}, // 162 - cent
|
|
||||||
{0x14, 0x1f, 0x15}, // 163 - sterling
|
|
||||||
{0x15, 0x0e, 0x15}, // 164 - currency
|
|
||||||
{0x0b, 0x1c, 0x0b}, // 165 - yen
|
|
||||||
{0x00, 0x1b, 0x00}, // 166 - brokenbar
|
|
||||||
{0x14, 0x1b, 0x05}, // 167 - section
|
|
||||||
{0x01, 0x00, 0x01}, // 168 - dieresis
|
|
||||||
{0x02, 0x05, 0x05}, // 169 - copyright
|
|
||||||
{0x16, 0x15, 0x17}, // 170 - ordfeminine
|
|
||||||
{0x02, 0x05, 0x00}, // 171 - guillemotleft
|
|
||||||
{0x02, 0x02, 0x06}, // 172 - logicalnot
|
|
||||||
{0x04, 0x04, 0x00}, // 173 - softhyphen
|
|
||||||
{0x07, 0x03, 0x04}, // 174 - registered
|
|
||||||
{0x01, 0x01, 0x01}, // 175 - macron
|
|
||||||
{0x02, 0x05, 0x02}, // 176 - degree
|
|
||||||
{0x12, 0x17, 0x12}, // 177 - plusminus
|
|
||||||
{0x01, 0x07, 0x04}, // 178 - twosuperior
|
|
||||||
{0x05, 0x07, 0x07}, // 179 - threesuperior
|
|
||||||
{0x00, 0x02, 0x01}, // 180 - acute
|
|
||||||
{0x1f, 0x08, 0x07}, // 181 - mu
|
|
||||||
{0x02, 0x1d, 0x1f}, // 182 - paragraph
|
|
||||||
{0x0e, 0x0e, 0x0e}, // 183 - periodcentered
|
|
||||||
{0x10, 0x14, 0x08}, // 184 - cedilla
|
|
||||||
{0x00, 0x07, 0x00}, // 185 - onesuperior
|
|
||||||
{0x12, 0x15, 0x12}, // 186 - ordmasculine
|
|
||||||
{0x00, 0x05, 0x02}, // 187 - guillemotright
|
|
||||||
{0x03, 0x08, 0x18}, // 188 - onequarter
|
|
||||||
{0x0b, 0x18, 0x10}, // 189 - onehalf
|
|
||||||
{0x03, 0x0b, 0x18}, // 190 - threequarters
|
|
||||||
{0x18, 0x15, 0x10}, // 191 - questiondown
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const uint8_t gFontSmall[95][6] =
|
const uint8_t gFontSmall[95][6] =
|
||||||
{
|
{
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
||||||
@@ -502,10 +448,10 @@ const uint8_t gFontSmall[95][6] =
|
|||||||
{0x00, 0x03, 0x07, 0x06, 0x00, 0x00},
|
{0x00, 0x03, 0x07, 0x06, 0x00, 0x00},
|
||||||
{0x20, 0x76, 0x56, 0x56, 0x7E, 0x3C},
|
{0x20, 0x76, 0x56, 0x56, 0x7E, 0x3C},
|
||||||
{0x7F, 0x7F, 0x6C, 0x6C, 0x7C, 0x38},
|
{0x7F, 0x7F, 0x6C, 0x6C, 0x7C, 0x38},
|
||||||
{0x3C, 0x7E, 0x66, 0x66, 0x66, 0x24},
|
{0x38, 0x7C, 0x6C, 0x6C, 0x6C, 0x00},
|
||||||
{0x38, 0x7C, 0x6C, 0x6C, 0x7F, 0x7F},
|
{0x38, 0x7C, 0x6C, 0x6C, 0x7F, 0x7F},
|
||||||
{0x3C, 0x7E, 0x56, 0x56, 0x5E, 0x0C},
|
{0x3C, 0x7E, 0x56, 0x56, 0x5E, 0x0C},
|
||||||
{0x7C, 0x7E, 0x36, 0x36, 0x06, 0x00},
|
{0x7E, 0x7F, 0x1B, 0x1B, 0x02, 0x00},
|
||||||
{0x0C, 0x5E, 0x56, 0x56, 0x7E, 0x3C},
|
{0x0C, 0x5E, 0x56, 0x56, 0x7E, 0x3C},
|
||||||
{0x7F, 0x7F, 0x0C, 0x0C, 0x7C, 0x78},
|
{0x7F, 0x7F, 0x0C, 0x0C, 0x7C, 0x78},
|
||||||
{0x00, 0x00, 0x7A, 0x7A, 0x00, 0x00},
|
{0x00, 0x00, 0x7A, 0x7A, 0x00, 0x00},
|
||||||
@@ -516,7 +462,7 @@ const uint8_t gFontSmall[95][6] =
|
|||||||
{0x7C, 0x7C, 0x0C, 0x0C, 0x7C, 0x78},
|
{0x7C, 0x7C, 0x0C, 0x0C, 0x7C, 0x78},
|
||||||
{0x3C, 0x7E, 0x66, 0x66, 0x7E, 0x3C},
|
{0x3C, 0x7E, 0x66, 0x66, 0x7E, 0x3C},
|
||||||
{0x7E, 0x7E, 0x36, 0x36, 0x3E, 0x1C},
|
{0x7E, 0x7E, 0x36, 0x36, 0x3E, 0x1C},
|
||||||
{0x1C, 0x3E, 0x36, 0x3E, 0x7E, 0x40},
|
{0x1C, 0x3E, 0x36, 0x7E, 0x7E, 0x60},
|
||||||
{0x7C, 0x7C, 0x0C, 0x0C, 0x18, 0x00},
|
{0x7C, 0x7C, 0x0C, 0x0C, 0x18, 0x00},
|
||||||
{0x4C, 0x5E, 0x56, 0x56, 0x76, 0x20},
|
{0x4C, 0x5E, 0x56, 0x56, 0x76, 0x20},
|
||||||
{0x3F, 0x7F, 0x6C, 0x6C, 0x60, 0x00},
|
{0x3F, 0x7F, 0x6C, 0x6C, 0x60, 0x00},
|
||||||
@@ -524,11 +470,177 @@ const uint8_t gFontSmall[95][6] =
|
|||||||
{0x0C, 0x3C, 0x70, 0x70, 0x3C, 0x0C},
|
{0x0C, 0x3C, 0x70, 0x70, 0x3C, 0x0C},
|
||||||
{0x3C, 0x7C, 0x30, 0x30, 0x7C, 0x3C},
|
{0x3C, 0x7C, 0x30, 0x30, 0x7C, 0x3C},
|
||||||
{0x44, 0x6C, 0x38, 0x38, 0x6C, 0x44},
|
{0x44, 0x6C, 0x38, 0x38, 0x6C, 0x44},
|
||||||
{0x06, 0x6E, 0x6C, 0x6C, 0x7E, 0x3E},
|
{0x06, 0x6E, 0x68, 0x68, 0x7E, 0x3E},
|
||||||
{0x66, 0x76, 0x7E, 0x6E, 0x66, 0x00},
|
{0x66, 0x76, 0x7E, 0x6E, 0x66, 0x00},
|
||||||
{0x08, 0x3E, 0x77, 0x41, 0x00, 0x00},
|
{0x08, 0x3E, 0x77, 0x41, 0x00, 0x00},
|
||||||
{0x00, 0x00, 0x7F, 0x00, 0x00, 0x00},
|
{0x00, 0x00, 0x7F, 0x00, 0x00, 0x00},
|
||||||
{0x00, 0x41, 0x77, 0x3E, 0x08, 0x00},
|
{0x00, 0x41, 0x77, 0x3E, 0x08, 0x00},
|
||||||
{0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00},
|
{0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_SPECTRUM
|
||||||
|
const uint8_t gFont3x5[160][3] =
|
||||||
|
{
|
||||||
|
{0x00, 0x00, 0x00}, // 32 - space
|
||||||
|
{0x00, 0x17, 0x00}, // 33 - exclam
|
||||||
|
{0x03, 0x00, 0x03}, // 34 - quotedbl
|
||||||
|
{0x1f, 0x0a, 0x1f}, // 35 - numbersign
|
||||||
|
{0x0a, 0x1f, 0x05}, // 36 - dollar
|
||||||
|
{0x09, 0x04, 0x12}, // 37 - percent
|
||||||
|
{0x0f, 0x17, 0x1c}, // 38 - ampersand
|
||||||
|
{0x00, 0x03, 0x00}, // 39 - quotesingle
|
||||||
|
{0x00, 0x0e, 0x11}, // 40 - parenleft
|
||||||
|
{0x11, 0x0e, 0x00}, // 41 - parenright
|
||||||
|
{0x05, 0x02, 0x05}, // 42 - asterisk
|
||||||
|
{0x04, 0x0e, 0x04}, // 43 - plus
|
||||||
|
{0x10, 0x08, 0x00}, // 44 - comma
|
||||||
|
{0x04, 0x04, 0x04}, // 45 - hyphen
|
||||||
|
{0x00, 0x10, 0x00}, // 46 - period
|
||||||
|
{0x18, 0x04, 0x03}, // 47 - slash
|
||||||
|
{0x1e, 0x11, 0x0f}, // 48 - zero
|
||||||
|
{0x02, 0x1f, 0x00}, // 49 - one
|
||||||
|
{0x19, 0x15, 0x12}, // 50 - two
|
||||||
|
{0x11, 0x15, 0x0a}, // 51 - three
|
||||||
|
{0x07, 0x04, 0x1f}, // 52 - four
|
||||||
|
{0x17, 0x15, 0x09}, // 53 - five
|
||||||
|
{0x1e, 0x15, 0x1d}, // 54 - six
|
||||||
|
{0x19, 0x05, 0x03}, // 55 - seven
|
||||||
|
{0x1f, 0x15, 0x1f}, // 56 - eight
|
||||||
|
{0x17, 0x15, 0x0f}, // 57 - nine
|
||||||
|
{0x00, 0x0a, 0x00}, // 58 - colon
|
||||||
|
{0x10, 0x0a, 0x00}, // 59 - semicolon
|
||||||
|
{0x04, 0x0a, 0x11}, // 60 - less
|
||||||
|
{0x0a, 0x0a, 0x0a}, // 61 - equal
|
||||||
|
{0x11, 0x0a, 0x04}, // 62 - greater
|
||||||
|
{0x01, 0x15, 0x03}, // 63 - question
|
||||||
|
{0x0e, 0x15, 0x16}, // 64 - at
|
||||||
|
{0x1e, 0x05, 0x1e}, // 65 - A
|
||||||
|
{0x1f, 0x15, 0x0a}, // 66 - B
|
||||||
|
{0x0e, 0x11, 0x11}, // 67 - C
|
||||||
|
{0x1f, 0x11, 0x0e}, // 68 - D
|
||||||
|
{0x1f, 0x15, 0x15}, // 69 - E
|
||||||
|
{0x1f, 0x05, 0x05}, // 70 - F
|
||||||
|
{0x0e, 0x15, 0x1d}, // 71 - G
|
||||||
|
{0x1f, 0x04, 0x1f}, // 72 - H
|
||||||
|
{0x11, 0x1f, 0x11}, // 73 - I
|
||||||
|
{0x08, 0x10, 0x0f}, // 74 - J
|
||||||
|
{0x1f, 0x04, 0x1b}, // 75 - K
|
||||||
|
{0x1f, 0x10, 0x10}, // 76 - L
|
||||||
|
{0x1f, 0x06, 0x1f}, // 77 - M
|
||||||
|
{0x1f, 0x0e, 0x1f}, // 78 - N
|
||||||
|
{0x0e, 0x11, 0x0e}, // 79 - O
|
||||||
|
{0x1f, 0x05, 0x02}, // 80 - P
|
||||||
|
{0x0e, 0x19, 0x1e}, // 81 - Q
|
||||||
|
{0x1f, 0x0d, 0x16}, // 82 - R
|
||||||
|
{0x12, 0x15, 0x09}, // 83 - S
|
||||||
|
{0x01, 0x1f, 0x01}, // 84 - T
|
||||||
|
{0x0f, 0x10, 0x1f}, // 85 - U
|
||||||
|
{0x07, 0x18, 0x07}, // 86 - V
|
||||||
|
{0x1f, 0x0c, 0x1f}, // 87 - W
|
||||||
|
{0x1b, 0x04, 0x1b}, // 88 - X
|
||||||
|
{0x03, 0x1c, 0x03}, // 89 - Y
|
||||||
|
{0x19, 0x15, 0x13}, // 90 - Z
|
||||||
|
{0x1f, 0x11, 0x11}, // 91 - bracketleft
|
||||||
|
{0x02, 0x04, 0x08}, // 92 - backslash
|
||||||
|
{0x11, 0x11, 0x1f}, // 93 - bracketright
|
||||||
|
{0x02, 0x01, 0x02}, // 94 - asciicircum
|
||||||
|
{0x10, 0x10, 0x10}, // 95 - underscore
|
||||||
|
{0x01, 0x02, 0x00}, // 96 - grave
|
||||||
|
{0x1a, 0x16, 0x1c}, // 97 - a
|
||||||
|
{0x1f, 0x12, 0x0c}, // 98 - b
|
||||||
|
{0x0c, 0x12, 0x12}, // 99 - c
|
||||||
|
{0x0c, 0x12, 0x1f}, // 100 - d
|
||||||
|
{0x0c, 0x1a, 0x16}, // 101 - e
|
||||||
|
{0x04, 0x1e, 0x05}, // 102 - f
|
||||||
|
{0x0c, 0x2a, 0x1e}, // 103 - g
|
||||||
|
{0x1f, 0x02, 0x1c}, // 104 - h
|
||||||
|
{0x00, 0x1d, 0x00}, // 105 - i
|
||||||
|
{0x10, 0x20, 0x1d}, // 106 - j
|
||||||
|
{0x1f, 0x0c, 0x12}, // 107 - k
|
||||||
|
{0x11, 0x1f, 0x10}, // 108 - l
|
||||||
|
{0x1e, 0x0e, 0x1e}, // 109 - m
|
||||||
|
{0x1e, 0x02, 0x1c}, // 110 - n
|
||||||
|
{0x0c, 0x12, 0x0c}, // 111 - o
|
||||||
|
{0x3e, 0x12, 0x0c}, // 112 - p
|
||||||
|
{0x0c, 0x12, 0x3e}, // 113 - q
|
||||||
|
{0x1c, 0x02, 0x02}, // 114 - r
|
||||||
|
{0x14, 0x1e, 0x0a}, // 115 - s
|
||||||
|
{0x02, 0x1f, 0x12}, // 116 - t
|
||||||
|
{0x0e, 0x10, 0x1e}, // 117 - u
|
||||||
|
{0x0e, 0x18, 0x0e}, // 118 - v
|
||||||
|
{0x1e, 0x1c, 0x1e}, // 119 - w
|
||||||
|
{0x12, 0x0c, 0x12}, // 120 - x
|
||||||
|
{0x06, 0x28, 0x1e}, // 121 - y
|
||||||
|
{0x1a, 0x1e, 0x16}, // 122 - z
|
||||||
|
{0x04, 0x1b, 0x11}, // 123 - braceleft
|
||||||
|
{0x00, 0x1b, 0x00}, // 124 - bar
|
||||||
|
{0x11, 0x1b, 0x04}, // 125 - braceright
|
||||||
|
{0x02, 0x03, 0x01}, // 126 - asciitilde
|
||||||
|
{0x00, 0x00, 0x00}, // 127 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 128 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 129 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 130 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 131 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 132 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 133 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 134 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 135 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 136 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 137 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 138 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 139 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 140 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 141 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 142 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 143 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 144 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 145 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 146 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 147 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 148 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 149 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 150 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 151 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 152 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 153 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 154 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 155 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 156 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 157 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 158 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 159 - empty
|
||||||
|
{0x00, 0x00, 0x00}, // 160 - empty
|
||||||
|
{0x00, 0x1d, 0x00}, // 161 - exclamdown
|
||||||
|
{0x0e, 0x1b, 0x0a}, // 162 - cent
|
||||||
|
{0x14, 0x1f, 0x15}, // 163 - sterling
|
||||||
|
{0x15, 0x0e, 0x15}, // 164 - currency
|
||||||
|
{0x0b, 0x1c, 0x0b}, // 165 - yen
|
||||||
|
{0x00, 0x1b, 0x00}, // 166 - brokenbar
|
||||||
|
{0x14, 0x1b, 0x05}, // 167 - section
|
||||||
|
{0x01, 0x00, 0x01}, // 168 - dieresis
|
||||||
|
{0x02, 0x05, 0x05}, // 169 - copyright
|
||||||
|
{0x16, 0x15, 0x17}, // 170 - ordfeminine
|
||||||
|
{0x02, 0x05, 0x00}, // 171 - guillemotleft
|
||||||
|
{0x02, 0x02, 0x06}, // 172 - logicalnot
|
||||||
|
{0x04, 0x04, 0x00}, // 173 - softhyphen
|
||||||
|
{0x07, 0x03, 0x04}, // 174 - registered
|
||||||
|
{0x01, 0x01, 0x01}, // 175 - macron
|
||||||
|
{0x02, 0x05, 0x02}, // 176 - degree
|
||||||
|
{0x12, 0x17, 0x12}, // 177 - plusminus
|
||||||
|
{0x01, 0x07, 0x04}, // 178 - twosuperior
|
||||||
|
{0x05, 0x07, 0x07}, // 179 - threesuperior
|
||||||
|
{0x00, 0x02, 0x01}, // 180 - acute
|
||||||
|
{0x1f, 0x08, 0x07}, // 181 - mu
|
||||||
|
{0x02, 0x1d, 0x1f}, // 182 - paragraph
|
||||||
|
{0x0e, 0x0e, 0x0e}, // 183 - periodcentered
|
||||||
|
{0x10, 0x14, 0x08}, // 184 - cedilla
|
||||||
|
{0x00, 0x07, 0x00}, // 185 - onesuperior
|
||||||
|
{0x12, 0x15, 0x12}, // 186 - ordmasculine
|
||||||
|
{0x00, 0x05, 0x02}, // 187 - guillemotright
|
||||||
|
{0x03, 0x08, 0x18}, // 188 - onequarter
|
||||||
|
{0x0b, 0x18, 0x10}, // 189 - onehalf
|
||||||
|
{0x03, 0x0b, 0x18}, // 190 - threequarters
|
||||||
|
{0x18, 0x15, 0x10}, // 191 - questiondown
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
14
functions.c
14
functions.c
@@ -22,6 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "bsp/dp32g030/gpio.h"
|
#include "bsp/dp32g030/gpio.h"
|
||||||
#include "dcs.h"
|
#include "dcs.h"
|
||||||
|
#include "driver/backlight.h"
|
||||||
#if defined(ENABLE_FMRADIO)
|
#if defined(ENABLE_FMRADIO)
|
||||||
#include "driver/bk1080.h"
|
#include "driver/bk1080.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -60,7 +61,10 @@ void FUNCTION_Init(void)
|
|||||||
g_CDCSS_Lost = false;
|
g_CDCSS_Lost = false;
|
||||||
g_CTCSS_Lost = false;
|
g_CTCSS_Lost = false;
|
||||||
|
|
||||||
g_VOX_Lost = false;
|
#ifdef ENABLE_VOX
|
||||||
|
g_VOX_Lost = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
g_SquelchLost = false;
|
g_SquelchLost = false;
|
||||||
|
|
||||||
gFlagTailNoteEliminationComplete = false;
|
gFlagTailNoteEliminationComplete = false;
|
||||||
@@ -113,7 +117,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
||||||
gDTMF_AUTO_RESET_TIME = 1 + (gEeprom.DTMF_AUTO_RESET_TIME * 2);
|
gDTMF_auto_reset_time_500ms = 1 + (gEeprom.DTMF_auto_reset_time * 2);
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
return;
|
return;
|
||||||
@@ -200,6 +204,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
|
|
||||||
DTMF_Reply();
|
DTMF_Reply();
|
||||||
|
|
||||||
|
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
||||||
|
BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
if (gAlarmState != ALARM_STATE_OFF)
|
if (gAlarmState != ALARM_STATE_OFF)
|
||||||
{
|
{
|
||||||
@@ -226,6 +233,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
else
|
else
|
||||||
BK4819_DisableScramble();
|
BK4819_DisableScramble();
|
||||||
|
|
||||||
|
if (gSetting_backlight_on_tx_rx == 1 || gSetting_backlight_on_tx_rx == 3)
|
||||||
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_BAND_SCOPE:
|
case FUNCTION_BAND_SCOPE:
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
|||||||
{
|
{
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||||
gEeprom.BATTERY_SAVE = 0;
|
gEeprom.BATTERY_SAVE = 0;
|
||||||
gEeprom.VOX_SWITCH = false;
|
#ifdef ENABLE_VOX
|
||||||
|
gEeprom.VOX_SWITCH = false;
|
||||||
|
#endif
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
gEeprom.AUTO_KEYPAD_LOCK = false;
|
gEeprom.AUTO_KEYPAD_LOCK = false;
|
||||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
14
init.c
14
init.c
@@ -30,21 +30,17 @@ void DATA_Init(void);
|
|||||||
void BSS_Init(void)
|
void BSS_Init(void)
|
||||||
{
|
{
|
||||||
uint32_t *pBss;
|
uint32_t *pBss;
|
||||||
|
for (pBss = __bss_start__; pBss < __bss_end__; pBss++)
|
||||||
for (pBss = __bss_start__; pBss < __bss_end__; pBss++) {
|
|
||||||
*pBss = 0;
|
*pBss = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATA_Init(void)
|
void DATA_Init(void)
|
||||||
{
|
{
|
||||||
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
|
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
|
||||||
volatile uint32_t *pDataFlash = (volatile uint32_t *)flash_data_start;
|
volatile uint32_t *pDataFlash = (volatile uint32_t *)flash_data_start;
|
||||||
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
|
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
|
||||||
uint32_t i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < Size / 4; i++) {
|
for (i = 0; i < (Size / 4); i++)
|
||||||
*pDataRam++ = *pDataFlash++;
|
*pDataRam++ = *pDataFlash++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
main.c
16
main.c
@@ -174,12 +174,14 @@ void Main(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gEeprom.POWER_ON_PASSWORD < 1000000)
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
{
|
if (gEeprom.POWER_ON_PASSWORD < 1000000)
|
||||||
bIsInLockScreen = true;
|
{
|
||||||
UI_DisplayLock();
|
bIsInLockScreen = true;
|
||||||
bIsInLockScreen = false;
|
UI_DisplayLock();
|
||||||
}
|
bIsInLockScreen = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOT_ProcessMode(BootMode);
|
BOOT_ProcessMode(BootMode);
|
||||||
|
|
||||||
@@ -193,7 +195,7 @@ void Main(void)
|
|||||||
|
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_WELCOME);
|
AUDIO_SetVoiceID(0, VOICE_ID_WELCOME);
|
||||||
|
|
||||||
Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL];
|
Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
{
|
{
|
||||||
AUDIO_SetVoiceID(1, VOICE_ID_CHANNEL_MODE);
|
AUDIO_SetVoiceID(1, VOICE_ID_CHANNEL_MODE);
|
||||||
|
|||||||
59
misc.c
59
misc.c
@@ -17,6 +17,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||||
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
||||||
@@ -45,7 +46,9 @@ const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec afte
|
|||||||
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
||||||
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
||||||
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
||||||
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
#ifdef ENABLE_VOX
|
||||||
|
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
||||||
|
#endif
|
||||||
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
||||||
|
|
||||||
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||||
@@ -61,7 +64,9 @@ const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
|||||||
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
||||||
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
||||||
|
|
||||||
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
#ifdef ENABLE_VOX
|
||||||
|
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
||||||
|
#endif
|
||||||
|
|
||||||
const uint16_t NOAA_countdown_10ms = 5000 / 10; // 5 seconds
|
const uint16_t NOAA_countdown_10ms = 5000 / 10; // 5 seconds
|
||||||
const uint16_t NOAA_countdown_2_10ms = 500 / 10; // 500ms
|
const uint16_t NOAA_countdown_2_10ms = 500 / 10; // 500ms
|
||||||
@@ -83,7 +88,7 @@ bool gSetting_TX_EN;
|
|||||||
uint8_t gSetting_F_LOCK;
|
uint8_t gSetting_F_LOCK;
|
||||||
bool gSetting_ScrambleEnable;
|
bool gSetting_ScrambleEnable;
|
||||||
|
|
||||||
bool gSetting_backlight_on_rx;
|
uint8_t gSetting_backlight_on_tx_rx;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
bool gSetting_AM_fix;
|
bool gSetting_AM_fix;
|
||||||
@@ -188,12 +193,14 @@ bool g_CDCSS_Lost;
|
|||||||
uint8_t gCDCSSCodeType;
|
uint8_t gCDCSSCodeType;
|
||||||
bool g_CTCSS_Lost;
|
bool g_CTCSS_Lost;
|
||||||
bool g_CxCSS_TAIL_Found;
|
bool g_CxCSS_TAIL_Found;
|
||||||
bool g_VOX_Lost;
|
#ifdef ENABLE_VOX
|
||||||
|
bool g_VOX_Lost;
|
||||||
|
bool gVOX_NoiseDetected;
|
||||||
|
uint16_t gVoxResumeCountdown;
|
||||||
|
uint16_t gVoxPauseCountdown;
|
||||||
|
#endif
|
||||||
bool g_SquelchLost;
|
bool g_SquelchLost;
|
||||||
uint8_t gFlashLightState;
|
uint8_t gFlashLightState;
|
||||||
bool gVOX_NoiseDetected;
|
|
||||||
uint16_t gVoxResumeCountdown;
|
|
||||||
uint16_t gVoxPauseCountdown;
|
|
||||||
volatile uint16_t gFlashLightBlinkCounter;
|
volatile uint16_t gFlashLightBlinkCounter;
|
||||||
bool gFlagEndTransmission;
|
bool gFlagEndTransmission;
|
||||||
uint16_t gLowBatteryCountdown;
|
uint16_t gLowBatteryCountdown;
|
||||||
@@ -234,7 +241,9 @@ uint8_t gShowChPrefix;
|
|||||||
volatile bool gNextTimeslice;
|
volatile bool gNextTimeslice;
|
||||||
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||||
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||||
volatile uint16_t gVoxStopCountdown_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
volatile uint16_t gVoxStopCountdown_10ms;
|
||||||
|
#endif
|
||||||
volatile bool gNextTimeslice40ms;
|
volatile bool gNextTimeslice40ms;
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
volatile uint16_t gNOAACountdown_10ms = 0;
|
volatile uint16_t gNOAACountdown_10ms = 0;
|
||||||
@@ -251,7 +260,39 @@ int16_t gCurrentRSSI[2] = {0, 0}; // now one per VFO
|
|||||||
|
|
||||||
uint8_t gIsLocked = 0xFF;
|
uint8_t gIsLocked = 0xFF;
|
||||||
|
|
||||||
// --------
|
unsigned int get_rx_VFO(void)
|
||||||
|
{
|
||||||
|
unsigned int rx_vfo = gEeprom.TX_VFO;
|
||||||
|
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||||
|
rx_vfo = 0;
|
||||||
|
else
|
||||||
|
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||||
|
rx_vfo = 1;
|
||||||
|
else
|
||||||
|
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||||
|
rx_vfo = 1;
|
||||||
|
else
|
||||||
|
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||||
|
rx_vfo = 0;
|
||||||
|
return rx_vfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int get_tx_VFO(void)
|
||||||
|
{
|
||||||
|
unsigned int tx_vfo = gEeprom.TX_VFO;
|
||||||
|
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||||
|
tx_vfo = 1;
|
||||||
|
else
|
||||||
|
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||||
|
tx_vfo = 0;
|
||||||
|
else
|
||||||
|
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||||
|
tx_vfo = 1;
|
||||||
|
else
|
||||||
|
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||||
|
tx_vfo = 0;
|
||||||
|
return tx_vfo;
|
||||||
|
}
|
||||||
|
|
||||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
||||||
{
|
{
|
||||||
|
|||||||
45
misc.h
45
misc.h
@@ -24,24 +24,20 @@
|
|||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST)
|
#define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST)
|
||||||
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
||||||
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
|
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
|
||||||
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
|
#define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
||||||
#define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MR_CHANNEL_FIRST = 0,
|
MR_CHANNEL_FIRST = 0,
|
||||||
MR_CHANNEL_LAST = 199u,
|
MR_CHANNEL_LAST = 199u,
|
||||||
FREQ_CHANNEL_FIRST = 200u,
|
FREQ_CHANNEL_FIRST = 200u,
|
||||||
FREQ_CHANNEL_LAST = 206u,
|
FREQ_CHANNEL_LAST = 206u,
|
||||||
#ifdef ENABLE_NOAA
|
NOAA_CHANNEL_FIRST = 207u,
|
||||||
NOAA_CHANNEL_FIRST = 207u,
|
NOAA_CHANNEL_LAST = 216u,
|
||||||
NOAA_CHANNEL_LAST = 216u,
|
|
||||||
#endif
|
|
||||||
LAST_CHANNEL
|
LAST_CHANNEL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -116,7 +112,9 @@ extern const uint16_t battery_save_count_10ms;
|
|||||||
extern const uint16_t power_save1_10ms;
|
extern const uint16_t power_save1_10ms;
|
||||||
extern const uint16_t power_save2_10ms;
|
extern const uint16_t power_save2_10ms;
|
||||||
|
|
||||||
extern const uint16_t vox_stop_count_down_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
extern const uint16_t vox_stop_count_down_10ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const uint16_t NOAA_countdown_10ms;
|
extern const uint16_t NOAA_countdown_10ms;
|
||||||
extern const uint16_t NOAA_countdown_2_10ms;
|
extern const uint16_t NOAA_countdown_2_10ms;
|
||||||
@@ -128,7 +126,9 @@ extern const uint16_t dual_watch_count_after_1_10ms;
|
|||||||
extern const uint16_t dual_watch_count_after_2_10ms;
|
extern const uint16_t dual_watch_count_after_2_10ms;
|
||||||
extern const uint16_t dual_watch_count_toggle_10ms;
|
extern const uint16_t dual_watch_count_toggle_10ms;
|
||||||
extern const uint16_t dual_watch_count_noaa_10ms;
|
extern const uint16_t dual_watch_count_noaa_10ms;
|
||||||
extern const uint16_t dual_watch_count_after_vox_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
extern const uint16_t dual_watch_count_after_vox_10ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const uint16_t scan_pause_delay_in_1_10ms;
|
extern const uint16_t scan_pause_delay_in_1_10ms;
|
||||||
extern const uint16_t scan_pause_delay_in_2_10ms;
|
extern const uint16_t scan_pause_delay_in_2_10ms;
|
||||||
@@ -152,7 +152,7 @@ extern bool gSetting_TX_EN;
|
|||||||
extern uint8_t gSetting_F_LOCK;
|
extern uint8_t gSetting_F_LOCK;
|
||||||
extern bool gSetting_ScrambleEnable;
|
extern bool gSetting_ScrambleEnable;
|
||||||
|
|
||||||
extern bool gSetting_backlight_on_rx;
|
extern uint8_t gSetting_backlight_on_tx_rx;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
extern bool gSetting_AM_fix;
|
extern bool gSetting_AM_fix;
|
||||||
@@ -258,12 +258,14 @@ extern bool g_CDCSS_Lost;
|
|||||||
extern uint8_t gCDCSSCodeType;
|
extern uint8_t gCDCSSCodeType;
|
||||||
extern bool g_CTCSS_Lost;
|
extern bool g_CTCSS_Lost;
|
||||||
extern bool g_CxCSS_TAIL_Found;
|
extern bool g_CxCSS_TAIL_Found;
|
||||||
extern bool g_VOX_Lost;
|
#ifdef ENABLE_VOX
|
||||||
|
extern bool g_VOX_Lost;
|
||||||
|
extern bool gVOX_NoiseDetected;
|
||||||
|
extern uint16_t gVoxResumeCountdown;
|
||||||
|
extern uint16_t gVoxPauseCountdown;
|
||||||
|
#endif
|
||||||
extern bool g_SquelchLost;
|
extern bool g_SquelchLost;
|
||||||
extern uint8_t gFlashLightState;
|
extern uint8_t gFlashLightState;
|
||||||
extern bool gVOX_NoiseDetected;
|
|
||||||
extern uint16_t gVoxResumeCountdown;
|
|
||||||
extern uint16_t gVoxPauseCountdown;
|
|
||||||
extern volatile uint16_t gFlashLightBlinkCounter;
|
extern volatile uint16_t gFlashLightBlinkCounter;
|
||||||
extern bool gFlagEndTransmission;
|
extern bool gFlagEndTransmission;
|
||||||
extern uint16_t gLowBatteryCountdown;
|
extern uint16_t gLowBatteryCountdown;
|
||||||
@@ -300,7 +302,9 @@ extern bool gF_LOCK;
|
|||||||
extern uint8_t gShowChPrefix;
|
extern uint8_t gShowChPrefix;
|
||||||
extern volatile uint8_t gFoundCDCSSCountdown_10ms;
|
extern volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||||
extern volatile uint8_t gFoundCTCSSCountdown_10ms;
|
extern volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||||
extern volatile uint16_t gVoxStopCountdown_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
extern volatile uint16_t gVoxStopCountdown_10ms;
|
||||||
|
#endif
|
||||||
extern volatile bool gNextTimeslice40ms;
|
extern volatile bool gNextTimeslice40ms;
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
extern volatile uint16_t gNOAACountdown_10ms;
|
extern volatile uint16_t gNOAACountdown_10ms;
|
||||||
@@ -314,6 +318,9 @@ extern int16_t gCurrentRSSI[2]; // now one per VFO
|
|||||||
extern uint8_t gIsLocked;
|
extern uint8_t gIsLocked;
|
||||||
extern volatile uint8_t boot_counter_10ms;
|
extern volatile uint8_t boot_counter_10ms;
|
||||||
|
|
||||||
|
unsigned int get_tx_VFO(void);
|
||||||
|
unsigned int get_rx_VFO(void);
|
||||||
|
|
||||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger);
|
void NUMBER_Get(char *pDigits, uint32_t *pInteger);
|
||||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits);
|
void NUMBER_ToDigits(uint32_t Value, char *pDigits);
|
||||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit);
|
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit);
|
||||||
|
|||||||
233
radio.c
233
radio.c
@@ -51,7 +51,7 @@ bool RADIO_CheckValidChannel(uint16_t Channel, bool bCheckScanList, uint8_t VFO)
|
|||||||
uint8_t PriorityCh1;
|
uint8_t PriorityCh1;
|
||||||
uint8_t PriorityCh2;
|
uint8_t PriorityCh2;
|
||||||
|
|
||||||
if (!IS_MR_CHANNEL(Channel))
|
if (Channel > MR_CHANNEL_LAST)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Attributes = gMR_ChannelAttributes[Channel];
|
Attributes = gMR_ChannelAttributes[Channel];
|
||||||
@@ -130,9 +130,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
|
|||||||
pInfo->freq_config_TX.Frequency = Frequency;
|
pInfo->freq_config_TX.Frequency = Frequency;
|
||||||
pInfo->pRX = &pInfo->freq_config_RX;
|
pInfo->pRX = &pInfo->freq_config_RX;
|
||||||
pInfo->pTX = &pInfo->freq_config_TX;
|
pInfo->pTX = &pInfo->freq_config_TX;
|
||||||
#ifdef ENABLE_COMPANDER
|
pInfo->Compander = 0; // off
|
||||||
pInfo->Compander = 0; // off
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
||||||
pInfo->AM_mode = 1;
|
pInfo->AM_mode = 1;
|
||||||
@@ -178,7 +176,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (Channel <= MR_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
Channel = RADIO_FindNextChannel(Channel, RADIO_CHANNEL_UP, false, VFO);
|
Channel = RADIO_FindNextChannel(Channel, RADIO_CHANNEL_UP, false, VFO);
|
||||||
if (Channel == 0xFF)
|
if (Channel == 0xFF)
|
||||||
@@ -202,7 +200,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
|
|
||||||
uint8_t Index;
|
uint8_t Index;
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (Channel <= MR_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
Channel = gEeprom.FreqChannel[VFO];
|
Channel = gEeprom.FreqChannel[VFO];
|
||||||
gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO];
|
gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO];
|
||||||
@@ -220,7 +218,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
Band = BAND6_400MHz;
|
Band = BAND6_400MHz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (Channel <= MR_CHANNEL_LAST)
|
||||||
{
|
{
|
||||||
gEeprom.VfoInfo[VFO].Band = Band;
|
gEeprom.VfoInfo[VFO].Band = Band;
|
||||||
gEeprom.VfoInfo[VFO].SCANLIST1_PARTICIPATION = !!(Attributes & MR_CH_SCANLIST1);
|
gEeprom.VfoInfo[VFO].SCANLIST1_PARTICIPATION = !!(Attributes & MR_CH_SCANLIST1);
|
||||||
@@ -237,7 +235,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
gEeprom.VfoInfo[VFO].SCANLIST2_PARTICIPATION = bParticipation2;
|
gEeprom.VfoInfo[VFO].SCANLIST2_PARTICIPATION = bParticipation2;
|
||||||
gEeprom.VfoInfo[VFO].CHANNEL_SAVE = Channel;
|
gEeprom.VfoInfo[VFO].CHANNEL_SAVE = Channel;
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (Channel <= MR_CHANNEL_LAST)
|
||||||
Base = Channel * 16;
|
Base = Channel * 16;
|
||||||
else
|
else
|
||||||
Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16);
|
Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16);
|
||||||
@@ -334,12 +332,12 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
if (Data[5] == 0xFF)
|
if (Data[5] == 0xFF)
|
||||||
{
|
{
|
||||||
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false;
|
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false;
|
||||||
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = 0;
|
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = !!((Data[5] >> 0) & 1u);
|
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = ((Data[5] >> 0) & 1u) ? true : false;
|
||||||
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = ((Data[5] >> 1) & 3u);
|
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = ((Data[5] >> 1) & 7u);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************
|
// ***************
|
||||||
@@ -382,13 +380,13 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
if (Frequency >= 10800000 && Frequency < 13600000)
|
if (Frequency >= 10800000 && Frequency < 13600000)
|
||||||
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
||||||
else
|
else
|
||||||
if (!IS_MR_CHANNEL(Channel))
|
if (Channel > MR_CHANNEL_LAST)
|
||||||
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency, 0);
|
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency, 0);
|
||||||
|
|
||||||
RADIO_ApplyOffset(pRadio);
|
RADIO_ApplyOffset(pRadio);
|
||||||
|
|
||||||
memset(gEeprom.VfoInfo[VFO].Name, 0, sizeof(gEeprom.VfoInfo[VFO].Name));
|
memset(gEeprom.VfoInfo[VFO].Name, 0, sizeof(gEeprom.VfoInfo[VFO].Name));
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (Channel < MR_CHANNEL_LAST)
|
||||||
{ // 16 bytes allocated to the channel name but only 10 used, the rest are 0's
|
{ // 16 bytes allocated to the channel name but only 10 used, the rest are 0's
|
||||||
EEPROM_ReadBuffer(0x0F50 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 0, 8);
|
EEPROM_ReadBuffer(0x0F50 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 0, 8);
|
||||||
EEPROM_ReadBuffer(0x0F58 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 8, 2);
|
EEPROM_ReadBuffer(0x0F58 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 8, 2);
|
||||||
@@ -420,9 +418,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF;
|
gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
||||||
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
||||||
}
|
}
|
||||||
@@ -430,22 +426,27 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||||
{
|
{
|
||||||
uint8_t Txp[3];
|
uint8_t Txp[3];
|
||||||
FREQUENCY_Band_t Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
|
FREQUENCY_Band_t Band;
|
||||||
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
|
||||||
|
// *******************************
|
||||||
|
// squelch
|
||||||
|
|
||||||
|
Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
|
||||||
|
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
||||||
|
|
||||||
if (gEeprom.SQUELCH_LEVEL == 0)
|
if (gEeprom.SQUELCH_LEVEL == 0)
|
||||||
{ // squelch == 0 (off)
|
{ // squelch == 0 (off)
|
||||||
pInfo->SquelchOpenRSSIThresh = 0;
|
pInfo->SquelchOpenRSSIThresh = 0; // 0 ~ 255
|
||||||
pInfo->SquelchOpenNoiseThresh = 127;
|
pInfo->SquelchOpenNoiseThresh = 127; // 127 ~ 0
|
||||||
pInfo->SquelchCloseGlitchThresh = 255;
|
pInfo->SquelchCloseGlitchThresh = 255; // 255 ~ 0
|
||||||
|
|
||||||
pInfo->SquelchCloseRSSIThresh = 0;
|
pInfo->SquelchCloseRSSIThresh = 0; // 0 ~ 255
|
||||||
pInfo->SquelchCloseNoiseThresh = 127;
|
pInfo->SquelchCloseNoiseThresh = 127; // 127 ~ 0
|
||||||
pInfo->SquelchOpenGlitchThresh = 255;
|
pInfo->SquelchOpenGlitchThresh = 255; // 255 ~ 0
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // squelch >= 1
|
{ // squelch >= 1
|
||||||
Base += gEeprom.SQUELCH_LEVEL; // my squelch-1
|
Base += gEeprom.SQUELCH_LEVEL; // my eeprom squelch-1
|
||||||
// VHF UHF
|
// VHF UHF
|
||||||
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
|
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
|
||||||
EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1); // 40 5
|
EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1); // 40 5
|
||||||
@@ -456,30 +457,61 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
|||||||
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
|
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
|
||||||
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
|
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
|
||||||
|
|
||||||
|
uint16_t rssi_open = pInfo->SquelchOpenRSSIThresh;
|
||||||
|
uint16_t rssi_close = pInfo->SquelchCloseRSSIThresh;
|
||||||
|
uint16_t noise_open = pInfo->SquelchOpenNoiseThresh;
|
||||||
|
uint16_t noise_close = pInfo->SquelchCloseNoiseThresh;
|
||||||
|
uint16_t glitch_open = pInfo->SquelchOpenGlitchThresh;
|
||||||
|
uint16_t glitch_close = pInfo->SquelchCloseGlitchThresh;
|
||||||
|
|
||||||
#if ENABLE_SQUELCH_MORE_SENSITIVE
|
#if ENABLE_SQUELCH_MORE_SENSITIVE
|
||||||
// make squelch a little more sensitive
|
// make squelch a little more sensitive
|
||||||
//
|
//
|
||||||
// getting the best setting here is still experimental, bare with me
|
// getting the best setting here is still experimental, bare with me
|
||||||
//
|
//
|
||||||
// note that 'noise' and 'glitch' value are inverted compared to 'rssi' values
|
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
||||||
|
|
||||||
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 10) / 11;
|
#if 0
|
||||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 10) / 11;
|
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 * 11) / 10;
|
#else
|
||||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 11) / 10;
|
// more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
||||||
|
rssi_open = (rssi_open * 3) / 4;
|
||||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 11) / 10;
|
noise_open = (noise_open * 4) / 3;
|
||||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 11) / 10;
|
glitch_open = (glitch_open * 4) / 3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pInfo->SquelchOpenNoiseThresh > 127)
|
rssi_close = (rssi_open * 9) / 10;
|
||||||
pInfo->SquelchOpenNoiseThresh = 127;
|
noise_close = (noise_open * 10) / 9;
|
||||||
|
glitch_close = (glitch_open * 10) / 9;
|
||||||
|
|
||||||
if (pInfo->SquelchCloseNoiseThresh > 127)
|
// ensure the 'close' threshold is lower than the 'open' threshold
|
||||||
pInfo->SquelchCloseNoiseThresh = 127;
|
if (rssi_close == rssi_open && rssi_close > 0)
|
||||||
|
rssi_close--;
|
||||||
|
if (noise_close == noise_open && noise_close < 127)
|
||||||
|
noise_close++;
|
||||||
|
if (glitch_close == glitch_open && glitch_close < 255)
|
||||||
|
glitch_close++;
|
||||||
|
|
||||||
|
pInfo->SquelchOpenRSSIThresh = (rssi_open > 255) ? 255 : rssi_open;
|
||||||
|
pInfo->SquelchCloseRSSIThresh = (rssi_close > 255) ? 255 : rssi_close;
|
||||||
|
pInfo->SquelchOpenNoiseThresh = (noise_open > 127) ? 127 : noise_open;
|
||||||
|
pInfo->SquelchCloseNoiseThresh = (noise_close > 127) ? 127 : noise_close;
|
||||||
|
pInfo->SquelchOpenGlitchThresh = (glitch_open > 255) ? 255 : glitch_open;
|
||||||
|
pInfo->SquelchCloseGlitchThresh = (glitch_close > 255) ? 255 : glitch_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *******************************
|
||||||
|
// output power
|
||||||
|
|
||||||
Band = FREQUENCY_GetBand(pInfo->pTX->Frequency);
|
Band = FREQUENCY_GetBand(pInfo->pTX->Frequency);
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->OUTPUT_POWER * 3), Txp, 3);
|
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->OUTPUT_POWER * 3), Txp, 3);
|
||||||
@@ -492,6 +524,8 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
|||||||
(frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2,
|
(frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2,
|
||||||
frequencyBandTable[Band].upper,
|
frequencyBandTable[Band].upper,
|
||||||
pInfo->pTX->Frequency);
|
pInfo->pTX->Frequency);
|
||||||
|
|
||||||
|
// *******************************
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||||
@@ -521,30 +555,16 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
|||||||
|
|
||||||
static void RADIO_SelectCurrentVfo(void)
|
static void RADIO_SelectCurrentVfo(void)
|
||||||
{
|
{
|
||||||
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gRxVfo : &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gRxVfo : &gEeprom.VfoInfo[gEeprom.TX_VFO];
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIO_SelectVfos(void)
|
void RADIO_SelectVfos(void)
|
||||||
{
|
{
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
gEeprom.TX_VFO = get_tx_VFO();
|
||||||
gEeprom.TX_CHANNEL = 1;
|
gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_VFO : (gEeprom.TX_VFO + 1) & 1u;
|
||||||
else
|
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
|
||||||
gEeprom.TX_CHANNEL = 0;
|
|
||||||
else
|
|
||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
|
||||||
gEeprom.TX_CHANNEL = 1;
|
|
||||||
else
|
|
||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
|
||||||
gEeprom.TX_CHANNEL = 0;
|
|
||||||
|
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
|
||||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||||
else
|
|
||||||
gEeprom.RX_CHANNEL = (gEeprom.TX_CHANNEL == 0) ? 1 : 0;
|
|
||||||
|
|
||||||
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
|
||||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
|
||||||
|
|
||||||
RADIO_SelectCurrentVfo();
|
RADIO_SelectCurrentVfo();
|
||||||
}
|
}
|
||||||
@@ -561,6 +581,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (Bandwidth)
|
switch (Bandwidth)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
@@ -568,14 +591,16 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
case BK4819_FILTER_BW_WIDE:
|
case BK4819_FILTER_BW_WIDE:
|
||||||
case BK4819_FILTER_BW_NARROW:
|
case BK4819_FILTER_BW_NARROW:
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
|
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
|
||||||
// BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||||
#else
|
#else
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
|
||||||
|
|
||||||
BK4819_SetupPowerAmplifier(0, 0);
|
BK4819_SetupPowerAmplifier(0, 0);
|
||||||
@@ -698,30 +723,30 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_VOX
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_NOAA
|
||||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
#ifdef ENABLE_FMRADIO
|
||||||
|
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||||
|
#else
|
||||||
|
if (gEeprom.VOX_SWITCH && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
if (gEeprom.VOX_SWITCH && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
#ifdef ENABLE_FMRADIO
|
||||||
#endif
|
if (gEeprom.VOX_SWITCH && !gFmRadioMode && gCurrentVfo->AM_mode == 0)
|
||||||
#else
|
#else
|
||||||
#ifdef ENABLE_FMRADIO
|
if (gEeprom.VOX_SWITCH && gCurrentVfo->AM_mode == 0)
|
||||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && gCurrentVfo->AM_mode == 0)
|
#endif
|
||||||
#else
|
|
||||||
if (gEeprom.VOX_SWITCH && gCurrentVfo->AM_mode == 0)
|
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||||
|
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
|
||||||
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
BK4819_DisableVox();
|
BK4819_DisableVox();
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
// RX expander
|
||||||
// RX expander
|
BK4819_SetCompander((gRxVfo->AM_mode == 0 && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
|
||||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||||
@@ -736,6 +761,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
#else
|
#else
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
{
|
{
|
||||||
|
BK4819_DisableDTMF();
|
||||||
BK4819_EnableDTMF();
|
BK4819_EnableDTMF();
|
||||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||||
}
|
}
|
||||||
@@ -809,6 +835,9 @@ void RADIO_SetTxParameters(void)
|
|||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (Bandwidth)
|
switch (Bandwidth)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
@@ -816,20 +845,20 @@ void RADIO_SetTxParameters(void)
|
|||||||
case BK4819_FILTER_BW_WIDE:
|
case BK4819_FILTER_BW_WIDE:
|
||||||
case BK4819_FILTER_BW_NARROW:
|
case BK4819_FILTER_BW_NARROW:
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
|
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
|
||||||
// BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||||
#else
|
#else
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
// TX compressor
|
||||||
// TX compressor
|
BK4819_SetCompander((gRxVfo->AM_mode == 0 && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
||||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BK4819_PrepareTransmit();
|
BK4819_PrepareTransmit();
|
||||||
|
|
||||||
@@ -882,10 +911,9 @@ void RADIO_SetVfoState(VfoState_t State)
|
|||||||
VfoState[1] = VFO_STATE_TX_DISABLE;
|
VfoState[1] = VFO_STATE_TX_DISABLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // 1of11
|
||||||
unsigned int chan = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) ? (gEeprom.RX_CHANNEL + 1) & 1 : gEeprom.RX_CHANNEL; // 1of11
|
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||||
chan = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_CHANNEL : chan;
|
VfoState[vfo] = State;
|
||||||
VfoState[chan] = State;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -906,11 +934,11 @@ void RADIO_PrepareTX(void)
|
|||||||
gDualWatchCountdown_10ms = dual_watch_count_after_tx_10ms;
|
gDualWatchCountdown_10ms = dual_watch_count_after_tx_10ms;
|
||||||
gScheduleDualWatch = false;
|
gScheduleDualWatch = false;
|
||||||
|
|
||||||
if (!gRxVfoIsActive)
|
if (gRxVfoIsActive)
|
||||||
{ // use the TX vfo
|
{ // use the TX vfo
|
||||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
gEeprom.RX_VFO = gEeprom.TX_VFO;
|
||||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
|
||||||
gRxVfoIsActive = true;
|
// gRxVfoIsActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let the user see that DW is not active
|
// let the user see that DW is not active
|
||||||
@@ -944,7 +972,6 @@ void RADIO_PrepareTX(void)
|
|||||||
State = VFO_STATE_TX_DISABLE;
|
State = VFO_STATE_TX_DISABLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
//if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST)
|
|
||||||
if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0)
|
if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0)
|
||||||
{ // TX frequency is allowed
|
{ // TX frequency is allowed
|
||||||
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
|
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
|
||||||
@@ -963,10 +990,13 @@ void RADIO_PrepareTX(void)
|
|||||||
if (State != VFO_STATE_NORMAL)
|
if (State != VFO_STATE_NORMAL)
|
||||||
{ // TX not allowed
|
{ // TX not allowed
|
||||||
RADIO_SetVfoState(State);
|
RADIO_SetVfoState(State);
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
gAlarmState = ALARM_STATE_OFF;
|
gAlarmState = ALARM_STATE_OFF;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||||
|
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1050,8 +1080,12 @@ void RADIO_SendEndOfTransmission(void)
|
|||||||
if (gEeprom.ROGER == ROGER_MODE_MDC)
|
if (gEeprom.ROGER == ROGER_MODE_MDC)
|
||||||
BK4819_PlayRogerMDC();
|
BK4819_PlayRogerMDC();
|
||||||
|
|
||||||
|
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
||||||
|
BK4819_PlaySingleTone(2475, 250, 28, gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
if (gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||||
(gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
|
(gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN ||
|
||||||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
|
||||||
{ // end-of-tx
|
{ // end-of-tx
|
||||||
if (gEeprom.DTMF_SIDE_TONE)
|
if (gEeprom.DTMF_SIDE_TONE)
|
||||||
{
|
{
|
||||||
@@ -1063,15 +1097,14 @@ void RADIO_SendEndOfTransmission(void)
|
|||||||
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|
||||||
BK4819_PlayDTMFString(
|
BK4819_PlayDTMFString(
|
||||||
gEeprom.DTMF_DOWN_CODE,
|
gEeprom.DTMF_DOWN_CODE,
|
||||||
0,
|
0,
|
||||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
|
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
|
||||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
|
gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
|
||||||
gEeprom.DTMF_CODE_PERSIST_TIME,
|
gEeprom.DTMF_CODE_PERSIST_TIME,
|
||||||
gEeprom.DTMF_CODE_INTERVAL_TIME);
|
gEeprom.DTMF_CODE_INTERVAL_TIME);
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
radio.h
11
radio.h
@@ -25,9 +25,7 @@
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
MR_CH_BAND_MASK = 0x0F << 0,
|
MR_CH_BAND_MASK = 0x0F << 0,
|
||||||
#ifdef ENABLE_COMPANDER
|
MR_CH_COMPAND = 3u << 4, // new
|
||||||
MR_CH_COMPAND = 3u << 4, // new
|
|
||||||
#endif
|
|
||||||
MR_CH_SCANLIST2 = 1u << 6,
|
MR_CH_SCANLIST2 = 1u << 6,
|
||||||
MR_CH_SCANLIST1 = 1u << 7
|
MR_CH_SCANLIST1 = 1u << 7
|
||||||
};
|
};
|
||||||
@@ -46,7 +44,8 @@ enum PTT_ID_t {
|
|||||||
PTT_ID_OFF = 0, // OFF
|
PTT_ID_OFF = 0, // OFF
|
||||||
PTT_ID_TX_UP, // BEGIN OF TX
|
PTT_ID_TX_UP, // BEGIN OF TX
|
||||||
PTT_ID_TX_DOWN, // END OF TX
|
PTT_ID_TX_DOWN, // END OF TX
|
||||||
PTT_ID_BOTH // BOTH
|
PTT_ID_BOTH, // BOTH
|
||||||
|
PTT_ID_APOLLO // Apolo quindar tones
|
||||||
};
|
};
|
||||||
typedef enum PTT_ID_t PTT_ID_t;
|
typedef enum PTT_ID_t PTT_ID_t;
|
||||||
|
|
||||||
@@ -111,9 +110,7 @@ typedef struct VFO_Info_t
|
|||||||
|
|
||||||
uint8_t AM_mode;
|
uint8_t AM_mode;
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
uint8_t Compander;
|
||||||
uint8_t Compander;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char Name[16];
|
char Name[16];
|
||||||
} VFO_Info_t;
|
} VFO_Info_t;
|
||||||
|
|||||||
12
scheduler.c
12
scheduler.c
@@ -77,20 +77,20 @@ void SystickHandler(void)
|
|||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||||
DECREMENT_AND_TRIGGER(gPowerSave_10ms, gPowerSaveCountdownExpired);
|
DECREMENT_AND_TRIGGER(gPowerSave_10ms, gPowerSaveCountdownExpired);
|
||||||
|
|
||||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
|
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
|
||||||
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch);
|
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch);
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
||||||
if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
if (gCurrentFunction != FUNCTION_RECEIVE)
|
if (gCurrentFunction != FUNCTION_RECEIVE)
|
||||||
DECREMENT_AND_TRIGGER(gNOAA_Countdown_10ms, gScheduleNOAA);
|
DECREMENT_AND_TRIGGER(gNOAA_Countdown_10ms, gScheduleNOAA);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING)
|
if (gScanStateDir != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING)
|
||||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
DECREMENT_AND_TRIGGER(ScanPauseDelayIn_10ms, gScheduleScanListen);
|
DECREMENT_AND_TRIGGER(gScanPauseDelayIn_10ms, gScheduleScanListen);
|
||||||
|
|
||||||
DECREMENT_AND_TRIGGER(gTailNoteEliminationCountdown_10ms, gFlagTailNoteEliminationComplete);
|
DECREMENT_AND_TRIGGER(gTailNoteEliminationCountdown_10ms, gFlagTailNoteEliminationComplete);
|
||||||
|
|
||||||
@@ -104,7 +104,9 @@ void SystickHandler(void)
|
|||||||
DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM);
|
DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECREMENT(gVoxStopCountdown_10ms);
|
#ifdef ENABLE_VOX
|
||||||
|
DECREMENT(gVoxStopCountdown_10ms);
|
||||||
|
#endif
|
||||||
|
|
||||||
DECREMENT(boot_counter_10ms);
|
DECREMENT(boot_counter_10ms);
|
||||||
}
|
}
|
||||||
|
|||||||
52
settings.c
52
settings.c
@@ -86,8 +86,13 @@ void SETTINGS_SaveSettings(void)
|
|||||||
State[3] = false;
|
State[3] = false;
|
||||||
#endif
|
#endif
|
||||||
State[4] = gEeprom.KEY_LOCK;
|
State[4] = gEeprom.KEY_LOCK;
|
||||||
State[5] = gEeprom.VOX_SWITCH;
|
#ifdef ENABLE_VOX
|
||||||
State[6] = gEeprom.VOX_LEVEL;
|
State[5] = gEeprom.VOX_SWITCH;
|
||||||
|
State[6] = gEeprom.VOX_LEVEL;
|
||||||
|
#else
|
||||||
|
State[5] = false;
|
||||||
|
State[6] = 0;
|
||||||
|
#endif
|
||||||
State[7] = gEeprom.MIC_SENSITIVITY;
|
State[7] = gEeprom.MIC_SENSITIVITY;
|
||||||
EEPROM_WriteBuffer(0x0E70, State);
|
EEPROM_WriteBuffer(0x0E70, State);
|
||||||
|
|
||||||
@@ -112,8 +117,10 @@ void SETTINGS_SaveSettings(void)
|
|||||||
EEPROM_WriteBuffer(0x0E90, State);
|
EEPROM_WriteBuffer(0x0E90, State);
|
||||||
|
|
||||||
memset(Password, 0xFF, sizeof(Password));
|
memset(Password, 0xFF, sizeof(Password));
|
||||||
Password[0] = gEeprom.POWER_ON_PASSWORD;
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
EEPROM_WriteBuffer(0x0E98, State);
|
Password[0] = gEeprom.POWER_ON_PASSWORD;
|
||||||
|
#endif
|
||||||
|
EEPROM_WriteBuffer(0x0E98, Password);
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
memset(State, 0xFF, sizeof(State));
|
memset(State, 0xFF, sizeof(State));
|
||||||
@@ -128,14 +135,14 @@ void SETTINGS_SaveSettings(void)
|
|||||||
#endif
|
#endif
|
||||||
State[1] = gEeprom.ROGER;
|
State[1] = gEeprom.ROGER;
|
||||||
State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION;
|
State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION;
|
||||||
State[3] = gEeprom.TX_CHANNEL;
|
State[3] = gEeprom.TX_VFO;
|
||||||
EEPROM_WriteBuffer(0x0EA8, State);
|
EEPROM_WriteBuffer(0x0EA8, State);
|
||||||
|
|
||||||
State[0] = gEeprom.DTMF_SIDE_TONE;
|
State[0] = gEeprom.DTMF_SIDE_TONE;
|
||||||
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
||||||
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
||||||
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
|
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
|
||||||
State[4] = gEeprom.DTMF_AUTO_RESET_TIME;
|
State[4] = gEeprom.DTMF_auto_reset_time;
|
||||||
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
||||||
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
||||||
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
||||||
@@ -174,15 +181,11 @@ void SETTINGS_SaveSettings(void)
|
|||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
|
if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
|
||||||
#endif
|
#endif
|
||||||
if (!gSetting_backlight_on_rx) State[7] &= ~(1u << 6);
|
State[7] = (State[7] & ~(3u << 6)) | ((gSetting_backlight_on_tx_rx & 3u) << 6);
|
||||||
|
|
||||||
EEPROM_WriteBuffer(0x0F40, State);
|
EEPROM_WriteBuffer(0x0F40, State);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SETTINGS_LoadChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
|
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
@@ -192,13 +195,13 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
const uint16_t OffsetMR = Channel * 16;
|
const uint16_t OffsetMR = Channel * 16;
|
||||||
uint16_t OffsetVFO = OffsetMR;
|
uint16_t OffsetVFO = OffsetMR;
|
||||||
|
|
||||||
if (!IS_MR_CHANNEL(Channel))
|
if (Channel > MR_CHANNEL_LAST)
|
||||||
{ // it's a VFO, not a channel
|
{ // it's a VFO, not a channel
|
||||||
OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90;
|
OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90;
|
||||||
OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32;
|
OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mode >= 2 || !IS_MR_CHANNEL(Channel))
|
if (Mode >= 2 || Channel > MR_CHANNEL_LAST)
|
||||||
{ // copy VFO to a channel
|
{ // copy VFO to a channel
|
||||||
|
|
||||||
uint8_t State[8];
|
uint8_t State[8];
|
||||||
@@ -216,15 +219,16 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
| (pVFO->OUTPUT_POWER << 2)
|
| (pVFO->OUTPUT_POWER << 2)
|
||||||
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
||||||
| (pVFO->FrequencyReverse << 0);
|
| (pVFO->FrequencyReverse << 0);
|
||||||
State[5] = (pVFO->DTMF_PTT_ID_TX_MODE << 1) | (pVFO->DTMF_DECODING_ENABLE << 0);
|
State[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1) | ((pVFO->DTMF_DECODING_ENABLE & 1u) << 0);
|
||||||
State[6] = pVFO->STEP_SETTING;
|
State[6] = pVFO->STEP_SETTING;
|
||||||
State[7] = pVFO->SCRAMBLING_TYPE;
|
State[7] = pVFO->SCRAMBLING_TYPE;
|
||||||
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
||||||
|
|
||||||
SETTINGS_UpdateChannel(Channel, pVFO, true);
|
SETTINGS_UpdateChannel(Channel, pVFO, true);
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (Channel <= MR_CHANNEL_LAST)
|
||||||
{
|
{ // it's a memory channel
|
||||||
|
|
||||||
#ifndef ENABLE_KEEP_MEM_NAME
|
#ifndef ENABLE_KEEP_MEM_NAME
|
||||||
// clear/reset the channel name
|
// clear/reset the channel name
|
||||||
//memset(&State, 0xFF, sizeof(State));
|
//memset(&State, 0xFF, sizeof(State));
|
||||||
@@ -255,20 +259,15 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
|||||||
{
|
{
|
||||||
uint8_t State[8];
|
uint8_t State[8];
|
||||||
uint8_t Attributes = 0xFF; // default attributes
|
uint8_t Attributes = 0xFF; // default attributes
|
||||||
#ifdef ENABLE_COMPANDER
|
|
||||||
Attributes &= ~MR_CH_COMPAND; // default to '0' = compander disabled
|
|
||||||
#endif
|
|
||||||
uint16_t Offset = 0x0D60 + (Channel & ~7u);
|
uint16_t Offset = 0x0D60 + (Channel & ~7u);
|
||||||
|
|
||||||
|
Attributes &= (uint8_t)(~MR_CH_COMPAND); // default to '0' = compander disabled
|
||||||
|
|
||||||
EEPROM_ReadBuffer(Offset, State, sizeof(State));
|
EEPROM_ReadBuffer(Offset, State, sizeof(State));
|
||||||
|
|
||||||
if (keep)
|
if (keep)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_COMPANDER
|
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Compander << 4) | (pVFO->Band << 0);
|
||||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Compander << 4) | (pVFO->Band << 0);
|
|
||||||
#else
|
|
||||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Band << 0);
|
|
||||||
#endif
|
|
||||||
if (State[Channel & 7u] == Attributes)
|
if (State[Channel & 7u] == Attributes)
|
||||||
return; // no change in the attributes
|
return; // no change in the attributes
|
||||||
}
|
}
|
||||||
@@ -280,8 +279,9 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
|||||||
gMR_ChannelAttributes[Channel] = Attributes;
|
gMR_ChannelAttributes[Channel] = Attributes;
|
||||||
|
|
||||||
// #ifndef ENABLE_KEEP_MEM_NAME
|
// #ifndef ENABLE_KEEP_MEM_NAME
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (Channel <= MR_CHANNEL_LAST)
|
||||||
{
|
{ // it's a memory channel
|
||||||
|
|
||||||
const uint16_t OffsetMR = Channel * 16;
|
const uint16_t OffsetMR = Channel * 16;
|
||||||
if (!keep)
|
if (!keep)
|
||||||
{ // clear/reset the channel name
|
{ // clear/reset the channel name
|
||||||
|
|||||||
38
settings.h
38
settings.h
@@ -121,13 +121,21 @@ typedef struct {
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
uint8_t NoaaChannel[2];
|
uint8_t NoaaChannel[2];
|
||||||
#endif
|
#endif
|
||||||
uint8_t RX_CHANNEL;
|
uint8_t RX_VFO;
|
||||||
uint8_t TX_CHANNEL;
|
uint8_t TX_VFO;
|
||||||
|
|
||||||
uint8_t field7_0xa;
|
uint8_t field7_0xa;
|
||||||
uint8_t field8_0xb;
|
uint8_t field8_0xb;
|
||||||
|
|
||||||
uint32_t POWER_ON_PASSWORD;
|
#ifdef ENABLE_FMRADIO
|
||||||
|
uint16_t FM_SelectedFrequency;
|
||||||
|
uint8_t FM_SelectedChannel;
|
||||||
|
bool FM_IsMrMode;
|
||||||
|
uint16_t FM_FrequencyPlaying;
|
||||||
|
uint16_t FM_LowerLimit;
|
||||||
|
uint16_t FM_UpperLimit;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t SQUELCH_LEVEL;
|
uint8_t SQUELCH_LEVEL;
|
||||||
uint8_t TX_TIMEOUT_TIMER;
|
uint8_t TX_TIMEOUT_TIMER;
|
||||||
bool KEY_LOCK;
|
bool KEY_LOCK;
|
||||||
@@ -153,24 +161,9 @@ typedef struct {
|
|||||||
uint8_t field29_0x26;
|
uint8_t field29_0x26;
|
||||||
uint8_t field30_0x27;
|
uint8_t field30_0x27;
|
||||||
|
|
||||||
uint16_t VOX1_THRESHOLD;
|
|
||||||
uint16_t VOX0_THRESHOLD;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
uint16_t FM_SelectedFrequency;
|
|
||||||
uint8_t FM_SelectedChannel;
|
|
||||||
bool FM_IsMrMode;
|
|
||||||
uint16_t FM_FrequencyPlaying;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t field37_0x32;
|
uint8_t field37_0x32;
|
||||||
uint8_t field38_0x33;
|
uint8_t field38_0x33;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
uint16_t FM_LowerLimit;
|
|
||||||
uint16_t FM_UpperLimit;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool AUTO_KEYPAD_LOCK;
|
bool AUTO_KEYPAD_LOCK;
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
ALARM_Mode_t ALARM_MODE;
|
ALARM_Mode_t ALARM_MODE;
|
||||||
@@ -201,7 +194,7 @@ typedef struct {
|
|||||||
char DTMF_SEPARATE_CODE;
|
char DTMF_SEPARATE_CODE;
|
||||||
char DTMF_GROUP_CALL_CODE;
|
char DTMF_GROUP_CALL_CODE;
|
||||||
uint8_t DTMF_DECODE_RESPONSE;
|
uint8_t DTMF_DECODE_RESPONSE;
|
||||||
uint8_t DTMF_AUTO_RESET_TIME;
|
uint8_t DTMF_auto_reset_time;
|
||||||
uint16_t DTMF_PRELOAD_TIME;
|
uint16_t DTMF_PRELOAD_TIME;
|
||||||
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
||||||
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
||||||
@@ -216,11 +209,16 @@ typedef struct {
|
|||||||
uint8_t VOLUME_GAIN;
|
uint8_t VOLUME_GAIN;
|
||||||
uint8_t DAC_GAIN;
|
uint8_t DAC_GAIN;
|
||||||
|
|
||||||
|
VFO_Info_t VfoInfo[2];
|
||||||
|
uint32_t POWER_ON_PASSWORD;
|
||||||
|
uint16_t VOX1_THRESHOLD;
|
||||||
|
uint16_t VOX0_THRESHOLD;
|
||||||
|
|
||||||
uint8_t field77_0x95;
|
uint8_t field77_0x95;
|
||||||
uint8_t field78_0x96;
|
uint8_t field78_0x96;
|
||||||
uint8_t field79_0x97;
|
uint8_t field79_0x97;
|
||||||
|
|
||||||
VFO_Info_t VfoInfo[2];
|
uint8_t _pad[1];
|
||||||
} EEPROM_Config_t;
|
} EEPROM_Config_t;
|
||||||
extern EEPROM_Config_t gEeprom;
|
extern EEPROM_Config_t gEeprom;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
char gInputBox[8];
|
char gInputBox[8];
|
||||||
uint8_t gInputBoxIndex;
|
uint8_t gInputBoxIndex;
|
||||||
|
|
||||||
void INPUTBOX_Append(char Digit)
|
void INPUTBOX_Append(const KEY_Code_t Digit)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex >= sizeof(gInputBox))
|
if (gInputBoxIndex >= sizeof(gInputBox))
|
||||||
return;
|
return;
|
||||||
@@ -29,6 +29,7 @@ void INPUTBOX_Append(char Digit)
|
|||||||
if (gInputBoxIndex == 0)
|
if (gInputBoxIndex == 0)
|
||||||
memset(gInputBox, 10, sizeof(gInputBox));
|
memset(gInputBox, 10, sizeof(gInputBox));
|
||||||
|
|
||||||
gInputBox[gInputBoxIndex++] = Digit;
|
if (Digit >= KEY_0 && Digit != KEY_INVALID)
|
||||||
|
gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,12 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "driver/keyboard.h"
|
||||||
|
|
||||||
extern char gInputBox[8];
|
extern char gInputBox[8];
|
||||||
extern uint8_t gInputBoxIndex;
|
extern uint8_t gInputBoxIndex;
|
||||||
|
|
||||||
void INPUTBOX_Append(char Digit);
|
void INPUTBOX_Append(const KEY_Code_t Digit);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "ARMCM0.h"
|
#include "ARMCM0.h"
|
||||||
@@ -156,3 +158,5 @@ void UI_DisplayLock(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -17,7 +17,9 @@
|
|||||||
#ifndef UI_LOCK_H
|
#ifndef UI_LOCK_H
|
||||||
#define UI_LOCK_H
|
#define UI_LOCK_H
|
||||||
|
|
||||||
void UI_DisplayLock(void);
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
|
void UI_DisplayLock(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
266
ui/main.c
266
ui/main.c
@@ -14,6 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h> // abs()
|
#include <stdlib.h> // abs()
|
||||||
|
|
||||||
@@ -36,21 +40,31 @@
|
|||||||
#include "ui/main.h"
|
#include "ui/main.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
enum center_line_t {
|
|
||||||
CENTER_LINE_NONE = 0,
|
|
||||||
CENTER_LINE_IN_USE,
|
|
||||||
CENTER_LINE_AUDIO_BAR,
|
|
||||||
CENTER_LINE_RSSI,
|
|
||||||
CENTER_LINE_AM_FIX_DATA,
|
|
||||||
CENTER_LINE_DTMF_DEC,
|
|
||||||
CENTER_LINE_CHARGE_DATA
|
|
||||||
};
|
|
||||||
typedef enum center_line_t center_line_t;
|
|
||||||
|
|
||||||
center_line_t center_line = CENTER_LINE_NONE;
|
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:
|
||||||
|
case 7: memmove(p + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||||
|
case 6: memmove(p + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||||
|
case 5: memmove(p + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||||
|
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||||
|
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||||
|
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||||
|
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||||
|
case 0: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
|
|
||||||
unsigned int sqrt16(unsigned int value)
|
unsigned int sqrt16(unsigned int value)
|
||||||
@@ -80,52 +94,60 @@ center_line_t center_line = CENTER_LINE_NONE;
|
|||||||
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
|
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MAIN)
|
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||||
return;
|
gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
{
|
||||||
|
return; // screen is in use
|
||||||
|
}
|
||||||
|
|
||||||
#if 1
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
// TX audio level
|
if (gAlarmState != ALARM_STATE_OFF)
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
|
|
||||||
|
|
||||||
// const unsigned int max = 65535;
|
|
||||||
// const unsigned int level = ((voice_amp * bar_width) + (max / 2)) / max; // with rounding
|
|
||||||
// const unsigned int len = (level <= bar_width) ? level : bar_width;
|
|
||||||
|
|
||||||
// make non-linear to make more sensitive at low values
|
|
||||||
const unsigned int level = voice_amp * 8;
|
|
||||||
const unsigned int sqrt_level = sqrt16((level < 65535) ? level : 65535);
|
|
||||||
const unsigned int len = (sqrt_level <= bar_width) ? sqrt_level : bar_width;
|
|
||||||
|
|
||||||
#else
|
|
||||||
// TX/RX AF input level (dB)
|
|
||||||
|
|
||||||
const uint8_t af_tx_rx = BK4819_GetAfTxRx(); // 6:0
|
|
||||||
const unsigned int max = 63;
|
|
||||||
const unsigned int level = (((uint16_t)af_tx_rx * bar_width) + (max / 2)) / max; // with rounding
|
|
||||||
const unsigned int len = (level <= bar_width) ? level : bar_width;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t *p_line = gFrameBuffer[line];
|
{
|
||||||
|
#if 1
|
||||||
|
// TX audio level
|
||||||
|
|
||||||
memset(p_line, 0, LCD_WIDTH);
|
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
|
||||||
|
|
||||||
#if 1
|
// const unsigned int max = 65535;
|
||||||
// solid bar
|
// const unsigned int level = ((voice_amp * bar_width) + (max / 2)) / max; // with rounding
|
||||||
for (i = 0; i < bar_width; i++)
|
// const unsigned int len = (level <= bar_width) ? level : bar_width;
|
||||||
p_line[bar_x + i] = (i > len) ? ((i & 1) == 0) ? 0x41 : 0x00 : ((i & 1) == 0) ? 0x7f : 0x3e;
|
|
||||||
#else
|
|
||||||
// knuled bar
|
|
||||||
for (i = 0; i < bar_width; i += 2)
|
|
||||||
p_line[bar_x + i] = (i <= len) ? 0x7f : 0x41;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
// make non-linear to make more sensitive at low values
|
||||||
ST7565_BlitFullScreen();
|
const unsigned int level = voice_amp * 8;
|
||||||
|
const unsigned int sqrt_level = sqrt16((level < 65535) ? level : 65535);
|
||||||
|
const unsigned int len = (sqrt_level <= bar_width) ? sqrt_level : bar_width;
|
||||||
|
|
||||||
|
#else
|
||||||
|
// TX/RX AF input level (dB)
|
||||||
|
|
||||||
|
const uint8_t af_tx_rx = BK4819_GetAfTxRx(); // 6:0
|
||||||
|
const unsigned int max = 63;
|
||||||
|
const unsigned int level = (((uint16_t)af_tx_rx * bar_width) + (max / 2)) / max; // with rounding
|
||||||
|
const unsigned int len = (level <= bar_width) ? level : bar_width;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint8_t *p_line = gFrameBuffer[line];
|
||||||
|
|
||||||
|
memset(p_line, 0, LCD_WIDTH);
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
// solid bar
|
||||||
|
for (i = 0; i < bar_width; i++)
|
||||||
|
p_line[bar_x + i] = (i > len) ? ((i & 1) == 0) ? 0x41 : 0x00 : ((i & 1) == 0) ? 0x7f : 0x3e;
|
||||||
|
#else
|
||||||
|
// knuled bar
|
||||||
|
for (i = 0; i < bar_width; i += 2)
|
||||||
|
p_line[bar_x + i] = (i <= len) ? 0x7f : 0x41;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
|
ST7565_BlitFullScreen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -160,7 +182,10 @@ center_line_t center_line = CENTER_LINE_NONE;
|
|||||||
|
|
||||||
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
||||||
return; // display is in use
|
return; // display is in use
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN)
|
|
||||||
|
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
||||||
|
gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
return; // display is in use
|
return; // display is in use
|
||||||
|
|
||||||
if (now)
|
if (now)
|
||||||
@@ -198,6 +223,8 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
|||||||
{
|
{
|
||||||
#ifdef ENABLE_RSSI_BAR
|
#ifdef ENABLE_RSSI_BAR
|
||||||
|
|
||||||
|
(void)vfo; // unused
|
||||||
|
|
||||||
// optional larger RSSI dBm, S-point and bar level
|
// optional larger RSSI dBm, S-point and bar level
|
||||||
|
|
||||||
if (center_line != CENTER_LINE_RSSI)
|
if (center_line != CENTER_LINE_RSSI)
|
||||||
@@ -275,25 +302,12 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
|||||||
|
|
||||||
memset(p_line, 0, 23);
|
memset(p_line, 0, 23);
|
||||||
|
|
||||||
if (rssi_level > 0)
|
// untested !!!
|
||||||
{
|
|
||||||
//if (rssi_level >= 1)
|
if (rssi_level == 0)
|
||||||
memmove(p_line, BITMAP_Antenna, 5);
|
|
||||||
if (rssi_level >= 2)
|
|
||||||
memmove(p_line + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
|
||||||
if (rssi_level >= 3)
|
|
||||||
memmove(p_line + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
|
||||||
if (rssi_level >= 4)
|
|
||||||
memmove(p_line + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
|
||||||
if (rssi_level >= 5)
|
|
||||||
memmove(p_line + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
|
||||||
if (rssi_level >= 6)
|
|
||||||
memmove(p_line + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
|
||||||
if (rssi_level >= 7)
|
|
||||||
memmove(p_line + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
p_line = NULL;
|
p_line = NULL;
|
||||||
|
else
|
||||||
|
UI_drawBars(p_line, rssi_level);
|
||||||
|
|
||||||
ST7565_DrawLine(0, Line, 23, p_line);
|
ST7565_DrawLine(0, Line, 23, p_line);
|
||||||
#endif
|
#endif
|
||||||
@@ -330,13 +344,13 @@ void UI_DisplayMain(void)
|
|||||||
for (vfo_num = 0; vfo_num < 2; vfo_num++)
|
for (vfo_num = 0; vfo_num < 2; vfo_num++)
|
||||||
{
|
{
|
||||||
const unsigned int line = (vfo_num == 0) ? line0 : line1;
|
const unsigned int line = (vfo_num == 0) ? line0 : line1;
|
||||||
uint8_t channel = gEeprom.TX_CHANNEL;
|
unsigned int channel = gEeprom.TX_VFO;
|
||||||
// uint8_t tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
// unsigned int tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||||
const bool same_vfo = (channel == vfo_num) ? true : false;
|
const bool same_vfo = (channel == vfo_num) ? true : false;
|
||||||
uint8_t *p_line0 = gFrameBuffer[line + 0];
|
uint8_t *p_line0 = gFrameBuffer[line + 0];
|
||||||
uint8_t *p_line1 = gFrameBuffer[line + 1];
|
uint8_t *p_line1 = gFrameBuffer[line + 1];
|
||||||
uint8_t mode = 0;
|
unsigned int mode = 0;
|
||||||
uint8_t state;
|
unsigned int state;
|
||||||
|
|
||||||
if (single_vfo)
|
if (single_vfo)
|
||||||
{ // we're in single VFO mode - screen is dedicated to just one VFO
|
{ // we're in single VFO mode - screen is dedicated to just one VFO
|
||||||
@@ -348,7 +362,7 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
|
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
|
||||||
channel = gEeprom.RX_CHANNEL; // we're currently monitoring the other VFO
|
channel = gEeprom.RX_VFO; // we're currently monitoring the other VFO
|
||||||
|
|
||||||
if (channel != vfo_num)
|
if (channel != vfo_num)
|
||||||
{
|
{
|
||||||
@@ -426,7 +440,7 @@ void UI_DisplayMain(void)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||||
if (channel == vfo_num)
|
if (channel == vfo_num)
|
||||||
{ // show the TX symbol
|
{ // show the TX symbol
|
||||||
mode = 1;
|
mode = 1;
|
||||||
@@ -444,7 +458,7 @@ void UI_DisplayMain(void)
|
|||||||
if ((gCurrentFunction == FUNCTION_RECEIVE ||
|
if ((gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
gCurrentFunction == FUNCTION_MONITOR ||
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
gCurrentFunction == FUNCTION_INCOMING) &&
|
gCurrentFunction == FUNCTION_INCOMING) &&
|
||||||
gEeprom.RX_CHANNEL == vfo_num)
|
gEeprom.RX_VFO == vfo_num)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_SMALL_BOLD
|
#ifdef ENABLE_SMALL_BOLD
|
||||||
UI_PrintStringSmallBold("RX", 14, 0, line);
|
UI_PrintStringSmallBold("RX", 14, 0, line);
|
||||||
@@ -454,10 +468,10 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
|
if (gEeprom.ScreenChannel[vfo_num] <= MR_CHANNEL_LAST)
|
||||||
{ // channel mode
|
{ // channel mode
|
||||||
const unsigned int x = 2;
|
const unsigned int x = 2;
|
||||||
const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) ? false : true;
|
const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num) ? false : true;
|
||||||
if (!inputting)
|
if (!inputting)
|
||||||
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number
|
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number
|
||||||
else
|
else
|
||||||
@@ -477,7 +491,7 @@ void UI_DisplayMain(void)
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num)
|
if (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num)
|
||||||
{ // channel number
|
{ // channel number
|
||||||
sprintf(String, "N%u", 1 + gEeprom.ScreenChannel[vfo_num] - NOAA_CHANNEL_FIRST);
|
sprintf(String, "N%u", 1 + gEeprom.ScreenChannel[vfo_num] - NOAA_CHANNEL_FIRST);
|
||||||
}
|
}
|
||||||
@@ -496,7 +510,7 @@ void UI_DisplayMain(void)
|
|||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
|
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
|
||||||
{
|
{
|
||||||
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||||
if (channel == vfo_num)
|
if (channel == vfo_num)
|
||||||
state = VFO_STATE_ALARM;
|
state = VFO_STATE_ALARM;
|
||||||
}
|
}
|
||||||
@@ -505,11 +519,11 @@ void UI_DisplayMain(void)
|
|||||||
if (state != VFO_STATE_NORMAL)
|
if (state != VFO_STATE_NORMAL)
|
||||||
{
|
{
|
||||||
const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"};
|
const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"};
|
||||||
if (state >= 0 && state < ARRAY_SIZE(state_list))
|
if (state < ARRAY_SIZE(state_list))
|
||||||
UI_PrintString(state_list[state], 31, 0, line, 8);
|
UI_PrintString(state_list[state], 31, 0, line, 8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
|
if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_VFO == vfo_num)
|
||||||
{ // user entering a frequency
|
{ // user entering a frequency
|
||||||
UI_DisplayFrequency(gInputBox, 32, line, true, false);
|
UI_DisplayFrequency(gInputBox, 32, line, true, false);
|
||||||
|
|
||||||
@@ -520,13 +534,13 @@ void UI_DisplayMain(void)
|
|||||||
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
|
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
{ // transmitting
|
{ // transmitting
|
||||||
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||||
if (channel == vfo_num)
|
if (channel == vfo_num)
|
||||||
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
|
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
|
if (gEeprom.ScreenChannel[vfo_num] <= MR_CHANNEL_LAST)
|
||||||
{ // channel mode
|
{ // it's a channel
|
||||||
|
|
||||||
// show the channel symbols
|
// show the channel symbols
|
||||||
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||||
@@ -535,12 +549,17 @@ void UI_DisplayMain(void)
|
|||||||
if (attributes & MR_CH_SCANLIST2)
|
if (attributes & MR_CH_SCANLIST2)
|
||||||
memmove(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
|
memmove(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
|
||||||
#ifndef ENABLE_BIG_FREQ
|
#ifndef ENABLE_BIG_FREQ
|
||||||
#ifdef ENABLE_COMPANDER
|
if ((attributes & MR_CH_COMPAND) > 0)
|
||||||
if ((attributes & MR_CH_COMPAND) > 0)
|
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||||
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
#else
|
||||||
#endif
|
|
||||||
|
// TODO: // find somewhere else to put the symbol
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
||||||
{
|
{
|
||||||
case MDF_FREQUENCY: // show the channel frequency
|
case MDF_FREQUENCY: // show the channel frequency
|
||||||
@@ -590,6 +609,8 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // frequency mode
|
{ // frequency mode
|
||||||
@@ -605,16 +626,14 @@ void UI_DisplayMain(void)
|
|||||||
UI_PrintString(String, 32, 0, line, 8);
|
UI_PrintString(String, 32, 0, line, 8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
// show the channel symbols
|
||||||
// show the channel symbols
|
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||||
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
if ((attributes & MR_CH_COMPAND) > 0)
|
||||||
if ((attributes & MR_CH_COMPAND) > 0)
|
#ifdef ENABLE_BIG_FREQ
|
||||||
#ifdef ENABLE_BIG_FREQ
|
memmove(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
|
||||||
memmove(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
|
#else
|
||||||
#else
|
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||||
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
#endif
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,23 +661,7 @@ void UI_DisplayMain(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Level >= 1)
|
UI_drawBars(p_line1 + LCD_WIDTH, Level);
|
||||||
{
|
|
||||||
uint8_t *p_line = p_line1 + LCD_WIDTH;
|
|
||||||
memmove(p_line + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
|
||||||
if (Level >= 2)
|
|
||||||
memmove(p_line + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
|
||||||
if (Level >= 3)
|
|
||||||
memmove(p_line + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
|
||||||
if (Level >= 4)
|
|
||||||
memmove(p_line + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
|
||||||
if (Level >= 5)
|
|
||||||
memmove(p_line + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
|
||||||
if (Level >= 6)
|
|
||||||
memmove(p_line + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
|
||||||
if (Level >= 7)
|
|
||||||
memmove(p_line + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************
|
// ************
|
||||||
@@ -673,7 +676,7 @@ void UI_DisplayMain(void)
|
|||||||
const FREQ_Config_t *pConfig = (mode == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
|
const FREQ_Config_t *pConfig = (mode == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
|
||||||
const unsigned int code_type = pConfig->CodeType;
|
const unsigned int code_type = pConfig->CodeType;
|
||||||
const char *code_list[] = {"", "CT", "DCS", "DCR"};
|
const char *code_list[] = {"", "CT", "DCS", "DCR"};
|
||||||
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list))
|
if (code_type < ARRAY_SIZE(code_list))
|
||||||
strcpy(String, code_list[code_type]);
|
strcpy(String, code_list[code_type]);
|
||||||
}
|
}
|
||||||
UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, line + 1);
|
UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, line + 1);
|
||||||
@@ -682,7 +685,7 @@ void UI_DisplayMain(void)
|
|||||||
{ // show the TX power
|
{ // show the TX power
|
||||||
const char pwr_list[] = "LMH";
|
const char pwr_list[] = "LMH";
|
||||||
const unsigned int i = gEeprom.VfoInfo[vfo_num].OUTPUT_POWER;
|
const unsigned int i = gEeprom.VfoInfo[vfo_num].OUTPUT_POWER;
|
||||||
String[0] = (i >= 0 && i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
|
String[0] = (i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
|
||||||
String[1] = '\0';
|
String[1] = '\0';
|
||||||
UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, line + 1);
|
UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, line + 1);
|
||||||
}
|
}
|
||||||
@@ -736,10 +739,14 @@ void UI_DisplayMain(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
|
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
|
||||||
if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
|
if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].AM_mode && gSetting_AM_fix)
|
||||||
{
|
{
|
||||||
|
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
center_line = CENTER_LINE_AM_FIX_DATA;
|
center_line = CENTER_LINE_AM_FIX_DATA;
|
||||||
AM_fix_print_data(gEeprom.RX_CHANNEL, String);
|
AM_fix_print_data(gEeprom.RX_VFO, String);
|
||||||
UI_PrintStringSmall(String, 2, 0, 3);
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -749,7 +756,7 @@ void UI_DisplayMain(void)
|
|||||||
if (rx)
|
if (rx)
|
||||||
{
|
{
|
||||||
center_line = CENTER_LINE_RSSI;
|
center_line = CENTER_LINE_RSSI;
|
||||||
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
|
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_VFO], false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -761,7 +768,13 @@ void UI_DisplayMain(void)
|
|||||||
{ // show live DTMF decode
|
{ // show live DTMF decode
|
||||||
const unsigned int len = strlen(gDTMF_RX_live);
|
const unsigned int len = strlen(gDTMF_RX_live);
|
||||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||||
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
center_line = CENTER_LINE_DTMF_DEC;
|
center_line = CENTER_LINE_DTMF_DEC;
|
||||||
|
|
||||||
strcpy(String, "DTMF ");
|
strcpy(String, "DTMF ");
|
||||||
strcat(String, gDTMF_RX_live + idx);
|
strcat(String, gDTMF_RX_live + idx);
|
||||||
UI_PrintStringSmall(String, 2, 0, 3);
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
@@ -771,7 +784,13 @@ void UI_DisplayMain(void)
|
|||||||
{ // show live DTMF decode
|
{ // show live DTMF decode
|
||||||
const unsigned int len = gDTMF_RX_index;
|
const unsigned int len = gDTMF_RX_index;
|
||||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||||
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
center_line = CENTER_LINE_DTMF_DEC;
|
center_line = CENTER_LINE_DTMF_DEC;
|
||||||
|
|
||||||
strcpy(String, "DTMF ");
|
strcpy(String, "DTMF ");
|
||||||
strcat(String, gDTMF_RX + idx);
|
strcat(String, gDTMF_RX + idx);
|
||||||
UI_PrintStringSmall(String, 2, 0, 3);
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
@@ -782,7 +801,12 @@ void UI_DisplayMain(void)
|
|||||||
else
|
else
|
||||||
if (gChargingWithTypeC)
|
if (gChargingWithTypeC)
|
||||||
{ // charging .. show the battery state
|
{ // charging .. show the battery state
|
||||||
|
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
center_line = CENTER_LINE_CHARGE_DATA;
|
center_line = CENTER_LINE_CHARGE_DATA;
|
||||||
|
|
||||||
sprintf(String, "Charge %u.%02uV %u%%",
|
sprintf(String, "Charge %u.%02uV %u%%",
|
||||||
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
||||||
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||||
|
|||||||
13
ui/main.h
13
ui/main.h
@@ -17,6 +17,19 @@
|
|||||||
#ifndef UI_MAIN_H
|
#ifndef UI_MAIN_H
|
||||||
#define UI_MAIN_H
|
#define UI_MAIN_H
|
||||||
|
|
||||||
|
enum center_line_t {
|
||||||
|
CENTER_LINE_NONE = 0,
|
||||||
|
CENTER_LINE_IN_USE,
|
||||||
|
CENTER_LINE_AUDIO_BAR,
|
||||||
|
CENTER_LINE_RSSI,
|
||||||
|
CENTER_LINE_AM_FIX_DATA,
|
||||||
|
CENTER_LINE_DTMF_DEC,
|
||||||
|
CENTER_LINE_CHARGE_DATA
|
||||||
|
};
|
||||||
|
typedef enum center_line_t center_line_t;
|
||||||
|
|
||||||
|
extern center_line_t center_line;
|
||||||
|
|
||||||
void UI_DisplayAudioBar(void);
|
void UI_DisplayAudioBar(void);
|
||||||
void UI_UpdateRSSI(const int16_t rssi, const int vfo);
|
void UI_UpdateRSSI(const int16_t rssi, const int vfo);
|
||||||
void UI_DisplayMain(void);
|
void UI_DisplayMain(void);
|
||||||
|
|||||||
205
ui/menu.c
205
ui/menu.c
@@ -18,6 +18,7 @@
|
|||||||
#include <stdlib.h> // abs()
|
#include <stdlib.h> // abs()
|
||||||
|
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
|
#include "app/menu.h"
|
||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "dcs.h"
|
#include "dcs.h"
|
||||||
@@ -42,97 +43,97 @@ const t_menu_item MenuList[] =
|
|||||||
{
|
{
|
||||||
// text, voice ID, menu ID
|
// text, voice ID, menu ID
|
||||||
|
|
||||||
{"SQL", VOICE_ID_SQUELCH, MENU_SQL },
|
{"SQL", VOICE_ID_SQUELCH, MENU_SQL },
|
||||||
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
||||||
{"T PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
{"T PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||||
{"R DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
{"R DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||||
{"R CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
{"R CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||||
{"T DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
{"T DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||||
{"T CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
{"T CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||||
{"T DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
{"T DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||||
{"T OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
{"T OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||||
{"T VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
{"T VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
||||||
{"T TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
{"T TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||||
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
||||||
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||||
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
||||||
{"CH SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
{"CH SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||||
{"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
{"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||||
{"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
{"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||||
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||||
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||||
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
#ifdef ENABLE_VOX
|
||||||
{"BLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
||||||
{"BLT RX", VOICE_ID_INVALID, MENU_ABR_ON_RX },
|
#endif
|
||||||
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
{"BLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||||
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
{"BLTTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX },
|
||||||
|
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
||||||
|
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||||
#endif
|
#endif
|
||||||
{"SC REV", VOICE_ID_INVALID, MENU_SC_REV },
|
{"SC REV", VOICE_ID_INVALID, MENU_SC_REV },
|
||||||
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||||
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||||
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||||
{"STE", VOICE_ID_INVALID, MENU_STE },
|
{"STE", VOICE_ID_INVALID, MENU_STE },
|
||||||
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
|
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
|
||||||
{"MIC", VOICE_ID_INVALID, MENU_MIC },
|
{"MIC", VOICE_ID_INVALID, MENU_MIC },
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
|
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COMPANDER
|
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
|
||||||
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
|
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
||||||
#endif
|
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
|
||||||
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
|
||||||
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
|
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
|
||||||
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
|
|
||||||
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
|
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||||
#endif
|
#endif
|
||||||
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||||
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
|
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
|
||||||
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
|
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
|
||||||
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||||
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
|
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||||
{"D RSP", VOICE_ID_INVALID, MENU_D_RSP },
|
{"D RSP", VOICE_ID_INVALID, MENU_D_RSP },
|
||||||
{"D HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
|
{"D HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||||
{"D PRE", VOICE_ID_INVALID, MENU_D_PRE },
|
{"D PRE", VOICE_ID_INVALID, MENU_D_PRE },
|
||||||
{"D DCD", VOICE_ID_INVALID, MENU_D_DCD },
|
{"D DCD", VOICE_ID_INVALID, MENU_D_DCD },
|
||||||
{"D LIST", VOICE_ID_INVALID, MENU_D_LIST },
|
{"D LIST", VOICE_ID_INVALID, MENU_D_LIST },
|
||||||
{"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
{"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||||
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
|
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
|
||||||
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
|
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
|
||||||
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||||
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
|
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||||
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
{"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX },
|
{"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
{"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
|
{"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1 },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
||||||
#endif
|
#endif
|
||||||
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||||
|
|
||||||
// hidden menu items from here on
|
// hidden menu items from here on
|
||||||
// enabled if pressing both the PTT and upper side button at power-on
|
// enabled if pressing both the PTT and upper side button at power-on
|
||||||
|
|
||||||
{"F LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
|
{"F LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
|
||||||
{"TX 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
{"TX 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
||||||
{"TX 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
{"TX 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
||||||
{"TX 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
{"TX 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||||
{"350 EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
{"350 EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||||
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||||
|
|
||||||
{"TX EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
{"TX EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
{"F CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
{"F CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||||
#endif
|
#endif
|
||||||
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
||||||
|
|
||||||
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_TXP[3][5] =
|
const char gSubMenu_TXP[3][5] =
|
||||||
@@ -239,12 +240,13 @@ const char gSubMenu_D_RSP[4][11] =
|
|||||||
"BOTH"
|
"BOTH"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_PTT_ID[4][7] =
|
const char gSubMenu_PTT_ID[5][15] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"OFF",
|
||||||
"KEY UP",
|
"KEY\nUP",
|
||||||
"KEY DN",
|
"KEY\nDOWN",
|
||||||
"BOTH"
|
"KEY\nUP+DOWN",
|
||||||
|
"APOLLO\nQUINDAR"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_PONMSG[4][8] =
|
const char gSubMenu_PONMSG[4][8] =
|
||||||
@@ -290,15 +292,13 @@ const char gSubMenu_BACKLIGHT[8][7] =
|
|||||||
"ON"
|
"ON"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
const char gSubMenu_RX_TX[4][6] =
|
||||||
const char gSubMenu_Compand[4][6] =
|
{
|
||||||
{
|
"OFF",
|
||||||
"OFF",
|
"TX",
|
||||||
"TX",
|
"RX",
|
||||||
"RX",
|
"TX/RX"
|
||||||
"TX/RX"
|
};
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
const char gSubMenu_AM_fix_test1[4][8] =
|
const char gSubMenu_AM_fix_test1[4][8] =
|
||||||
@@ -437,6 +437,9 @@ void UI_DisplayMenu(void)
|
|||||||
|
|
||||||
bool already_printed = false;
|
bool already_printed = false;
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (gMenuCursor)
|
switch (gMenuCursor)
|
||||||
{
|
{
|
||||||
case MENU_SQL:
|
case MENU_SQL:
|
||||||
@@ -557,12 +560,14 @@ void UI_DisplayMenu(void)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
if (gSubMenuSelection == 0)
|
case MENU_VOX:
|
||||||
strcpy(String, "OFF");
|
if (gSubMenuSelection == 0)
|
||||||
else
|
strcpy(String, "OFF");
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
else
|
||||||
break;
|
sprintf(String, "%d", gSubMenuSelection);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case MENU_ABR:
|
case MENU_ABR:
|
||||||
strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]);
|
strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]);
|
||||||
@@ -583,16 +588,14 @@ void UI_DisplayMenu(void)
|
|||||||
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "AUTO");
|
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "AUTO");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
case MENU_ABR_ON_TX_RX:
|
||||||
strcpy(String, gSubMenu_Compand[gSubMenuSelection]);
|
strcpy(String, gSubMenu_RX_TX[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
case MENU_AM_FIX:
|
case MENU_AM_FIX:
|
||||||
#endif
|
#endif
|
||||||
case MENU_ABR_ON_RX:
|
|
||||||
case MENU_BCL:
|
case MENU_BCL:
|
||||||
case MENU_BEEP:
|
case MENU_BEEP:
|
||||||
case MENU_S_ADD1:
|
case MENU_S_ADD1:
|
||||||
@@ -710,7 +713,10 @@ void UI_DisplayMenu(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
sprintf(String, "LIST%u", gSubMenuSelection);
|
if (gSubMenuSelection < 2)
|
||||||
|
sprintf(String, "LIST%u", 1 + gSubMenuSelection);
|
||||||
|
else
|
||||||
|
strcpy(String, "ALL");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@@ -787,8 +793,7 @@ void UI_DisplayMenu(void)
|
|||||||
const uint32_t value = 22656 + gSubMenuSelection;
|
const uint32_t value = 22656 + gSubMenuSelection;
|
||||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||||
|
|
||||||
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value
|
writeXtalFreqCal(gSubMenuSelection, false);
|
||||||
BK4819_WriteRegister(BK4819_REG_3B, value);
|
|
||||||
|
|
||||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||||
gSubMenuSelection,
|
gSubMenuSelection,
|
||||||
@@ -805,6 +810,8 @@ void UI_DisplayMenu(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
if (!already_printed)
|
if (!already_printed)
|
||||||
{ // we now do multi-line text in a single string
|
{ // we now do multi-line text in a single string
|
||||||
|
|
||||||
|
|||||||
12
ui/menu.h
12
ui/menu.h
@@ -49,9 +49,11 @@ enum
|
|||||||
MENU_MEM_NAME,
|
MENU_MEM_NAME,
|
||||||
MENU_MDF,
|
MENU_MDF,
|
||||||
MENU_SAVE,
|
MENU_SAVE,
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
MENU_VOX,
|
MENU_VOX,
|
||||||
|
#endif
|
||||||
MENU_ABR,
|
MENU_ABR,
|
||||||
MENU_ABR_ON_RX,
|
MENU_ABR_ON_TX_RX,
|
||||||
MENU_TDR,
|
MENU_TDR,
|
||||||
MENU_BEEP,
|
MENU_BEEP,
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -67,9 +69,7 @@ enum
|
|||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
MENU_MIC_BAR,
|
MENU_MIC_BAR,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COMPANDER
|
|
||||||
MENU_COMPAND,
|
MENU_COMPAND,
|
||||||
#endif
|
|
||||||
MENU_1_CALL,
|
MENU_1_CALL,
|
||||||
MENU_S_LIST,
|
MENU_S_LIST,
|
||||||
MENU_SLIST1,
|
MENU_SLIST1,
|
||||||
@@ -139,15 +139,13 @@ extern const char gSubMenu_MDF[4][15];
|
|||||||
extern const char gSubMenu_AL_MOD[2][5];
|
extern const char gSubMenu_AL_MOD[2][5];
|
||||||
#endif
|
#endif
|
||||||
extern const char gSubMenu_D_RSP[4][11];
|
extern const char gSubMenu_D_RSP[4][11];
|
||||||
extern const char gSubMenu_PTT_ID[4][7];
|
extern const char gSubMenu_PTT_ID[5][15];
|
||||||
extern const char gSubMenu_PONMSG[4][8];
|
extern const char gSubMenu_PONMSG[4][8];
|
||||||
extern const char gSubMenu_ROGER[3][9];
|
extern const char gSubMenu_ROGER[3][9];
|
||||||
extern const char gSubMenu_RESET[2][4];
|
extern const char gSubMenu_RESET[2][4];
|
||||||
extern const char gSubMenu_F_LOCK[6][4];
|
extern const char gSubMenu_F_LOCK[6][4];
|
||||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||||
#ifdef ENABLE_COMPANDER
|
extern const char gSubMenu_RX_TX[4][6];
|
||||||
extern const char gSubMenu_Compand[4][6];
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
extern const char gSubMenu_AM_fix_test1[4][8];
|
extern const char gSubMenu_AM_fix_test1[4][8];
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
84
ui/status.c
84
ui/status.c
@@ -94,12 +94,26 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
// SCAN indicator
|
// SCAN indicator
|
||||||
if (gScanState != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
||||||
{
|
{
|
||||||
memmove(line + x, BITMAP_SC, sizeof(BITMAP_SC));
|
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||||
x1 = x + sizeof(BITMAP_SC);
|
{ // 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
|
||||||
|
{ // frequency mode
|
||||||
|
UI_PrintStringSmallBuffer("S", line + x);
|
||||||
|
}
|
||||||
|
x1 = x + 7;
|
||||||
}
|
}
|
||||||
x += sizeof(BITMAP_SC);
|
x += 7; // font character width
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
// VOICE indicator
|
// VOICE indicator
|
||||||
@@ -131,13 +145,15 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
}
|
}
|
||||||
x += sizeof(BITMAP_XB);
|
x += sizeof(BITMAP_XB);
|
||||||
|
|
||||||
// VOX indicator
|
#ifdef ENABLE_VOX
|
||||||
if (gEeprom.VOX_SWITCH || test_display)
|
// VOX indicator
|
||||||
{
|
if (gEeprom.VOX_SWITCH || test_display)
|
||||||
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
{
|
||||||
x1 = x + sizeof(BITMAP_VOX);
|
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||||
}
|
x1 = x + sizeof(BITMAP_VOX);
|
||||||
x += sizeof(BITMAP_VOX);
|
}
|
||||||
|
x += sizeof(BITMAP_VOX);
|
||||||
|
#endif
|
||||||
|
|
||||||
// KEY-LOCK indicator
|
// KEY-LOCK indicator
|
||||||
if (gEeprom.KEY_LOCK || test_display)
|
if (gEeprom.KEY_LOCK || test_display)
|
||||||
@@ -208,23 +224,37 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
|
|
||||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||||
line += sizeof(BITMAP_BatteryLevel1);
|
line += sizeof(BITMAP_BatteryLevel1);
|
||||||
if (gBatteryDisplayLevel >= 2)
|
{
|
||||||
memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
const int8_t pos[] = {-4, -7, -10, 13};
|
||||||
if (gBatteryDisplayLevel >= 3)
|
for (unsigned int i = 0; i < ARRAY_SIZE(pos); i++)
|
||||||
memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
if (gBatteryDisplayLevel >= (2 + i))
|
||||||
if (gBatteryDisplayLevel >= 4)
|
memmove(line + pos[i], BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (gBatteryDisplayLevel >= 5)
|
/* switch (gBatteryDisplayLevel)
|
||||||
memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
{
|
||||||
|
default:
|
||||||
|
case 5: memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 4: memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 3: memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 2: memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
}
|
||||||
|
*/ }
|
||||||
#else
|
#else
|
||||||
if (gBatteryDisplayLevel >= 2)
|
{
|
||||||
memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
const int8_t pos[] = {3, 6, 9, 12};
|
||||||
if (gBatteryDisplayLevel >= 3)
|
for (unsigned int i = 0; i < ARRAY_SIZE(pos); i++)
|
||||||
memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
if (gBatteryDisplayLevel >= (2 + i))
|
||||||
if (gBatteryDisplayLevel >= 4)
|
memmove(line + pos[i], BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
/*
|
||||||
if (gBatteryDisplayLevel >= 5)
|
switch (gBatteryDisplayLevel)
|
||||||
memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
{
|
||||||
|
default:
|
||||||
|
case 5: memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 4: memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 3: memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 2: memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
}
|
||||||
|
*/ }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
2
ui/ui.c
2
ui/ui.c
@@ -84,7 +84,7 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
|||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
gIsInSubMenu = false;
|
gIsInSubMenu = false;
|
||||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||||
gScanState = SCAN_OFF;
|
gScanStateDir = SCAN_OFF;
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
gFM_ScanState = FM_SCAN_OFF;
|
gFM_ScanState = FM_SCAN_OFF;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
123
utils/main.cpp
123
utils/main.cpp
@@ -93,15 +93,29 @@ void create_gain_table(const char *filename)
|
|||||||
mixer_dB[orig_mixer] +
|
mixer_dB[orig_mixer] +
|
||||||
pga_dB[orig_pga];
|
pga_dB[orig_pga];
|
||||||
|
|
||||||
const uint8_t lna_short_min = 0; // 0
|
#if 1
|
||||||
const uint8_t lna_min = 0; // 0
|
// full table
|
||||||
const uint8_t mixer_min = 0; // 0
|
const uint8_t lna_short_min = 0; // 0
|
||||||
const uint8_t pga_min = 0; // 0
|
const uint8_t lna_min = 0; // 0
|
||||||
|
const uint8_t mixer_min = 0; // 0
|
||||||
|
const uint8_t pga_min = 0; // 0
|
||||||
|
|
||||||
const uint8_t lna_short_max = 3; // 3
|
const uint8_t lna_short_max = 3; // 3
|
||||||
const uint8_t lna_max = 7; // 5
|
const uint8_t lna_max = 7; // 5
|
||||||
const uint8_t mixer_max = 3; // 3
|
const uint8_t mixer_max = 3; // 3
|
||||||
const uint8_t pga_max = 7; // 7
|
const uint8_t pga_max = 7; // 7
|
||||||
|
#else
|
||||||
|
// just one register changes
|
||||||
|
const uint8_t lna_short_min = 0;
|
||||||
|
const uint8_t lna_min = 2;
|
||||||
|
const uint8_t mixer_min = 3;
|
||||||
|
const uint8_t pga_min = 6;
|
||||||
|
|
||||||
|
const uint8_t lna_short_max = 3;
|
||||||
|
const uint8_t lna_max = 2;
|
||||||
|
const uint8_t mixer_max = 3;
|
||||||
|
const uint8_t pga_max = 6;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t lna_short = lna_short_min;
|
uint8_t lna_short = lna_short_min;
|
||||||
uint8_t lna = lna_min;
|
uint8_t lna = lna_min;
|
||||||
@@ -244,37 +258,90 @@ void create_gain_table(const char *filename)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf(file, "\n");
|
fprintf(file, "\n");
|
||||||
fprintf(file, "\tconst t_am_fix_gain_table am_fix_gain_table[] =\n");
|
fprintf(file, "\tstatic const t_am_fix_gain_table am_fix_gain_table[] =\n");
|
||||||
fprintf(file, "\t{\n");
|
fprintf(file, "\t{\n");
|
||||||
fprintf(file, "\t\t{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original\n\n");
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < gain_table.size(); i++)
|
#if 0
|
||||||
|
fprintf(file, "\t\t{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original\n\n");
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < gain_table.size(); i++)
|
||||||
|
{
|
||||||
|
char s[1024];
|
||||||
|
|
||||||
|
const t_gain_table entry = gain_table[i];
|
||||||
|
|
||||||
|
sprintf(s, "\t\t{%u, %u, %u, %u}, // %3u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
||||||
|
entry.lna_short,
|
||||||
|
entry.lna,
|
||||||
|
entry.mixer,
|
||||||
|
entry.pga,
|
||||||
|
1 + i,
|
||||||
|
entry.lna_short_dB,
|
||||||
|
entry.lna_dB,
|
||||||
|
entry.mixer_dB,
|
||||||
|
entry.pga_dB,
|
||||||
|
entry.sum_dB);
|
||||||
|
|
||||||
|
if (i == original_index)
|
||||||
|
strcat(s, " original");
|
||||||
|
|
||||||
|
fprintf(file, "%s\n", s);
|
||||||
|
}
|
||||||
|
#else
|
||||||
{
|
{
|
||||||
char s[1024];
|
//BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
||||||
|
|
||||||
const t_gain_table entry = gain_table[i];
|
uint16_t reg_val;
|
||||||
|
int16_t sum_dB;
|
||||||
|
|
||||||
sprintf(s, "\t\t{%u, %u, %u, %u}, // %3u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
reg_val = ((uint16_t)orig_lna_short << 8) | ((uint16_t)orig_lna << 5) | ((uint16_t)orig_mixer << 3) | ((uint16_t)orig_pga << 0);
|
||||||
entry.lna_short,
|
sum_dB = lna_short_dB[orig_lna_short] + lna_dB[orig_lna] + mixer_dB[orig_mixer] + pga_dB[orig_pga];
|
||||||
entry.lna,
|
fprintf(file, "\t\t{0x%04X, %-3d}, // 0 .. %u %u %u %u .. 0dB -14dB 0dB -3dB .. -17dB original\n\n",
|
||||||
entry.mixer,
|
reg_val,
|
||||||
entry.pga,
|
sum_dB,
|
||||||
1 + i,
|
orig_lna_short,
|
||||||
entry.lna_short_dB,
|
orig_lna,
|
||||||
entry.lna_dB,
|
orig_mixer,
|
||||||
entry.mixer_dB,
|
orig_pga);
|
||||||
entry.pga_dB,
|
|
||||||
entry.sum_dB);
|
|
||||||
|
|
||||||
if (i == original_index)
|
for (unsigned int i = 0; i < gain_table.size(); i++)
|
||||||
strcat(s, " original");
|
{
|
||||||
|
char s[1024];
|
||||||
|
|
||||||
fprintf(file, "%s\n", s);
|
const t_gain_table entry = gain_table[i];
|
||||||
|
|
||||||
|
reg_val = ((uint16_t)entry.lna_short << 8) | ((uint16_t)entry.lna << 5) | ((uint16_t)entry.mixer << 3) | ((uint16_t)entry.pga << 0);
|
||||||
|
sum_dB = lna_short_dB[entry.lna_short] + lna_dB[entry.lna] + mixer_dB[entry.mixer] + pga_dB[entry.pga];
|
||||||
|
|
||||||
|
sprintf(s, "\t\t{0x%04X, %-3d}, // %3u .. %u %u %u %u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
||||||
|
reg_val,
|
||||||
|
sum_dB,
|
||||||
|
|
||||||
|
1 + i,
|
||||||
|
|
||||||
|
entry.lna_short,
|
||||||
|
entry.lna,
|
||||||
|
entry.mixer,
|
||||||
|
entry.pga,
|
||||||
|
|
||||||
|
entry.lna_short_dB,
|
||||||
|
entry.lna_dB,
|
||||||
|
entry.mixer_dB,
|
||||||
|
entry.pga_dB,
|
||||||
|
|
||||||
|
entry.sum_dB);
|
||||||
|
|
||||||
|
if (i == original_index)
|
||||||
|
strcat(s, " original");
|
||||||
|
|
||||||
|
fprintf(file, "%s\n", s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(file, "\t};\n\n");
|
fprintf(file, "\t};\n\n");
|
||||||
|
|
||||||
fprintf(file, "\tconst unsigned int original_index = %u;\n", 1 + original_index);
|
fprintf(file, "\tstatic const unsigned int original_index = %u;\n", 1 + original_index);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
utils/misc.exe
BIN
utils/misc.exe
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user