Compare commits
208 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
140b5f4b4a | ||
|
|
3e0ea6f7de | ||
|
|
ed64c7fb49 | ||
|
|
d70fa1b7b4 | ||
|
|
a41628410e | ||
|
|
f7c25b482d | ||
|
|
ac3cd08163 | ||
|
|
c1657a37f2 | ||
|
|
a2580d5d8d | ||
|
|
5d4f7529ed | ||
|
|
20a3e3b605 | ||
|
|
f3cc0f5acf | ||
|
|
2086bd6aaa | ||
|
|
3b3db88e5e | ||
|
|
f6791395cc | ||
|
|
8739996668 | ||
|
|
1740583ccc | ||
|
|
b12244e352 | ||
|
|
e6ac0d1d8d | ||
|
|
eda199d47a | ||
|
|
012c375f2e | ||
|
|
4a96dfa6ce | ||
|
|
ec10aec0c4 | ||
|
|
49c2c6b405 | ||
|
|
38b1e5cbaa | ||
|
|
9a64a18010 | ||
|
|
72eddd009b | ||
|
|
77d58eb8f5 | ||
|
|
856dbe083d | ||
|
|
50cc34ad9b | ||
|
|
c996577a0b | ||
|
|
e877820594 | ||
|
|
8ab123c927 | ||
|
|
a510b89c6a | ||
|
|
8b41a1fa66 | ||
|
|
99fc8a8311 | ||
|
|
5c3eea2fcb | ||
|
|
ffb26a1f86 | ||
|
|
a8ae1b7739 | ||
|
|
b59df11bd6 | ||
|
|
146c8dede4 | ||
|
|
c2090676d8 | ||
|
|
b29bae88f1 | ||
|
|
c55a40481d | ||
|
|
a37a1ca6ef | ||
|
|
8629b1b867 | ||
|
|
f7c0d4149b | ||
|
|
87fd5c19d0 | ||
|
|
d132969c91 | ||
|
|
a5fa0b1e4b | ||
|
|
a21c8a62ac | ||
|
|
9fd3701f46 | ||
|
|
1d95737088 | ||
|
|
2f7042056a | ||
|
|
13b41abce6 | ||
|
|
b9f9566158 | ||
|
|
710a417e12 | ||
|
|
f11d0fbcda | ||
|
|
96144af9e9 | ||
|
|
4dd2445833 | ||
|
|
6172d942be | ||
|
|
0c0cbb232c | ||
|
|
298ff29cf4 | ||
|
|
f70707e17f | ||
|
|
f1fc04591c | ||
|
|
a26c397417 | ||
|
|
d3a2a7bee9 | ||
|
|
d817ff7e6a | ||
|
|
ec4bec5b1f | ||
|
|
d7c458839c | ||
|
|
cff2f25e56 | ||
|
|
63ac84883e | ||
|
|
f8252df281 | ||
|
|
be00bb99ad | ||
|
|
7e6a78ab6c | ||
|
|
06c2ddf543 | ||
|
|
47f1e80252 | ||
|
|
64bc29d362 | ||
|
|
8d17f5922c | ||
|
|
063dc61e65 | ||
|
|
60ccd3372f | ||
|
|
149a0f5bdc | ||
|
|
c7da7cf725 | ||
|
|
4b9147327a | ||
|
|
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 | ||
|
|
6d0aea4587 | ||
|
|
ec2d6e4a74 | ||
|
|
b301a8d21e | ||
|
|
339e280a27 | ||
|
|
f8aaf47374 | ||
|
|
84e174544d | ||
|
|
ac05207ef0 | ||
|
|
9d5d36cc1f | ||
|
|
c5c86d0ad0 | ||
|
|
010ea0308a | ||
|
|
b3ca095af1 | ||
|
|
6a3a26c470 | ||
|
|
2551077cef | ||
|
|
2397e3950b | ||
|
|
d11e7863dc | ||
|
|
35c7530036 | ||
|
|
87d1cf7c86 | ||
|
|
bf2564b9f5 | ||
|
|
c59e0ea06c | ||
|
|
9ac3525683 | ||
|
|
3ac330ddee | ||
|
|
af342cf904 | ||
|
|
ec33203403 | ||
|
|
3c7f496f3e | ||
|
|
174c06dfbf | ||
|
|
d86ccaafcd | ||
|
|
d826ecb0ae | ||
|
|
e0aa1a83be | ||
|
|
e64bf6bbd6 | ||
|
|
aafc93c2ee | ||
|
|
58eced120e | ||
|
|
bbf8a7061e | ||
|
|
aea80cb046 | ||
|
|
4333fdeb3a | ||
|
|
a9aa37e043 | ||
|
|
1fc1a102ea | ||
|
|
86d2dade7a | ||
|
|
6f7bb75b52 | ||
|
|
82b8f6755f | ||
|
|
8caff25b7c | ||
|
|
c644b30b2f | ||
|
|
de174d072c | ||
|
|
c3c344daec | ||
|
|
fc1bc8791c | ||
|
|
5c413eb7cd | ||
|
|
fa4ae2caa6 | ||
|
|
e092145542 | ||
|
|
5ba5b9f2eb | ||
|
|
4fb8f7b0e7 | ||
|
|
0f210ff872 | ||
|
|
b45043aab2 | ||
|
|
ba3decad78 | ||
|
|
7df7461d31 | ||
|
|
b7241f77ef | ||
|
|
ae6cf797cb | ||
|
|
618a184bf1 | ||
|
|
b0f6be2c7c | ||
|
|
aba9e435f2 | ||
|
|
6546f9d4ce | ||
|
|
1eac6018ba | ||
|
|
f32eeda636 | ||
|
|
9493f34c23 |
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
||||
firmware
|
||||
/firmware.packed.bin
|
||||
/firmware.bin
|
||||
/compiled-firmware
|
||||
|
||||
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM archlinux:latest
|
||||
RUN pacman -Syyu base-devel --noconfirm
|
||||
RUN pacman -Syyu arm-none-eabi-gcc --noconfirm
|
||||
RUN pacman -Syyu arm-none-eabi-newlib --noconfirm
|
||||
RUN pacman -Syyu git --noconfirm
|
||||
RUN pacman -Syyu python-pip --noconfirm
|
||||
RUN pacman -Syyu python-crcmod --noconfirm
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
RUN git submodule update --init --recursive
|
||||
#RUN make && cp firmware* compiled-firmware/
|
||||
157
Makefile
@@ -3,38 +3,54 @@
|
||||
# 0 = disable
|
||||
# 1 = enable
|
||||
#
|
||||
ENABLE_CLANG := 0
|
||||
ENABLE_SWD := 0
|
||||
ENABLE_OVERLAY := 1
|
||||
ENABLE_OVERLAY := 0
|
||||
ENABLE_LTO := 1
|
||||
ENABLE_UART := 1
|
||||
ENABLE_AIRCOPY := 0
|
||||
ENABLE_FMRADIO := 0
|
||||
ENABLE_FMRADIO := 1
|
||||
ENABLE_NOAA := 0
|
||||
ENABLE_VOICE := 0
|
||||
ENABLE_ALARM := 1
|
||||
ENABLE_VOX := 1
|
||||
ENABLE_ALARM := 0
|
||||
ENABLE_TX1750 := 0
|
||||
ENABLE_PWRON_PASSWORD := 0
|
||||
ENABLE_BIG_FREQ := 1
|
||||
ENABLE_SMALL_BOLD := 1
|
||||
ENABLE_KEEP_MEM_NAME := 1
|
||||
ENABLE_WIDE_RX := 1
|
||||
ENABLE_TX_WHEN_AM := 0
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||
ENABLE_MAIN_KEY_HOLD := 1
|
||||
ENABLE_F_CAL_MENU := 0
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0
|
||||
ENABLE_BOOT_BEEPS := 0
|
||||
ENABLE_COMPANDER := 1
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 1
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||
ENABLE_NO_SCAN_TIMEOUT := 1
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 0
|
||||
ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||
ENABLE_AM_FIX := 1
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1
|
||||
ENABLE_SQUELCH1_LOWER := 0
|
||||
ENABLE_AM_FIX_SHOW_DATA := 0
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 1
|
||||
ENABLE_RSSI_BAR := 1
|
||||
ENABLE_AUDIO_BAR := 1
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
ENABLE_SPECTRUM := 1
|
||||
#ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||
#ENABLE_BAND_SCOPE := 1
|
||||
ENABLE_REDUCE_LOW_MID_TX_POWER:= 0
|
||||
|
||||
#############################################################
|
||||
|
||||
TARGET = firmware
|
||||
|
||||
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
|
||||
ENABLE_OVERLAY := 0
|
||||
endif
|
||||
|
||||
BSP_DEFINITIONS := $(wildcard hardware/*/*.def)
|
||||
BSP_HEADERS := $(patsubst hardware/%,bsp/%,$(BSP_DEFINITIONS))
|
||||
BSP_HEADERS := $(patsubst %.def,%.h,$(BSP_HEADERS))
|
||||
@@ -87,6 +103,7 @@ ifeq ($(ENABLE_FMRADIO),1)
|
||||
OBJS += app/fm.o
|
||||
endif
|
||||
OBJS += app/generic.o
|
||||
OBJS += app/common.o
|
||||
OBJS += app/main.o
|
||||
OBJS += app/menu.o
|
||||
ifeq ($(ENABLE_SPECTRUM), 1)
|
||||
@@ -96,7 +113,9 @@ OBJS += app/scanner.o
|
||||
ifeq ($(ENABLE_UART),1)
|
||||
OBJS += app/uart.o
|
||||
endif
|
||||
OBJS += am_fix.o
|
||||
ifeq ($(ENABLE_AM_FIX), 1)
|
||||
OBJS += am_fix.o
|
||||
endif
|
||||
OBJS += audio.o
|
||||
OBJS += bitmaps.o
|
||||
OBJS += board.o
|
||||
@@ -119,7 +138,9 @@ ifeq ($(ENABLE_FMRADIO),1)
|
||||
endif
|
||||
OBJS += ui/helper.o
|
||||
OBJS += ui/inputbox.o
|
||||
OBJS += ui/lock.o
|
||||
ifeq ($(ENABLE_PWRON_PASSWORD),1)
|
||||
OBJS += ui/lock.o
|
||||
endif
|
||||
OBJS += ui/main.o
|
||||
OBJS += ui/menu.o
|
||||
OBJS += ui/scanner.o
|
||||
@@ -129,15 +150,28 @@ OBJS += ui/welcome.o
|
||||
OBJS += version.o
|
||||
OBJS += main.o
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifeq ($(OS), Windows_NT)
|
||||
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
else
|
||||
TOP := $(shell pwd)
|
||||
endif
|
||||
|
||||
AS = arm-none-eabi-gcc
|
||||
CC = arm-none-eabi-gcc
|
||||
|
||||
CC =
|
||||
LD = arm-none-eabi-gcc
|
||||
|
||||
ifeq ($(ENABLE_CLANG),0)
|
||||
CC += arm-none-eabi-gcc
|
||||
# Use GCC's linker to avoid undefined symbol errors
|
||||
# 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
|
||||
SIZE = arm-none-eabi-size
|
||||
|
||||
@@ -153,10 +187,30 @@ ifeq ($(ENABLE_OVERLAY),1)
|
||||
ASFLAGS += -DENABLE_OVERLAY
|
||||
endif
|
||||
|
||||
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
||||
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD
|
||||
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
|
||||
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
|
||||
CFLAGS =
|
||||
ifeq ($(ENABLE_CLANG),0)
|
||||
CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
||||
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD
|
||||
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
|
||||
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
|
||||
else
|
||||
# Oz needed to make it fit on flash
|
||||
CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
||||
endif
|
||||
|
||||
ifeq ($(ENABLE_LTO),1)
|
||||
CFLAGS += -flto=2
|
||||
else
|
||||
# We get most of the space savings if LTO creates problems
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
endif
|
||||
|
||||
# May cause unhelpful build failures
|
||||
#CFLAGS += -Wpadded
|
||||
|
||||
# catch any and all warnings
|
||||
CFLAGS += -Wextra
|
||||
#CFLAGS += -Wpedantic
|
||||
|
||||
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
||||
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
||||
@@ -167,15 +221,15 @@ endif
|
||||
ifeq ($(ENABLE_SWD),1)
|
||||
CFLAGS += -DENABLE_SWD
|
||||
endif
|
||||
ifeq ($(ENABLE_OVERLAY),1)
|
||||
CFLAGS += -DENABLE_OVERLAY
|
||||
endif
|
||||
ifeq ($(ENABLE_AIRCOPY),1)
|
||||
CFLAGS += -DENABLE_AIRCOPY
|
||||
endif
|
||||
ifeq ($(ENABLE_FMRADIO),1)
|
||||
CFLAGS += -DENABLE_FMRADIO
|
||||
endif
|
||||
ifeq ($(ENABLE_OVERLAY),1)
|
||||
CFLAGS += -DENABLE_OVERLAY
|
||||
endif
|
||||
ifeq ($(ENABLE_UART),1)
|
||||
CFLAGS += -DENABLE_UART
|
||||
endif
|
||||
@@ -191,11 +245,20 @@ endif
|
||||
ifeq ($(ENABLE_VOICE),1)
|
||||
CFLAGS += -DENABLE_VOICE
|
||||
endif
|
||||
ifeq ($(ENABLE_VOX),1)
|
||||
CFLAGS += -DENABLE_VOX
|
||||
endif
|
||||
ifeq ($(ENABLE_ALARM),1)
|
||||
CFLAGS += -DENABLE_ALARM
|
||||
endif
|
||||
ifeq ($(ENABLE_TX1750),1)
|
||||
CFLAGS += -DENABLE_TX1750
|
||||
endif
|
||||
ifeq ($(ENABLE_PWRON_PASSWORD),1)
|
||||
CFLAGS += -DENABLE_PWRON_PASSWORD
|
||||
endif
|
||||
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
|
||||
CFLAGS += -DKEEP_MEM_NAME
|
||||
CFLAGS += -DENABLE_KEEP_MEM_NAME
|
||||
endif
|
||||
ifeq ($(ENABLE_WIDE_RX),1)
|
||||
CFLAGS += -DENABLE_WIDE_RX
|
||||
@@ -203,26 +266,23 @@ endif
|
||||
ifeq ($(ENABLE_TX_WHEN_AM),1)
|
||||
CFLAGS += -DENABLE_TX_WHEN_AM
|
||||
endif
|
||||
ifeq ($(ENABLE_F_CAL_MENU),1)
|
||||
CFLAGS += -DENABLE_F_CAL_MENU
|
||||
endif
|
||||
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
||||
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||
endif
|
||||
ifeq ($(ENABLE_MAIN_KEY_HOLD),1)
|
||||
CFLAGS += -DENABLE_MAIN_KEY_HOLD
|
||||
endif
|
||||
ifeq ($(ENABLE_BOOT_BEEPS),1)
|
||||
CFLAGS += -DENABLE_BOOT_BEEPS
|
||||
endif
|
||||
ifeq ($(ENABLE_COMPANDER),1)
|
||||
CFLAGS += -DENABLE_COMPANDER
|
||||
endif
|
||||
ifeq ($(ENABLE_SHOW_CHARGE_LEVEL),1)
|
||||
CFLAGS += -DENABLE_SHOW_CHARGE_LEVEL
|
||||
endif
|
||||
ifeq ($(ENABLE_REVERSE_BAT_SYMBOL),1)
|
||||
CFLAGS += -DENABLE_REVERSE_BAT_SYMBOL
|
||||
endif
|
||||
ifeq ($(ENABLE_NO_SCAN_TIMEOUT),1)
|
||||
CFLAGS += -DENABLE_NO_SCAN_TIMEOUT
|
||||
ifeq ($(ENABLE_CODE_SCAN_TIMEOUT),1)
|
||||
CFLAGS += -DENABLE_CODE_SCAN_TIMEOUT
|
||||
endif
|
||||
ifeq ($(ENABLE_AM_FIX),1)
|
||||
CFLAGS += -DENABLE_AM_FIX
|
||||
@@ -233,8 +293,14 @@ endif
|
||||
ifeq ($(ENABLE_AM_FIX_TEST1),1)
|
||||
CFLAGS += -DENABLE_AM_FIX_TEST1
|
||||
endif
|
||||
ifeq ($(ENABLE_SQUELCH1_LOWER),1)
|
||||
CFLAGS += -DENABLE_SQUELCH1_LOWER
|
||||
ifeq ($(ENABLE_SQUELCH_MORE_SENSITIVE),1)
|
||||
CFLAGS += -DENABLE_SQUELCH_MORE_SENSITIVE
|
||||
endif
|
||||
ifeq ($(ENABLE_FASTER_CHANNEL_SCAN),1)
|
||||
CFLAGS += -DENABLE_FASTER_CHANNEL_SCAN
|
||||
endif
|
||||
ifeq ($(ENABLE_BACKLIGHT_ON_RX),1)
|
||||
CFLAGS += -DENABLE_BACKLIGHT_ON_RX
|
||||
endif
|
||||
ifeq ($(ENABLE_RSSI_BAR),1)
|
||||
CFLAGS += -DENABLE_RSSI_BAR
|
||||
@@ -251,12 +317,29 @@ endif
|
||||
ifeq ($(ENABLE_BAND_SCOPE),1)
|
||||
CFLAGS += -DENABLE_BAND_SCOPE
|
||||
endif
|
||||
ifeq ($(ENABLE_REDUCE_LOW_MID_TX_POWER),1)
|
||||
CFLAGS += -DENABLE_REDUCE_LOW_MID_TX_POWER
|
||||
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)
|
||||
ASFLAGS += -g
|
||||
CFLAGS += -g
|
||||
CFLAGS += -g
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
|
||||
144
README.md
@@ -1,10 +1,21 @@
|
||||
# Main features:
|
||||
- OneOfEleven mods, including AM fix
|
||||
- fagci spectrum analyzer
|
||||
- better battery percentage calculation (based on real measurement)
|
||||
- many of OneOfEleven mods, including AM fix
|
||||
- fagci spectrum analyzer (**F+5** to turn on)
|
||||
- some other smaller mods introduced by me
|
||||
|
||||
Go to [Wiki](https://github.com/egzumer/uv-k5-firmware-custom/wiki) to learn more.
|
||||
|
||||
<img src="images/main.jpg" width=300 /><img src="images/spectrum.jpg" width=300 /><img src="images/audiobar.jpg" width=300 /><img src="images/rssibar.jpg" width=300 />
|
||||
|
||||
❗❗❗You can now calibrate the battery voltage reading in the radio menu.
|
||||
|
||||
<img src="images/batcal.jpg" width=300 />
|
||||
|
||||
To enter the calibration:
|
||||
|
||||
1. turn the radio on while holding PTT and the first side button
|
||||
2. go to BATCAL option and adjust the voltage with UP/DOWN buttons
|
||||
3. confirm the setting, calibration will be saved to EEPROM
|
||||
|
||||
|
||||
# Open reimplementation of the Quan Sheng UV-K5 v2.1.27 firmware
|
||||
@@ -16,57 +27,79 @@ https://github.com/fagci/uv-k5-firmware-fagci-mod/tree/refactor
|
||||
|
||||
All is a cloned and customized version of DualTachyon's open firmware found here ..
|
||||
|
||||
https://github.com/DualTachyon/uv-k5-firmware
|
||||
https://github.com/DualTachyon/uv-k5-firmware .. a cool achievement !
|
||||
|
||||
A cool achievement
|
||||
Use this firmware at your own risk (entirely). There is absolutely no guarantee that it will work in any way shape or form on your radio(s), it may even brick your radio(s), in which case, you'd need to buy another radio.
|
||||
Anyway, have fun.
|
||||
|
||||
# Radio performance
|
||||
|
||||
Please note that the Quansheng uv-k radios are not professional quality transceivers, their
|
||||
performance is strictly limited, somewhat below that of a decent transceiver. The RX front
|
||||
end has no track-tuned band pass filtering at all, and so are wide band/wide open to any
|
||||
and all signals over a wide frequency range. Using the radio in high intensity RF environments
|
||||
will nearly always destroy your reception, the receiver simply doesn't have a great dynamic
|
||||
range, though are quite sensitive (weak signal wise).
|
||||
Please note that the Quansheng UV-Kx radios are not professional quality transceivers, their
|
||||
performance is strictly limited. The RX front end has no track-tuned band pass filtering
|
||||
at all, and so are wide band/wide open to any and all signals over a large frequency range.
|
||||
|
||||
Saying that, they are nice toys for the price, fun to play with.
|
||||
Using the radio in high intensity RF environments will most likely make reception anything but
|
||||
easy (AM mode will suffer far more than FM ever will), the receiver simply doesn't have a
|
||||
great dynamic range, which results in distorted AM audio with stronger RX'ed signals.
|
||||
There is nothing more anyone can do in firmware/software to improve that, once the RX gain
|
||||
adjustment I do (AM fix) reaches the hardwares limit, your AM RX audio will be all but
|
||||
non-existant (just like Quansheng's firmware).
|
||||
On the other hand, FM RX audio will/should be fine.
|
||||
|
||||
But, they are nice toys for the price, fun to play with.
|
||||
|
||||
# User customization
|
||||
|
||||
You can customize the firmware by enabling/disabling various compile options.
|
||||
You can customize the firmware by enabling/disabling various compile options, this allows
|
||||
us to remove certain firmware features in order to make room in the flash for others.
|
||||
You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) ..
|
||||
|
||||
```
|
||||
ENABLE_CLANG := 0 **experimental, builds with clang instead of gcc (LTO will be disabled if you enable this)
|
||||
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
|
||||
ENABLE_OVERLAY := 1 cpu FLASH stuff
|
||||
ENABLE_UART := 1 without this you can't configure radio via PC
|
||||
ENABLE_AIRCOPY := 0 easier to just enter frequency
|
||||
ENABLE_FMRADIO := 1 WBFM VHF band 2 RX
|
||||
ENABLE_NOAA := 0 everything NOAA
|
||||
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed
|
||||
ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this)
|
||||
ENABLE_UART := 1 without this you can't configure radio via PC !
|
||||
ENABLE_AIRCOPY := 0 easier to just enter frequency with butts
|
||||
ENABLE_FMRADIO := 0 WBFM VHF broadcast band receiver
|
||||
ENABLE_NOAA := 0 everything NOAA (only of any use in the USA)
|
||||
ENABLE_VOICE := 0 want to hear voices ?
|
||||
ENABLE_VOX := 0
|
||||
ENABLE_ALARM := 0 TX alarms
|
||||
ENABLE_BIG_FREQ := 0 big font frequencies
|
||||
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
|
||||
ENABLE_PWRON_PASSWORD := 1 power-on password stuff
|
||||
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
|
||||
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
|
||||
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
|
||||
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though frontend not tuned over full range)
|
||||
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-end/PA not designed for full range)
|
||||
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
|
||||
ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
||||
ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead hold down keys 0-9 to access the functions
|
||||
ENABLE_BOOT_BEEPS := 0 give user audio feedback on volume knob position at boot-up
|
||||
ENABLE_COMPANDER := 1 compander option (per channel)
|
||||
ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up
|
||||
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_NO_SCAN_TIMEOUT := 1 remove the 32 sec timeout from the CTCSS/DCS scan (press exit butt to end scan)
|
||||
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation - ignore the on-screen RSSI (for now)
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix
|
||||
ENABLE_SQUELCH1_LOWER := 0 adjusts squelch setting '1' to be more sensitive - I plan to let user adjust it in the menu
|
||||
ENABLE_RSSI_BAR := 1 enable a dBm/Sx RSSI bar graph level
|
||||
ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan)
|
||||
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 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_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
|
||||
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
|
||||
#ENABLE_COPY_CHAN_TO_VFO := 1 not yet implemented - copy the channel into the VFO
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1 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_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
|
||||
|
||||
* Various Quansheng firmware bugs fixed
|
||||
@@ -86,28 +119,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.
|
||||
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
|
||||
|
||||
To build the firmware, you need to fetch the submodules and then run make:
|
||||
```
|
||||
git submodule update --init --recursive --depth=1
|
||||
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.
|
||||
|
||||
To compile directly in windows without the need of a linux virtual machine:
|
||||
|
||||
```
|
||||
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
|
||||
To compile directly in windows:
|
||||
|
||||
3. You may (or not) need to manualy add gcc path to you OS environment PATH.
|
||||
ie add C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin
|
||||
|
||||
4. You may (or not) need to reboot your PC after installing the above
|
||||
```
|
||||
|
||||
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.
|
||||
1. Open windows command line and run:
|
||||
```
|
||||
winget install -e -h git.git Python.Python.3.8 GnuWin32.Make
|
||||
winget install -e -h Arm.GnuArmEmbeddedToolchain -v "10 2021.10"
|
||||
```
|
||||
2. Close command line, open a new one and run:
|
||||
```
|
||||
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.
|
||||
|
||||
@@ -115,6 +158,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:
|
||||
|
||||
* [OneOfEleven](https://github.com/OneOfEleven)
|
||||
* [DualTachyon](https://github.com/DualTachyon)
|
||||
* [Mikhail](https://github.com/fagci)
|
||||
* [Andrej](https://github.com/Tunas1337)
|
||||
@@ -148,13 +192,13 @@ You may obtain a copy of the License at
|
||||
# Example changes/updates
|
||||
|
||||
<p float="left">
|
||||
<img src="/image1.png" width=300 />
|
||||
<img src="/image2.png" width=300 />
|
||||
<img src="/image3.png" width=300 />
|
||||
<img src="/images/image1.png" width=300 />
|
||||
<img src="/images/image2.png" width=300 />
|
||||
<img src="/images/image3.png" width=300 />
|
||||
</p>
|
||||
|
||||
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>
|
||||
|
||||
332
am_fix.c
@@ -30,30 +30,13 @@
|
||||
#include "functions.h"
|
||||
#include "misc.h"
|
||||
|
||||
// original QS front end register settings
|
||||
const uint8_t orig_lna_short = 3; // 0dB
|
||||
const uint8_t orig_lna = 2; // -14dB
|
||||
const uint8_t orig_mixer = 3; // 0dB
|
||||
const uint8_t orig_pga = 6; // -3dB
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#if 1
|
||||
// bitfields take up less flash bytes
|
||||
uint8_t lna_short:2; // 0 ~ 3
|
||||
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;
|
||||
uint16_t reg_val;
|
||||
int8_t gain_dB;
|
||||
} __attribute__((packed)) t_gain_table;
|
||||
|
||||
// REG_10 AGC gain table
|
||||
//
|
||||
@@ -68,10 +51,10 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
// <7:5> = LNA Gain
|
||||
// 7 = 0dB
|
||||
// 6 = -2dB
|
||||
// 5 = -4dB
|
||||
// 5 = -4dB < original value
|
||||
// 4 = -6dB
|
||||
// 3 = -9dB
|
||||
// 2 = -14dB < original value
|
||||
// 2 = -14dB
|
||||
// 1 = -19dB
|
||||
// 0 = -24dB
|
||||
//
|
||||
@@ -103,141 +86,140 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
// 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[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
||||
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 pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
||||
//// 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_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 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};
|
||||
|
||||
// lookup table is hugely easier than writing code to do the same
|
||||
//
|
||||
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
|
||||
|
||||
// test table that lets me manually set the lna-short register
|
||||
// to measure it's actual dB change using an RF signal generator
|
||||
|
||||
{0, 2, 3, 6}, // 1 .. -33dB -14dB 0dB -3dB .. -50dB
|
||||
{1, 2, 3, 6}, // 2 .. -30dB -14dB 0dB -3dB .. -47dB
|
||||
{2, 2, 3, 6}, // 3 .. -24dB -14dB 0dB -3dB .. -41dB
|
||||
{3, 2, 3, 6} // 4 .. 0dB -14dB 0dB -3dB .. -17dB
|
||||
{0x005E, -50}, // 1 .. 0 2 3 6 .. -33dB -14dB 0dB -3dB .. -50dB
|
||||
{0x015E, -47}, // 2 .. 1 2 3 6 .. -30dB -14dB 0dB -3dB .. -47dB
|
||||
{0x025E, -41}, // 3 .. 2 2 3 6 .. -24dB -14dB 0dB -3dB .. -41dB
|
||||
{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
|
||||
|
||||
{0, 0, 0, 0}, // 1 .. -33dB -24dB -8dB -33dB .. -98dB
|
||||
{0, 0, 1, 0}, // 2 .. -33dB -24dB -6dB -33dB .. -96dB
|
||||
{1, 0, 0, 0}, // 3 .. -30dB -24dB -8dB -33dB .. -95dB
|
||||
{0, 1, 0, 0}, // 4 .. -33dB -19dB -8dB -33dB .. -93dB
|
||||
{0, 0, 0, 1}, // 5 .. -33dB -24dB -8dB -27dB .. -92dB
|
||||
{0, 1, 1, 0}, // 6 .. -33dB -19dB -6dB -33dB .. -91dB
|
||||
{0, 0, 1, 1}, // 7 .. -33dB -24dB -6dB -27dB .. -90dB
|
||||
{1, 0, 0, 1}, // 8 .. -30dB -24dB -8dB -27dB .. -89dB
|
||||
{0, 1, 2, 0}, // 9 .. -33dB -19dB -3dB -33dB .. -88dB
|
||||
{1, 0, 3, 0}, // 10 .. -30dB -24dB 0dB -33dB .. -87dB
|
||||
{0, 0, 0, 2}, // 11 .. -33dB -24dB -8dB -21dB .. -86dB
|
||||
{1, 1, 2, 0}, // 12 .. -30dB -19dB -3dB -33dB .. -85dB
|
||||
{0, 0, 3, 1}, // 13 .. -33dB -24dB 0dB -27dB .. -84dB
|
||||
{0, 3, 0, 0}, // 14 .. -33dB -9dB -8dB -33dB .. -83dB
|
||||
{1, 1, 3, 0}, // 15 .. -30dB -19dB 0dB -33dB .. -82dB
|
||||
{1, 0, 3, 1}, // 16 .. -30dB -24dB 0dB -27dB .. -81dB
|
||||
{0, 2, 3, 0}, // 17 .. -33dB -14dB 0dB -33dB .. -80dB
|
||||
{1, 2, 0, 1}, // 18 .. -30dB -14dB -8dB -27dB .. -79dB
|
||||
{0, 3, 2, 0}, // 19 .. -33dB -9dB -3dB -33dB .. -78dB
|
||||
{1, 4, 0, 0}, // 20 .. -30dB -6dB -8dB -33dB .. -77dB
|
||||
{1, 1, 3, 1}, // 21 .. -30dB -19dB 0dB -27dB .. -76dB
|
||||
{0, 0, 2, 3}, // 22 .. -33dB -24dB -3dB -15dB .. -75dB
|
||||
{1, 3, 0, 1}, // 23 .. -30dB -9dB -8dB -27dB .. -74dB
|
||||
{1, 6, 0, 0}, // 24 .. -30dB -2dB -8dB -33dB .. -73dB
|
||||
{0, 7, 1, 0}, // 25 .. -33dB 0dB -6dB -33dB .. -72dB
|
||||
{0, 6, 2, 0}, // 26 .. -33dB -2dB -3dB -33dB .. -71dB
|
||||
{2, 1, 3, 1}, // 27 .. -24dB -19dB 0dB -27dB .. -70dB
|
||||
{0, 3, 1, 2}, // 28 .. -33dB -9dB -6dB -21dB .. -69dB
|
||||
{0, 0, 0, 6}, // 29 .. -33dB -24dB -8dB -3dB .. -68dB
|
||||
{0, 5, 2, 1}, // 30 .. -33dB -4dB -3dB -27dB .. -67dB
|
||||
{0, 0, 1, 6}, // 31 .. -33dB -24dB -6dB -3dB .. -66dB
|
||||
{1, 2, 3, 2}, // 32 .. -30dB -14dB 0dB -21dB .. -65dB
|
||||
{2, 1, 1, 3}, // 33 .. -24dB -19dB -6dB -15dB .. -64dB
|
||||
{1, 7, 3, 0}, // 34 .. -30dB 0dB 0dB -33dB .. -63dB
|
||||
{1, 3, 0, 3}, // 35 .. -30dB -9dB -8dB -15dB .. -62dB
|
||||
{0, 1, 2, 5}, // 36 .. -33dB -19dB -3dB -6dB .. -61dB
|
||||
{2, 0, 2, 4}, // 37 .. -24dB -24dB -3dB -9dB .. -60dB
|
||||
{1, 6, 3, 1}, // 38 .. -30dB -2dB 0dB -27dB .. -59dB
|
||||
{1, 2, 0, 5}, // 39 .. -30dB -14dB -8dB -6dB .. -58dB
|
||||
{2, 5, 0, 2}, // 40 .. -24dB -4dB -8dB -21dB .. -57dB
|
||||
{2, 6, 2, 1}, // 41 .. -24dB -2dB -3dB -27dB .. -56dB
|
||||
{0, 5, 2, 3}, // 42 .. -33dB -4dB -3dB -15dB .. -55dB
|
||||
{2, 0, 2, 6}, // 43 .. -24dB -24dB -3dB -3dB .. -54dB
|
||||
{0, 3, 0, 6}, // 44 .. -33dB -9dB -8dB -3dB .. -53dB
|
||||
{0, 6, 0, 4}, // 45 .. -33dB -2dB -8dB -9dB .. -52dB
|
||||
{0, 3, 1, 6}, // 46 .. -33dB -9dB -6dB -3dB .. -51dB
|
||||
{1, 2, 3, 5}, // 47 .. -30dB -14dB 0dB -6dB .. -50dB
|
||||
{0, 5, 1, 5}, // 48 .. -33dB -4dB -6dB -6dB .. -49dB
|
||||
{0, 3, 3, 5}, // 49 .. -33dB -9dB 0dB -6dB .. -48dB
|
||||
{0, 6, 2, 4}, // 50 .. -33dB -2dB -3dB -9dB .. -47dB
|
||||
{1, 5, 2, 4}, // 51 .. -30dB -4dB -3dB -9dB .. -46dB
|
||||
{3, 0, 1, 3}, // 52 .. 0dB -24dB -6dB -15dB .. -45dB
|
||||
{0, 6, 1, 6}, // 53 .. -33dB -2dB -6dB -3dB .. -44dB
|
||||
{1, 5, 2, 5}, // 54 .. -30dB -4dB -3dB -6dB .. -43dB
|
||||
{0, 4, 2, 7}, // 55 .. -33dB -6dB -3dB 0dB .. -42dB
|
||||
{2, 2, 2, 7}, // 56 .. -24dB -14dB -3dB 0dB .. -41dB
|
||||
{2, 5, 2, 4}, // 57 .. -24dB -4dB -3dB -9dB .. -40dB
|
||||
{2, 3, 3, 5}, // 58 .. -24dB -9dB 0dB -6dB .. -39dB
|
||||
{1, 6, 3, 5}, // 59 .. -30dB -2dB 0dB -6dB .. -38dB
|
||||
{2, 5, 1, 6}, // 60 .. -24dB -4dB -6dB -3dB .. -37dB
|
||||
{3, 3, 3, 1}, // 61 .. 0dB -9dB 0dB -27dB .. -36dB
|
||||
{3, 2, 3, 2}, // 62 .. 0dB -14dB 0dB -21dB .. -35dB
|
||||
{2, 5, 2, 6}, // 63 .. -24dB -4dB -3dB -3dB .. -34dB
|
||||
{3, 0, 1, 6}, // 64 .. 0dB -24dB -6dB -3dB .. -33dB
|
||||
{3, 0, 0, 7}, // 65 .. 0dB -24dB -8dB 0dB .. -32dB
|
||||
{2, 5, 3, 6}, // 66 .. -24dB -4dB 0dB -3dB .. -31dB
|
||||
{3, 3, 3, 2}, // 67 .. 0dB -9dB 0dB -21dB .. -30dB
|
||||
{2, 6, 3, 6}, // 68 .. -24dB -2dB 0dB -3dB .. -29dB
|
||||
{3, 2, 0, 5}, // 69 .. 0dB -14dB -8dB -6dB .. -28dB
|
||||
{3, 5, 0, 3}, // 70 .. 0dB -4dB -8dB -15dB .. -27dB
|
||||
{3, 3, 0, 4}, // 71 .. 0dB -9dB -8dB -9dB .. -26dB
|
||||
{3, 1, 1, 7}, // 72 .. 0dB -19dB -6dB 0dB .. -25dB
|
||||
{3, 4, 2, 3}, // 73 .. 0dB -6dB -3dB -15dB .. -24dB
|
||||
{3, 4, 0, 4}, // 74 .. 0dB -6dB -8dB -9dB .. -23dB
|
||||
{3, 2, 0, 7}, // 75 .. 0dB -14dB -8dB 0dB .. -22dB
|
||||
{3, 7, 1, 3}, // 76 .. 0dB 0dB -6dB -15dB .. -21dB
|
||||
{3, 6, 2, 3}, // 77 .. 0dB -2dB -3dB -15dB .. -20dB
|
||||
{3, 5, 3, 3}, // 78 .. 0dB -4dB 0dB -15dB .. -19dB
|
||||
{3, 3, 3, 4}, // 79 .. 0dB -9dB 0dB -9dB .. -18dB
|
||||
{3, 2, 3, 6}, // 80 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||
{3, 6, 0, 5}, // 81 .. 0dB -2dB -8dB -6dB .. -16dB
|
||||
{3, 7, 1, 4}, // 82 .. 0dB 0dB -6dB -9dB .. -15dB
|
||||
{3, 2, 3, 7}, // 83 .. 0dB -14dB 0dB 0dB .. -14dB
|
||||
{3, 6, 0, 6}, // 84 .. 0dB -2dB -8dB -3dB .. -13dB
|
||||
{3, 3, 2, 7}, // 85 .. 0dB -9dB -3dB 0dB .. -12dB
|
||||
{3, 7, 0, 6}, // 86 .. 0dB 0dB -8dB -3dB .. -11dB
|
||||
{3, 5, 3, 5}, // 87 .. 0dB -4dB 0dB -6dB .. -10dB
|
||||
{3, 7, 2, 5}, // 88 .. 0dB 0dB -3dB -6dB .. -9dB
|
||||
{3, 6, 3, 5}, // 89 .. 0dB -2dB 0dB -6dB .. -8dB
|
||||
{3, 5, 2, 7}, // 90 .. 0dB -4dB -3dB 0dB .. -7dB
|
||||
{3, 7, 2, 6}, // 91 .. 0dB 0dB -3dB -3dB .. -6dB
|
||||
{3, 6, 2, 7}, // 92 .. 0dB -2dB -3dB 0dB .. -5dB
|
||||
{3, 5, 3, 7}, // 93 .. 0dB -4dB 0dB 0dB .. -4dB
|
||||
{3, 7, 2, 7}, // 94 .. 0dB 0dB -3dB 0dB .. -3dB
|
||||
{3, 6, 3, 7}, // 95 .. 0dB -2dB 0dB 0dB .. -2dB
|
||||
{3, 7, 3, 7} // 96 .. 0dB 0dB 0dB 0dB .. 0dB
|
||||
{0x0000, -98}, // 1 .. 0 0 0 0 .. -33dB -24dB -8dB -33dB .. -98dB
|
||||
{0x0008, -96}, // 2 .. 0 0 1 0 .. -33dB -24dB -6dB -33dB .. -96dB
|
||||
{0x0100, -95}, // 3 .. 1 0 0 0 .. -30dB -24dB -8dB -33dB .. -95dB
|
||||
{0x0020, -93}, // 4 .. 0 1 0 0 .. -33dB -19dB -8dB -33dB .. -93dB
|
||||
{0x0001, -92}, // 5 .. 0 0 0 1 .. -33dB -24dB -8dB -27dB .. -92dB
|
||||
{0x0028, -91}, // 6 .. 0 1 1 0 .. -33dB -19dB -6dB -33dB .. -91dB
|
||||
{0x0009, -90}, // 7 .. 0 0 1 1 .. -33dB -24dB -6dB -27dB .. -90dB
|
||||
{0x0101, -89}, // 8 .. 1 0 0 1 .. -30dB -24dB -8dB -27dB .. -89dB
|
||||
{0x0030, -88}, // 9 .. 0 1 2 0 .. -33dB -19dB -3dB -33dB .. -88dB
|
||||
{0x0118, -87}, // 10 .. 1 0 3 0 .. -30dB -24dB 0dB -33dB .. -87dB
|
||||
{0x0002, -86}, // 11 .. 0 0 0 2 .. -33dB -24dB -8dB -21dB .. -86dB
|
||||
{0x0130, -85}, // 12 .. 1 1 2 0 .. -30dB -19dB -3dB -33dB .. -85dB
|
||||
{0x0019, -84}, // 13 .. 0 0 3 1 .. -33dB -24dB 0dB -27dB .. -84dB
|
||||
{0x0060, -83}, // 14 .. 0 3 0 0 .. -33dB -9dB -8dB -33dB .. -83dB
|
||||
{0x0138, -82}, // 15 .. 1 1 3 0 .. -30dB -19dB 0dB -33dB .. -82dB
|
||||
{0x0119, -81}, // 16 .. 1 0 3 1 .. -30dB -24dB 0dB -27dB .. -81dB
|
||||
{0x0058, -80}, // 17 .. 0 2 3 0 .. -33dB -14dB 0dB -33dB .. -80dB
|
||||
{0x0141, -79}, // 18 .. 1 2 0 1 .. -30dB -14dB -8dB -27dB .. -79dB
|
||||
{0x0070, -78}, // 19 .. 0 3 2 0 .. -33dB -9dB -3dB -33dB .. -78dB
|
||||
{0x0180, -77}, // 20 .. 1 4 0 0 .. -30dB -6dB -8dB -33dB .. -77dB
|
||||
{0x0139, -76}, // 21 .. 1 1 3 1 .. -30dB -19dB 0dB -27dB .. -76dB
|
||||
{0x0013, -75}, // 22 .. 0 0 2 3 .. -33dB -24dB -3dB -15dB .. -75dB
|
||||
{0x0161, -74}, // 23 .. 1 3 0 1 .. -30dB -9dB -8dB -27dB .. -74dB
|
||||
{0x01C0, -73}, // 24 .. 1 6 0 0 .. -30dB -2dB -8dB -33dB .. -73dB
|
||||
{0x00E8, -72}, // 25 .. 0 7 1 0 .. -33dB 0dB -6dB -33dB .. -72dB
|
||||
{0x00D0, -71}, // 26 .. 0 6 2 0 .. -33dB -2dB -3dB -33dB .. -71dB
|
||||
{0x0239, -70}, // 27 .. 2 1 3 1 .. -24dB -19dB 0dB -27dB .. -70dB
|
||||
{0x006A, -69}, // 28 .. 0 3 1 2 .. -33dB -9dB -6dB -21dB .. -69dB
|
||||
{0x0006, -68}, // 29 .. 0 0 0 6 .. -33dB -24dB -8dB -3dB .. -68dB
|
||||
{0x00B1, -67}, // 30 .. 0 5 2 1 .. -33dB -4dB -3dB -27dB .. -67dB
|
||||
{0x000E, -66}, // 31 .. 0 0 1 6 .. -33dB -24dB -6dB -3dB .. -66dB
|
||||
{0x015A, -65}, // 32 .. 1 2 3 2 .. -30dB -14dB 0dB -21dB .. -65dB
|
||||
{0x022B, -64}, // 33 .. 2 1 1 3 .. -24dB -19dB -6dB -15dB .. -64dB
|
||||
{0x01F8, -63}, // 34 .. 1 7 3 0 .. -30dB 0dB 0dB -33dB .. -63dB
|
||||
{0x0163, -62}, // 35 .. 1 3 0 3 .. -30dB -9dB -8dB -15dB .. -62dB
|
||||
{0x0035, -61}, // 36 .. 0 1 2 5 .. -33dB -19dB -3dB -6dB .. -61dB
|
||||
{0x0214, -60}, // 37 .. 2 0 2 4 .. -24dB -24dB -3dB -9dB .. -60dB
|
||||
{0x01D9, -59}, // 38 .. 1 6 3 1 .. -30dB -2dB 0dB -27dB .. -59dB
|
||||
{0x0145, -58}, // 39 .. 1 2 0 5 .. -30dB -14dB -8dB -6dB .. -58dB
|
||||
{0x02A2, -57}, // 40 .. 2 5 0 2 .. -24dB -4dB -8dB -21dB .. -57dB
|
||||
{0x02D1, -56}, // 41 .. 2 6 2 1 .. -24dB -2dB -3dB -27dB .. -56dB
|
||||
{0x00B3, -55}, // 42 .. 0 5 2 3 .. -33dB -4dB -3dB -15dB .. -55dB
|
||||
{0x0216, -54}, // 43 .. 2 0 2 6 .. -24dB -24dB -3dB -3dB .. -54dB
|
||||
{0x0066, -53}, // 44 .. 0 3 0 6 .. -33dB -9dB -8dB -3dB .. -53dB
|
||||
{0x00C4, -52}, // 45 .. 0 6 0 4 .. -33dB -2dB -8dB -9dB .. -52dB
|
||||
{0x006E, -51}, // 46 .. 0 3 1 6 .. -33dB -9dB -6dB -3dB .. -51dB
|
||||
{0x015D, -50}, // 47 .. 1 2 3 5 .. -30dB -14dB 0dB -6dB .. -50dB
|
||||
{0x00AD, -49}, // 48 .. 0 5 1 5 .. -33dB -4dB -6dB -6dB .. -49dB
|
||||
{0x007D, -48}, // 49 .. 0 3 3 5 .. -33dB -9dB 0dB -6dB .. -48dB
|
||||
{0x00D4, -47}, // 50 .. 0 6 2 4 .. -33dB -2dB -3dB -9dB .. -47dB
|
||||
{0x01B4, -46}, // 51 .. 1 5 2 4 .. -30dB -4dB -3dB -9dB .. -46dB
|
||||
{0x030B, -45}, // 52 .. 3 0 1 3 .. 0dB -24dB -6dB -15dB .. -45dB
|
||||
{0x00CE, -44}, // 53 .. 0 6 1 6 .. -33dB -2dB -6dB -3dB .. -44dB
|
||||
{0x01B5, -43}, // 54 .. 1 5 2 5 .. -30dB -4dB -3dB -6dB .. -43dB
|
||||
{0x0097, -42}, // 55 .. 0 4 2 7 .. -33dB -6dB -3dB 0dB .. -42dB
|
||||
{0x0257, -41}, // 56 .. 2 2 2 7 .. -24dB -14dB -3dB 0dB .. -41dB
|
||||
{0x02B4, -40}, // 57 .. 2 5 2 4 .. -24dB -4dB -3dB -9dB .. -40dB
|
||||
{0x027D, -39}, // 58 .. 2 3 3 5 .. -24dB -9dB 0dB -6dB .. -39dB
|
||||
{0x01DD, -38}, // 59 .. 1 6 3 5 .. -30dB -2dB 0dB -6dB .. -38dB
|
||||
{0x02AE, -37}, // 60 .. 2 5 1 6 .. -24dB -4dB -6dB -3dB .. -37dB
|
||||
{0x0379, -36}, // 61 .. 3 3 3 1 .. 0dB -9dB 0dB -27dB .. -36dB
|
||||
{0x035A, -35}, // 62 .. 3 2 3 2 .. 0dB -14dB 0dB -21dB .. -35dB
|
||||
{0x02B6, -34}, // 63 .. 2 5 2 6 .. -24dB -4dB -3dB -3dB .. -34dB
|
||||
{0x030E, -33}, // 64 .. 3 0 1 6 .. 0dB -24dB -6dB -3dB .. -33dB
|
||||
{0x0307, -32}, // 65 .. 3 0 0 7 .. 0dB -24dB -8dB 0dB .. -32dB
|
||||
{0x02BE, -31}, // 66 .. 2 5 3 6 .. -24dB -4dB 0dB -3dB .. -31dB
|
||||
{0x037A, -30}, // 67 .. 3 3 3 2 .. 0dB -9dB 0dB -21dB .. -30dB
|
||||
{0x02DE, -29}, // 68 .. 2 6 3 6 .. -24dB -2dB 0dB -3dB .. -29dB
|
||||
{0x0345, -28}, // 69 .. 3 2 0 5 .. 0dB -14dB -8dB -6dB .. -28dB
|
||||
{0x03A3, -27}, // 70 .. 3 5 0 3 .. 0dB -4dB -8dB -15dB .. -27dB
|
||||
{0x0364, -26}, // 71 .. 3 3 0 4 .. 0dB -9dB -8dB -9dB .. -26dB
|
||||
{0x032F, -25}, // 72 .. 3 1 1 7 .. 0dB -19dB -6dB 0dB .. -25dB
|
||||
{0x0393, -24}, // 73 .. 3 4 2 3 .. 0dB -6dB -3dB -15dB .. -24dB
|
||||
{0x0384, -23}, // 74 .. 3 4 0 4 .. 0dB -6dB -8dB -9dB .. -23dB
|
||||
{0x0347, -22}, // 75 .. 3 2 0 7 .. 0dB -14dB -8dB 0dB .. -22dB
|
||||
{0x03EB, -21}, // 76 .. 3 7 1 3 .. 0dB 0dB -6dB -15dB .. -21dB
|
||||
{0x03D3, -20}, // 77 .. 3 6 2 3 .. 0dB -2dB -3dB -15dB .. -20dB
|
||||
{0x03BB, -19}, // 78 .. 3 5 3 3 .. 0dB -4dB 0dB -15dB .. -19dB
|
||||
{0x037C, -18}, // 79 .. 3 3 3 4 .. 0dB -9dB 0dB -9dB .. -18dB
|
||||
{0x03CC, -17}, // 80 .. 3 6 1 4 .. 0dB -2dB -6dB -9dB .. -17dB
|
||||
{0x03C5, -16}, // 81 .. 3 6 0 5 .. 0dB -2dB -8dB -6dB .. -16dB
|
||||
{0x03EC, -15}, // 82 .. 3 7 1 4 .. 0dB 0dB -6dB -9dB .. -15dB
|
||||
{0x035F, -14}, // 83 .. 3 2 3 7 .. 0dB -14dB 0dB 0dB .. -14dB
|
||||
{0x03BC, -13}, // 84 .. 3 5 3 4 .. 0dB -4dB 0dB -9dB .. -13dB
|
||||
{0x038F, -12}, // 85 .. 3 4 1 7 .. 0dB -6dB -6dB 0dB .. -12dB
|
||||
{0x03E6, -11}, // 86 .. 3 7 0 6 .. 0dB 0dB -8dB -3dB .. -11dB
|
||||
{0x03AF, -10}, // 87 .. 3 5 1 7 .. 0dB -4dB -6dB 0dB .. -10dB
|
||||
{0x03F5, -9 }, // 88 .. 3 7 2 5 .. 0dB 0dB -3dB -6dB .. -9dB
|
||||
{0x03D6, -8 }, // 89 .. 3 6 2 6 .. 0dB -2dB -3dB -3dB .. -8dB
|
||||
{0x03BE, -7 }, // 90 .. 3 5 3 6 .. 0dB -4dB 0dB -3dB .. -7dB original
|
||||
{0x03F6, -6 }, // 91 .. 3 7 2 6 .. 0dB 0dB -3dB -3dB .. -6dB
|
||||
{0x03DE, -5 }, // 92 .. 3 6 3 6 .. 0dB -2dB 0dB -3dB .. -5dB
|
||||
{0x03BF, -4 }, // 93 .. 3 5 3 7 .. 0dB -4dB 0dB 0dB .. -4dB
|
||||
{0x03F7, -3 }, // 94 .. 3 7 2 7 .. 0dB 0dB -3dB 0dB .. -3dB
|
||||
{0x03DF, -2 }, // 95 .. 3 6 3 7 .. 0dB -2dB 0dB 0dB .. -2dB
|
||||
{0x03FF, 0 }, // 96 .. 3 7 3 7 .. 0dB 0dB 0dB 0dB .. 0dB
|
||||
};
|
||||
|
||||
const unsigned int original_index = 80;
|
||||
static const unsigned int original_index = 90;
|
||||
|
||||
#endif
|
||||
|
||||
// total RF gain for each table index
|
||||
int8_t gain_dB[ARRAY_SIZE(gain_table)] = {0};
|
||||
|
||||
// display update rate
|
||||
const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
||||
unsigned int counter = 0;
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
// display update rate
|
||||
static const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
||||
unsigned int counter = 0;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
// user manually sets the table index .. used to calibrate the desired dB gain table
|
||||
@@ -280,13 +262,6 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
#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
|
||||
{ // set a maximum gain to use
|
||||
// const int16_t max_gain_dB = gain_dB[original_index];
|
||||
@@ -294,7 +269,8 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
|
||||
max_index = ARRAY_SIZE(gain_table);
|
||||
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;
|
||||
}
|
||||
#else
|
||||
@@ -306,7 +282,9 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
void AM_fix_reset(const int vfo)
|
||||
{ // reset the AM fixer upper
|
||||
|
||||
counter = 0;
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
counter = 0;
|
||||
#endif
|
||||
|
||||
prev_rssi[vfo] = 0;
|
||||
|
||||
@@ -340,7 +318,9 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
case FUNCTION_TRANSMIT:
|
||||
case FUNCTION_BAND_SCOPE:
|
||||
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;
|
||||
|
||||
// only adjust stuff if we're in one of these modes
|
||||
@@ -351,14 +331,16 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
break;
|
||||
}
|
||||
|
||||
if (counter > 0)
|
||||
{
|
||||
if (++counter >= display_update_rate)
|
||||
{ // trigger a display update
|
||||
counter = 0;
|
||||
gUpdateDisplay = true;
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
if (counter > 0)
|
||||
{
|
||||
if (++counter >= display_update_rate)
|
||||
{ // trigger a display update
|
||||
counter = 0;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // sample the current RSSI level
|
||||
// average it with the previous rssi (a bit of noise/spike immunity)
|
||||
@@ -367,11 +349,14 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
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];
|
||||
if (gCurrentRSSI[vfo] != new_rssi)
|
||||
{
|
||||
gCurrentRSSI[vfo] = new_rssi;
|
||||
|
||||
if (counter == 0)
|
||||
{ // trigger a display update
|
||||
counter = 1;
|
||||
@@ -379,6 +364,9 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
// user is manually adjusting a gain register - don't do anything automatically
|
||||
@@ -411,10 +399,12 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
if (diff_dB >= 10)
|
||||
{ // jump immediately to a new gain setting
|
||||
// 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
|
||||
while (index > 1)
|
||||
if (gain_dB[--index] <= desired_gain_dB)
|
||||
if (gain_table[--index].gain_dB <= desired_gain_dB)
|
||||
break;
|
||||
|
||||
//index = (gain_table_index[vfo] + index) / 2; // easy does it
|
||||
@@ -438,7 +428,7 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
}
|
||||
}
|
||||
|
||||
if (diff_dB >= -4) // 4dB hysterisis (help reduce gain hunting)
|
||||
if (diff_dB >= -6) // 6dB hysterisis (help reduce gain hunting)
|
||||
hold_counter[vfo] = 30; // 300ms hold
|
||||
|
||||
if (hold_counter[vfo] == 0)
|
||||
@@ -447,8 +437,10 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
gain_table_index[vfo] = (index <= max_index) ? index : max_index; // limit the gain index
|
||||
}
|
||||
|
||||
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
||||
return; // no gain change
|
||||
#if 0
|
||||
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
||||
return; // no gain change - this is to reduce writing to the BK chip on ever call
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -459,33 +451,35 @@ const uint8_t orig_pga = 6; // -3dB
|
||||
// remember the new table index
|
||||
gain_table_index_prev[vfo] = index;
|
||||
|
||||
const t_gain_table gains = gain_table[index];
|
||||
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));
|
||||
BK4819_WriteRegister(BK4819_REG_13, gain_table[index].reg_val);
|
||||
|
||||
// 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
|
||||
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
|
||||
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||
|
||||
if (counter == 0)
|
||||
{
|
||||
counter = 1;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
if (counter == 0)
|
||||
{
|
||||
counter = 1;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
|
||||
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];
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
5
am_fix.h
@@ -20,11 +20,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern const uint8_t orig_lna_short;
|
||||
extern const uint8_t orig_lna;
|
||||
extern const uint8_t orig_mixer;
|
||||
extern const uint8_t orig_pga;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
extern int16_t rssi_gain_diff[2];
|
||||
|
||||
|
||||
307
app/action.c
@@ -14,8 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/action.h"
|
||||
#include "app/app.h"
|
||||
#include "app/common.h"
|
||||
#include "app/dtmf.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
@@ -43,6 +46,7 @@ static void ACTION_FlashLight(void)
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
gFlashLightState++;
|
||||
break;
|
||||
default:
|
||||
@@ -82,11 +86,11 @@ void ACTION_Monitor(void)
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
if (gScanState != SCAN_OFF)
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
{
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gScanPauseMode = true;
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gScanPauseMode = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
@@ -107,85 +111,107 @@ void ACTION_Monitor(void)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
gRequestDisplayScreen = gScreenToDisplay;
|
||||
gRequestDisplayScreen = gScreenToDisplay;
|
||||
}
|
||||
|
||||
void ACTION_Scan(bool bRestart)
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
if (gFM_ScanState != FM_SCAN_OFF)
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
FM_PlayAndUpdate();
|
||||
|
||||
gMonitor = false;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t Frequency;
|
||||
|
||||
if (gFM_ScanState != FM_SCAN_OFF)
|
||||
if (bRestart)
|
||||
{
|
||||
FM_PlayAndUpdate();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
gFM_AutoScan = true;
|
||||
gFM_ChannelPosition = 0;
|
||||
FM_EraseChannels();
|
||||
Frequency = gEeprom.FM_LowerLimit;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t Frequency;
|
||||
|
||||
if (bRestart)
|
||||
{
|
||||
gFM_AutoScan = true;
|
||||
gFM_ChannelPosition = 0;
|
||||
FM_EraseChannels();
|
||||
Frequency = gEeprom.FM_LowerLimit;
|
||||
}
|
||||
else
|
||||
{
|
||||
gFM_AutoScan = false;
|
||||
gFM_ChannelPosition = 0;
|
||||
Frequency = gEeprom.FM_FrequencyPlaying;
|
||||
}
|
||||
|
||||
BK1080_GetFrequencyDeviation(Frequency);
|
||||
FM_Tune(Frequency, 1, bRestart);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_BEGIN;
|
||||
#endif
|
||||
gFM_AutoScan = false;
|
||||
gFM_ChannelPosition = 0;
|
||||
Frequency = gEeprom.FM_FrequencyPlaying;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
BK1080_GetFrequencyDeviation(Frequency);
|
||||
FM_Tune(Frequency, 1, bRestart);
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_BEGIN;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{ // not scanning
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
gDTMF_RX_live_timeout = 0;
|
||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#endif
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
|
||||
if (gScanState != SCAN_OFF)
|
||||
{
|
||||
SCANNER_Stop();
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
{ // already scanning
|
||||
|
||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||
{ // channel mode
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
// keep scanning but toggle between scan lists
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
SCANNER_ScanChannels(false, gScanStateDir);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
else
|
||||
{ // stop scanning
|
||||
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CHANNEL_Next(true, 1);
|
||||
{ // start scanning
|
||||
|
||||
SCANNER_ScanChannels(true, SCAN_FWD);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
@@ -193,7 +219,7 @@ void ACTION_Scan(bool bRestart)
|
||||
#endif
|
||||
|
||||
// clear the other vfo's rssi level (to hide the antenna symbol)
|
||||
gVFO_RSSI_bar_level[gEeprom.RX_CHANNEL == 0] = 0;
|
||||
gVFO_RSSI_bar_level[(gEeprom.RX_VFO + 1) & 1u] = 0;
|
||||
|
||||
// let the user see DW is not active
|
||||
gDualWatchActive = false;
|
||||
@@ -202,43 +228,68 @@ void ACTION_Scan(bool bRestart)
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!bRestart)
|
||||
{ // scanning
|
||||
// if (!bRestart)
|
||||
if (!bRestart && IS_MR_CHANNEL(gNextMrChannel))
|
||||
{ // channel mode, keep scanning but toggle between scan lists
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
SCANNER_ScanChannels(false, gScanStateDir);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
else
|
||||
{ // stop scanning
|
||||
gMonitor = false;
|
||||
|
||||
|
||||
SCANNER_Stop();
|
||||
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
}
|
||||
|
||||
void ACTION_Vox(void)
|
||||
{
|
||||
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
||||
gRequestSaveSettings = true;
|
||||
gFlagReconfigureVfos = true;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_VOX;
|
||||
#endif
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
static void ACTION_AlarmOr1750(bool b1750)
|
||||
#ifdef ENABLE_VOX
|
||||
void ACTION_Vox(void)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM;
|
||||
gAlarmRunningCounter = 0;
|
||||
gFlagPrepareTX = true;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
||||
gRequestSaveSettings = true;
|
||||
gFlagReconfigureVfos = true;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_VOX;
|
||||
#endif
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
static void ACTION_AlarmOr1750(const bool b1750)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750)
|
||||
gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM;
|
||||
gAlarmRunningCounter = 0;
|
||||
#elif defined(ENABLE_ALARM)
|
||||
gAlarmState = ALARM_STATE_TXALARM;
|
||||
gAlarmRunningCounter = 0;
|
||||
#else
|
||||
gAlarmState = ALARM_STATE_TX1750;
|
||||
#endif
|
||||
|
||||
gFlagPrepareTX = true;
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
void ACTION_FM(void)
|
||||
{
|
||||
@@ -249,8 +300,11 @@ void ACTION_Vox(void)
|
||||
FM_TurnOff();
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
gVoxResumeCountdown = 80;
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 80;
|
||||
#endif
|
||||
gFlagReconfigureVfos = true;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
@@ -262,7 +316,8 @@ void ACTION_Vox(void)
|
||||
|
||||
FM_Start();
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
}
|
||||
}
|
||||
@@ -270,18 +325,16 @@ void ACTION_Vox(void)
|
||||
|
||||
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
uint8_t Short = ACTION_OPT_NONE;
|
||||
uint8_t Long = ACTION_OPT_NONE;
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MAIN && gDTMF_InputMode)
|
||||
if (gScreenToDisplay == DISPLAY_MAIN && gDTMF_InputMode) // entering DTMF code
|
||||
{
|
||||
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed)
|
||||
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed) // side1 btn pressed
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
if (gDTMF_InputIndex > 0)
|
||||
|
||||
if (gDTMF_InputBox_Index > 0) // DTMF codes are in the input box
|
||||
{
|
||||
gDTMF_InputBox[--gDTMF_InputIndex] = '-';
|
||||
if (gDTMF_InputIndex > 0)
|
||||
gDTMF_InputBox[--gDTMF_InputBox_Index] = '-'; // delete one code
|
||||
if (gDTMF_InputBox_Index > 0)
|
||||
{
|
||||
gPttWasReleased = true;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
@@ -294,43 +347,52 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputMode = false; // turn off DTMF input box if no codes left
|
||||
}
|
||||
|
||||
gPttWasReleased = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Key == KEY_SIDE1)
|
||||
{
|
||||
Short = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
||||
Long = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
||||
}
|
||||
else
|
||||
if (Key == KEY_SIDE2)
|
||||
{
|
||||
Short = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
||||
Long = gEeprom.KEY_2_LONG_PRESS_ACTION;
|
||||
uint8_t funcShort = ACTION_OPT_NONE;
|
||||
uint8_t funcLong = ACTION_OPT_NONE;
|
||||
switch(Key) {
|
||||
case KEY_SIDE1:
|
||||
funcShort = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
||||
funcLong = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
||||
break;
|
||||
case KEY_SIDE2:
|
||||
funcShort = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
||||
funcLong = gEeprom.KEY_2_LONG_PRESS_ACTION;
|
||||
break;
|
||||
case KEY_MENU:
|
||||
funcLong = gEeprom.KEY_M_LONG_PRESS_ACTION;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
if (!bKeyHeld && bKeyPressed) // button pushed
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyHeld || bKeyPressed)
|
||||
// held or released beyond this point
|
||||
|
||||
if(!(bKeyHeld && !bKeyPressed)) // don't beep on released after hold
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (bKeyHeld || bKeyPressed) // held
|
||||
{
|
||||
if (!bKeyHeld)
|
||||
return;
|
||||
funcShort = funcLong;
|
||||
|
||||
Short = Long;
|
||||
|
||||
if (!bKeyPressed)
|
||||
if (!bKeyPressed) //ignore release if held
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Short)
|
||||
// held or released after short press beyond this point
|
||||
|
||||
switch (funcShort)
|
||||
{
|
||||
default:
|
||||
case ACTION_OPT_NONE:
|
||||
@@ -348,22 +410,33 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
ACTION_Scan(true);
|
||||
break;
|
||||
case ACTION_OPT_VOX:
|
||||
#ifdef ENABLE_VOX
|
||||
ACTION_Vox();
|
||||
#endif
|
||||
break;
|
||||
case ACTION_OPT_ALARM:
|
||||
#ifdef ENABLE_ALARM
|
||||
ACTION_AlarmOr1750(false);
|
||||
#endif
|
||||
#ifdef ENABLE_ALARM
|
||||
ACTION_AlarmOr1750(false);
|
||||
#endif
|
||||
break;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
case ACTION_OPT_FM:
|
||||
ACTION_FM();
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
case ACTION_OPT_FM:
|
||||
ACTION_FM();
|
||||
break;
|
||||
#endif
|
||||
case ACTION_OPT_1750:
|
||||
#ifdef ENABLE_ALARM
|
||||
#ifdef ENABLE_TX1750
|
||||
ACTION_AlarmOr1750(true);
|
||||
#endif
|
||||
break;
|
||||
case ACTION_OPT_KEYLOCK:
|
||||
COMMON_KeypadLockToggle();
|
||||
break;
|
||||
case ACTION_OPT_A_B:
|
||||
COMMON_SwitchVFOs();
|
||||
break;
|
||||
case ACTION_OPT_VFO_MR:
|
||||
COMMON_SwitchVFOMode();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,10 @@
|
||||
//static void ACTION_FlashLight(void)
|
||||
void ACTION_Power(void);
|
||||
void ACTION_Monitor(void);
|
||||
void ACTION_Scan(bool bFlag);
|
||||
void ACTION_Vox(void);
|
||||
void ACTION_Scan(bool bRestart);
|
||||
#ifdef ENABLE_VOX
|
||||
void ACTION_Vox(void);
|
||||
#endif
|
||||
#ifdef ENABLE_ALARM
|
||||
//static void ACTION_AlarmOr1750(bool b1750)
|
||||
#endif
|
||||
|
||||
@@ -57,7 +57,7 @@ void AIRCOPY_SendMessage(void)
|
||||
|
||||
BK4819_SendFSKData(g_FSK_Buffer);
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||
|
||||
gAircopySendCountdown = 30;
|
||||
}
|
||||
@@ -131,19 +131,17 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
Frequency = StrToUL(INPUTBOX_GetAscii()) * 100;
|
||||
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
for (i = 0; i < ARRAY_SIZE(frequencyBandTable); i++)
|
||||
{
|
||||
if (Frequency >= LowerLimitFrequencyBandTable[i] && Frequency <= UpperLimitFrequencyBandTable[i])
|
||||
if (Frequency >= frequencyBandTable[i].lower && Frequency < frequencyBandTable[i].upper)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
gRxVfo->Band = i;
|
||||
Frequency += 75;
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gRxVfo->StepFrequency, 0);
|
||||
Frequency = FREQUENCY_RoundToStep(Frequency, gRxVfo->StepFrequency);
|
||||
gRxVfo->freq_config_RX.Frequency = Frequency;
|
||||
gRxVfo->freq_config_TX.Frequency = Frequency;
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "functions.h"
|
||||
#include "frequencies.h"
|
||||
#include "radio.h"
|
||||
|
||||
void APP_EndTransmission(void);
|
||||
void CHANNEL_Next(bool bFlag, int8_t Direction);
|
||||
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 direction);
|
||||
void APP_Update(void);
|
||||
void APP_TimeSlice10ms(void);
|
||||
void APP_TimeSlice500ms(void);
|
||||
|
||||
73
app/common.c
Normal file
@@ -0,0 +1,73 @@
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
void COMMON_KeypadLockToggle()
|
||||
{
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MENU &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{ // toggle the keyboad lock
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
||||
#endif
|
||||
|
||||
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
||||
|
||||
gRequestSaveSettings = true;
|
||||
}
|
||||
}
|
||||
|
||||
void COMMON_SwitchVFOs()
|
||||
{
|
||||
gEeprom.TX_VFO ^= 1;
|
||||
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||
gEeprom.CROSS_BAND_RX_TX = gEeprom.TX_VFO + 1;
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
gEeprom.DUAL_WATCH = gEeprom.TX_VFO + 1;
|
||||
|
||||
gRequestSaveSettings = 1;
|
||||
gFlagReconfigureVfos = true;
|
||||
gScheduleDualWatch = true;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
void COMMON_SwitchVFOMode()
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gEeprom.VFO_OPEN && !IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
#else
|
||||
if (gEeprom.VFO_OPEN)
|
||||
#endif
|
||||
{
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // swap to frequency mode
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = gEeprom.FreqChannel[gEeprom.TX_VFO];
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 0);
|
||||
if (Channel != 0xFF)
|
||||
{ // swap to channel mode
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(1, Channel + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
app/common.h
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
#ifndef APP_COMMON_H
|
||||
#define APP_COMMON_H
|
||||
|
||||
#include "functions.h"
|
||||
#include "settings.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
void COMMON_KeypadLockToggle();
|
||||
void COMMON_SwitchVFOs();
|
||||
void COMMON_SwitchVFOMode();
|
||||
|
||||
#endif
|
||||
266
app/dtmf.c
@@ -22,6 +22,7 @@
|
||||
#endif
|
||||
#include "app/scanner.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "audio.h"
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/eeprom.h"
|
||||
#include "driver/gpio.h"
|
||||
@@ -33,12 +34,16 @@
|
||||
#include "ui/ui.h"
|
||||
|
||||
char gDTMF_String[15];
|
||||
char gDTMF_InputBox[15];
|
||||
|
||||
char gDTMF_Received[16];
|
||||
uint8_t gDTMF_WriteIndex = 0;
|
||||
uint8_t gDTMF_PreviousIndex = 0;
|
||||
uint8_t gDTMF_RecvTimeout = 0;
|
||||
char gDTMF_InputBox[15];
|
||||
uint8_t gDTMF_InputBox_Index = 0;
|
||||
bool gDTMF_InputMode = false;
|
||||
uint8_t gDTMF_PreviousIndex = 0;
|
||||
|
||||
char gDTMF_RX[17];
|
||||
uint8_t gDTMF_RX_index = 0;
|
||||
uint8_t gDTMF_RX_timeout = 0;
|
||||
bool gDTMF_RX_pending = false;
|
||||
|
||||
char gDTMF_RX_live[20];
|
||||
uint8_t gDTMF_RX_live_timeout = 0;
|
||||
@@ -48,12 +53,9 @@ char gDTMF_ID[4];
|
||||
char gDTMF_Caller[4];
|
||||
char gDTMF_Callee[4];
|
||||
DTMF_State_t gDTMF_State;
|
||||
bool gDTMF_DecodeRing;
|
||||
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||
uint8_t gDTMFChosenContact;
|
||||
uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
uint8_t gDTMF_InputIndex;
|
||||
bool gDTMF_InputMode;
|
||||
uint8_t gDTMF_chosen_contact;
|
||||
uint8_t gDTMF_auto_reset_time_500ms;
|
||||
DTMF_CallState_t gDTMF_CallState;
|
||||
DTMF_ReplyState_t gDTMF_ReplyState;
|
||||
DTMF_CallMode_t gDTMF_CallMode;
|
||||
@@ -61,14 +63,22 @@ bool gDTMF_IsTx;
|
||||
uint8_t gDTMF_TxStopCountdown_500ms;
|
||||
bool gDTMF_IsGroupCall;
|
||||
|
||||
bool DTMF_ValidateCodes(char *pCode, uint8_t Size)
|
||||
void DTMF_clear_RX(void)
|
||||
{
|
||||
gDTMF_RX_timeout = 0;
|
||||
gDTMF_RX_index = 0;
|
||||
gDTMF_RX_pending = false;
|
||||
memset(gDTMF_RX, 0, sizeof(gDTMF_RX));
|
||||
}
|
||||
|
||||
bool DTMF_ValidateCodes(char *pCode, const unsigned int size)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (pCode[0] == 0xFF || pCode[0] == 0)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < Size; i++)
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (pCode[i] == 0xFF || pCode[i] == 0)
|
||||
{
|
||||
@@ -121,16 +131,34 @@ bool DTMF_FindContact(const char *pContact, char *pResult)
|
||||
return false;
|
||||
}
|
||||
|
||||
char DTMF_GetCharacter(const uint8_t code)
|
||||
char DTMF_GetCharacter(const unsigned int code)
|
||||
{
|
||||
const char list[] = "0123456789ABCD*#";
|
||||
return (code < ARRAY_SIZE(list)) ? list[code] : 0xFF;
|
||||
switch (code)
|
||||
{
|
||||
case KEY_0: return '0';
|
||||
case KEY_1: return '1';
|
||||
case KEY_2: return '2';
|
||||
case KEY_3: return '3';
|
||||
case KEY_4: return '4';
|
||||
case KEY_5: return '5';
|
||||
case KEY_6: return '6';
|
||||
case KEY_7: return '7';
|
||||
case KEY_8: return '8';
|
||||
case KEY_9: return '9';
|
||||
case KEY_MENU: return 'A';
|
||||
case KEY_UP: return 'B';
|
||||
case KEY_DOWN: return 'C';
|
||||
case KEY_EXIT: return 'D';
|
||||
case KEY_STAR: return '*';
|
||||
case KEY_F: return '#';
|
||||
default: return 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, uint8_t Size, bool bCheckGroup)
|
||||
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < Size; i++)
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (pMsg[i] != pTemplate[i])
|
||||
{
|
||||
@@ -140,58 +168,76 @@ bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, uint8_t Size,
|
||||
}
|
||||
}
|
||||
|
||||
return DTMF_CALL_MODE_NOT_GROUP;
|
||||
return true;
|
||||
}
|
||||
|
||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, uint32_t Size)
|
||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < Size; i++)
|
||||
unsigned int i;
|
||||
for (i = 0; i < size; i++)
|
||||
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE)
|
||||
break;
|
||||
return (i != Size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
|
||||
|
||||
return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
|
||||
}
|
||||
|
||||
void DTMF_Append(char Code)
|
||||
void DTMF_clear_input_box(void)
|
||||
{
|
||||
if (gDTMF_InputIndex == 0)
|
||||
memset(gDTMF_InputBox, 0, sizeof(gDTMF_InputBox));
|
||||
gDTMF_InputBox_Index = 0;
|
||||
gDTMF_InputMode = false;
|
||||
}
|
||||
|
||||
void DTMF_Append(const char code)
|
||||
{
|
||||
if (gDTMF_InputBox_Index == 0)
|
||||
{
|
||||
memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox));
|
||||
memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox) - 1);
|
||||
gDTMF_InputBox[sizeof(gDTMF_InputBox) - 1] = 0;
|
||||
}
|
||||
else
|
||||
if (gDTMF_InputIndex >= sizeof(gDTMF_InputBox))
|
||||
return;
|
||||
|
||||
gDTMF_InputBox[gDTMF_InputIndex++] = Code;
|
||||
if (gDTMF_InputBox_Index < (sizeof(gDTMF_InputBox) - 1))
|
||||
gDTMF_InputBox[gDTMF_InputBox_Index++] = code;
|
||||
}
|
||||
|
||||
void DTMF_HandleRequest(void)
|
||||
{
|
||||
char String[20];
|
||||
uint8_t Offset;
|
||||
{ // proccess the RX'ed DTMF characters
|
||||
|
||||
if (!gDTMF_RequestPending)
|
||||
return;
|
||||
|
||||
gDTMF_RequestPending = false;
|
||||
|
||||
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
char String[21];
|
||||
unsigned int Offset;
|
||||
|
||||
if (!gDTMF_RX_pending)
|
||||
return; // nothing new received
|
||||
|
||||
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
{ // we're busy scanning
|
||||
DTMF_clear_RX();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||
{ // D-DCD is disabled or we're alive
|
||||
DTMF_clear_RX();
|
||||
return;
|
||||
}
|
||||
|
||||
gDTMF_RX_pending = false;
|
||||
|
||||
if (gDTMF_RX_index >= 9)
|
||||
{ // look for the KILL code
|
||||
|
||||
if (gDTMF_WriteIndex >= 9)
|
||||
{
|
||||
Offset = gDTMF_WriteIndex - 9;
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.KILL_CODE);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, true))
|
||||
{
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // bugger
|
||||
|
||||
if (gEeprom.PERMIT_REMOTE_KILL)
|
||||
{
|
||||
gSetting_KILLED = true;
|
||||
gSetting_KILLED = true; // oooerr !
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
SETTINGS_SaveSettings();
|
||||
|
||||
@@ -212,82 +258,118 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
gUpdateStatus = true;
|
||||
gUpdateDisplay = true;
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gDTMF_RX_index >= 9)
|
||||
{ // look for the REVIVE code
|
||||
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, true))
|
||||
{
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // shit, we're back !
|
||||
|
||||
gSetting_KILLED = false;
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
SETTINGS_SaveSettings();
|
||||
|
||||
gDTMF_ReplyState = DTMF_REPLY_AB;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gDTMF_WriteIndex >= 2)
|
||||
{
|
||||
if (DTMF_CompareMessage(gDTMF_Received + (gDTMF_WriteIndex - 2), "AB", 2, true))
|
||||
{
|
||||
gDTMF_State = DTMF_STATE_TX_SUCC;
|
||||
gUpdateDisplay = true;
|
||||
return;
|
||||
if (gDTMF_RX_index >= 2)
|
||||
{ // look for ACK reply
|
||||
|
||||
strcpy(String, "AB");
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // ends with "AB"
|
||||
|
||||
if (gDTMF_ReplyState != DTMF_REPLY_NONE) // 1of11
|
||||
// if (gDTMF_CallState != DTMF_CALL_STATE_NONE) // 1of11
|
||||
// if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) // 1of11
|
||||
{
|
||||
gDTMF_State = DTMF_STATE_TX_SUCC;
|
||||
DTMF_clear_RX();
|
||||
gUpdateDisplay = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT && gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP && gDTMF_WriteIndex >= 9)
|
||||
{
|
||||
Offset = gDTMF_WriteIndex - 9;
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT &&
|
||||
gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP &&
|
||||
gDTMF_RX_index >= 9)
|
||||
{ // waiting for a reply
|
||||
|
||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, false))
|
||||
{
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), false))
|
||||
{ // we got a response
|
||||
gDTMF_State = DTMF_STATE_CALL_OUT_RSP;
|
||||
DTMF_clear_RX();
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (gSetting_KILLED || gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{ // we've been killed or expecting a reply
|
||||
return;
|
||||
}
|
||||
|
||||
if (gDTMF_WriteIndex >= 7)
|
||||
{
|
||||
Offset = gDTMF_WriteIndex - 7;
|
||||
|
||||
sprintf(String, "%s%c", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE);
|
||||
if (gDTMF_RX_index >= 7)
|
||||
{ // see if we're being called
|
||||
|
||||
gDTMF_IsGroupCall = false;
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 4, true))
|
||||
{
|
||||
sprintf(String, "%s%c", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE);
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String) - 3;
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // it's for us !
|
||||
|
||||
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED;
|
||||
|
||||
memmove(gDTMF_Callee, gDTMF_Received + Offset + 0, 3);
|
||||
memmove(gDTMF_Caller, gDTMF_Received + Offset + 4, 3);
|
||||
memset(gDTMF_Callee, 0, sizeof(gDTMF_Callee));
|
||||
memset(gDTMF_Caller, 0, sizeof(gDTMF_Caller));
|
||||
memmove(gDTMF_Callee, gDTMF_RX + Offset + 0, 3);
|
||||
memmove(gDTMF_Caller, gDTMF_RX + Offset + 4, 3);
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
gUpdateDisplay = true;
|
||||
|
||||
switch (gEeprom.DTMF_DECODE_RESPONSE)
|
||||
{
|
||||
case 3:
|
||||
gDTMF_DecodeRing = true;
|
||||
case DTMF_DEC_RESPONSE_BOTH:
|
||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
||||
// Fallthrough
|
||||
case 2:
|
||||
[[fallthrough]];
|
||||
case DTMF_DEC_RESPONSE_REPLY:
|
||||
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
|
||||
break;
|
||||
case 1:
|
||||
gDTMF_DecodeRing = true;
|
||||
case DTMF_DEC_RESPONSE_RING:
|
||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
||||
break;
|
||||
default:
|
||||
gDTMF_DecodeRing = false;
|
||||
case DTMF_DEC_RESPONSE_NONE:
|
||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
break;
|
||||
}
|
||||
@@ -301,14 +383,11 @@ void DTMF_HandleRequest(void)
|
||||
void DTMF_Reply(void)
|
||||
{
|
||||
uint16_t Delay;
|
||||
char String[20];
|
||||
char String[23];
|
||||
const char *pString = NULL;
|
||||
|
||||
switch (gDTMF_ReplyState)
|
||||
{
|
||||
case DTMF_REPLY_NONE:
|
||||
return;
|
||||
|
||||
case DTMF_REPLY_ANI:
|
||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||
{
|
||||
@@ -320,22 +399,28 @@ void DTMF_Reply(void)
|
||||
pString = String;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case DTMF_REPLY_AB:
|
||||
pString = "AB";
|
||||
break;
|
||||
|
||||
|
||||
case DTMF_REPLY_AAAAA:
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||
pString = String;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || (gCurrentVfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOT && gCurrentVfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOTH))
|
||||
case DTMF_REPLY_NONE:
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
||||
{
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
// send TX-UP DTMF
|
||||
pString = gEeprom.DTMF_UP_CODE;
|
||||
break;
|
||||
}
|
||||
@@ -344,14 +429,15 @@ void DTMF_Reply(void)
|
||||
|
||||
if (pString == NULL)
|
||||
return;
|
||||
|
||||
Delay = gEeprom.DTMF_PRELOAD_TIME;
|
||||
|
||||
Delay = (gEeprom.DTMF_PRELOAD_TIME < 200) ? 200 : gEeprom.DTMF_PRELOAD_TIME;
|
||||
|
||||
if (gEeprom.DTMF_SIDE_TONE)
|
||||
{
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
{ // the user will also hear the transmitted tones
|
||||
AUDIO_AudioPathOn();
|
||||
gEnableSpeaker = true;
|
||||
Delay = (gEeprom.DTMF_PRELOAD_TIME < 60) ? 60 : gEeprom.DTMF_PRELOAD_TIME;
|
||||
}
|
||||
|
||||
SYSTEM_DelayMs(Delay);
|
||||
|
||||
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
||||
@@ -364,7 +450,7 @@ void DTMF_Reply(void)
|
||||
gEeprom.DTMF_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_CODE_INTERVAL_TIME);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
gEnableSpeaker = false;
|
||||
|
||||
|
||||
46
app/dtmf.h
@@ -33,7 +33,15 @@ typedef enum DTMF_State_t DTMF_State_t;
|
||||
enum DTMF_CallState_t {
|
||||
DTMF_CALL_STATE_NONE = 0,
|
||||
DTMF_CALL_STATE_CALL_OUT,
|
||||
DTMF_CALL_STATE_RECEIVED
|
||||
DTMF_CALL_STATE_RECEIVED,
|
||||
DTMF_CALL_STATE_RECEIVED_STAY
|
||||
};
|
||||
|
||||
enum DTMF_DecodeResponse_t {
|
||||
DTMF_DEC_RESPONSE_NONE = 0,
|
||||
DTMF_DEC_RESPONSE_RING,
|
||||
DTMF_DEC_RESPONSE_REPLY,
|
||||
DTMF_DEC_RESPONSE_BOTH
|
||||
};
|
||||
|
||||
typedef enum DTMF_CallState_t DTMF_CallState_t;
|
||||
@@ -53,15 +61,24 @@ enum DTMF_CallMode_t {
|
||||
DTMF_CALL_MODE_DTMF
|
||||
};
|
||||
|
||||
enum { // seconds
|
||||
DTMF_HOLD_MIN = 5,
|
||||
DTMF_HOLD_MAX = 60
|
||||
};
|
||||
|
||||
typedef enum DTMF_CallMode_t DTMF_CallMode_t;
|
||||
|
||||
extern char gDTMF_String[15];
|
||||
extern char gDTMF_InputBox[15];
|
||||
|
||||
extern char gDTMF_Received[16];
|
||||
extern uint8_t gDTMF_WriteIndex;
|
||||
extern char gDTMF_InputBox[15];
|
||||
extern uint8_t gDTMF_InputBox_Index;
|
||||
extern bool gDTMF_InputMode;
|
||||
extern uint8_t gDTMF_PreviousIndex;
|
||||
extern uint8_t gDTMF_RecvTimeout;
|
||||
|
||||
extern char gDTMF_RX[17];
|
||||
extern uint8_t gDTMF_RX_index;
|
||||
extern uint8_t gDTMF_RX_timeout;
|
||||
extern bool gDTMF_RX_pending;
|
||||
|
||||
extern char gDTMF_RX_live[20];
|
||||
extern uint8_t gDTMF_RX_live_timeout;
|
||||
@@ -71,25 +88,24 @@ extern char gDTMF_ID[4];
|
||||
extern char gDTMF_Caller[4];
|
||||
extern char gDTMF_Callee[4];
|
||||
extern DTMF_State_t gDTMF_State;
|
||||
extern bool gDTMF_DecodeRing;
|
||||
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||
extern uint8_t gDTMFChosenContact;
|
||||
extern uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
extern uint8_t gDTMF_InputIndex;
|
||||
extern bool gDTMF_InputMode;
|
||||
extern uint8_t gDTMF_chosen_contact;
|
||||
extern uint8_t gDTMF_auto_reset_time_500ms;
|
||||
extern DTMF_CallState_t gDTMF_CallState;
|
||||
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
||||
extern bool gDTMF_IsTx;
|
||||
extern uint8_t gDTMF_TxStopCountdown_500ms;
|
||||
|
||||
bool DTMF_ValidateCodes(char *pCode, uint8_t Size);
|
||||
void DTMF_clear_RX(void);
|
||||
bool DTMF_ValidateCodes(char *pCode, const unsigned int size);
|
||||
bool DTMF_GetContact(const int Index, char *pContact);
|
||||
bool DTMF_FindContact(const char *pContact, char *pResult);
|
||||
char DTMF_GetCharacter(const uint8_t code);
|
||||
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, uint8_t Size, bool bFlag);
|
||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, uint32_t Size);
|
||||
void DTMF_Append(char Code);
|
||||
char DTMF_GetCharacter(const unsigned int code);
|
||||
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, const unsigned int size, const bool bFlag);
|
||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
|
||||
void DTMF_clear_input_box(void);
|
||||
void DTMF_Append(const char vode);
|
||||
void DTMF_HandleRequest(void);
|
||||
void DTMF_Reply(void);
|
||||
|
||||
|
||||
14
app/fm.c
@@ -45,7 +45,6 @@ bool gFM_AutoScan;
|
||||
uint8_t gFM_ChannelPosition;
|
||||
bool gFM_FoundFrequency;
|
||||
bool gFM_AutoScan;
|
||||
uint8_t gFM_ResumeCountdown_500ms;
|
||||
uint16_t gFM_RestoreCountdown_10ms;
|
||||
|
||||
bool FM_CheckValidChannel(uint8_t Channel)
|
||||
@@ -97,7 +96,7 @@ void FM_TurnOff(void)
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
gFM_RestoreCountdown_10ms = 0;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
gEnableSpeaker = false;
|
||||
|
||||
@@ -120,7 +119,7 @@ void FM_EraseChannels(void)
|
||||
|
||||
void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag)
|
||||
{
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
gEnableSpeaker = false;
|
||||
|
||||
@@ -167,7 +166,7 @@ void FM_PlayAndUpdate(void)
|
||||
gScheduleFM = false;
|
||||
gAskToSave = false;
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOn();
|
||||
|
||||
gEnableSpeaker = true;
|
||||
}
|
||||
@@ -278,8 +277,7 @@ static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
uint32_t Frequency;
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
Frequency /= 10000;
|
||||
Frequency = StrToUL(INPUTBOX_GetAscii());
|
||||
|
||||
if (Frequency < gEeprom.FM_LowerLimit || gEeprom.FM_UpperLimit < Frequency)
|
||||
{
|
||||
@@ -627,7 +625,7 @@ void FM_Play(void)
|
||||
if (!gEeprom.FM_IsMrMode)
|
||||
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOn();
|
||||
gEnableSpeaker = true;
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
@@ -661,7 +659,7 @@ void FM_Start(void)
|
||||
|
||||
BK1080_Init(gEeprom.FM_FrequencyPlaying, true);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOn();
|
||||
|
||||
gEnableSpeaker = true;
|
||||
gUpdateStatus = true;
|
||||
|
||||
1
app/fm.h
@@ -39,7 +39,6 @@ extern uint8_t gFM_ChannelPosition;
|
||||
extern uint16_t gFM_FrequencyDeviation;
|
||||
extern bool gFM_FoundFrequency;
|
||||
extern bool gFM_AutoScan;
|
||||
extern uint8_t gFM_ResumeCountdown_500ms;
|
||||
extern uint16_t gFM_RestoreCountdown_10ms;
|
||||
|
||||
bool FM_CheckValidChannel(uint8_t Channel);
|
||||
|
||||
280
app/generic.c
@@ -17,9 +17,12 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/common.h"
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
|
||||
#include "app/generic.h"
|
||||
#include "app/menu.h"
|
||||
#include "app/scanner.h"
|
||||
@@ -37,29 +40,24 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gInputBoxIndex > 0)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
if (!bKeyHeld && bKeyPressed) // short pressed
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyHeld || !bKeyPressed)
|
||||
if (bKeyHeld || !bKeyPressed) // held or released
|
||||
{
|
||||
if (bKeyHeld || bKeyPressed)
|
||||
if (bKeyHeld || bKeyPressed) // held or pressed (cannot be held and not pressed I guess, so it checks only if HELD?)
|
||||
{
|
||||
if (!bKeyHeld)
|
||||
if (!bKeyHeld) // won't ever pass
|
||||
return;
|
||||
|
||||
if (!bKeyPressed)
|
||||
if (!bKeyPressed) // won't ever pass
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
||||
#endif
|
||||
|
||||
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
||||
gRequestSaveSettings = true;
|
||||
COMMON_KeypadLockToggle();
|
||||
}
|
||||
else
|
||||
else // released
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM)
|
||||
@@ -69,7 +67,10 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
#endif
|
||||
|
||||
gWasFKeyPressed = !gWasFKeyPressed;
|
||||
gWasFKeyPressed = !gWasFKeyPressed; // toggle F function
|
||||
|
||||
if (gWasFKeyPressed)
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (!gWasFKeyPressed)
|
||||
@@ -79,16 +80,16 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
else // short pressed
|
||||
{
|
||||
if (gScreenToDisplay != DISPLAY_FM)
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState == FM_SCAN_OFF)
|
||||
if (gFM_ScanState == FM_SCAN_OFF) // not scanning
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
@@ -96,6 +97,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
#endif
|
||||
|
||||
gBeepToPlay = BEEP_440HZ_500MS;
|
||||
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
}
|
||||
@@ -104,154 +106,144 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
if (!bKeyPressed)
|
||||
{
|
||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
|
||||
{ // PTT released
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{ // we are transmitting .. stop
|
||||
|
||||
if (gFlagEndTransmission)
|
||||
{
|
||||
if (gFlagEndTransmission)
|
||||
{
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
}
|
||||
else
|
||||
{
|
||||
APP_EndTransmission();
|
||||
|
||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||
{
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
}
|
||||
else
|
||||
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
||||
}
|
||||
|
||||
gFlagEndTransmission = false;
|
||||
gVOX_NoiseDetected = false;
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
}
|
||||
else
|
||||
{
|
||||
APP_EndTransmission();
|
||||
|
||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
else
|
||||
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
||||
}
|
||||
|
||||
gFlagEndTransmission = false;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVOX_NoiseDetected = false;
|
||||
#endif
|
||||
|
||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||
|
||||
// beep when you release the PTT
|
||||
//gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL; // 1of11
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gScanState != SCAN_OFF)
|
||||
{
|
||||
SCANNER_Stop();
|
||||
// PTT pressed
|
||||
|
||||
gPttDebounceCounter = 0;
|
||||
gPttIsPressed = false;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
if (gScanStateDir != SCAN_OFF || // frequency/channel scanning
|
||||
gScreenToDisplay == DISPLAY_SCANNER || // CTCSS/CDCSS scanning
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF) // " "
|
||||
{ // we're scanning .. stop
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState == FM_SCAN_OFF)
|
||||
#endif
|
||||
{
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gScreenToDisplay == DISPLAY_MENU || gScreenToDisplay == DISPLAY_FM)
|
||||
#else
|
||||
if (gScreenToDisplay == DISPLAY_MENU)
|
||||
#endif
|
||||
{
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gInputBoxIndex = 0;
|
||||
gPttIsPressed = false;
|
||||
gPttDebounceCounter = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
gFlagPrepareTX = true;
|
||||
|
||||
if (gDTMF_InputMode)
|
||||
{
|
||||
if (gDTMF_InputIndex > 0 || gDTMF_PreviousIndex > 0)
|
||||
{
|
||||
if (gDTMF_InputIndex == 0)
|
||||
gDTMF_InputIndex = gDTMF_PreviousIndex;
|
||||
|
||||
gDTMF_InputBox[gDTMF_InputIndex] = 0;
|
||||
|
||||
#if 0
|
||||
// append our DTMF ID to the inputted DTMF code -
|
||||
// IF the user inputted code is exactly 3 digits long
|
||||
if (gDTMF_InputIndex == 3)
|
||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
||||
else
|
||||
#else
|
||||
// append our DTMF ID to the inputted DTMF code -
|
||||
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
||||
if (gDTMF_InputIndex == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
||||
else
|
||||
#endif
|
||||
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
||||
|
||||
strcpy(gDTMF_String, gDTMF_InputBox);
|
||||
|
||||
gDTMF_PreviousIndex = gDTMF_InputIndex;
|
||||
gDTMF_ReplyState = DTMF_REPLY_ANI;
|
||||
gDTMF_State = DTMF_STATE_0;
|
||||
}
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gFlagPrepareTX = true;
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
||||
gUpdateStatus = true;
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||
{ // CTCSS/CDCSS scanning .. stop
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||
gFlagStopScan = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gFlagResetVfos = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MENU_StopCssScan();
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
{ // frequency/channel scanning . .stop
|
||||
SCANNER_Stop();
|
||||
}
|
||||
}
|
||||
#ifdef ENABLE_FMRADIO
|
||||
else
|
||||
{
|
||||
FM_PlayAndUpdate();
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
{ // CTCSS/CDCSS scanning .. stop
|
||||
MENU_StopCssScan();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
goto cancel_tx;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState != FM_SCAN_OFF)
|
||||
{ // FM radio is scanning .. stop
|
||||
FM_PlayAndUpdate();
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
goto cancel_tx;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gScreenToDisplay == DISPLAY_FM)
|
||||
goto start_tx; // listening to the FM radio .. start TX'ing
|
||||
#endif
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0)
|
||||
{ // already transmitting
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
if (!gDTMF_InputMode && gDTMF_InputBox_Index == 0)
|
||||
goto start_tx; // wasn't entering a DTMF code .. start TX'ing (maybe)
|
||||
|
||||
// was entering a DTMF string
|
||||
|
||||
if (gDTMF_InputBox_Index > 0 || gDTMF_PreviousIndex > 0)
|
||||
{ // going to transmit a DTMF string
|
||||
|
||||
if (gDTMF_InputBox_Index == 0 && gDTMF_PreviousIndex > 0)
|
||||
gDTMF_InputBox_Index = gDTMF_PreviousIndex; // use the previous DTMF string
|
||||
|
||||
if (gDTMF_InputBox_Index < sizeof(gDTMF_InputBox))
|
||||
gDTMF_InputBox[gDTMF_InputBox_Index] = 0; // NULL term the string
|
||||
|
||||
// append our DTMF ID to the inputted DTMF code -
|
||||
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
||||
if (gDTMF_InputBox_Index == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
||||
else
|
||||
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
||||
|
||||
// remember the DTMF string
|
||||
gDTMF_PreviousIndex = gDTMF_InputBox_Index;
|
||||
strcpy(gDTMF_String, gDTMF_InputBox);
|
||||
|
||||
gDTMF_ReplyState = DTMF_REPLY_ANI;
|
||||
gDTMF_State = DTMF_STATE_0;
|
||||
}
|
||||
|
||||
DTMF_clear_input_box();
|
||||
|
||||
start_tx:
|
||||
// request start TX
|
||||
gFlagPrepareTX = true;
|
||||
goto done;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
cancel_tx:
|
||||
if (gPttIsPressed)
|
||||
{
|
||||
gPttWasPressed = true;
|
||||
}
|
||||
|
||||
gPttWasPressed = true;
|
||||
done:
|
||||
gPttDebounceCounter = 0;
|
||||
if (gScreenToDisplay != DISPLAY_MENU && gRequestDisplayScreen != DISPLAY_FM) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gUpdateStatus = true;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
|
||||
577
app/main.c
@@ -18,16 +18,20 @@
|
||||
|
||||
#include "app/action.h"
|
||||
#include "app/app.h"
|
||||
#include "app/common.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
#include "app/generic.h"
|
||||
#include "app/main.h"
|
||||
#include "app/scanner.h"
|
||||
|
||||
#ifdef ENABLE_SPECTRUM
|
||||
#include "app/spectrum.h"
|
||||
#endif
|
||||
|
||||
#include "audio.h"
|
||||
#include "board.h"
|
||||
#include "driver/bk4819.h"
|
||||
#include "dtmf.h"
|
||||
#include "frequencies.h"
|
||||
@@ -36,11 +40,49 @@
|
||||
#include "settings.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/ui.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -50,36 +92,82 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
#else
|
||||
|
||||
|
||||
// TODO: do something useful with the key
|
||||
// TODO: make use of this function key
|
||||
|
||||
|
||||
#endif
|
||||
break;
|
||||
|
||||
case KEY_1:
|
||||
if (!IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
if (!IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||
if (gEeprom.VFO_OPEN && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{
|
||||
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_INCOMING ||
|
||||
gRxReceptionMode == RX_MODE_NONE ||
|
||||
gScanPauseDelayIn_10ms == 0)
|
||||
{ // scan is running (not paused)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t vfo = gEeprom.TX_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;
|
||||
|
||||
RADIO_SelectVfos();
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
//SETTINGS_SaveChannel(channel, gEeprom.RX_VFO, gRxVfo, 1);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Band = gTxVfo->Band + 1;
|
||||
if (gSetting_350EN || Band != BAND5_350MHz)
|
||||
{
|
||||
if (Band > BAND7_470MHz)
|
||||
Band = BAND1_50MHz;
|
||||
if(gTxVfo->Band == 6 && gTxVfo->pRX->Frequency < 100000000) {
|
||||
gTxVfo->pRX->Frequency = 100000000;
|
||||
return;
|
||||
}
|
||||
else
|
||||
Band = BAND6_400MHz;
|
||||
gTxVfo->Band = Band;
|
||||
else {
|
||||
Band = gTxVfo->Band + 1;
|
||||
if (gSetting_350EN || Band != BAND5_350MHz) {
|
||||
if (Band > BAND7_470MHz)
|
||||
Band = BAND1_50MHz;
|
||||
}
|
||||
else
|
||||
Band = BAND6_400MHz;
|
||||
|
||||
gEeprom.ScreenChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
gTxVfo->Band = Band;
|
||||
|
||||
gEeprom.ScreenChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
}
|
||||
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
if (beep)
|
||||
@@ -88,63 +176,14 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_2:
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_CHAN_B;
|
||||
else
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_CHAN_A;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_B;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
|
||||
else
|
||||
gEeprom.TX_CHANNEL = (Vfo == 0);
|
||||
|
||||
gRequestSaveSettings = 1;
|
||||
gFlagReconfigureVfos = true;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
COMMON_SwitchVFOs();
|
||||
|
||||
if (beep)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
break;
|
||||
|
||||
case KEY_3:
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gEeprom.VFO_OPEN && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
#else
|
||||
if (gEeprom.VFO_OPEN)
|
||||
#endif
|
||||
{
|
||||
uint8_t Channel;
|
||||
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
break;
|
||||
}
|
||||
|
||||
Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 0);
|
||||
if (Channel != 0xFF)
|
||||
{
|
||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(1, Channel + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
COMMON_SwitchVFOMode();
|
||||
|
||||
if (beep)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
@@ -155,7 +194,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
gWasFKeyPressed = false;
|
||||
gFlagStartScan = true;
|
||||
gScanSingleFrequency = false;
|
||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gUpdateStatus = true;
|
||||
|
||||
@@ -165,46 +204,33 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_5:
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if(beep) {
|
||||
#ifdef ENABLE_NOAA
|
||||
|
||||
if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_CHANNEL];
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_VFO];
|
||||
}
|
||||
else
|
||||
{
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
||||
#ifdef ENABLE_VOICE
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO];
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
#elif defined(ENABLE_SPECTRUM)
|
||||
#elif defined(ENABLE_SPECTRUM)
|
||||
APP_RunSpectrum();
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
#else
|
||||
// toggle scanlist-1 and scanlist 2
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef ENABLE_VOX
|
||||
toggle_chan_scanlist();
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case KEY_6:
|
||||
@@ -212,7 +238,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_7:
|
||||
#ifdef ENABLE_VOX
|
||||
ACTION_Vox();
|
||||
#else
|
||||
toggle_chan_scanlist();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case KEY_8:
|
||||
@@ -225,11 +255,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
{
|
||||
gEeprom.MrChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(1, gEeprom.CHAN_1_CALL + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(1, gEeprom.CHAN_1_CALL + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
break;
|
||||
@@ -254,45 +284,36 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (bKeyHeld)
|
||||
{ // 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
|
||||
gInputBoxIndex = 0;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
|
||||
processFKeyFunction(Key, false);
|
||||
if (gInputBoxIndex > 0)
|
||||
{ // delete any inputted chars
|
||||
gInputBoxIndex = 0;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
|
||||
processFKeyFunction(Key, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MAIN_KEY_HOLD
|
||||
if (bKeyPressed)
|
||||
{ // key is pressed
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed
|
||||
return; // don't use the key till it's released
|
||||
}
|
||||
#else
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
#endif
|
||||
if (bKeyPressed)
|
||||
{ // key is pressed
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed
|
||||
return; // don't use the key till it's released
|
||||
}
|
||||
|
||||
if (!gWasFKeyPressed)
|
||||
{ // F-key wasn't pressed
|
||||
|
||||
const uint8_t Vfo = gEeprom.TX_CHANNEL;
|
||||
const uint8_t Vfo = gEeprom.TX_VFO;
|
||||
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
|
||||
@@ -302,7 +323,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // user is entering channel number
|
||||
|
||||
|
||||
uint16_t Channel;
|
||||
|
||||
if (gInputBoxIndex != 3)
|
||||
@@ -337,14 +358,14 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
// #ifdef ENABLE_NOAA
|
||||
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
// if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
// #endif
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // user is entering frequency
|
||||
|
||||
uint32_t Frequency;
|
||||
{ // user is entering a frequency
|
||||
|
||||
if (gInputBoxIndex < 6)
|
||||
uint32_t Frequency;
|
||||
bool isGigaF = gTxVfo->pRX->Frequency >= 100000000;
|
||||
if (gInputBoxIndex < 6 + isGigaF)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
@@ -354,26 +375,25 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
Frequency = StrToUL(INPUTBOX_GetAscii()) * 100;
|
||||
|
||||
// clamp the frequency entered to some valid value
|
||||
if (Frequency < LowerLimitFrequencyBandTable[0])
|
||||
if (Frequency < frequencyBandTable[0].lower)
|
||||
{
|
||||
Frequency = LowerLimitFrequencyBandTable[0];
|
||||
Frequency = frequencyBandTable[0].lower;
|
||||
}
|
||||
else
|
||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
{
|
||||
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2;
|
||||
Frequency = (Frequency < center) ? bx_stop1_Hz : bx_start2_Hz;
|
||||
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||
Frequency = (Frequency < center) ? BX4819_band1.upper : BX4819_band2.lower;
|
||||
}
|
||||
else
|
||||
if (Frequency > UpperLimitFrequencyBandTable[6])
|
||||
if (Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||
{
|
||||
Frequency = UpperLimitFrequencyBandTable[6];
|
||||
Frequency = frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
const FREQUENCY_Band_t band = FREQUENCY_GetBand(Frequency);
|
||||
|
||||
@@ -386,35 +406,32 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gTxVfo->Band = band;
|
||||
gEeprom.ScreenChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||
|
||||
|
||||
SETTINGS_SaveVfoIndices();
|
||||
|
||||
|
||||
RADIO_ConfigureChannel(Vfo, VFO_CONFIGURE_RELOAD);
|
||||
}
|
||||
|
||||
// Frequency += 75; // is this meant to be rounding ?
|
||||
Frequency += gTxVfo->StepFrequency / 2; // no idea, but this is
|
||||
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]);
|
||||
|
||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
||||
|
||||
Frequency = FREQUENCY_RoundToStep(Frequency, gTxVfo->StepFrequency);
|
||||
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
{ // clamp the frequency to the limit
|
||||
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2;
|
||||
Frequency = (Frequency < center) ? bx_stop1_Hz - gTxVfo->StepFrequency : bx_start2_Hz;
|
||||
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||
Frequency = (Frequency < center) ? BX4819_band1.upper - gTxVfo->StepFrequency : BX4819_band2.lower;
|
||||
}
|
||||
|
||||
|
||||
gTxVfo->freq_config_RX.Frequency = Frequency;
|
||||
|
||||
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // user is entering NOAA channel
|
||||
|
||||
|
||||
uint8_t Channel;
|
||||
|
||||
if (gInputBoxIndex != 2)
|
||||
@@ -458,14 +475,22 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
{ // exit key pressed
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{ // clear CALL mode being displayed
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
gUpdateDisplay = true;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (!gFmRadioMode)
|
||||
#endif
|
||||
{
|
||||
if (gScanState == SCAN_OFF)
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
{
|
||||
if (gInputBoxIndex == 0)
|
||||
return;
|
||||
@@ -480,6 +505,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
else
|
||||
{
|
||||
gScanKeepResult = false;
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -499,11 +525,12 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
if (bKeyHeld && bKeyPressed)
|
||||
{
|
||||
if (gInputBoxIndex > 0)
|
||||
{ // exit key held down
|
||||
|
||||
if (gInputBoxIndex > 0 || gDTMF_InputBox_Index > 0 || gDTMF_InputMode)
|
||||
{ // cancel key input mode (channel/frequency entry)
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputIndex = 0;
|
||||
gDTMF_InputBox_Index = 0;
|
||||
memset(gDTMF_String, 0, sizeof(gDTMF_String));
|
||||
gInputBoxIndex = 0;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
@@ -514,11 +541,18 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
{
|
||||
if (bKeyPressed && !bKeyHeld)
|
||||
// menu key pressed
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (bKeyHeld)
|
||||
{ // key held down (long press)
|
||||
{ // menu key held down (long press)
|
||||
|
||||
if (bKeyPressed)
|
||||
{
|
||||
{ // long press MENU key
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||
{
|
||||
if (gInputBoxIndex > 0)
|
||||
@@ -530,69 +564,26 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
|
||||
|
||||
|
||||
// TODO: long press M-key
|
||||
|
||||
|
||||
|
||||
#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))
|
||||
{ // VFO mode
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // other VFO is in channel mode
|
||||
channel = gTxVfo->CHANNEL_SAVE;
|
||||
vfo = gRxVfo->CHANNEL_SAVE;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // VFO mode
|
||||
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;
|
||||
|
||||
|
||||
|
||||
//gEeprom.RX_CHANNEL = () & 1; // swap to the VFO
|
||||
|
||||
|
||||
// gRequestSaveVFO = true;
|
||||
// gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
// gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ACTION_Handle(KEY_MENU, bKeyPressed, bKeyHeld);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bKeyPressed)
|
||||
{
|
||||
bool bFlag;
|
||||
if (!bKeyPressed && !gDTMF_InputMode)
|
||||
{ // menu key released
|
||||
const bool bFlag = (gInputBoxIndex == 0);
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
bFlag = (gInputBoxIndex == 0);
|
||||
gInputBoxIndex = 0;
|
||||
if (bFlag)
|
||||
{
|
||||
gFlagRefreshSetting = true;
|
||||
if (gScanStateDir != SCAN_OFF) {
|
||||
SCANNER_Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
gFlagRefreshSetting = true;
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_MENU;
|
||||
@@ -607,6 +598,9 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
return;
|
||||
|
||||
if (gInputBoxIndex)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
@@ -614,72 +608,72 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyHeld || !bKeyPressed)
|
||||
{
|
||||
if (bKeyHeld || bKeyPressed)
|
||||
{
|
||||
if (!bKeyHeld)
|
||||
return;
|
||||
if (bKeyHeld && !gWasFKeyPressed) // long press
|
||||
{
|
||||
if (!bKeyPressed) // released
|
||||
return;
|
||||
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
ACTION_Scan(false);// toggle scanning
|
||||
|
||||
ACTION_Scan(false);
|
||||
return;
|
||||
}
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyPressed) // just pressed
|
||||
{
|
||||
// gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
// just released
|
||||
|
||||
if (!gWasFKeyPressed) // pressed without the F-key
|
||||
{
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gScanState == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (gScanStateDir == SCAN_OFF && !IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
#else
|
||||
if (gScanState == SCAN_OFF)
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
#endif
|
||||
{
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
{ // start entering a DTMF string
|
||||
|
||||
memmove(gDTMF_InputBox, gDTMF_String, MIN(sizeof(gDTMF_InputBox), sizeof(gDTMF_String) - 1));
|
||||
gDTMF_InputBox_Index = 0;
|
||||
gDTMF_InputMode = true;
|
||||
memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox));
|
||||
gDTMF_InputIndex = 0;
|
||||
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
if (!gWasFKeyPressed)
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
{ // with the F-key
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gFlagStartScan = true;
|
||||
gScanSingleFrequency = true;
|
||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
}
|
||||
else
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
#else
|
||||
gFlagStartScan = true;
|
||||
gScanSingleFrequency = true;
|
||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
gPttWasReleased = true;
|
||||
// scan the CTCSS/DCS code
|
||||
gFlagStartScan = true;
|
||||
gScanSingleFrequency = true;
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
}
|
||||
|
||||
gPttWasReleased = true;
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -713,10 +707,10 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
}
|
||||
|
||||
if (gScanState == SCAN_OFF)
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
||||
if (!IS_NOAA_CHANNEL(Channel))
|
||||
#endif
|
||||
{
|
||||
uint8_t Next;
|
||||
@@ -725,14 +719,14 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
{ // step/down in frequency
|
||||
const uint32_t frequency = APP_SetFrequencyByStep(gTxVfo, Direction);
|
||||
|
||||
if (RX_FREQUENCY_Check(frequency) < 0)
|
||||
if (RX_freq_check(frequency) < 0)
|
||||
{ // frequency not allowed
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
gTxVfo->freq_config_RX.Frequency = frequency;
|
||||
|
||||
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
}
|
||||
@@ -744,8 +738,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
if (Channel == Next)
|
||||
return;
|
||||
|
||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Next;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Next;
|
||||
gEeprom.MrChannel[gEeprom.TX_VFO] = Next;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Next;
|
||||
|
||||
if (!bKeyHeld)
|
||||
{
|
||||
@@ -758,9 +752,9 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
{
|
||||
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
|
||||
gEeprom.NoaaChannel[gEeprom.TX_CHANNEL] = Channel;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel;
|
||||
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_VFO] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
|
||||
gEeprom.NoaaChannel[gEeprom.TX_VFO] = Channel;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -769,7 +763,10 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
return;
|
||||
}
|
||||
|
||||
CHANNEL_Next(false, Direction);
|
||||
// jump to the next channel
|
||||
SCANNER_ScanChannels(false, Direction);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
@@ -785,29 +782,25 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gDTMF_InputMode && bKeyPressed)
|
||||
if (gDTMF_InputMode && bKeyPressed && !bKeyHeld)
|
||||
{
|
||||
if (!bKeyHeld)
|
||||
{
|
||||
const char Character = DTMF_GetCharacter(Key);
|
||||
if (Character != 0xFF)
|
||||
{ // add key to DTMF string
|
||||
DTMF_Append(Character);
|
||||
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gPttWasReleased = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
const char Character = DTMF_GetCharacter(Key);
|
||||
if (Character != 0xFF)
|
||||
{ // add key to DTMF string
|
||||
DTMF_Append(Character);
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gPttWasReleased = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: ???
|
||||
if (Key > KEY_PTT)
|
||||
{
|
||||
Key = KEY_SIDE2;
|
||||
}
|
||||
// if (Key > KEY_PTT)
|
||||
// {
|
||||
// Key = KEY_SIDE2; // what's this doing ???
|
||||
// }
|
||||
|
||||
switch (Key)
|
||||
{
|
||||
|
||||
505
app/menu.c
@@ -32,6 +32,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "frequencies.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#if defined(ENABLE_OVERLAY)
|
||||
@@ -46,6 +47,34 @@
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom)
|
||||
{
|
||||
BK4819_WriteRegister(BK4819_REG_3B, 22656 + value);
|
||||
|
||||
if (update_eeprom)
|
||||
{
|
||||
struct
|
||||
{
|
||||
int16_t BK4819_XtalFreqLow;
|
||||
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;
|
||||
|
||||
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
||||
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
||||
//
|
||||
EEPROM_ReadBuffer(0x1F88, &misc, 8);
|
||||
misc.BK4819_XtalFreqLow = value;
|
||||
EEPROM_WriteBuffer(0x1F88, &misc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void MENU_StartCssScan(int8_t Direction)
|
||||
{
|
||||
gCssScanMode = CSS_SCAN_MODE_SCANNING;
|
||||
@@ -57,8 +86,8 @@ void MENU_StartCssScan(int8_t Direction)
|
||||
|
||||
MENU_SelectNextCode();
|
||||
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
|
||||
void MENU_StopCssScan(void)
|
||||
@@ -69,9 +98,9 @@ void MENU_StopCssScan(void)
|
||||
RADIO_SetupRegisters(true);
|
||||
}
|
||||
|
||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||
{
|
||||
switch (Cursor)
|
||||
switch (menu_id)
|
||||
{
|
||||
case MENU_SQL:
|
||||
*pMin = 0;
|
||||
@@ -88,6 +117,16 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1;
|
||||
break;
|
||||
|
||||
case MENU_ABR_MIN:
|
||||
*pMin = 0;
|
||||
*pMax = 9;
|
||||
break;
|
||||
|
||||
case MENU_ABR_MAX:
|
||||
*pMin = 1;
|
||||
*pMax = 10;
|
||||
break;
|
||||
|
||||
case MENU_F_LOCK:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_F_LOCK) - 1;
|
||||
@@ -109,9 +148,8 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
case MENU_XB:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_CHAN) - 1;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_RXMode) - 1;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -166,12 +204,11 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_Compand) - 1;
|
||||
break;
|
||||
#endif
|
||||
case MENU_COMPAND:
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_RX_TX) - 1;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
case MENU_AM_FIX_TEST1:
|
||||
@@ -219,7 +256,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_TOT) - 1;
|
||||
break;
|
||||
|
||||
case MENU_VOX:
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
#endif
|
||||
case MENU_RP_STE:
|
||||
*pMin = 0;
|
||||
*pMax = 10;
|
||||
@@ -250,7 +289,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
*pMin = 1;
|
||||
*pMin = 0;
|
||||
*pMax = 2;
|
||||
break;
|
||||
|
||||
@@ -284,9 +323,30 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = 16;
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
*pMin = -50;
|
||||
*pMax = +50;
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
*pMin = -50;
|
||||
*pMax = +50;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_BATCAL:
|
||||
*pMin = 1600;
|
||||
*pMax = 2200;
|
||||
break;
|
||||
|
||||
case MENU_BATTYP:
|
||||
*pMin = 0;
|
||||
*pMax = 1;
|
||||
break;
|
||||
|
||||
case MENU_F1SHRT:
|
||||
case MENU_F1LONG:
|
||||
case MENU_F2SHRT:
|
||||
case MENU_F2LONG:
|
||||
case MENU_MLONG:
|
||||
*pMin = 0;
|
||||
*pMax = gSubMenu_SIDEFUNCTIONS_size-1;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -303,14 +363,14 @@ void MENU_AcceptSetting(void)
|
||||
uint8_t Code;
|
||||
FREQ_Config_t *pConfig = &gTxVfo->freq_config_RX;
|
||||
|
||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max))
|
||||
if (!MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||
{
|
||||
if (gSubMenuSelection < Min) gSubMenuSelection = Min;
|
||||
else
|
||||
if (gSubMenuSelection > Max) gSubMenuSelection = Max;
|
||||
}
|
||||
|
||||
switch (gMenuCursor)
|
||||
switch (GetCurrentMenuId())
|
||||
{
|
||||
default:
|
||||
return;
|
||||
@@ -368,9 +428,7 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_T_CTCS:
|
||||
pConfig = &gTxVfo->freq_config_TX;
|
||||
|
||||
// Fallthrough
|
||||
|
||||
[[fallthrough]];
|
||||
case MENU_R_CTCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
{
|
||||
@@ -380,14 +438,20 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
}
|
||||
Code = 0;
|
||||
pConfig->Code = Code;
|
||||
pConfig->CodeType = CODE_TYPE_OFF;
|
||||
|
||||
BK4819_ExitSubAu();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
Code = gSubMenuSelection - 1;
|
||||
pConfig->Code = Code;
|
||||
|
||||
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||
}
|
||||
pConfig->Code = Code;
|
||||
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
@@ -408,6 +472,12 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_SCR:
|
||||
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
||||
#if 0
|
||||
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
#endif
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
@@ -421,7 +491,7 @@ void MENU_AcceptSetting(void)
|
||||
#if 0
|
||||
gEeprom.MrChannel[0] = gSubMenuSelection;
|
||||
#else
|
||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = gSubMenuSelection;
|
||||
gEeprom.MrChannel[gEeprom.TX_VFO] = gSubMenuSelection;
|
||||
#endif
|
||||
gRequestSaveChannel = 2;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
@@ -441,7 +511,7 @@ void MENU_AcceptSetting(void)
|
||||
// save the channel name
|
||||
memset(gTxVfo->Name, 0, sizeof(gTxVfo->Name));
|
||||
memmove(gTxVfo->Name, edit, 10);
|
||||
SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_CHANNEL, gTxVfo, 3);
|
||||
SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_VFO, gTxVfo, 3);
|
||||
gFlagReconfigureVfos = true;
|
||||
return;
|
||||
|
||||
@@ -449,38 +519,43 @@ void MENU_AcceptSetting(void)
|
||||
gEeprom.BATTERY_SAVE = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_VOX:
|
||||
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ABR:
|
||||
gEeprom.BACKLIGHT = gSubMenuSelection;
|
||||
gEeprom.BACKLIGHT_TIME = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_ABR_MIN:
|
||||
gEeprom.BACKLIGHT_MIN = gSubMenuSelection;
|
||||
gEeprom.BACKLIGHT_MAX = MAX(gSubMenuSelection + 1 , gEeprom.BACKLIGHT_MAX);
|
||||
break;
|
||||
|
||||
case MENU_ABR_MAX:
|
||||
gEeprom.BACKLIGHT_MAX = gSubMenuSelection;
|
||||
gEeprom.BACKLIGHT_MIN = MIN(gSubMenuSelection - 1, gEeprom.BACKLIGHT_MIN);
|
||||
break;
|
||||
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
gSetting_backlight_on_tx_rx = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
gEeprom.DUAL_WATCH = gSubMenuSelection;
|
||||
gEeprom.DUAL_WATCH = (gEeprom.TX_VFO + 1) * (gSubMenuSelection & 1);
|
||||
gEeprom.CROSS_BAND_RX_TX = (gEeprom.TX_VFO + 1) * ((gSubMenuSelection & 2) > 0);
|
||||
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
|
||||
case MENU_XB:
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
|
||||
return;
|
||||
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||
return;
|
||||
#endif
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = gSubMenuSelection;
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
|
||||
case MENU_BEEP:
|
||||
gEeprom.BEEP_CONTROL = gSubMenuSelection;
|
||||
break;
|
||||
@@ -524,7 +599,7 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_STE:
|
||||
gEeprom.TAIL_NOTE_ELIMINATION = gSubMenuSelection;
|
||||
gEeprom.TAIL_TONE_ELIMINATION = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_RP_STE:
|
||||
@@ -533,7 +608,7 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_MIC:
|
||||
gEeprom.MIC_SENSITIVITY = gSubMenuSelection;
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
gFlagReconfigureVfos = true;
|
||||
break;
|
||||
|
||||
@@ -542,20 +617,21 @@ void MENU_AcceptSetting(void)
|
||||
gSetting_mic_bar = gSubMenuSelection;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
gTxVfo->Compander = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
#endif
|
||||
|
||||
case MENU_COMPAND:
|
||||
gTxVfo->Compander = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
// gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_1_CALL:
|
||||
gEeprom.CHAN_1_CALL = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection - 1;
|
||||
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
@@ -573,7 +649,7 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_D_HOLD:
|
||||
gEeprom.DTMF_AUTO_RESET_TIME = gSubMenuSelection;
|
||||
gEeprom.DTMF_auto_reset_time = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_D_PRE:
|
||||
@@ -591,13 +667,14 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_D_DCD:
|
||||
gTxVfo->DTMF_DECODING_ENABLE = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
DTMF_clear_RX();
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_D_LIVE_DEC:
|
||||
gDTMF_RX_live_timeout = 0;
|
||||
gDTMF_RX_live[0] = '\0';
|
||||
gSetting_live_DTMF_decoder = gSubMenuSelection;
|
||||
gDTMF_RX_live_timeout = 0;
|
||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||
if (!gSetting_live_DTMF_decoder)
|
||||
BK4819_DisableDTMF();
|
||||
gFlagReconfigureVfos = true;
|
||||
@@ -605,12 +682,12 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_D_LIST:
|
||||
gDTMFChosenContact = gSubMenuSelection - 1;
|
||||
gDTMF_chosen_contact = gSubMenuSelection - 1;
|
||||
if (gIsDtmfContactValid)
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
gDTMF_InputMode = true;
|
||||
gDTMF_InputIndex = 3;
|
||||
gDTMF_InputBox_Index = 3;
|
||||
memmove(gDTMF_InputBox, gDTMF_ID, 4);
|
||||
gRequestDisplayScreen = DISPLAY_INVALID;
|
||||
}
|
||||
@@ -693,26 +770,44 @@ void MENU_AcceptSetting(void)
|
||||
gSetting_TX_EN = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection;
|
||||
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;
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
writeXtalFreqCal(gSubMenuSelection, true);
|
||||
return;
|
||||
#endif
|
||||
|
||||
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
||||
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
||||
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
|
||||
Misc.BK4819_XtalFreqLow = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
EEPROM_WriteBuffer(0x1F88, &Misc);
|
||||
}
|
||||
case MENU_BATCAL:
|
||||
{ // voltages are averages between discharge curves of 1600 and 2200 mAh
|
||||
gBatteryCalibration[0] = (520ul * gSubMenuSelection) / 760; // 5.20V empty, blinking above this value, reduced functionality below
|
||||
gBatteryCalibration[1] = (689ul * gSubMenuSelection) / 760; // 6.89V, ~5%, 1 bars above this value
|
||||
gBatteryCalibration[2] = (724ul * gSubMenuSelection) / 760; // 7.24V, ~17%, 2 bars above this value
|
||||
gBatteryCalibration[3] = gSubMenuSelection; // 7.6V, ~29%, 3 bars above this value
|
||||
gBatteryCalibration[4] = (771ul * gSubMenuSelection) / 760; // 7.71V, ~65%, 4 bars above this value
|
||||
gBatteryCalibration[5] = 2300;
|
||||
SETTINGS_SaveBatteryCalibration(gBatteryCalibration);
|
||||
return;
|
||||
}
|
||||
|
||||
case MENU_BATTYP:
|
||||
gEeprom.BATTERY_TYPE = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_F1SHRT:
|
||||
case MENU_F1LONG:
|
||||
case MENU_F2SHRT:
|
||||
case MENU_F2LONG:
|
||||
case MENU_MLONG:
|
||||
{
|
||||
uint8_t * fun[]= {
|
||||
&gEeprom.KEY_1_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_1_LONG_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_LONG_PRESS_ACTION,
|
||||
&gEeprom.KEY_M_LONG_PRESS_ACTION};
|
||||
*fun[GetCurrentMenuId()-MENU_F1SHRT] = gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].id;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
gRequestSaveSettings = true;
|
||||
@@ -722,18 +817,17 @@ void MENU_SelectNextCode(void)
|
||||
{
|
||||
int32_t UpperLimit;
|
||||
|
||||
if (gMenuCursor == MENU_R_DCS)
|
||||
if (GetCurrentMenuId() == MENU_R_DCS)
|
||||
UpperLimit = 208;
|
||||
//UpperLimit = ARRAY_SIZE(DCS_Options);
|
||||
else
|
||||
if (gMenuCursor == MENU_R_CTCS)
|
||||
else if (GetCurrentMenuId() == MENU_R_CTCS)
|
||||
UpperLimit = ARRAY_SIZE(CTCSS_Options) - 1;
|
||||
else
|
||||
return;
|
||||
|
||||
gSubMenuSelection = NUMBER_AddWithWraparound(gSubMenuSelection, gMenuScrollDirection, 1, UpperLimit);
|
||||
|
||||
if (gMenuCursor == MENU_R_DCS)
|
||||
if (GetCurrentMenuId() == MENU_R_DCS)
|
||||
{
|
||||
if (gSubMenuSelection > 104)
|
||||
{
|
||||
@@ -755,7 +849,7 @@ void MENU_SelectNextCode(void)
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
ScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
||||
gScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
@@ -765,7 +859,7 @@ static void MENU_ClampSelection(int8_t Direction)
|
||||
int32_t Min;
|
||||
int32_t Max;
|
||||
|
||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max))
|
||||
if (!MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||
{
|
||||
int32_t Selection = gSubMenuSelection;
|
||||
if (Selection < Min) Selection = Min;
|
||||
@@ -777,7 +871,7 @@ static void MENU_ClampSelection(int8_t Direction)
|
||||
|
||||
void MENU_ShowCurrentSetting(void)
|
||||
{
|
||||
switch (gMenuCursor)
|
||||
switch (GetCurrentMenuId())
|
||||
{
|
||||
case MENU_SQL:
|
||||
gSubMenuSelection = gEeprom.SQUELCH_LEVEL;
|
||||
@@ -857,35 +951,42 @@ void MENU_ShowCurrentSetting(void)
|
||||
#if 0
|
||||
gSubMenuSelection = gEeprom.MrChannel[0];
|
||||
#else
|
||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL];
|
||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MENU_MEM_NAME:
|
||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL];
|
||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
|
||||
break;
|
||||
|
||||
case MENU_SAVE:
|
||||
gSubMenuSelection = gEeprom.BATTERY_SAVE;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ABR:
|
||||
gSubMenuSelection = gEeprom.BACKLIGHT;
|
||||
gSubMenuSelection = gEeprom.BACKLIGHT_TIME;
|
||||
break;
|
||||
|
||||
gBacklightCountdown = 0;
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
|
||||
case MENU_ABR_MIN:
|
||||
gSubMenuSelection = gEeprom.BACKLIGHT_MIN;
|
||||
break;
|
||||
|
||||
case MENU_ABR_MAX:
|
||||
gSubMenuSelection = gEeprom.BACKLIGHT_MAX;
|
||||
break;
|
||||
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
gSubMenuSelection = gSetting_backlight_on_tx_rx;
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
gSubMenuSelection = gEeprom.DUAL_WATCH;
|
||||
break;
|
||||
|
||||
case MENU_XB:
|
||||
gSubMenuSelection = gEeprom.CROSS_BAND_RX_TX;
|
||||
gSubMenuSelection = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
|
||||
break;
|
||||
|
||||
case MENU_BEEP:
|
||||
@@ -896,11 +997,11 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
case MENU_VOICE:
|
||||
gSubMenuSelection = gEeprom.VOICE_PROMPT;
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
case MENU_VOICE:
|
||||
gSubMenuSelection = gEeprom.VOICE_PROMPT;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_SC_REV:
|
||||
gSubMenuSelection = gEeprom.SCAN_RESUME_MODE;
|
||||
@@ -923,7 +1024,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_STE:
|
||||
gSubMenuSelection = gEeprom.TAIL_NOTE_ELIMINATION;
|
||||
gSubMenuSelection = gEeprom.TAIL_TONE_ELIMINATION;
|
||||
break;
|
||||
|
||||
case MENU_RP_STE:
|
||||
@@ -934,24 +1035,22 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gEeprom.MIC_SENSITIVITY;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
case MENU_MIC_BAR:
|
||||
gSubMenuSelection = gSetting_mic_bar;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
gSubMenuSelection = gTxVfo->Compander;
|
||||
return;
|
||||
#endif
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
case MENU_MIC_BAR:
|
||||
gSubMenuSelection = gSetting_mic_bar;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_COMPAND:
|
||||
gSubMenuSelection = gTxVfo->Compander;
|
||||
return;
|
||||
|
||||
case MENU_1_CALL:
|
||||
gSubMenuSelection = gEeprom.CHAN_1_CALL;
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT + 1;
|
||||
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT;
|
||||
break;
|
||||
|
||||
case MENU_SLIST1:
|
||||
@@ -977,7 +1076,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_D_HOLD:
|
||||
gSubMenuSelection = gEeprom.DTMF_AUTO_RESET_TIME;
|
||||
gSubMenuSelection = gEeprom.DTMF_auto_reset_time;
|
||||
break;
|
||||
|
||||
case MENU_D_PRE:
|
||||
@@ -997,7 +1096,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_D_LIST:
|
||||
gSubMenuSelection = gDTMFChosenContact + 1;
|
||||
gSubMenuSelection = gDTMF_chosen_contact + 1;
|
||||
break;
|
||||
|
||||
case MENU_D_LIVE_DEC:
|
||||
@@ -1016,12 +1115,12 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gTxVfo->AM_mode;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
case MENU_AM_FIX:
|
||||
gSubMenuSelection = gSetting_AM_fix;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
case MENU_AM_FIX:
|
||||
gSubMenuSelection = gSetting_AM_fix;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
case MENU_AM_FIX_TEST1:
|
||||
gSubMenuSelection = gSetting_AM_fix_test1;
|
||||
@@ -1038,7 +1137,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
#if 0
|
||||
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[0], 1, false, 1);
|
||||
#else
|
||||
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 1);
|
||||
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 1);
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -1070,9 +1169,46 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gSetting_TX_EN;
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_BATCAL:
|
||||
gSubMenuSelection = gBatteryCalibration[3];
|
||||
break;
|
||||
|
||||
case MENU_BATTYP:
|
||||
gSubMenuSelection = gEeprom.BATTERY_TYPE;
|
||||
break;
|
||||
|
||||
case MENU_F1SHRT:
|
||||
case MENU_F1LONG:
|
||||
case MENU_F2SHRT:
|
||||
case MENU_F2LONG:
|
||||
case MENU_MLONG:
|
||||
{
|
||||
uint8_t * fun[]= {
|
||||
&gEeprom.KEY_1_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_1_LONG_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_LONG_PRESS_ACTION,
|
||||
&gEeprom.KEY_M_LONG_PRESS_ACTION};
|
||||
uint8_t id = *fun[GetCurrentMenuId()-MENU_F1SHRT];
|
||||
|
||||
for(int i = 0; i < gSubMenu_SIDEFUNCTIONS_size; i++) {
|
||||
if(gSubMenu_SIDEFUNCTIONS[i].id==id) {
|
||||
gSubMenuSelection = i;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1088,12 +1224,12 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
{ // currently editing the channel name
|
||||
|
||||
if (edit_index < 10)
|
||||
{
|
||||
if (Key >= KEY_0 && Key <= KEY_9)
|
||||
if (Key <= KEY_9)
|
||||
{
|
||||
edit[edit_index] = '0' + Key - KEY_0;
|
||||
|
||||
@@ -1122,7 +1258,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
Value = (gInputBox[0] * 10) + gInputBox[1];
|
||||
|
||||
|
||||
if (Value > 0 && Value <= gMenuListCount)
|
||||
{
|
||||
gMenuCursor = Value - 1;
|
||||
@@ -1135,7 +1271,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
gInputBox[0] = gInputBox[1];
|
||||
gInputBoxIndex = 1;
|
||||
|
||||
[[fallthrough]];
|
||||
case 1:
|
||||
Value = gInputBox[0];
|
||||
if (Value > 0 && Value <= gMenuListCount)
|
||||
@@ -1153,7 +1289,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_OFFSET)
|
||||
if (GetCurrentMenuId() == MENU_OFFSET)
|
||||
{
|
||||
uint32_t Frequency;
|
||||
|
||||
@@ -1168,15 +1304,18 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Frequency + 75, gTxVfo->StepFrequency, 0);
|
||||
|
||||
Frequency = StrToUL(INPUTBOX_GetAscii())*100;
|
||||
gSubMenuSelection = FREQUENCY_RoundToStep(Frequency, gTxVfo->StepFrequency);
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH || gMenuCursor == MENU_1_CALL || gMenuCursor == MENU_MEM_NAME)
|
||||
|
||||
if (GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
GetCurrentMenuId() == MENU_1_CALL ||
|
||||
GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
{ // enter 3-digit channel number
|
||||
|
||||
if (gInputBoxIndex < 3)
|
||||
@@ -1205,7 +1344,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (MENU_GetLimits(gMenuCursor, &Min, &Max))
|
||||
if (MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
@@ -1250,7 +1389,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gIsInSubMenu)
|
||||
{
|
||||
if (gInputBoxIndex == 0 || gMenuCursor != MENU_OFFSET)
|
||||
if (gInputBoxIndex == 0 || GetCurrentMenuId() != MENU_OFFSET)
|
||||
{
|
||||
gAskForConfirmation = 0;
|
||||
gIsInSubMenu = false;
|
||||
@@ -1264,6 +1403,8 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
else
|
||||
gInputBox[--gInputBoxIndex] = 10;
|
||||
|
||||
// ***********************
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
return;
|
||||
}
|
||||
@@ -1273,11 +1414,10 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
if (gEeprom.BACKLIGHT == 0)
|
||||
|
||||
if (gEeprom.BACKLIGHT_TIME == 0) // backlight set to always off
|
||||
{
|
||||
gBacklightCountdown = 0;
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||
BACKLIGHT_TurnOff(); // turn the backlight OFF
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1305,25 +1445,29 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
if (!gIsInSubMenu)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gMenuCursor != MENU_SCR)
|
||||
if (GetCurrentMenuId() != MENU_SCR)
|
||||
gAnotherVoiceID = MenuList[gMenuCursor].voice_id;
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
if (gMenuCursor == MENU_DEL_CH || gMenuCursor == MENU_MEM_NAME)
|
||||
if (GetCurrentMenuId() == MENU_DEL_CH || GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
if (!RADIO_CheckValidChannel(gSubMenuSelection, false, 0))
|
||||
return; // invalid channel
|
||||
#endif
|
||||
|
||||
gAskForConfirmation = 0;
|
||||
gIsInSubMenu = true;
|
||||
gInputBoxIndex = 0;
|
||||
edit_index = -1;
|
||||
|
||||
// if (GetCurrentMenuId() != MENU_D_LIST)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
edit_index = -1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_MEM_NAME)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
{
|
||||
if (edit_index < 0)
|
||||
{ // enter channel name edit mode
|
||||
@@ -1370,10 +1514,10 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
if (gIsInSubMenu)
|
||||
{
|
||||
if (gMenuCursor == MENU_RESET ||
|
||||
gMenuCursor == MENU_MEM_CH ||
|
||||
gMenuCursor == MENU_DEL_CH ||
|
||||
gMenuCursor == MENU_MEM_NAME)
|
||||
if (GetCurrentMenuId() == MENU_RESET ||
|
||||
GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
{
|
||||
switch (gAskForConfirmation)
|
||||
{
|
||||
@@ -1386,7 +1530,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
UI_DisplayMenu();
|
||||
|
||||
if (gMenuCursor == MENU_RESET)
|
||||
if (GetCurrentMenuId() == MENU_RESET)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM);
|
||||
@@ -1421,7 +1565,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gMenuCursor == MENU_SCR)
|
||||
if (GetCurrentMenuId() == MENU_SCR)
|
||||
gAnotherVoiceID = (gSubMenuSelection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON;
|
||||
else
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
@@ -1437,7 +1581,7 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
{ // currently editing the channel name
|
||||
|
||||
if (edit_index < 10)
|
||||
@@ -1459,12 +1603,12 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gRxVfo->AM_mode == 0)
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gRxVfo->AM_mode == 0)
|
||||
#else
|
||||
if (gRxVfo->AM_mode == 0)
|
||||
#endif
|
||||
{
|
||||
if (gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS)
|
||||
if (GetCurrentMenuId() == MENU_R_CTCS || GetCurrentMenuId() == MENU_R_DCS)
|
||||
{ // scan CTCSS or DCS to find the tone/code of the incoming signal
|
||||
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
@@ -1499,7 +1643,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
uint8_t Channel;
|
||||
bool bCheckScanList;
|
||||
|
||||
if (gMenuCursor == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0)
|
||||
{ // change the character
|
||||
if (bKeyPressed && edit_index < 10 && Direction != 0)
|
||||
{
|
||||
@@ -1545,20 +1689,21 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
|
||||
if (!gIsInSubMenu)
|
||||
{
|
||||
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
|
||||
gFlagRefreshSetting = true;
|
||||
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
|
||||
|
||||
gFlagRefreshSetting = true;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
|
||||
if (gMenuCursor != MENU_ABR && gEeprom.BACKLIGHT == 0)
|
||||
if (GetCurrentMenuId() != MENU_ABR && gEeprom.BACKLIGHT_TIME == 0) // backlight always off and not in the backlight menu
|
||||
{
|
||||
gBacklightCountdown = 0;
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||
BACKLIGHT_TurnOff();
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_OFFSET)
|
||||
if (GetCurrentMenuId() == MENU_OFFSET)
|
||||
{
|
||||
int32_t Offset = (Direction * gTxVfo->StepFrequency) + gSubMenuSelection;
|
||||
if (Offset < 99999990)
|
||||
@@ -1569,14 +1714,14 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
else
|
||||
Offset = 0;
|
||||
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Offset, gTxVfo->StepFrequency, 0);
|
||||
gSubMenuSelection = FREQUENCY_RoundToStep(Offset, gTxVfo->StepFrequency);
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
return;
|
||||
}
|
||||
|
||||
VFO = 0;
|
||||
|
||||
switch (gMenuCursor)
|
||||
switch (GetCurrentMenuId())
|
||||
{
|
||||
case MENU_DEL_CH:
|
||||
case MENU_1_CALL:
|
||||
@@ -1586,11 +1731,12 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
|
||||
case MENU_SLIST2:
|
||||
VFO = 1;
|
||||
[[fallthrough]];
|
||||
case MENU_SLIST1:
|
||||
bCheckScanList = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
MENU_ClampSelection(Direction);
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
return;
|
||||
@@ -1635,7 +1781,7 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
MENU_Key_STAR(bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
case KEY_F:
|
||||
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
{ // currently editing the channel name
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
@@ -1665,6 +1811,19 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
break;
|
||||
}
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MENU && gMenuCursor == MENU_VOL)
|
||||
gVoltageMenuCountdown = menu_timeout_500ms;
|
||||
if (gScreenToDisplay == DISPLAY_MENU)
|
||||
{
|
||||
if (GetCurrentMenuId() == MENU_VOL ||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
GetCurrentMenuId() == MENU_F_CALI ||
|
||||
#endif
|
||||
GetCurrentMenuId() == MENU_BATCAL)
|
||||
{
|
||||
gMenuCountdown = menu_timeout_long_500ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
gMenuCountdown = menu_timeout_500ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom);
|
||||
#endif
|
||||
|
||||
int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax);
|
||||
void MENU_AcceptSetting(void);
|
||||
void MENU_SelectNextCode(void);
|
||||
void MENU_ShowCurrentSetting(void);
|
||||
|
||||
346
app/scanner.c
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/dtmf.h"
|
||||
#include "app/generic.h"
|
||||
#include "app/scanner.h"
|
||||
#include "audio.h"
|
||||
@@ -36,12 +38,26 @@ uint32_t gScanFrequency;
|
||||
bool gScanPauseMode;
|
||||
SCAN_CssState_t gScanCssState;
|
||||
volatile bool gScheduleScanListen = true;
|
||||
volatile uint16_t ScanPauseDelayIn_10ms;
|
||||
volatile uint16_t gScanPauseDelayIn_10ms;
|
||||
uint8_t gScanProgressIndicator;
|
||||
uint8_t gScanHitCount;
|
||||
bool gScanUseCssResult;
|
||||
int8_t gScanState;
|
||||
bool bScanKeepFrequency;
|
||||
int8_t gScanStateDir;
|
||||
bool gScanKeepResult;
|
||||
|
||||
typedef enum {
|
||||
SCAN_NEXT_CHAN_SCANLIST1 = 0,
|
||||
SCAN_NEXT_CHAN_SCANLIST2,
|
||||
SCAN_NEXT_CHAN_DUAL_WATCH,
|
||||
SCAN_NEXT_CHAN_MR,
|
||||
SCAN_NEXT_NUM
|
||||
} scan_next_chan_t;
|
||||
|
||||
|
||||
scan_next_chan_t currentScanList;
|
||||
uint32_t initialFrqOrChan;
|
||||
uint8_t initialCROSS_BAND_RX_TX;
|
||||
uint32_t lastFoundFrqOrChan;
|
||||
|
||||
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
@@ -52,7 +68,9 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
uint16_t Channel;
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
INPUTBOX_Append(Key);
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
|
||||
if (gInputBoxIndex < 3)
|
||||
@@ -64,8 +82,8 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
|
||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -91,7 +109,8 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
case 0:
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||
gUpdateStatus = true;
|
||||
gFlagStopScan = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
@@ -160,34 +179,19 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
case 0:
|
||||
if (!gScanSingleFrequency)
|
||||
{
|
||||
int16_t Delta625;
|
||||
uint32_t Freq250 = FREQUENCY_FloorToStep(gScanFrequency, 250, 0);
|
||||
uint32_t Freq625 = FREQUENCY_FloorToStep(gScanFrequency, 625, 0);
|
||||
int16_t Delta250 = (int16_t)gScanFrequency - (int16_t)Freq250;
|
||||
uint32_t freq250 = FREQUENCY_RoundToStep(gScanFrequency, 250);
|
||||
uint32_t freq625 = FREQUENCY_RoundToStep(gScanFrequency, 625);
|
||||
|
||||
if (125 < Delta250)
|
||||
{
|
||||
Delta250 = 250 - Delta250;
|
||||
Freq250 += 250;
|
||||
}
|
||||
uint32_t diff250 = gScanFrequency > freq250 ? gScanFrequency - freq250 : freq250 - gScanFrequency;
|
||||
uint32_t diff625 = gScanFrequency > freq625 ? gScanFrequency - freq625 : freq625 - gScanFrequency;
|
||||
|
||||
Delta625 = (int16_t)gScanFrequency - (int16_t)Freq625;
|
||||
|
||||
if (312 < Delta625)
|
||||
{
|
||||
Delta625 = 625 - Delta625;
|
||||
Freq625 += 625;
|
||||
}
|
||||
|
||||
if (Delta625 < Delta250)
|
||||
{
|
||||
if(diff250 > diff625) {
|
||||
gStepSetting = STEP_6_25kHz;
|
||||
gScanFrequency = Freq625;
|
||||
gScanFrequency = freq625;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
gStepSetting = STEP_2_5kHz;
|
||||
gScanFrequency = Freq250;
|
||||
gScanFrequency = freq250;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +227,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
case 2:
|
||||
if (!gScanSingleFrequency)
|
||||
{
|
||||
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, FREQUENCY_GetBand(gScanFrequency), gScanFrequency);
|
||||
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, gScanFrequency);
|
||||
|
||||
if (gScanUseCssResult)
|
||||
{
|
||||
@@ -248,16 +252,16 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
Channel = gScanChannel;
|
||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Channel;
|
||||
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
|
||||
}
|
||||
else
|
||||
{
|
||||
Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[gEeprom.TX_CHANNEL] = Channel;
|
||||
gEeprom.FreqChannel[gEeprom.TX_VFO] = Channel;
|
||||
}
|
||||
|
||||
gTxVfo->CHANNEL_SAVE = Channel;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
#endif
|
||||
@@ -358,24 +362,24 @@ void SCANNER_Start(void)
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
gRxVfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
gRxVfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||
#endif
|
||||
|
||||
BackupStep = gRxVfo->STEP_SETTING;
|
||||
BackupFrequency = gRxVfo->StepFrequency;
|
||||
|
||||
RADIO_InitInfo(gRxVfo, gRxVfo->CHANNEL_SAVE, gRxVfo->Band, gRxVfo->pRX->Frequency);
|
||||
RADIO_InitInfo(gRxVfo, gRxVfo->CHANNEL_SAVE, gRxVfo->pRX->Frequency);
|
||||
|
||||
gRxVfo->STEP_SETTING = BackupStep;
|
||||
gRxVfo->StepFrequency = BackupFrequency;
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
gIsNoaaMode = false;
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
gIsNoaaMode = false;
|
||||
#endif
|
||||
|
||||
if (gScanSingleFrequency)
|
||||
{
|
||||
@@ -399,57 +403,257 @@ void SCANNER_Start(void)
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
gScanDelay_10ms = scan_delay_10ms;
|
||||
gScanCssResultCode = 0xFF;
|
||||
gScanCssResultType = 0xFF;
|
||||
gScanHitCount = 0;
|
||||
gScanUseCssResult = false;
|
||||
gDTMF_RequestPending = false;
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
g_CDCSS_Lost = false;
|
||||
gCDCSSCodeType = 0;
|
||||
g_CTCSS_Lost = false;
|
||||
g_VOX_Lost = false;
|
||||
#ifdef ENABLE_VOX
|
||||
g_VOX_Lost = false;
|
||||
#endif
|
||||
g_SquelchLost = false;
|
||||
gScannerEditState = 0;
|
||||
gScanProgressIndicator = 0;
|
||||
}
|
||||
|
||||
void SCANNER_Found()
|
||||
{
|
||||
switch (gEeprom.SCAN_RESUME_MODE)
|
||||
{
|
||||
case SCAN_RESUME_TO:
|
||||
if (!gScanPauseMode)
|
||||
{
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gScanPauseMode = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCAN_RESUME_CO:
|
||||
case SCAN_RESUME_SE:
|
||||
gScanPauseDelayIn_10ms = 0;
|
||||
gScheduleScanListen = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) { //memory scan
|
||||
lastFoundFrqOrChan = gRxVfo->CHANNEL_SAVE;
|
||||
}
|
||||
else { // frequency scan
|
||||
lastFoundFrqOrChan = gRxVfo->freq_config_RX.Frequency;
|
||||
}
|
||||
|
||||
|
||||
gScanKeepResult = true;
|
||||
}
|
||||
|
||||
void SCANNER_Stop(void)
|
||||
{
|
||||
const uint8_t Previous = gRestoreMrChannel;
|
||||
|
||||
gScanState = SCAN_OFF;
|
||||
|
||||
if (!bScanKeepFrequency)
|
||||
{
|
||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||
{
|
||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gRestoreMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = Previous;
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD);
|
||||
}
|
||||
else
|
||||
{
|
||||
gRxVfo->freq_config_RX.Frequency = gRestoreFrequency;
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
}
|
||||
RADIO_SetupRegisters(true);
|
||||
gUpdateDisplay = true;
|
||||
return;
|
||||
if(initialCROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
gEeprom.CROSS_BAND_RX_TX = initialCROSS_BAND_RX_TX;
|
||||
initialCROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
}
|
||||
|
||||
gScanStateDir = SCAN_OFF;
|
||||
|
||||
if (!IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
const uint32_t chFr = gScanKeepResult ? lastFoundFrqOrChan : initialFrqOrChan;
|
||||
const bool channelChanged = chFr != initialFrqOrChan;
|
||||
if (IS_MR_CHANNEL(gNextMrChannel)) {
|
||||
gEeprom.MrChannel[gEeprom.RX_VFO] = chFr;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = chFr;
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
if(channelChanged) {
|
||||
SETTINGS_SaveVfoIndices();
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gRxVfo->freq_config_RX.Frequency = chFr;
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
|
||||
return;
|
||||
if(channelChanged) {
|
||||
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_VFO, gRxVfo, 1);
|
||||
}
|
||||
}
|
||||
|
||||
SETTINGS_SaveVfoIndices();
|
||||
|
||||
gUpdateStatus = true;
|
||||
RADIO_SetupRegisters(true);
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void NextFreqChannel(void)
|
||||
{
|
||||
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
|
||||
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||
#endif
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void NextMemChannel(void)
|
||||
{
|
||||
static unsigned int prev_mr_chan = 0;
|
||||
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
|
||||
const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const unsigned int prev_chan = gNextMrChannel;
|
||||
unsigned int chan = 0;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
switch (currentScanList)
|
||||
{
|
||||
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||
prev_mr_chan = gNextMrChannel;
|
||||
|
||||
if (chan1 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||
{
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gNextMrChannel = chan1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[[fallthrough]];
|
||||
case SCAN_NEXT_CHAN_SCANLIST2:
|
||||
if (chan2 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||
{
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||
gNextMrChannel = chan2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[[fallthrough]];
|
||||
|
||||
// this bit doesn't yet work if the other VFO is a frequency
|
||||
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||
// dual watch is enabled - include the other VFO in the scan
|
||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
// {
|
||||
// chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||
// chan = gEeprom.ScreenChannel[chan];
|
||||
// if (IS_MR_CHANNEL(chan))
|
||||
// {
|
||||
// currentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||
// gNextMrChannel = chan;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
default:
|
||||
case SCAN_NEXT_CHAN_MR:
|
||||
currentScanList = SCAN_NEXT_CHAN_MR;
|
||||
gNextMrChannel = prev_mr_chan;
|
||||
chan = 0xff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!enabled || chan == 0xff)
|
||||
{
|
||||
chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (chan == 0xFF)
|
||||
{ // no valid channel found
|
||||
chan = MR_CHANNEL_FIRST;
|
||||
}
|
||||
|
||||
gNextMrChannel = chan;
|
||||
}
|
||||
|
||||
if (gNextMrChannel != prev_chan)
|
||||
{
|
||||
gEeprom.MrChannel[ gEeprom.RX_VFO] = gNextMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gNextMrChannel;
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
#endif
|
||||
|
||||
if (enabled)
|
||||
if (++currentScanList >= SCAN_NEXT_NUM)
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
|
||||
}
|
||||
|
||||
void SCANNER_ScanChannels(const bool storeBackupSettings, const int8_t scan_direction)
|
||||
{
|
||||
if (storeBackupSettings) {
|
||||
initialCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gScanKeepResult = false;
|
||||
}
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gScanStateDir = scan_direction;
|
||||
|
||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||
{ // channel mode
|
||||
if (storeBackupSettings) {
|
||||
initialFrqOrChan = gRxVfo->CHANNEL_SAVE;
|
||||
lastFoundFrqOrChan = initialFrqOrChan;
|
||||
}
|
||||
NextMemChannel();
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
if (storeBackupSettings) {
|
||||
initialFrqOrChan = gRxVfo->freq_config_RX.Frequency;
|
||||
lastFoundFrqOrChan = initialFrqOrChan;
|
||||
}
|
||||
NextFreqChannel();
|
||||
}
|
||||
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScanPauseMode = false;
|
||||
}
|
||||
|
||||
void SCANNER_ContinueScanning()
|
||||
{
|
||||
if (IS_FREQ_CHANNEL(gNextMrChannel))
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
NextFreqChannel(); // switch to next frequency
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
NextMemChannel(); // switch to next channel
|
||||
}
|
||||
|
||||
gScanPauseMode = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
@@ -32,7 +32,9 @@ typedef enum SCAN_CssState_t SCAN_CssState_t;
|
||||
|
||||
enum
|
||||
{
|
||||
SCAN_OFF = 0,
|
||||
SCAN_REV = -1,
|
||||
SCAN_OFF = 0,
|
||||
SCAN_FWD = +1
|
||||
};
|
||||
|
||||
extern DCS_CodeType_t gScanCssResultType;
|
||||
@@ -46,16 +48,22 @@ extern uint32_t gScanFrequency;
|
||||
extern bool gScanPauseMode;
|
||||
extern SCAN_CssState_t gScanCssState;
|
||||
extern volatile bool gScheduleScanListen;
|
||||
extern volatile uint16_t ScanPauseDelayIn_10ms;
|
||||
extern volatile uint16_t gScanPauseDelayIn_10ms;
|
||||
extern uint8_t gScanProgressIndicator;
|
||||
extern uint8_t gScanHitCount;
|
||||
extern bool gScanUseCssResult;
|
||||
extern int8_t gScanState;
|
||||
extern bool bScanKeepFrequency;
|
||||
|
||||
// scan direction, if not equal SCAN_OFF indicates
|
||||
// that we are in a process of scanning channels/frequencies
|
||||
extern int8_t gScanStateDir;
|
||||
extern bool gScanKeepResult;
|
||||
|
||||
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void SCANNER_Start(void);
|
||||
void SCANNER_Found();
|
||||
void SCANNER_Stop(void);
|
||||
void SCANNER_ScanChannels(const bool storeBackupSettings, const int8_t scan_direction);
|
||||
void SCANNER_ContinueScanning();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
186
app/spectrum.c
@@ -14,7 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "../app/spectrum.h"
|
||||
#include "app/spectrum.h"
|
||||
#include "driver/backlight.h"
|
||||
#include "audio.h"
|
||||
|
||||
struct FrequencyBandInfo {
|
||||
uint32_t lower;
|
||||
@@ -22,19 +24,8 @@ struct FrequencyBandInfo {
|
||||
uint32_t middle;
|
||||
};
|
||||
|
||||
const struct FrequencyBandInfo FrequencyBandTable[7] = {
|
||||
[BAND1_50MHz ] = {.lower = 1600000, .middle = 6500000, .upper = 7600000},
|
||||
[BAND2_108MHz] = {.lower = 10800000, .middle = 12200000, .upper = 13599990},
|
||||
[BAND3_136MHz] = {.lower = 13600000, .middle = 15000000, .upper = 17399990},
|
||||
[BAND4_174MHz] = {.lower = 17400000, .middle = 26000000, .upper = 34999990},
|
||||
[BAND5_350MHz] = {.lower = 35000000, .middle = 37000000, .upper = 39999990},
|
||||
[BAND6_400MHz] = {.lower = 40000000, .middle = 43500000, .upper = 46999990},
|
||||
[BAND7_470MHz] = {.lower = 47000000, .middle = 55000000, .upper = 130000000},
|
||||
};
|
||||
|
||||
|
||||
#define F_MIN FrequencyBandTable[0].lower
|
||||
#define F_MAX FrequencyBandTable[ARRAY_SIZE(FrequencyBandTable) - 1].upper
|
||||
#define F_MIN frequencyBandTable[0].lower
|
||||
#define F_MAX frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper
|
||||
|
||||
const uint16_t RSSI_MAX_VALUE = 65535;
|
||||
|
||||
@@ -57,41 +48,41 @@ PeakInfo peak;
|
||||
ScanInfo scanInfo;
|
||||
KeyboardState kbd = {KEY_INVALID, KEY_INVALID, 0};
|
||||
|
||||
const char *bwOptions[] = {"25k", "12.5k", "6.25k"};
|
||||
const char *modulationTypeOptions[] = {"FM", "AM", "USB"};
|
||||
const char *bwOptions[] = {" 25k", "12.5k", "6.25k"};
|
||||
const char *modulationTypeOptions[] = {" FM", " AM", "USB"};
|
||||
const uint8_t modulationTypeTuneSteps[] = {100, 50, 10};
|
||||
const uint8_t modTypeReg47Values[] = {1, 7, 5};
|
||||
|
||||
SpectrumSettings settings = {STEPS_64,
|
||||
S_STEP_25_0kHz,
|
||||
80000,
|
||||
3200,
|
||||
0,
|
||||
true,
|
||||
BK4819_FILTER_BW_WIDE,
|
||||
BK4819_FILTER_BW_WIDE,
|
||||
false,
|
||||
-130,
|
||||
-50};
|
||||
SpectrumSettings settings = {stepsCount: STEPS_64,
|
||||
scanStepIndex: S_STEP_25_0kHz,
|
||||
frequencyChangeStep: 80000,
|
||||
scanDelay: 3200,
|
||||
rssiTriggerLevel: 150,
|
||||
backlightState: true,
|
||||
bw: BK4819_FILTER_BW_WIDE,
|
||||
listenBw: BK4819_FILTER_BW_WIDE,
|
||||
modulationType: false,
|
||||
dbMin: -130,
|
||||
dbMax: -50};
|
||||
|
||||
uint32_t fMeasure = 0;
|
||||
uint32_t currentFreq, tempFreq;
|
||||
uint16_t rssiHistory[128] = {};
|
||||
uint16_t rssiHistory[128];
|
||||
|
||||
uint8_t freqInputIndex = 0;
|
||||
uint8_t freqInputDotIndex = 0;
|
||||
KEY_Code_t freqInputArr[10];
|
||||
char freqInputString[11] = "----------\0"; // XXXX.XXXXX\0
|
||||
char freqInputString[11];
|
||||
|
||||
uint8_t menuState = 0;
|
||||
uint16_t listenT = 0;
|
||||
|
||||
RegisterSpec registerSpecs[] = {
|
||||
{},
|
||||
{"LNAs", 0x13, 8, 0b11, 1},
|
||||
{"LNA", 0x13, 5, 0b111, 1},
|
||||
{"PGA", 0x13, 0, 0b111, 1},
|
||||
{"IF", 0x3D, 0, 0xFFFF, 0x2aaa},
|
||||
{"LNAs", BK4819_REG_13, 8, 0b11, 1},
|
||||
{"LNA", BK4819_REG_13, 5, 0b111, 1},
|
||||
{"PGA", BK4819_REG_13, 0, 0b111, 1},
|
||||
{"IF", BK4819_REG_3D, 0, 0xFFFF, 0x2aaa},
|
||||
// {"MIX", 0x13, 3, 0b11, 1}, // TODO: hidden
|
||||
};
|
||||
|
||||
@@ -215,23 +206,23 @@ static void ToggleAFBit(bool on) {
|
||||
}
|
||||
|
||||
static void BackupRegisters() {
|
||||
R30 = BK4819_ReadRegister(0x30);
|
||||
R37 = BK4819_ReadRegister(0x37);
|
||||
R3D = BK4819_ReadRegister(0x3D);
|
||||
R43 = BK4819_ReadRegister(0x43);
|
||||
R47 = BK4819_ReadRegister(0x47);
|
||||
R48 = BK4819_ReadRegister(0x48);
|
||||
R7E = BK4819_ReadRegister(0x7E);
|
||||
R30 = BK4819_ReadRegister(BK4819_REG_30);
|
||||
R37 = BK4819_ReadRegister(BK4819_REG_37);
|
||||
R3D = BK4819_ReadRegister(BK4819_REG_3D);
|
||||
R43 = BK4819_ReadRegister(BK4819_REG_43);
|
||||
R47 = BK4819_ReadRegister(BK4819_REG_47);
|
||||
R48 = BK4819_ReadRegister(BK4819_REG_48);
|
||||
R7E = BK4819_ReadRegister(BK4819_REG_7E);
|
||||
}
|
||||
|
||||
static void RestoreRegisters() {
|
||||
BK4819_WriteRegister(0x30, R30);
|
||||
BK4819_WriteRegister(0x37, R37);
|
||||
BK4819_WriteRegister(0x3D, R3D);
|
||||
BK4819_WriteRegister(0x43, R43);
|
||||
BK4819_WriteRegister(0x47, R47);
|
||||
BK4819_WriteRegister(0x48, R48);
|
||||
BK4819_WriteRegister(0x7E, R7E);
|
||||
BK4819_WriteRegister(BK4819_REG_30, R30);
|
||||
BK4819_WriteRegister(BK4819_REG_37, R37);
|
||||
BK4819_WriteRegister(BK4819_REG_3D, R3D);
|
||||
BK4819_WriteRegister(BK4819_REG_43, R43);
|
||||
BK4819_WriteRegister(BK4819_REG_47, R47);
|
||||
BK4819_WriteRegister(BK4819_REG_48, R48);
|
||||
BK4819_WriteRegister(BK4819_REG_7E, R7E);
|
||||
}
|
||||
|
||||
static void SetModulation(ModulationType type) {
|
||||
@@ -240,9 +231,9 @@ static void SetModulation(ModulationType type) {
|
||||
reg &= ~(0b111 << 8);
|
||||
BK4819_WriteRegister(BK4819_REG_47, reg | (modTypeReg47Values[type] << 8));
|
||||
if (type == MOD_USB) {
|
||||
BK4819_WriteRegister(0x3D, 0b0010101101000101);
|
||||
BK4819_WriteRegister(BK4819_REG_3D, 0b0010101101000101);
|
||||
BK4819_WriteRegister(BK4819_REG_37, 0x160F);
|
||||
BK4819_WriteRegister(0x48, 0b0000001110101000);
|
||||
BK4819_WriteRegister(BK4819_REG_48, 0b0000001110101000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,8 +250,9 @@ static void SetF(uint32_t f) {
|
||||
|
||||
BK4819_SetFrequency(fMeasure);
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(fMeasure);
|
||||
uint16_t reg = BK4819_ReadRegister(BK4819_REG_30);
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0);
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0xbff1);
|
||||
BK4819_WriteRegister(BK4819_REG_30, reg);
|
||||
}
|
||||
|
||||
// Spectrum related
|
||||
@@ -294,12 +286,16 @@ static void DeInitSpectrum() {
|
||||
isInitialized = false;
|
||||
}
|
||||
|
||||
uint8_t GetBWRegValueForScan() { return scanStepBWRegValues[0]; }
|
||||
uint8_t GetBWRegValueForScan() {
|
||||
return scanStepBWRegValues[settings.scanStepIndex];
|
||||
}
|
||||
|
||||
uint16_t GetRssi() {
|
||||
SYSTICK_DelayUs(settings.scanDelay);
|
||||
/* while ((BK4819_ReadRegister(0x63) & 0b11111111) >= 255)
|
||||
; */
|
||||
// SYSTICK_DelayUs(800);
|
||||
// testing autodelay based on Glitch value
|
||||
while ((BK4819_ReadRegister(0x63) & 0b11111111) >= 255) {
|
||||
SYSTICK_DelayUs(100);
|
||||
}
|
||||
return BK4819_GetRSSI();
|
||||
}
|
||||
|
||||
@@ -309,16 +305,16 @@ static void ToggleAudio(bool on) {
|
||||
}
|
||||
audioState = on;
|
||||
if (on) {
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOn();
|
||||
} else {
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
}
|
||||
}
|
||||
|
||||
static void ToggleRX(bool on) {
|
||||
isListening = on;
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, on);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, on);
|
||||
|
||||
ToggleAudio(on);
|
||||
ToggleAFDAC(on);
|
||||
@@ -361,7 +357,9 @@ static void RelaunchScan() {
|
||||
InitScan();
|
||||
ResetPeak();
|
||||
ToggleRX(false);
|
||||
#ifdef SPECTRUM_AUTOMATIC_SQUELCH
|
||||
settings.rssiTriggerLevel = RSSI_MAX_VALUE;
|
||||
#endif
|
||||
preventKeypress = true;
|
||||
scanInfo.rssiMin = RSSI_MAX_VALUE;
|
||||
}
|
||||
@@ -409,6 +407,7 @@ static void UpdateRssiTriggerLevel(bool inc) {
|
||||
else
|
||||
settings.rssiTriggerLevel -= 2;
|
||||
redrawScreen = true;
|
||||
redrawStatus = true;
|
||||
}
|
||||
|
||||
static void UpdateDBMax(bool inc) {
|
||||
@@ -419,8 +418,8 @@ static void UpdateDBMax(bool inc) {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
// RelaunchScan();
|
||||
redrawStatus = true;
|
||||
redrawScreen = true;
|
||||
SYSTEM_DelayMs(20);
|
||||
}
|
||||
|
||||
@@ -435,7 +434,7 @@ static void UpdateScanStep(bool inc) {
|
||||
settings.frequencyChangeStep = GetBW() >> 1;
|
||||
RelaunchScan();
|
||||
ResetBlacklist();
|
||||
redrawStatus = true;
|
||||
redrawScreen = true;
|
||||
}
|
||||
|
||||
static void UpdateCurrentFreq(bool inc) {
|
||||
@@ -496,9 +495,9 @@ static void ToggleListeningBW() {
|
||||
static void ToggleBacklight() {
|
||||
settings.backlightState = !settings.backlightState;
|
||||
if (settings.backlightState) {
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
BACKLIGHT_TurnOn();
|
||||
} else {
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
BACKLIGHT_TurnOff();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,7 +510,7 @@ static void ToggleStepsCount() {
|
||||
settings.frequencyChangeStep = GetBW() >> 1;
|
||||
RelaunchScan();
|
||||
ResetBlacklist();
|
||||
redrawStatus = true;
|
||||
redrawScreen = true;
|
||||
}
|
||||
|
||||
static void ResetFreqInput() {
|
||||
@@ -553,7 +552,7 @@ static void UpdateFreqInput(KEY_Code_t key) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
if (i < freqInputIndex) {
|
||||
digitKey = freqInputArr[i];
|
||||
freqInputString[i] = digitKey <= KEY_9 ? '0' + digitKey : '.';
|
||||
freqInputString[i] = digitKey <= KEY_9 ? '0' + digitKey-KEY_0 : '.';
|
||||
} else {
|
||||
freqInputString[i] = '-';
|
||||
}
|
||||
@@ -561,14 +560,14 @@ static void UpdateFreqInput(KEY_Code_t key) {
|
||||
|
||||
uint32_t base = 100000; // 1MHz in BK units
|
||||
for (int i = dotIndex - 1; i >= 0; --i) {
|
||||
tempFreq += freqInputArr[i] * base;
|
||||
tempFreq += (freqInputArr[i]-KEY_0) * base;
|
||||
base *= 10;
|
||||
}
|
||||
|
||||
base = 10000; // 0.1MHz in BK units
|
||||
if (dotIndex < freqInputIndex) {
|
||||
for (int i = dotIndex + 1; i < freqInputIndex; ++i) {
|
||||
tempFreq += freqInputArr[i] * base;
|
||||
tempFreq += (freqInputArr[i]-KEY_0) * base;
|
||||
base /= 10;
|
||||
}
|
||||
}
|
||||
@@ -584,14 +583,15 @@ static void Blacklist() {
|
||||
|
||||
// Draw things
|
||||
|
||||
// applied x2 to prevent initial rounding
|
||||
uint8_t Rssi2PX(uint16_t rssi, uint8_t pxMin, uint8_t pxMax) {
|
||||
const int DB_MIN = settings.dbMin;
|
||||
const int DB_MAX = settings.dbMax;
|
||||
const int DB_MIN = settings.dbMin << 1;
|
||||
const int DB_MAX = settings.dbMax << 1;
|
||||
const int DB_RANGE = DB_MAX - DB_MIN;
|
||||
|
||||
const uint8_t PX_RANGE = pxMax - pxMin;
|
||||
|
||||
int dbm = clamp(Rssi2DBm(rssi), DB_MIN, DB_MAX);
|
||||
int dbm = clamp(rssi - (160 << 1), DB_MIN, DB_MAX);
|
||||
|
||||
return ((dbm - DB_MIN) * PX_RANGE + DB_RANGE / 2) / DB_RANGE + pxMin;
|
||||
}
|
||||
@@ -610,8 +610,14 @@ static void DrawSpectrum() {
|
||||
}
|
||||
|
||||
static void DrawStatus() {
|
||||
#ifdef SPECTRUM_EXTRA_VALUES
|
||||
sprintf(String, "%d/%d P:%d T:%d", settings.dbMin, settings.dbMax,
|
||||
Rssi2DBm(peak.rssi), Rssi2DBm(settings.rssiTriggerLevel));
|
||||
#else
|
||||
sprintf(String, "%d/%d", settings.dbMin, settings.dbMax);
|
||||
GUI_DisplaySmallest(String, 0, 2, true, true);
|
||||
#endif
|
||||
GUI_DisplaySmallest(String, 0, 1, true, true);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[i], &gBatteryCurrent);
|
||||
}
|
||||
@@ -623,19 +629,12 @@ static void DrawStatus() {
|
||||
gBatteryVoltages[3]) /
|
||||
4;
|
||||
|
||||
if (gBatteryCalibration[5] < Voltage) {
|
||||
v = 5;
|
||||
} else if (gBatteryCalibration[4] < Voltage) {
|
||||
v = 5;
|
||||
} else if (gBatteryCalibration[3] < Voltage) {
|
||||
v = 4;
|
||||
} else if (gBatteryCalibration[2] < Voltage) {
|
||||
v = 3;
|
||||
} else if (gBatteryCalibration[1] < Voltage) {
|
||||
v = 2;
|
||||
} else if (gBatteryCalibration[0] < Voltage) {
|
||||
v = 1;
|
||||
for(uint8_t i = 5; i > 0; i--) {
|
||||
if(Voltage > gBatteryCalibration[i - 1]) {
|
||||
v = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gStatusLine[127] = 0b01111110;
|
||||
for (int i = 126; i >= 116; i--) {
|
||||
@@ -653,19 +652,15 @@ static void DrawStatus() {
|
||||
|
||||
static void DrawF(uint32_t f) {
|
||||
sprintf(String, "%u.%05u", f / 100000, f % 100000);
|
||||
UI_PrintStringSmall(String, 0, 127, 0);
|
||||
UI_PrintStringSmall(String, 8, 127, 0);
|
||||
|
||||
sprintf(String, "%s", modulationTypeOptions[settings.modulationType]);
|
||||
GUI_DisplaySmallest(String, 115, 1, false, true);
|
||||
GUI_DisplaySmallest(String, 116, 1, false, true);
|
||||
sprintf(String, "%s", bwOptions[settings.listenBw]);
|
||||
GUI_DisplaySmallest(String, 107, 7, false, true);
|
||||
GUI_DisplaySmallest(String, 108, 7, false, true);
|
||||
}
|
||||
|
||||
static void DrawNums() {
|
||||
sprintf(String, "P:%d", Rssi2DBm(peak.rssi));
|
||||
GUI_DisplaySmallest(String, 32, 8, false, true);
|
||||
sprintf(String, "T:%d", Rssi2DBm(settings.rssiTriggerLevel));
|
||||
GUI_DisplaySmallest(String, 64, 8, false, true);
|
||||
|
||||
if (currentState == SPECTRUM) {
|
||||
sprintf(String, "%ux", GetStepsCount());
|
||||
@@ -675,7 +670,7 @@ static void DrawNums() {
|
||||
}
|
||||
|
||||
if (IsCenterMode()) {
|
||||
sprintf(String, "%u.%05u \xB1%u.%02uk", currentFreq / 100000,
|
||||
sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000,
|
||||
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
||||
settings.frequencyChangeStep % 100);
|
||||
GUI_DisplaySmallest(String, 36, 49, false, true);
|
||||
@@ -683,7 +678,7 @@ static void DrawNums() {
|
||||
sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000);
|
||||
GUI_DisplaySmallest(String, 0, 49, false, true);
|
||||
|
||||
sprintf(String, "\xB1%u.%02uk", settings.frequencyChangeStep / 100,
|
||||
sprintf(String, "\x7F%u.%02uk", settings.frequencyChangeStep / 100,
|
||||
settings.frequencyChangeStep % 100);
|
||||
GUI_DisplaySmallest(String, 48, 49, false, true);
|
||||
|
||||
@@ -894,8 +889,8 @@ void OnKeyDownStill(KEY_Code_t key) {
|
||||
break;
|
||||
case KEY_PTT:
|
||||
// TODO: start transmit
|
||||
/* BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true); */
|
||||
/* BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true); */
|
||||
break;
|
||||
case KEY_MENU:
|
||||
if (menuState == ARRAY_SIZE(registerSpecs) - 1) {
|
||||
@@ -966,8 +961,6 @@ static void RenderStill() {
|
||||
GUI_DisplaySmallest(String, 4, 25, false, true);
|
||||
sprintf(String, "%d dBm", dbm);
|
||||
GUI_DisplaySmallest(String, 28, 25, false, true);
|
||||
sprintf(String, "V: %d", scanInfo.rssi);
|
||||
GUI_DisplaySmallest(String, 64, 25, false, true);
|
||||
|
||||
if (!monitorMode) {
|
||||
uint8_t x = Rssi2PX(settings.rssiTriggerLevel, 0, 121);
|
||||
@@ -1107,7 +1100,6 @@ static void UpdateListening() {
|
||||
}
|
||||
|
||||
if (currentState == SPECTRUM) {
|
||||
SetF(fMeasure);
|
||||
BK4819_WriteRegister(0x43, GetBWRegValueForScan());
|
||||
Measure();
|
||||
BK4819_WriteRegister(0x43, listenBWRegValues[settings.listenBw]);
|
||||
@@ -1158,7 +1150,7 @@ static void Tick() {
|
||||
void APP_RunSpectrum() {
|
||||
// TX here coz it always? set to active VFO
|
||||
currentFreq = initialFreq =
|
||||
gEeprom.VfoInfo[gEeprom.TX_CHANNEL].pRX->Frequency;
|
||||
gEeprom.VfoInfo[gEeprom.TX_VFO].pRX->Frequency;
|
||||
|
||||
BackupRegisters();
|
||||
|
||||
@@ -1167,7 +1159,7 @@ void APP_RunSpectrum() {
|
||||
redrawScreen = false; // we will wait until scan done
|
||||
newScanStart = true;
|
||||
|
||||
ToggleRX(false);
|
||||
ToggleRX(true), ToggleRX(false); // hack to prevent noise when squelch off
|
||||
SetModulation(settings.modulationType = MOD_FM);
|
||||
BK4819_SetFilterBandwidth(settings.listenBw = BK4819_FILTER_BW_WIDE, false);
|
||||
|
||||
|
||||
@@ -122,18 +122,17 @@ typedef enum ScanStep {
|
||||
} ScanStep;
|
||||
|
||||
typedef struct SpectrumSettings {
|
||||
uint32_t frequencyChangeStep;
|
||||
StepsCount stepsCount;
|
||||
ScanStep scanStepIndex;
|
||||
uint32_t frequencyChangeStep;
|
||||
uint16_t scanDelay;
|
||||
uint16_t rssiTriggerLevel;
|
||||
|
||||
bool backlightState;
|
||||
BK4819_FilterBandwidth_t bw;
|
||||
BK4819_FilterBandwidth_t listenBw;
|
||||
ModulationType modulationType;
|
||||
int dbMin;
|
||||
int dbMax;
|
||||
int dbMax;
|
||||
ModulationType modulationType;
|
||||
bool backlightState;
|
||||
} SpectrumSettings;
|
||||
|
||||
typedef struct KeyboardState {
|
||||
@@ -161,8 +160,8 @@ typedef struct RegisterSpec {
|
||||
typedef struct PeakInfo {
|
||||
uint16_t t;
|
||||
uint16_t rssi;
|
||||
uint8_t i;
|
||||
uint32_t f;
|
||||
uint8_t i;
|
||||
} PeakInfo;
|
||||
|
||||
void APP_RunSpectrum(void);
|
||||
|
||||
100
app/uart.c
@@ -27,6 +27,7 @@
|
||||
#include "bsp/dp32g030/dma.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "driver/aes.h"
|
||||
#include "driver/backlight.h"
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/crc.h"
|
||||
#include "driver/eeprom.h"
|
||||
@@ -48,7 +49,7 @@ typedef struct {
|
||||
} Header_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Padding[2];
|
||||
uint8_t Padding[2];
|
||||
uint16_t ID;
|
||||
} Footer_t;
|
||||
|
||||
@@ -60,10 +61,10 @@ typedef struct {
|
||||
typedef struct {
|
||||
Header_t Header;
|
||||
struct {
|
||||
char Version[16];
|
||||
bool bHasCustomAesKey;
|
||||
bool bIsInLockScreen;
|
||||
uint8_t Padding[2];
|
||||
char Version[16];
|
||||
bool bHasCustomAesKey;
|
||||
bool bIsInLockScreen;
|
||||
uint8_t Padding[2];
|
||||
uint32_t Challenge[4];
|
||||
} Data;
|
||||
} REPLY_0514_t;
|
||||
@@ -71,8 +72,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
Header_t Header;
|
||||
uint16_t Offset;
|
||||
uint8_t Size;
|
||||
uint8_t Padding;
|
||||
uint8_t Size;
|
||||
uint8_t Padding;
|
||||
uint32_t Timestamp;
|
||||
} CMD_051B_t;
|
||||
|
||||
@@ -80,19 +81,19 @@ typedef struct {
|
||||
Header_t Header;
|
||||
struct {
|
||||
uint16_t Offset;
|
||||
uint8_t Size;
|
||||
uint8_t Padding;
|
||||
uint8_t Data[128];
|
||||
uint8_t Size;
|
||||
uint8_t Padding;
|
||||
uint8_t Data[128];
|
||||
} Data;
|
||||
} REPLY_051B_t;
|
||||
|
||||
typedef struct {
|
||||
Header_t Header;
|
||||
uint16_t Offset;
|
||||
uint8_t Size;
|
||||
bool bAllowPassword;
|
||||
uint8_t Size;
|
||||
bool bAllowPassword;
|
||||
uint32_t Timestamp;
|
||||
uint8_t Data[0];
|
||||
uint8_t Data[0];
|
||||
} CMD_051D_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -106,8 +107,8 @@ typedef struct {
|
||||
Header_t Header;
|
||||
struct {
|
||||
uint16_t RSSI;
|
||||
uint8_t ExNoiseIndicator;
|
||||
uint8_t GlitchIndicator;
|
||||
uint8_t ExNoiseIndicator;
|
||||
uint8_t GlitchIndicator;
|
||||
} Data;
|
||||
} REPLY_0527_t;
|
||||
|
||||
@@ -137,7 +138,10 @@ typedef struct {
|
||||
uint32_t Timestamp;
|
||||
} CMD_052F_t;
|
||||
|
||||
static const uint8_t Obfuscation[16] = { 0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80 };
|
||||
static const uint8_t Obfuscation[16] =
|
||||
{
|
||||
0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80
|
||||
};
|
||||
|
||||
static union
|
||||
{
|
||||
@@ -157,12 +161,11 @@ static void SendReply(void *pReply, uint16_t Size)
|
||||
{
|
||||
Header_t Header;
|
||||
Footer_t Footer;
|
||||
uint8_t *pBytes;
|
||||
uint16_t i;
|
||||
|
||||
if (bIsEncrypted)
|
||||
{
|
||||
pBytes = (uint8_t *)pReply;
|
||||
uint8_t *pBytes = (uint8_t *)pReply;
|
||||
unsigned int i;
|
||||
for (i = 0; i < Size; i++)
|
||||
pBytes[i] ^= Obfuscation[i % 16];
|
||||
}
|
||||
@@ -171,6 +174,7 @@ static void SendReply(void *pReply, uint16_t Size)
|
||||
Header.Size = Size;
|
||||
UART_Send(&Header, sizeof(Header));
|
||||
UART_Send(pReply, Size);
|
||||
|
||||
if (bIsEncrypted)
|
||||
{
|
||||
Footer.Padding[0] = Obfuscation[(Size + 0) % 16] ^ 0xFF;
|
||||
@@ -205,14 +209,16 @@ static void SendVersion(void)
|
||||
|
||||
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
|
||||
{
|
||||
uint8_t i;
|
||||
uint32_t IV[4];
|
||||
unsigned int i;
|
||||
uint32_t IV[4];
|
||||
|
||||
IV[0] = 0;
|
||||
IV[1] = 0;
|
||||
IV[2] = 0;
|
||||
IV[3] = 0;
|
||||
|
||||
AES_Encrypt(pKey, IV, pIn, IV, true);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
if (IV[i] != pResponse[i])
|
||||
return true;
|
||||
@@ -225,10 +231,16 @@ static void CMD_0514(const uint8_t *pBuffer)
|
||||
const CMD_0514_t *pCmd = (const CMD_0514_t *)pBuffer;
|
||||
|
||||
Timestamp = pCmd->Timestamp;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||
#endif
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
|
||||
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||
|
||||
// turn the LCD backlight off
|
||||
BACKLIGHT_TurnOff();
|
||||
|
||||
SendVersion();
|
||||
}
|
||||
|
||||
@@ -241,14 +253,17 @@ static void CMD_051B(const uint8_t *pBuffer)
|
||||
if (pCmd->Timestamp != Timestamp)
|
||||
return;
|
||||
|
||||
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||
#endif
|
||||
|
||||
memset(&Reply, 0, sizeof(Reply));
|
||||
Reply.Header.ID = 0x051C;
|
||||
Reply.Header.ID = 0x051C;
|
||||
Reply.Header.Size = pCmd->Size + 4;
|
||||
Reply.Data.Offset = pCmd->Offset;
|
||||
Reply.Data.Size = pCmd->Size;
|
||||
Reply.Data.Size = pCmd->Size;
|
||||
|
||||
if (bHasCustomAesKey)
|
||||
bLocked = gIsLocked;
|
||||
@@ -269,11 +284,14 @@ static void CMD_051D(const uint8_t *pBuffer)
|
||||
if (pCmd->Timestamp != Timestamp)
|
||||
return;
|
||||
|
||||
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||
|
||||
bReloadEeprom = false;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||
#endif
|
||||
|
||||
Reply.Header.ID = 0x051E;
|
||||
Reply.Header.Size = sizeof(Reply.Data);
|
||||
Reply.Data.Offset = pCmd->Offset;
|
||||
@@ -282,7 +300,7 @@ static void CMD_051D(const uint8_t *pBuffer)
|
||||
|
||||
if (!bIsLocked)
|
||||
{
|
||||
uint16_t i;
|
||||
unsigned int i;
|
||||
for (i = 0; i < (pCmd->Size / 8); i++)
|
||||
{
|
||||
const uint16_t Offset = pCmd->Offset + (i * 8U);
|
||||
@@ -319,23 +337,25 @@ static void CMD_0529(void)
|
||||
{
|
||||
REPLY_0529_t Reply;
|
||||
|
||||
Reply.Header.ID = 0x52A;
|
||||
Reply.Header.ID = 0x52A;
|
||||
Reply.Header.Size = sizeof(Reply.Data);
|
||||
|
||||
// Original doesn't actually send current!
|
||||
BOARD_ADC_GetBatteryInfo(&Reply.Data.Voltage, &Reply.Data.Current);
|
||||
|
||||
SendReply(&Reply, sizeof(Reply));
|
||||
}
|
||||
|
||||
static void CMD_052D(const uint8_t *pBuffer)
|
||||
{
|
||||
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
|
||||
REPLY_052D_t Reply;
|
||||
bool bIsLocked;
|
||||
REPLY_052D_t Reply;
|
||||
bool bIsLocked;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||
#endif
|
||||
Reply.Header.ID = 0x052E;
|
||||
Reply.Header.ID = 0x052E;
|
||||
Reply.Header.Size = sizeof(Reply.Data);
|
||||
|
||||
bIsLocked = bHasCustomAesKey;
|
||||
@@ -373,7 +393,7 @@ static void CMD_052F(const uint8_t *pBuffer)
|
||||
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gEeprom.RX_CHANNEL = 0;
|
||||
gEeprom.RX_VFO = 0;
|
||||
gEeprom.DTMF_SIDE_TONE = false;
|
||||
gEeprom.VfoInfo[0].FrequencyReverse = false;
|
||||
gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX;
|
||||
@@ -389,24 +409,25 @@ static void CMD_052F(const uint8_t *pBuffer)
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
|
||||
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||
|
||||
Timestamp = pCmd->Timestamp;
|
||||
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
// turn the LCD backlight off
|
||||
BACKLIGHT_TurnOff();
|
||||
|
||||
SendVersion();
|
||||
}
|
||||
|
||||
bool UART_IsCommandAvailable(void)
|
||||
{
|
||||
uint16_t DmaLength;
|
||||
uint16_t CommandLength;
|
||||
uint16_t Index;
|
||||
uint16_t TailIndex;
|
||||
uint16_t Size;
|
||||
uint16_t CRC;
|
||||
uint16_t i;
|
||||
uint16_t CommandLength;
|
||||
uint16_t DmaLength = DMA_CH0->ST & 0xFFFU;
|
||||
|
||||
DmaLength = DMA_CH0->ST & 0xFFFU;
|
||||
while (1)
|
||||
{
|
||||
if (gUART_WriteIndex == DmaLength)
|
||||
@@ -435,7 +456,7 @@ bool UART_IsCommandAvailable(void)
|
||||
Index = DMA_INDEX(gUART_WriteIndex, 2);
|
||||
Size = (UART_DMA_Buffer[DMA_INDEX(Index, 1)] << 8) | UART_DMA_Buffer[Index];
|
||||
|
||||
if ((Size + 8) > sizeof(UART_DMA_Buffer))
|
||||
if ((Size + 8u) > sizeof(UART_DMA_Buffer))
|
||||
{
|
||||
gUART_WriteIndex = DmaLength;
|
||||
return false;
|
||||
@@ -480,9 +501,12 @@ bool UART_IsCommandAvailable(void)
|
||||
bIsEncrypted = true;
|
||||
|
||||
if (bIsEncrypted)
|
||||
for (i = 0; i < Size + 2; i++)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < (Size + 2u); i++)
|
||||
UART_Command.Buffer[i] ^= Obfuscation[i % 16];
|
||||
|
||||
}
|
||||
|
||||
CRC = UART_Command.Buffer[Size] | (UART_Command.Buffer[Size + 1] << 8);
|
||||
|
||||
return (CRC_Calculate(UART_Command.Buffer, Size) != CRC) ? false : true;
|
||||
|
||||
81
audio.c
@@ -76,7 +76,12 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
uint16_t ToneFrequency;
|
||||
uint16_t Duration;
|
||||
|
||||
if (Beep != BEEP_880HZ_60MS_TRIPLE_BEEP && Beep != BEEP_500HZ_60MS_DOUBLE_BEEP && Beep != BEEP_440HZ_500MS && !gEeprom.BEEP_CONTROL)
|
||||
if (Beep != BEEP_880HZ_60MS_TRIPLE_BEEP &&
|
||||
Beep != BEEP_500HZ_60MS_DOUBLE_BEEP &&
|
||||
Beep != BEEP_440HZ_500MS &&
|
||||
Beep != BEEP_880HZ_200MS &&
|
||||
Beep != BEEP_880HZ_500MS &&
|
||||
!gEeprom.BEEP_CONTROL)
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
@@ -92,7 +97,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
|
||||
ToneConfig = BK4819_ReadRegister(BK4819_REG_71);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && gRxIdleMode)
|
||||
BK4819_RX_TurnOn();
|
||||
@@ -123,6 +128,8 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
break;
|
||||
case BEEP_880HZ_40MS_OPTIONAL:
|
||||
case BEEP_880HZ_60MS_TRIPLE_BEEP:
|
||||
case BEEP_880HZ_200MS:
|
||||
case BEEP_880HZ_500MS:
|
||||
ToneFrequency = 880;
|
||||
break;
|
||||
}
|
||||
@@ -131,7 +138,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOn();
|
||||
|
||||
SYSTEM_DelayMs(60);
|
||||
|
||||
@@ -142,14 +149,14 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
SYSTEM_DelayMs(60);
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
[[fallthrough]];
|
||||
case BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL:
|
||||
case BEEP_500HZ_60MS_DOUBLE_BEEP:
|
||||
BK4819_ExitTxMute();
|
||||
SYSTEM_DelayMs(60);
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
[[fallthrough]];
|
||||
case BEEP_1KHZ_60MS_OPTIONAL:
|
||||
BK4819_ExitTxMute();
|
||||
Duration = 60;
|
||||
@@ -161,7 +168,13 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
Duration = 40;
|
||||
break;
|
||||
|
||||
case BEEP_880HZ_200MS:
|
||||
BK4819_ExitTxMute();
|
||||
Duration = 200;
|
||||
break;
|
||||
|
||||
case BEEP_440HZ_500MS:
|
||||
case BEEP_880HZ_500MS:
|
||||
default:
|
||||
BK4819_ExitTxMute();
|
||||
Duration = 500;
|
||||
@@ -172,9 +185,11 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
gVoxResumeCountdown = 80;
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 80;
|
||||
#endif
|
||||
|
||||
SYSTEM_DelayMs(5);
|
||||
BK4819_TurnsOffTones_TurnsOnRX();
|
||||
@@ -182,7 +197,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
BK4819_WriteRegister(BK4819_REG_71, ToneConfig);
|
||||
|
||||
if (gEnableSpeaker)
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOn();
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
@@ -245,7 +260,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
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);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -253,8 +270,12 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
BK1080_Mute(true);
|
||||
#endif
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
gVoxResumeCountdown = 2000;
|
||||
AUDIO_AudioPathOn();
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 2000;
|
||||
#endif
|
||||
|
||||
SYSTEM_DelayMs(5);
|
||||
AUDIO_PlayVoice(VoiceID);
|
||||
|
||||
@@ -265,13 +286,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
{
|
||||
SYSTEM_DelayMs(Delay * 10);
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
||||
{
|
||||
if (gRxVfo->AM_mode)
|
||||
BK4819_SetAF(BK4819_AF_AM);
|
||||
else
|
||||
BK4819_SetAF(BK4819_AF_OPEN);
|
||||
}
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
@@ -279,11 +297,15 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
#endif
|
||||
|
||||
if (!gEnableSpeaker)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
gVoiceWriteIndex = 0;
|
||||
gVoiceReadIndex = 0;
|
||||
gVoxResumeCountdown = 80;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 80;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -396,14 +418,19 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
|
||||
gCountdownToPlayNextVoice_10ms = Delay;
|
||||
gFlagPlayQueuedVoice = false;
|
||||
gVoxResumeCountdown = 2000;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 2000;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
@@ -411,11 +438,15 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
#endif
|
||||
|
||||
if (!gEnableSpeaker)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
gVoxResumeCountdown = 80;
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 80;
|
||||
#endif
|
||||
|
||||
gVoiceWriteIndex = 0;
|
||||
gVoiceReadIndex = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
13
audio.h
@@ -20,12 +20,17 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
enum BEEP_Type_t
|
||||
{
|
||||
BEEP_NONE = 0,
|
||||
BEEP_1KHZ_60MS_OPTIONAL,
|
||||
BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL,
|
||||
BEEP_440HZ_500MS,
|
||||
BEEP_880HZ_200MS,
|
||||
BEEP_880HZ_500MS,
|
||||
BEEP_500HZ_60MS_DOUBLE_BEEP,
|
||||
BEEP_440HZ_40MS_OPTIONAL,
|
||||
BEEP_880HZ_40MS_OPTIONAL,
|
||||
@@ -128,6 +133,14 @@ enum VOICE_ID_t
|
||||
|
||||
typedef enum VOICE_ID_t VOICE_ID_t;
|
||||
|
||||
static inline void AUDIO_AudioPathOn(void) {
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
}
|
||||
|
||||
static inline void AUDIO_AudioPathOff(void) {
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
extern VOICE_ID_t gVoiceID[8];
|
||||
extern uint8_t gVoiceReadIndex;
|
||||
|
||||
204
bitmaps.c
@@ -4,7 +4,7 @@
|
||||
// all these images are on their right sides
|
||||
// turn your monitor 90-deg anti-clockwise to see the images
|
||||
|
||||
const uint8_t BITMAP_PowerSave[8] =
|
||||
const uint8_t BITMAP_POWERSAVE[8] =
|
||||
{
|
||||
#if 0
|
||||
// "S"
|
||||
@@ -29,6 +29,30 @@ const uint8_t BITMAP_PowerSave[8] =
|
||||
#endif
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_TX[8] =
|
||||
{ // "TX"
|
||||
0b00000000,
|
||||
0b00000001,
|
||||
0b00000001,
|
||||
0b01111111,
|
||||
0b00000001,
|
||||
0b00000001,
|
||||
0b00000000,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_RX[8] =
|
||||
{ // "RX"
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
0b00001001,
|
||||
0b00011001,
|
||||
0b01100110,
|
||||
0b00000000,
|
||||
0b00000000,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_BatteryLevel[2] =
|
||||
{
|
||||
0b01011101,
|
||||
@@ -114,27 +138,29 @@ const uint8_t BITMAP_F_Key[6] =
|
||||
0b01000001
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_VOX[18] =
|
||||
{ // "VOX"
|
||||
0b00000000,
|
||||
0b00011111,
|
||||
0b00100000,
|
||||
0b01000000,
|
||||
0b00100000,
|
||||
0b00011111,
|
||||
0b00000000,
|
||||
0b00111110,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b00111110,
|
||||
0b00000000,
|
||||
0b01100011,
|
||||
0b00010100,
|
||||
0b00001000,
|
||||
0b00010100,
|
||||
0b01100011
|
||||
};
|
||||
#ifdef ENABLE_VOX
|
||||
const uint8_t BITMAP_VOX[18] =
|
||||
{ // "VOX"
|
||||
0b00000000,
|
||||
0b00011111,
|
||||
0b00100000,
|
||||
0b01000000,
|
||||
0b00100000,
|
||||
0b00011111,
|
||||
0b00000000,
|
||||
0b00111110,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b00111110,
|
||||
0b00000000,
|
||||
0b01100011,
|
||||
0b00010100,
|
||||
0b00001000,
|
||||
0b00010100,
|
||||
0b01100011
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
const uint8_t BITMAP_WX[12] =
|
||||
@@ -171,26 +197,27 @@ const uint8_t BITMAP_VOX[18] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const uint8_t BITMAP_TDR1[12] =
|
||||
{ // "DW"
|
||||
0b00000000,
|
||||
const uint8_t BITMAP_TDR1[15] =
|
||||
{ // "DWR"
|
||||
0b01111111,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b00111110,
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
0b00100000,
|
||||
0b00011000,
|
||||
0b00100000,
|
||||
0b01111111
|
||||
0b01111111,
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
0b00011001,
|
||||
0b00101001,
|
||||
0b01000110
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_TDR2[12] =
|
||||
const uint8_t BITMAP_TDR2[9] =
|
||||
{ // "><" .. DW on hold
|
||||
0b00000000,
|
||||
0b00000000,
|
||||
0b00100010,
|
||||
0b00110110,
|
||||
0b00011100,
|
||||
@@ -200,7 +227,6 @@ const uint8_t BITMAP_TDR2[12] =
|
||||
0b00011100,
|
||||
0b00110110,
|
||||
0b00100010,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -218,27 +244,8 @@ const uint8_t BITMAP_TDR2[12] =
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
const uint8_t BITMAP_FM[12] =
|
||||
{ // "FM"
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
0b00001001,
|
||||
0b00001001,
|
||||
0b00001001,
|
||||
0b00000001,
|
||||
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
0b00000010,
|
||||
0b00001100,
|
||||
0b00000010,
|
||||
0b01111111
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
const uint8_t BITMAP_NOAA[12] =
|
||||
const uint8_t BITMAP_NOAA[11] =
|
||||
{ // "NS"
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
@@ -246,33 +253,14 @@ const uint8_t BITMAP_TDR2[12] =
|
||||
0b00001000,
|
||||
0b00010000,
|
||||
0b01111111,
|
||||
|
||||
0b00000000,
|
||||
0b01000110,
|
||||
0b01001001,
|
||||
0b01001001,
|
||||
0b01001001,
|
||||
0b00110001
|
||||
};
|
||||
#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] =
|
||||
{
|
||||
0b00000011,
|
||||
@@ -282,49 +270,7 @@ const uint8_t BITMAP_Antenna[5] =
|
||||
0b00000011
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_AntennaLevel1[3] =
|
||||
{
|
||||
0b01100000,
|
||||
0b01100000,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_AntennaLevel2[3] =
|
||||
{
|
||||
0b01110000,
|
||||
0b01110000,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_AntennaLevel3[3] =
|
||||
{
|
||||
0b01111000,
|
||||
0b01111000,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_AntennaLevel4[3] =
|
||||
{
|
||||
0b01111100,
|
||||
0b01111100,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_AntennaLevel5[3] =
|
||||
{
|
||||
0b01111110,
|
||||
0b01111110,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_AntennaLevel6[3] =
|
||||
{
|
||||
0b01111111,
|
||||
0b01111111,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_CurrentIndicator[8] =
|
||||
const uint8_t BITMAP_MARKER[8] =
|
||||
{
|
||||
0b11111111,
|
||||
0b11111111,
|
||||
@@ -359,17 +305,7 @@ const uint8_t BITMAP_VFO_NotDefault[8] =
|
||||
0b00010100,
|
||||
0b00001000
|
||||
};
|
||||
/*
|
||||
const uint8_t BITMAP_ScanList[6] =
|
||||
{ // diamond symbol
|
||||
0b00001000,
|
||||
0b00011100,
|
||||
0b00111110,
|
||||
0b00111110,
|
||||
0b00011100,
|
||||
0b00001000
|
||||
};
|
||||
*/
|
||||
|
||||
const uint8_t BITMAP_ScanList1[6] =
|
||||
{ // 'I' symbol
|
||||
0b00000000,
|
||||
@@ -390,14 +326,12 @@ const uint8_t BITMAP_ScanList2[6] =
|
||||
0b01000010
|
||||
};
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
const uint8_t BITMAP_compand[6] =
|
||||
{
|
||||
0b00000000,
|
||||
0b00111100,
|
||||
0b01000010,
|
||||
0b01000010,
|
||||
0b01000010,
|
||||
0b00100100
|
||||
};
|
||||
#endif
|
||||
const uint8_t BITMAP_compand[6] =
|
||||
{
|
||||
0b00000000,
|
||||
0b00111100,
|
||||
0b01000010,
|
||||
0b01000010,
|
||||
0b01000010,
|
||||
0b00100100
|
||||
};
|
||||
|
||||
39
bitmaps.h
@@ -4,7 +4,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint8_t BITMAP_PowerSave[8];
|
||||
extern const uint8_t BITMAP_POWERSAVE[8];
|
||||
extern const uint8_t BITMAP_TX[8];
|
||||
extern const uint8_t BITMAP_RX[8];
|
||||
|
||||
extern const uint8_t BITMAP_BatteryLevel[2];
|
||||
extern const uint8_t BITMAP_BatteryLevel1[17];
|
||||
@@ -19,51 +21,34 @@ extern const uint8_t BITMAP_KeyLock[6];
|
||||
|
||||
extern const uint8_t BITMAP_F_Key[6];
|
||||
|
||||
extern const uint8_t BITMAP_VOX[18];
|
||||
|
||||
#if 0
|
||||
extern const uint8_t BITMAP_WX[12];
|
||||
#else
|
||||
extern const uint8_t BITMAP_XB[12];
|
||||
#ifdef ENABLE_VOX
|
||||
extern const uint8_t BITMAP_VOX[18];
|
||||
#endif
|
||||
|
||||
extern const uint8_t BITMAP_TDR1[12];
|
||||
extern const uint8_t BITMAP_TDR2[12];
|
||||
extern const uint8_t BITMAP_XB[12];
|
||||
|
||||
extern const uint8_t BITMAP_TDR1[15];
|
||||
extern const uint8_t BITMAP_TDR2[9];
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
extern const uint8_t BITMAP_VoicePrompt[9];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
extern const uint8_t BITMAP_FM[12];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
extern const uint8_t BITMAP_NOAA[12];
|
||||
extern const uint8_t BITMAP_NOAA[11];
|
||||
#endif
|
||||
|
||||
extern const uint8_t BITMAP_SC[12];
|
||||
|
||||
extern const uint8_t BITMAP_Antenna[5];
|
||||
extern const uint8_t BITMAP_AntennaLevel1[3];
|
||||
extern const uint8_t BITMAP_AntennaLevel2[3];
|
||||
extern const uint8_t BITMAP_AntennaLevel3[3];
|
||||
extern const uint8_t BITMAP_AntennaLevel4[3];
|
||||
extern const uint8_t BITMAP_AntennaLevel5[3];
|
||||
extern const uint8_t BITMAP_AntennaLevel6[3];
|
||||
|
||||
extern const uint8_t BITMAP_CurrentIndicator[8];
|
||||
extern const uint8_t BITMAP_MARKER[8];
|
||||
|
||||
extern const uint8_t BITMAP_VFO_Default[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_ScanList2[6];
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
extern const uint8_t BITMAP_compand[6];
|
||||
#endif
|
||||
extern const uint8_t BITMAP_compand[6];
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
63
board.c
@@ -26,7 +26,7 @@
|
||||
#include "bsp/dp32g030/saradc.h"
|
||||
#include "bsp/dp32g030/syscon.h"
|
||||
#include "driver/adc.h"
|
||||
//#include "driver/backlight.h"
|
||||
#include "driver/backlight.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "driver/bk1080.h"
|
||||
#endif
|
||||
@@ -94,8 +94,6 @@ void BOARD_GPIO_Init(void)
|
||||
| GPIO_DIR_6_MASK // INPUT
|
||||
);
|
||||
GPIOB->DIR |= 0
|
||||
// Back light
|
||||
| GPIO_DIR_6_BITS_OUTPUT
|
||||
// ST7565
|
||||
| GPIO_DIR_9_BITS_OUTPUT
|
||||
// ST7565 + SWD IO
|
||||
@@ -183,14 +181,10 @@ void BOARD_PORTCON_Init(void)
|
||||
// PORT B pin selection
|
||||
|
||||
PORTCON_PORTB_SEL0 &= ~(0
|
||||
// Back light
|
||||
| PORTCON_PORTB_SEL0_B6_MASK
|
||||
// SPI0 SSN
|
||||
| PORTCON_PORTB_SEL0_B7_MASK
|
||||
);
|
||||
PORTCON_PORTB_SEL0 |= 0
|
||||
// Back light
|
||||
| PORTCON_PORTB_SEL0_B6_BITS_GPIOB6
|
||||
// SPI0 SSN
|
||||
| PORTCON_PORTB_SEL0_B7_BITS_SPI0_SSN
|
||||
;
|
||||
@@ -508,8 +502,9 @@ void BOARD_Init(void)
|
||||
{
|
||||
BOARD_PORTCON_Init();
|
||||
BOARD_GPIO_Init();
|
||||
BACKLIGHT_InitHardware();
|
||||
BOARD_ADC_Init();
|
||||
ST7565_Init();
|
||||
ST7565_Init(true);
|
||||
#ifdef ENABLE_FMRADIO
|
||||
BK1080_Init(0, false);
|
||||
#endif
|
||||
@@ -532,18 +527,22 @@ void BOARD_EEPROM_Init(void)
|
||||
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
||||
#endif
|
||||
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
||||
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
||||
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
||||
#ifdef ENABLE_VOX
|
||||
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;
|
||||
|
||||
// 0E78..0E7F
|
||||
EEPROM_ReadBuffer(0x0E78, Data, 8);
|
||||
gEeprom.BACKLIGHT_MAX = (Data[0] & 0xF) <= 10 ? (Data[0] & 0xF) : 10;
|
||||
gEeprom.BACKLIGHT_MIN = (Data[0] >> 4) < gEeprom.BACKLIGHT_MAX ? (Data[0] >> 4) : 0;
|
||||
gEeprom.CHANNEL_DISPLAY_MODE = (Data[1] < 4) ? Data[1] : MDF_FREQUENCY; // 4 instead of 3 - extra display mode
|
||||
gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF;
|
||||
gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4;
|
||||
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
||||
gEeprom.BACKLIGHT = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 3;
|
||||
gEeprom.TAIL_NOTE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
||||
gEeprom.BACKLIGHT_TIME = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 3;
|
||||
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
||||
gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true;
|
||||
|
||||
// 0E80..0E87
|
||||
@@ -588,7 +587,8 @@ void BOARD_EEPROM_Init(void)
|
||||
|
||||
// 0E90..0E97
|
||||
EEPROM_ReadBuffer(0x0E90, Data, 8);
|
||||
gEeprom.BEEP_CONTROL = (Data[0] < 2) ? Data[0] : true;
|
||||
gEeprom.BEEP_CONTROL = Data[0] & 1;
|
||||
gEeprom.KEY_M_LONG_PRESS_ACTION = ((Data[0] >> 1) < ACTION_OPT_LEN) ? (Data[0] >> 1) : ACTION_OPT_NONE;
|
||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = (Data[1] < ACTION_OPT_LEN) ? Data[1] : ACTION_OPT_MONITOR;
|
||||
gEeprom.KEY_1_LONG_PRESS_ACTION = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_FLASHLIGHT;
|
||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN;
|
||||
@@ -614,7 +614,8 @@ void BOARD_EEPROM_Init(void)
|
||||
#endif
|
||||
gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF;
|
||||
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;
|
||||
gEeprom.BATTERY_TYPE = (Data[4] < BATTERY_TYPE_UNKNOWN) ? Data[4] : BATTERY_TYPE_1600_MAH;
|
||||
|
||||
// 0ED0..0ED7
|
||||
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
||||
@@ -622,7 +623,7 @@ void BOARD_EEPROM_Init(void)
|
||||
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_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_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
||||
@@ -685,7 +686,8 @@ void BOARD_EEPROM_Init(void)
|
||||
|
||||
// 0F18..0F1F
|
||||
EEPROM_ReadBuffer(0x0F18, Data, 8);
|
||||
gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false;
|
||||
// gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false;
|
||||
gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 3) ? Data[0] : false; // we now have 'all' channel scan option
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
const unsigned int j = 1 + (i * 3);
|
||||
@@ -705,13 +707,14 @@ void BOARD_EEPROM_Init(void)
|
||||
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true;
|
||||
gSetting_TX_EN = (Data[7] & (1u << 0)) ? 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
|
||||
gSetting_mic_bar = (Data[7] & (1u << 4)) ? true : false;
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX
|
||||
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
|
||||
#endif
|
||||
gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u;
|
||||
|
||||
if (!gEeprom.VFO_OPEN)
|
||||
{
|
||||
@@ -735,18 +738,18 @@ void BOARD_EEPROM_Init(void)
|
||||
}
|
||||
}
|
||||
|
||||
void BOARD_EEPROM_LoadMoreSettings(void)
|
||||
void BOARD_EEPROM_LoadCalibration(void)
|
||||
{
|
||||
// uint8_t Mic;
|
||||
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_1, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_2, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_3, gEEPROM_1EC0_0, 8);
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[3], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[4], gEEPROM_RSSI_CALIB[3], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[5], gEEPROM_RSSI_CALIB[3], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[6], gEEPROM_RSSI_CALIB[3], 8);
|
||||
|
||||
// 8 * 16-bit values
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[0], 8);
|
||||
EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[1], 8);
|
||||
EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[0], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[1], gEEPROM_RSSI_CALIB[0], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[2], gEEPROM_RSSI_CALIB[0], 8);
|
||||
|
||||
EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12);
|
||||
if (gBatteryCalibration[0] >= 5000)
|
||||
@@ -756,9 +759,11 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
||||
}
|
||||
gBatteryCalibration[5] = 2300;
|
||||
|
||||
EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2);
|
||||
EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2);
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
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);
|
||||
//gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15;
|
||||
gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY];
|
||||
@@ -861,7 +866,7 @@ void BOARD_FactoryReset(bool bIsAll)
|
||||
|
||||
if (bIsAll)
|
||||
{
|
||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, BAND6_400MHz, 43350000);
|
||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, 43350000);
|
||||
|
||||
// set the first few memory channels
|
||||
for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++)
|
||||
|
||||
2
board.h
@@ -27,7 +27,7 @@ void BOARD_ADC_Init(void);
|
||||
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
||||
void BOARD_Init(void);
|
||||
void BOARD_EEPROM_Init(void);
|
||||
void BOARD_EEPROM_LoadMoreSettings(void);
|
||||
void BOARD_EEPROM_LoadCalibration(void);
|
||||
uint32_t BOARD_fetchChannelFrequency(const int channel);
|
||||
void BOARD_fetchChannelName(char *s, const int channel);
|
||||
void BOARD_FactoryReset(bool bIsAll);
|
||||
|
||||
146
bsp/dp32g030/pwmplus.h
Normal file
@@ -0,0 +1,146 @@
|
||||
#ifndef HARDWARE_DP32G030_PWMPLUS_H
|
||||
#define HARDWARE_DP32G030_PWMPLUS_H
|
||||
|
||||
#define PWM_PLUS0_BASE_ADDR 0x400B4000U
|
||||
|
||||
//---------------
|
||||
|
||||
#define PWMPLUS_CFG 0x00U
|
||||
|
||||
#define PWMPLUS_CFG_COUNTER_EN_SHIFT 0U
|
||||
#define PWMPLUS_CFG_COUNTER_EN_WIDTH 1U
|
||||
#define PWMPLUS_CFG_COUNTER_EN_MASK (((1U << PWMPLUS_CFG_COUNTER_EN_WIDTH) - 1U) << PWMPLUS_CFG_COUNTER_EN_SHIFT)
|
||||
#define PWMPLUS_CFG_COUNTER_EN_VALUE_ENABLE 1U
|
||||
#define PWMPLUS_CFG_COUNTER_EN_BITS_ENABLE (PWMPLUS_CFG_COUNTER_EN_VALUE_ENABLE << PWMPLUS_CFG_COUNTER_EN_SHIFT)
|
||||
|
||||
#define PWMPLUS_CFG_CNT_TYPE_SHIFT 1U
|
||||
|
||||
#define PWMPLUS_CFG_CNT_REP_SHIFT 2U
|
||||
#define PWMPLUS_CFG_CNT_REP_WIDTH 1U
|
||||
#define PWMPLUS_CFG_CNT_REP_VALUE_ENABLE 1U
|
||||
#define PWMPLUS_CFG_CNT_REP_BITS_ENABLE (PWMPLUS_CFG_CNT_REP_VALUE_ENABLE << PWMPLUS_CFG_CNT_REP_SHIFT)
|
||||
|
||||
#define PWMPLUS_CFG_OUT_MODE_SHIFT 3U
|
||||
#define PWMPLUS_CFG_OUT_MODE_VALUE_ENABLE 1U
|
||||
#define PWMPLUS_CFG_OUT_MODE_BITS_ENABLE (PWMPLUS_CFG_OUT_MODE_VALUE_ENABLE << PWMPLUS_CFG_OUT_MODE_SHIFT)
|
||||
|
||||
#define PWMPLUS_CFG_AUTO_RELOAD_SHIFT 8U
|
||||
|
||||
//---------------
|
||||
|
||||
#define PWMPLUS_GEN 0x04U
|
||||
|
||||
#define PWMPLUS_GEN_CH0_OE_SHIFT 24U
|
||||
#define PWMPLUS_GEN_CH0_OE_WIDTH 1U
|
||||
#define PWMPLUS_GEN_CH0_OE_VALUE_ENABLE 1U
|
||||
#define PWMPLUS_GEN_CH0_OE_BITS_ENABLE (PWMPLUS_GEN_CH0_OE_VALUE_ENABLE << PWMPLUS_GEN_CH0_OE_SHIFT)
|
||||
|
||||
#define PWMPLUS_GEN_CH0_OUTINV_SHIFT 16U
|
||||
#define PWMPLUS_GEN_CH0_OUTINV_WIDTH 1U
|
||||
#define PWMPLUS_GEN_CH0_OUTINV_VALUE_ENABLE 1U
|
||||
#define PWMPLUS_GEN_CH0_OUTINV_BITS_ENABLE (PWMPLUS_GEN_CH0_OUTINV_VALUE_ENABLE << PWMPLUS_GEN_CH0_OUTINV_SHIFT)
|
||||
|
||||
#define PWMPLUS_GEN_CH0_START_SHIFT 8U
|
||||
#define PWMPLUS_GEN_CH0_START_WIDTH 1U
|
||||
#define PWMPLUS_GEN_CH0_START_VALUE_ENABLE 1U
|
||||
#define PWMPLUS_GEN_CH0_START_BITS_ENABLE (PWMPLUS_GEN_CH0_START_VALUE_ENABLE << PWMPLUS_GEN_CH0_START_SHIFT)
|
||||
|
||||
#define PWMPLUS_GEN_CH0_IDLE_SHIFT 0U
|
||||
#define PWMPLUS_GEN_CH0_IDLE_WIDTH 1U
|
||||
#define PWMPLUS_GEN_CH0_IDLE_VALUE_ENABLE 1U
|
||||
#define PWMPLUS_GEN_CH0_IDLE_BITS_ENABLE (PWMPLUS_GEN_CH0_IDLE_VALUE_ENABLE << PWMPLUS_GEN_CH0_IDLE_SHIFT)
|
||||
|
||||
//---------------
|
||||
|
||||
#define PWMPLUS_CLKSRC 0x08U
|
||||
#define PWMPLUS_BRAKE_CFG 0x0CU
|
||||
#define PWMPLUS_MASK_LEV 0x10U
|
||||
#define PWMPLUS_PERIOD 0x1CU
|
||||
#define PWMPLUS_CH0_COMP 0x20U
|
||||
#define PWMPLUS_CH1_COMP 0x24U
|
||||
#define PWMPLUS_CH2_COMP 0x28U
|
||||
#define PWMPLUS_CH0_DT 0x30U
|
||||
#define PWMPLUS_CH1_DT 0x34U
|
||||
#define PWMPLUS_CH2_DT 0x38U
|
||||
#define PWMPLUS_TRIG_COMP 0x40U
|
||||
#define PWMPLUS_TRIG_CFG 0x44U
|
||||
#define PWMPLUS_IE 0x60U
|
||||
#define PWMPLUS_IF 0x64U
|
||||
#define PWMPLUS_SWLOAD 0x84U
|
||||
#define PWMPLUS_MASK_EN 0x88
|
||||
#define PWMPLUS_CNT_ST 0xE0
|
||||
#define PWMPLUS_BRAKE_ST 0xE4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define PWM_PLUS0_CFG_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CFG)
|
||||
#define PWM_PLUS0_CFG (*(volatile uint32_t *)PWM_PLUS0_CFG_ADDR)
|
||||
|
||||
#define PWM_PLUS0_GEN_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_GEN)
|
||||
#define PWM_PLUS0_GEN (*(volatile uint32_t *)PWM_PLUS0_GEN_ADDR)
|
||||
|
||||
#define PWM_PLUS0_CLKSRC_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CLKSRC)
|
||||
#define PWM_PLUS0_CLKSRC (*(volatile uint32_t *)PWM_PLUS0_CLKSRC_ADDR)
|
||||
|
||||
#define PWM_PLUS0_BRAKE_CFG_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_BRAKE_CFG)
|
||||
#define PWM_PLUS0_BRAKE_CFG (*(volatile uint32_t *)PWM_PLUS0_BRAKE_CFG_ADDR)
|
||||
|
||||
#define PWM_PLUS0_MASK_LEV_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_MASK_LEV)
|
||||
#define PWM_PLUS0_MASK_LEV (*(volatile uint32_t *)PWM_PLUS0_MASK_LEV_ADDR)
|
||||
|
||||
#define PWM_PLUS0_PERIOD_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_PERIOD)
|
||||
#define PWM_PLUS0_PERIOD (*(volatile uint32_t *)PWM_PLUS0_PERIOD_ADDR)
|
||||
|
||||
#define PWM_PLUS0_CH0_COMP_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH0_COMP)
|
||||
#define PWM_PLUS0_CH0_COMP (*(volatile uint32_t *)PWM_PLUS0_CH0_COMP_ADDR)
|
||||
|
||||
#define PWM_PLUS0_CH1_COMP_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH1_COMP)
|
||||
#define PWM_PLUS0_CH1_COMP (*(volatile uint32_t *)PWM_PLUS0_CH1_COMP_ADDR)
|
||||
|
||||
#define PWM_PLUS0_CH2_COMP_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH2_COMP)
|
||||
#define PWM_PLUS0_CH2_COMP (*(volatile uint32_t *)PWM_PLUS0_CH2_COMP_ADDR)
|
||||
|
||||
#define PWM_PLUS0_CH0_DT_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH0_DT)
|
||||
#define PWM_PLUS0_CH0_DT (*(volatile uint32_t *)PWM_PLUS0_CH0_DT_ADDR)
|
||||
|
||||
#define PWM_PLUS0_CH1_DT_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH1_DT)
|
||||
#define PWM_PLUS0_CH1_DT (*(volatile uint32_t *)PWM_PLUS0_CH1_DT_ADDR)
|
||||
|
||||
#define PWM_PLUS0_CH2_DT_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH2_DT)
|
||||
#define PWM_PLUS0_CH2_DT (*(volatile uint32_t *)PWM_PLUS0_CH2_DT_ADDR)
|
||||
|
||||
#define PWM_PLUS0_TRIG_COMP_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_TRIG_COMP)
|
||||
#define PWM_PLUS0_TRIG_COMP (*(volatile uint32_t *)PWM_PLUS0_TRIG_COMP_ADDR)
|
||||
|
||||
#define PWM_PLUS0_TRIG_CFG_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_TRIG_CFG)
|
||||
#define PWM_PLUS0_TRIG_CFG (*(volatile uint32_t *)PWM_PLUS0_TRIG_CFG_ADDR)
|
||||
|
||||
#define PWM_PLUS0_IE_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_IE)
|
||||
#define PWM_PLUS0_IE (*(volatile uint32_t *)PWM_PLUS0_IE_ADDR)
|
||||
|
||||
#define PWM_PLUS0_IF_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_IF)
|
||||
#define PWM_PLUS0_IF (*(volatile uint32_t *)PWM_PLUS0_IF_ADDR)
|
||||
|
||||
#define PWM_PLUS0_SWLOAD_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_SWLOAD)
|
||||
#define PWM_PLUS0_SWLOAD (*(volatile uint32_t *)PWM_PLUS0_SWLOAD_ADDR)
|
||||
|
||||
#define PWM_PLUS0_MASK_EN_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_MASK_EN)
|
||||
#define PWM_PLUS0_MASK_EN (*(volatile uint32_t *)PWM_PLUS0_MASK_EN_ADDR)
|
||||
|
||||
#define PWM_PLUS0_CNT_ST_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CNT_ST)
|
||||
#define PWM_PLUS0_CNT_ST (*(volatile uint32_t *)PWM_PLUS0_CNT_ST_ADDR)
|
||||
|
||||
#define PWM_PLUS0_BRAKE_ST_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_BRAKE_ST)
|
||||
#define PWM_PLUS0_BRAKE_ST (*(volatile uint32_t *)PWM_PLUS0_BRAKE_ST_ADDR)
|
||||
|
||||
#endif
|
||||
4
compile-with-docker.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
docker build -t uvk5 .
|
||||
docker run -v %CD%\compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make clean && make && cp firmware* compiled-firmware/"
|
||||
pause
|
||||
3
compile-with-docker.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
docker build -t uvk5 .
|
||||
docker run -v ${PWD}/compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make && cp firmware* compiled-firmware/"
|
||||
2
dcs.c
@@ -91,7 +91,7 @@ uint8_t DCS_GetCdcssCode(uint32_t Code)
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
uint8_t DCS_GetCtcssCode(uint16_t Code)
|
||||
uint8_t DCS_GetCtcssCode(int Code)
|
||||
{
|
||||
unsigned int i;
|
||||
uint8_t Result = 0xFF;
|
||||
|
||||
2
dcs.h
@@ -39,7 +39,7 @@ extern const uint16_t DCS_Options[104];
|
||||
|
||||
uint32_t DCS_GetGolayCodeWord(DCS_CodeType_t CodeType, uint8_t Option);
|
||||
uint8_t DCS_GetCdcssCode(uint32_t Code);
|
||||
uint8_t DCS_GetCtcssCode(uint16_t Code);
|
||||
uint8_t DCS_GetCtcssCode(int Code);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
18
debugging.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef DEBUGGING_H
|
||||
#define DEBUGGING_H
|
||||
|
||||
#include "driver/uart.h"
|
||||
#include "string.h"
|
||||
#include "external/printf/printf.h"
|
||||
|
||||
|
||||
static inline void LogUart(char * str)
|
||||
{
|
||||
UART_Send(str, strlen(str));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -134,9 +134,9 @@ void ADC_Configure(ADC_Config_t *pAdc)
|
||||
;
|
||||
|
||||
if (SARADC_IE == 0) {
|
||||
NVIC_DisableIRQ(DP32_SARADC_IRQn);
|
||||
NVIC_DisableIRQ((IRQn_Type)DP32_SARADC_IRQn);
|
||||
} else {
|
||||
NVIC_EnableIRQ(DP32_SARADC_IRQn);
|
||||
NVIC_EnableIRQ((IRQn_Type)DP32_SARADC_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
11
driver/adc.h
@@ -42,8 +42,10 @@ enum ADC_CH_MASK {
|
||||
typedef enum ADC_CH_MASK ADC_CH_MASK;
|
||||
|
||||
typedef struct {
|
||||
uint8_t CLK_SEL;
|
||||
uint16_t EXTTRIG_SEL;
|
||||
uint16_t IE_CHx_EOC;
|
||||
ADC_CH_MASK CH_SEL;
|
||||
uint8_t CLK_SEL;
|
||||
uint8_t AVG;
|
||||
uint8_t CONT;
|
||||
uint8_t MEM_MODE;
|
||||
@@ -51,13 +53,12 @@ typedef struct {
|
||||
uint8_t SMPL_SETUP;
|
||||
uint8_t SMPL_WIN;
|
||||
uint8_t ADC_TRIG;
|
||||
uint16_t EXTTRIG_SEL;
|
||||
bool CALIB_OFFSET_VALID;
|
||||
bool CALIB_KD_VALID;
|
||||
uint8_t DMA_EN;
|
||||
uint16_t IE_CHx_EOC;
|
||||
uint8_t IE_FIFO_HFULL;
|
||||
uint8_t IE_FIFO_FULL;
|
||||
bool CALIB_OFFSET_VALID;
|
||||
bool CALIB_KD_VALID;
|
||||
uint8_t _pad[1];
|
||||
} ADC_Config_t;
|
||||
|
||||
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 *pI = (const uint32_t *)pIv;
|
||||
|
||||
(void)IsDecrypt; // unused
|
||||
|
||||
AES_CR = (AES_CR & ~AES_CR_EN_MASK) | AES_CR_EN_BITS_DISABLE;
|
||||
AES_CR = AES_CR_CHMOD_BITS_CBC;
|
||||
AES_KEYR3 = pK[0];
|
||||
|
||||
@@ -16,21 +16,54 @@
|
||||
|
||||
#include "backlight.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "bsp/dp32g030/pwmplus.h"
|
||||
#include "bsp/dp32g030/portcon.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "settings.h"
|
||||
|
||||
// this is decremented once every 500ms
|
||||
uint16_t gBacklightCountdown = 0;
|
||||
bool backlightOn;
|
||||
|
||||
void BACKLIGHT_InitHardware()
|
||||
{
|
||||
// 48MHz / 94 / 1024 ~ 500Hz
|
||||
const uint32_t PWM_FREQUENCY_HZ = 1000;
|
||||
PWM_PLUS0_CLKSRC |= ((48000000 / 1024 / PWM_FREQUENCY_HZ) << 16);
|
||||
PWM_PLUS0_PERIOD = 1023;
|
||||
|
||||
PORTCON_PORTB_SEL0 &= ~(0
|
||||
// Back light
|
||||
| PORTCON_PORTB_SEL0_B6_MASK
|
||||
);
|
||||
PORTCON_PORTB_SEL0 |= 0
|
||||
// Back light PWM
|
||||
| PORTCON_PORTB_SEL0_B6_BITS_PWMP0_CH0
|
||||
;
|
||||
|
||||
PWM_PLUS0_GEN =
|
||||
PWMPLUS_GEN_CH0_OE_BITS_ENABLE |
|
||||
PWMPLUS_GEN_CH0_OUTINV_BITS_ENABLE |
|
||||
0;
|
||||
|
||||
PWM_PLUS0_CFG =
|
||||
PWMPLUS_CFG_CNT_REP_BITS_ENABLE |
|
||||
PWMPLUS_CFG_COUNTER_EN_BITS_ENABLE |
|
||||
0;
|
||||
}
|
||||
|
||||
void BACKLIGHT_TurnOn(void)
|
||||
{
|
||||
if (gEeprom.BACKLIGHT == 0)
|
||||
if (gEeprom.BACKLIGHT_TIME != 0) {
|
||||
backlightOn = true;
|
||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
||||
}
|
||||
else {
|
||||
BACKLIGHT_TurnOff();
|
||||
return;
|
||||
|
||||
// turn the backlight ON
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
}
|
||||
|
||||
switch (gEeprom.BACKLIGHT)
|
||||
switch (gEeprom.BACKLIGHT_TIME)
|
||||
{
|
||||
default:
|
||||
case 1: // 5 sec
|
||||
@@ -58,3 +91,21 @@ void BACKLIGHT_TurnOn(void)
|
||||
|
||||
gBacklightCountdown *= 2;
|
||||
}
|
||||
|
||||
void BACKLIGHT_TurnOff()
|
||||
{
|
||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MIN);
|
||||
gBacklightCountdown = 0;
|
||||
backlightOn = false;
|
||||
}
|
||||
|
||||
bool BACKLIGHT_IsOn()
|
||||
{
|
||||
return backlightOn;
|
||||
}
|
||||
|
||||
void BACKLIGHT_SetBrightness(uint8_t brigtness)
|
||||
{
|
||||
PWM_PLUS0_CH0_COMP = (1 << brigtness) - 1;
|
||||
//PWM_PLUS0_SWLOAD = 1;
|
||||
}
|
||||
@@ -18,10 +18,16 @@
|
||||
#define DRIVER_BACKLIGHT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern uint16_t gBacklightCountdown;
|
||||
extern uint8_t gBacklightBrightness;
|
||||
|
||||
void BACKLIGHT_TurnOn(void);
|
||||
void BACKLIGHT_InitHardware();
|
||||
void BACKLIGHT_TurnOn();
|
||||
void BACKLIGHT_TurnOff();
|
||||
bool BACKLIGHT_IsOn();
|
||||
void BACKLIGHT_SetBrightness(uint8_t brigtness);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ enum BK4819_REGISTER_t {
|
||||
BK4819_REG_3A = 0x3AU,
|
||||
BK4819_REG_3B = 0x3BU,
|
||||
BK4819_REG_3C = 0x3CU,
|
||||
BK4819_REG_3D = 0x3DU,
|
||||
BK4819_REG_3E = 0x3EU,
|
||||
BK4819_REG_3F = 0x3FU,
|
||||
BK4819_REG_43 = 0x43U,
|
||||
@@ -95,13 +96,12 @@ enum BK4819_REGISTER_t {
|
||||
typedef enum BK4819_REGISTER_t BK4819_REGISTER_t;
|
||||
|
||||
enum BK4819_GPIO_PIN_t {
|
||||
BK4819_GPIO6_PIN2 = 0,
|
||||
BK4819_GPIO5_PIN1 = 1,
|
||||
BK4819_GPIO4_PIN32 = 2,
|
||||
BK4819_GPIO3_PIN31 = 3,
|
||||
BK4819_GPIO2_PIN30 = 4,
|
||||
BK4819_GPIO1_PIN29_RED = 5,
|
||||
BK4819_GPIO0_PIN28_GREEN = 6,
|
||||
BK4819_GPIO0_PIN28_RX_ENABLE = 0,
|
||||
BK4819_GPIO1_PIN29_PA_ENABLE = 1,
|
||||
BK4819_GPIO3_PIN31_UHF_LNA = 3,
|
||||
BK4819_GPIO4_PIN32_VHF_LNA = 4,
|
||||
BK4819_GPIO5_PIN1_RED = 5,
|
||||
BK4819_GPIO6_PIN2_GREEN = 6,
|
||||
};
|
||||
|
||||
typedef enum BK4819_GPIO_PIN_t BK4819_GPIO_PIN_t;
|
||||
|
||||
1202
driver/bk4819.c
@@ -24,22 +24,22 @@
|
||||
|
||||
enum BK4819_AF_Type_t
|
||||
{
|
||||
BK4819_AF_MUTE = 0u,
|
||||
BK4819_AF_OPEN = 1u,
|
||||
BK4819_AF_ALAM = 2u,
|
||||
BK4819_AF_BEEP = 3u,
|
||||
BK4819_AF_UNKNOWN1 = 4u,
|
||||
BK4819_AF_UNKNOWN2 = 5u,
|
||||
BK4819_AF_CTCO = 6u,
|
||||
BK4819_AF_AM = 7u,
|
||||
BK4819_AF_FSKO = 8u,
|
||||
BK4819_AF_UNKNOWN3 = 9u,
|
||||
BK4819_AF_UNKNOWN4 = 10u,
|
||||
BK4819_AF_UNKNOWN5 = 11u,
|
||||
BK4819_AF_UNKNOWN6 = 12u,
|
||||
BK4819_AF_UNKNOWN7 = 13u,
|
||||
BK4819_AF_UNKNOWN8 = 14u,
|
||||
BK4819_AF_UNKNOWN9 = 15u
|
||||
BK4819_AF_MUTE = 0u, //
|
||||
BK4819_AF_FM = 1u, // FM
|
||||
BK4819_AF_ALAM = 2u, //
|
||||
BK4819_AF_BEEP = 3u, //
|
||||
BK4819_AF_BASEBAND1 = 4u, // SSB
|
||||
BK4819_AF_BASEBAND2 = 5u, // SSB
|
||||
BK4819_AF_CTCO = 6u, // strange LF audio .. maybe the CTCSS LF line ?
|
||||
BK4819_AF_AM = 7u, // AM
|
||||
BK4819_AF_FSKO = 8u, // nothing
|
||||
BK4819_AF_UNKNOWN3 = 9u, // distorted
|
||||
BK4819_AF_UNKNOWN4 = 10u, // nothing at all
|
||||
BK4819_AF_UNKNOWN5 = 11u, // distorted
|
||||
BK4819_AF_UNKNOWN6 = 12u, // distorted
|
||||
BK4819_AF_UNKNOWN7 = 13u, // interesting
|
||||
BK4819_AF_UNKNOWN8 = 14u, // interesting
|
||||
BK4819_AF_UNKNOWN9 = 15u // not a lot
|
||||
};
|
||||
|
||||
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
||||
@@ -62,6 +62,7 @@ enum BK4819_CssScanResult_t
|
||||
|
||||
typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
|
||||
|
||||
// radio is asleep, not listening
|
||||
extern bool gRxIdleMode;
|
||||
|
||||
void BK4819_Init(void);
|
||||
@@ -70,7 +71,8 @@ void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data);
|
||||
void BK4819_WriteU8(uint8_t Data);
|
||||
void BK4819_WriteU16(uint16_t Data);
|
||||
|
||||
void BK4819_SetAGC(uint8_t Value);
|
||||
void BK4819_EnableAGC();
|
||||
void BK4819_DisableAGC();
|
||||
|
||||
void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet);
|
||||
|
||||
@@ -102,6 +104,7 @@ void BK4819_DisableVox(void);
|
||||
void BK4819_DisableDTMF(void);
|
||||
void BK4819_EnableDTMF(void);
|
||||
void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch);
|
||||
void BK4819_PlaySingleTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level, const bool play_speaker);
|
||||
void BK4819_EnterTxMute(void);
|
||||
void BK4819_ExitTxMute(void);
|
||||
void BK4819_Sleep(void);
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "driver/eeprom.h"
|
||||
#include "driver/i2c.h"
|
||||
#include "driver/system.h"
|
||||
@@ -38,16 +41,22 @@ void EEPROM_ReadBuffer(uint16_t Address, void *pBuffer, uint8_t Size)
|
||||
|
||||
void EEPROM_WriteBuffer(uint16_t Address, const void *pBuffer)
|
||||
{
|
||||
I2C_Start();
|
||||
if (pBuffer == NULL || Address >= 0x2000)
|
||||
return;
|
||||
|
||||
I2C_Write(0xA0);
|
||||
|
||||
I2C_Write((Address >> 8) & 0xFF);
|
||||
I2C_Write((Address >> 0) & 0xFF);
|
||||
uint8_t buffer[8];
|
||||
EEPROM_ReadBuffer(Address, buffer, 8);
|
||||
if (memcmp(pBuffer, buffer, 8) != 0)
|
||||
{
|
||||
I2C_Start();
|
||||
I2C_Write(0xA0);
|
||||
I2C_Write((Address >> 8) & 0xFF);
|
||||
I2C_Write((Address >> 0) & 0xFF);
|
||||
I2C_WriteBuffer(pBuffer, 8);
|
||||
I2C_Stop();
|
||||
}
|
||||
|
||||
I2C_WriteBuffer(pBuffer, 8);
|
||||
|
||||
I2C_Stop();
|
||||
|
||||
SYSTEM_DelayMs(10);
|
||||
// give the EEPROM time to burn the data in (apparently takes 5ms)
|
||||
SYSTEM_DelayMs(8);
|
||||
}
|
||||
|
||||
@@ -14,25 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "driver/gpio.h"
|
||||
|
||||
void GPIO_ClearBit(volatile uint32_t *pReg, uint8_t Bit)
|
||||
{
|
||||
*pReg &= ~(1U << Bit);
|
||||
}
|
||||
|
||||
uint8_t GPIO_CheckBit(volatile uint32_t *pReg, uint8_t Bit)
|
||||
{
|
||||
return (*pReg >> Bit) & 1U;
|
||||
}
|
||||
|
||||
void GPIO_FlipBit(volatile uint32_t *pReg, uint8_t Bit)
|
||||
{
|
||||
*pReg ^= 1U << Bit;
|
||||
}
|
||||
|
||||
void GPIO_SetBit(volatile uint32_t *pReg, uint8_t Bit)
|
||||
{
|
||||
*pReg |= 1U << Bit;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,10 +58,21 @@ enum GPIOC_PINS {
|
||||
GPIOC_PIN_PTT = 5
|
||||
};
|
||||
|
||||
void GPIO_ClearBit(volatile uint32_t *pReg, uint8_t Bit);
|
||||
uint8_t GPIO_CheckBit(volatile uint32_t *pReg, uint8_t Bit);
|
||||
void GPIO_FlipBit(volatile uint32_t *pReg, uint8_t Bit);
|
||||
void GPIO_SetBit(volatile uint32_t *pReg, uint8_t Bit);
|
||||
static inline void GPIO_ClearBit(volatile uint32_t *pReg, uint8_t Bit) {
|
||||
*pReg &= ~(1U << Bit);
|
||||
}
|
||||
|
||||
static inline uint8_t GPIO_CheckBit(volatile uint32_t *pReg, uint8_t Bit) {
|
||||
return (*pReg >> Bit) & 1U;
|
||||
}
|
||||
|
||||
static inline void GPIO_FlipBit(volatile uint32_t *pReg, uint8_t Bit) {
|
||||
*pReg ^= 1U << Bit;
|
||||
}
|
||||
|
||||
static inline void GPIO_SetBit(volatile uint32_t *pReg, uint8_t Bit) {
|
||||
*pReg |= 1U << Bit;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,182 +19,141 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/systick.h"
|
||||
#include "driver/i2c.h"
|
||||
#include "misc.h"
|
||||
|
||||
KEY_Code_t gKeyReading0 = KEY_INVALID;
|
||||
KEY_Code_t gKeyReading1 = KEY_INVALID;
|
||||
uint16_t gDebounceCounter;
|
||||
bool gWasFKeyPressed;
|
||||
KEY_Code_t gKeyReading0 = KEY_INVALID;
|
||||
KEY_Code_t gKeyReading1 = KEY_INVALID;
|
||||
uint16_t gDebounceCounter = 0;
|
||||
bool gWasFKeyPressed = false;
|
||||
|
||||
static const struct {
|
||||
|
||||
// Using a 16 bit pre-calculated shift and invert is cheaper
|
||||
// than using 8 bit and doing shift and invert in code.
|
||||
uint16_t set_to_zero_mask;
|
||||
|
||||
// We are very fortunate.
|
||||
// The key and pin defines fit together in a single u8, making this very efficient
|
||||
struct {
|
||||
KEY_Code_t key : 5;
|
||||
uint8_t pin : 3; // Pin 6 is highest
|
||||
} pins[4];
|
||||
|
||||
} keyboard[] = {
|
||||
|
||||
{ // Zero row
|
||||
// Set to zero to handle special case of nothing pulled down
|
||||
.set_to_zero_mask = 0xffff,
|
||||
.pins = {
|
||||
{ .key = KEY_SIDE1, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||
|
||||
// Duplicate to fill the array with valid values
|
||||
{ .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||
{ .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1}
|
||||
}
|
||||
},
|
||||
{ // First row
|
||||
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_4) & 0xffff,
|
||||
.pins = {
|
||||
{ .key = KEY_MENU, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||
{ .key = KEY_1, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||
{ .key = KEY_4, .pin = GPIOA_PIN_KEYBOARD_2},
|
||||
{ .key = KEY_7, .pin = GPIOA_PIN_KEYBOARD_3}
|
||||
}
|
||||
},
|
||||
{ // Second row
|
||||
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_5) & 0xffff,
|
||||
.pins = {
|
||||
{ .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||
{ .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1},
|
||||
{ .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||
{ .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3}
|
||||
}
|
||||
},
|
||||
{ // Third row
|
||||
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_6) & 0xffff,
|
||||
.pins = {
|
||||
{ .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||
{ .key = KEY_3 , .pin = GPIOA_PIN_KEYBOARD_1},
|
||||
{ .key = KEY_6 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||
{ .key = KEY_9 , .pin = GPIOA_PIN_KEYBOARD_3}
|
||||
}
|
||||
},
|
||||
{ // Fourth row
|
||||
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_7) & 0xffff,
|
||||
.pins = {
|
||||
{ .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||
{ .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||
{ .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||
{ .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
KEY_Code_t KEYBOARD_Poll(void)
|
||||
{
|
||||
KEY_Code_t Key = KEY_INVALID;
|
||||
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
||||
|
||||
SYSTICK_DelayUs(1);
|
||||
// if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||
// return KEY_PTT;
|
||||
|
||||
// *****************
|
||||
// Keys connected to gnd
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
||||
for (unsigned int j = 0; j < ARRAY_SIZE(keyboard); j++)
|
||||
{
|
||||
Key = KEY_SIDE1;
|
||||
goto Bye;
|
||||
uint16_t reg;
|
||||
unsigned int i;
|
||||
unsigned int k;
|
||||
|
||||
// Set all high
|
||||
GPIOA->DATA |= 1u << GPIOA_PIN_KEYBOARD_4 |
|
||||
1u << GPIOA_PIN_KEYBOARD_5 |
|
||||
1u << GPIOA_PIN_KEYBOARD_6 |
|
||||
1u << GPIOA_PIN_KEYBOARD_7;
|
||||
|
||||
// Clear the pin we are selecting
|
||||
GPIOA->DATA &= keyboard[j].set_to_zero_mask;
|
||||
|
||||
// Read all 4 GPIO pins at once .. with de-noise, max of 8 sample loops
|
||||
for (i = 0, k = 0, reg = 0; i < 3 && k < 8; i++, k++)
|
||||
{
|
||||
uint16_t reg2;
|
||||
|
||||
SYSTICK_DelayUs(1);
|
||||
|
||||
reg2 = GPIOA->DATA;
|
||||
if (reg != reg2)
|
||||
{ // noise
|
||||
reg = reg2;
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
if (i < 3)
|
||||
break; // noise is too bad
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
||||
{
|
||||
Key = KEY_SIDE2;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
// Original doesn't do PTT
|
||||
|
||||
// *****************
|
||||
// First row
|
||||
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
||||
SYSTICK_DelayUs(1);
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
||||
{
|
||||
Key = KEY_MENU;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
||||
{
|
||||
Key = KEY_1;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_2))
|
||||
{
|
||||
Key = KEY_4;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_3))
|
||||
{
|
||||
Key = KEY_7;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
// *****************
|
||||
// Second row
|
||||
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
||||
SYSTICK_DelayUs(1);
|
||||
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
||||
SYSTICK_DelayUs(1);
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
||||
{
|
||||
Key = KEY_UP;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
||||
{
|
||||
Key = KEY_2;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_2))
|
||||
{
|
||||
Key = KEY_5;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_3))
|
||||
{
|
||||
Key = KEY_8;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
// *****************
|
||||
// Third row
|
||||
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
||||
SYSTICK_DelayUs(1);
|
||||
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
||||
SYSTICK_DelayUs(1);
|
||||
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
||||
SYSTICK_DelayUs(1);
|
||||
// Create I2C stop condition since we might have toggled I2C pins
|
||||
// This leaves GPIOA_PIN_KEYBOARD_4 and GPIOA_PIN_KEYBOARD_5 high
|
||||
I2C_Stop();
|
||||
|
||||
// Reset VOICE pins
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
||||
SYSTICK_DelayUs(1);
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
||||
{
|
||||
Key = KEY_DOWN;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
||||
{
|
||||
Key = KEY_3;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_2))
|
||||
{
|
||||
Key = KEY_6;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_3))
|
||||
{
|
||||
Key = KEY_9;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
// *****************
|
||||
// Fourth row
|
||||
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
||||
SYSTICK_DelayUs(1);
|
||||
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
||||
SYSTICK_DelayUs(1);
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
||||
{
|
||||
Key = KEY_EXIT;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
||||
{
|
||||
Key = KEY_STAR;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_2))
|
||||
{
|
||||
Key = KEY_0;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_3))
|
||||
{
|
||||
Key = KEY_F;
|
||||
goto Bye;
|
||||
}
|
||||
|
||||
// *****************
|
||||
|
||||
Bye:
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -21,30 +21,29 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum KEY_Code_t {
|
||||
KEY_0 = 0,
|
||||
KEY_1 = 1,
|
||||
KEY_2 = 2,
|
||||
KEY_3 = 3,
|
||||
KEY_4 = 4,
|
||||
KEY_5 = 5,
|
||||
KEY_6 = 6,
|
||||
KEY_7 = 7,
|
||||
KEY_8 = 8,
|
||||
KEY_9 = 9,
|
||||
KEY_MENU = 10,
|
||||
KEY_UP = 11,
|
||||
KEY_DOWN = 12,
|
||||
KEY_EXIT = 13,
|
||||
KEY_STAR = 14,
|
||||
KEY_F = 15,
|
||||
KEY_PTT = 21,
|
||||
KEY_SIDE2 = 22,
|
||||
KEY_SIDE1 = 23,
|
||||
KEY_INVALID = 255
|
||||
enum KEY_Code_e {
|
||||
KEY_0 = 0, // 0
|
||||
KEY_1, // 1
|
||||
KEY_2, // 2
|
||||
KEY_3, // 3
|
||||
KEY_4, // 4
|
||||
KEY_5, // 5
|
||||
KEY_6, // 6
|
||||
KEY_7, // 7
|
||||
KEY_8, // 8
|
||||
KEY_9, // 9
|
||||
KEY_MENU, // A
|
||||
KEY_UP, // B
|
||||
KEY_DOWN, // C
|
||||
KEY_EXIT, // D
|
||||
KEY_STAR, // *
|
||||
KEY_F, // #
|
||||
KEY_PTT, //
|
||||
KEY_SIDE2, //
|
||||
KEY_SIDE1, //
|
||||
KEY_INVALID //
|
||||
};
|
||||
|
||||
typedef enum KEY_Code_t KEY_Code_t;
|
||||
typedef enum KEY_Code_e KEY_Code_t;
|
||||
|
||||
extern KEY_Code_t gKeyReading0;
|
||||
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 == SPI0) {
|
||||
NVIC_EnableIRQ(DP32_SPI0_IRQn);
|
||||
NVIC_EnableIRQ((IRQn_Type)DP32_SPI0_IRQn);
|
||||
} else if (pPort == SPI1) {
|
||||
NVIC_EnableIRQ(DP32_SPI1_IRQn);
|
||||
NVIC_EnableIRQ((IRQn_Type)DP32_SPI1_IRQn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,10 +82,10 @@ void ST7565_BlitFullScreen(void)
|
||||
}
|
||||
|
||||
#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);
|
||||
#else
|
||||
SYSTEM_DelayMs(1);
|
||||
// SYSTEM_DelayMs(1);
|
||||
#endif
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||
@@ -119,7 +119,11 @@ void ST7565_FillScreen(uint8_t Value)
|
||||
{
|
||||
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);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned int j;
|
||||
@@ -132,21 +136,27 @@ void ST7565_FillScreen(uint8_t Value)
|
||||
}
|
||||
SPI_WaitForUndocumentedTxFifoStatusBit();
|
||||
}
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||
}
|
||||
|
||||
void ST7565_Init(void)
|
||||
void ST7565_Init(const bool full)
|
||||
{
|
||||
SPI0_Init();
|
||||
|
||||
ST7565_Configure_GPIO_B11();
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||
|
||||
ST7565_WriteByte(0xE2); // internal reset
|
||||
|
||||
SYSTEM_DelayMs(120);
|
||||
|
||||
if (full)
|
||||
{
|
||||
SPI0_Init();
|
||||
|
||||
ST7565_HardwareReset();
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||
|
||||
ST7565_WriteByte(0xE2); // internal reset
|
||||
|
||||
SYSTEM_DelayMs(120);
|
||||
}
|
||||
else
|
||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||
|
||||
ST7565_WriteByte(0xA2); // bias 9
|
||||
ST7565_WriteByte(0xC0); // com normal
|
||||
ST7565_WriteByte(0xA1); // reverse ?
|
||||
@@ -157,33 +167,39 @@ void ST7565_Init(void)
|
||||
ST7565_WriteByte(0xA4); // all points normal
|
||||
ST7565_WriteByte(0x24); //
|
||||
ST7565_WriteByte(0x81); // volume first ?
|
||||
|
||||
ST7565_WriteByte(0x1f); // contrast ?
|
||||
ST7565_WriteByte(0x2B); // power control ?
|
||||
|
||||
SYSTEM_DelayMs(1);
|
||||
|
||||
ST7565_WriteByte(0x2E); // power control ?
|
||||
|
||||
SYSTEM_DelayMs(1);
|
||||
|
||||
ST7565_WriteByte(0x2F); //
|
||||
ST7565_WriteByte(0x2F); //
|
||||
ST7565_WriteByte(0x2F); //
|
||||
ST7565_WriteByte(0x2F); //
|
||||
|
||||
SYSTEM_DelayMs(40);
|
||||
|
||||
if (full)
|
||||
{
|
||||
ST7565_WriteByte(0x2B); // power control ?
|
||||
|
||||
SYSTEM_DelayMs(1);
|
||||
|
||||
ST7565_WriteByte(0x2E); // power control ?
|
||||
|
||||
SYSTEM_DelayMs(1);
|
||||
|
||||
ST7565_WriteByte(0x2F); //
|
||||
ST7565_WriteByte(0x2F); //
|
||||
ST7565_WriteByte(0x2F); //
|
||||
ST7565_WriteByte(0x2F); //
|
||||
|
||||
SYSTEM_DelayMs(40);
|
||||
}
|
||||
|
||||
ST7565_WriteByte(0x40); // start line ?
|
||||
ST7565_WriteByte(0xAF); // display on ?
|
||||
|
||||
|
||||
SPI_WaitForUndocumentedTxFifoStatusBit();
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||
|
||||
ST7565_FillScreen(0x00);
|
||||
if (full)
|
||||
ST7565_FillScreen(0x00);
|
||||
}
|
||||
|
||||
void ST7565_Configure_GPIO_B11(void)
|
||||
void ST7565_HardwareReset(void)
|
||||
{
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_RES);
|
||||
SYSTEM_DelayMs(1);
|
||||
|
||||
@@ -30,8 +30,8 @@ void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const u
|
||||
void ST7565_BlitFullScreen(void);
|
||||
void ST7565_BlitStatusLine(void);
|
||||
void ST7565_FillScreen(uint8_t Value);
|
||||
void ST7565_Init(void);
|
||||
void ST7565_Configure_GPIO_B11(void);
|
||||
void ST7565_Init(const bool full);
|
||||
void ST7565_HardwareReset(void);
|
||||
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
||||
void ST7565_WriteByte(uint8_t Value);
|
||||
|
||||
|
||||
@@ -29,26 +29,17 @@ void SYSTICK_Init(void)
|
||||
|
||||
void SYSTICK_DelayUs(uint32_t Delay)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t Start;
|
||||
uint32_t Previous;
|
||||
uint32_t Current;
|
||||
uint32_t Delta;
|
||||
|
||||
i = 0;
|
||||
Start = SysTick->LOAD;
|
||||
Previous = SysTick->VAL;
|
||||
const uint32_t ticks = Delay * gTickMultiplier;
|
||||
uint32_t i = 0;
|
||||
uint32_t Start = SysTick->LOAD;
|
||||
uint32_t Previous = SysTick->VAL;
|
||||
do {
|
||||
do {
|
||||
Current = SysTick->VAL;
|
||||
} while (Current == Previous);
|
||||
if (Current < Previous) {
|
||||
Delta = -Current;
|
||||
} else {
|
||||
Delta = Start - Current;
|
||||
}
|
||||
i += Delta + Previous;
|
||||
uint32_t Current;
|
||||
uint32_t Delta;
|
||||
while ((Current = SysTick->VAL) == Previous) {}
|
||||
Delta = (Current < Previous) ? -Current : Start - Current;
|
||||
i += Delta + Previous;
|
||||
Previous = Current;
|
||||
} while (i < Delay * gTickMultiplier);
|
||||
} while (i < ticks);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ SECTIONS
|
||||
.text :
|
||||
{
|
||||
. = 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 */
|
||||
*(.rodata) /* .rodata sections */
|
||||
|
||||
698
font.c
@@ -16,105 +16,204 @@
|
||||
|
||||
#include "font.h"
|
||||
|
||||
//const uint8_t gFontBig[95][16] =
|
||||
const uint8_t gFontBig[95][15] =
|
||||
// removed last and middle column which was all 0x00
|
||||
// also the space char is not needed
|
||||
const uint8_t gFontBig[95 - 1][16 - 2] =
|
||||
{
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' '
|
||||
{0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!'
|
||||
{0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"'
|
||||
{0x40, 0xF0, 0xF0, 0x40, 0xF0, 0xF0, 0x40, 0x00, 0x04, 0x1F, 0x1F, 0x04, 0x1F, 0x1F, 0x04}, // , 0x00}, // '#'
|
||||
{0x70, 0xF8, 0x88, 0x8F, 0x8F, 0x98, 0x30, 0x00, 0x06, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // , 0x00}, // '$'
|
||||
{0x60, 0x60, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x00, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x18, 0x18}, // , 0x00}, // '%'
|
||||
{0x00, 0xB0, 0xF8, 0xC8, 0x78, 0xB0, 0x80, 0x00, 0x0F, 0x1F, 0x10, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // '&'
|
||||
{0x00, 0x20, 0x3E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '''
|
||||
{0x00, 0x00, 0xE0, 0xF0, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x00}, // , 0x00}, // '('
|
||||
{0x00, 0x00, 0x08, 0x18, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x0F, 0x07, 0x00}, // , 0x00}, // ')'
|
||||
{0x00, 0x40, 0xC0, 0x80, 0x80, 0xC0, 0x40, 0x00, 0x01, 0x05, 0x07, 0x03, 0x03, 0x07, 0x05}, // , 0x01}, // '*'
|
||||
{0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x07, 0x07, 0x01, 0x01}, // , 0x00}, // '+'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x3C, 0x1C, 0x00, 0x00}, // , 0x00}, // ','
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, // , 0x00}, // '-'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}, // , 0x00}, // '.'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x00, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00}, // , 0x00}, // '/'
|
||||
{0xF0, 0xF8, 0x08, 0x88, 0x48, 0xF8, 0xF0, 0x00, 0x0F, 0x1F, 0x12, 0x11, 0x10, 0x1F, 0x0F}, // , 0x00}, // '0'
|
||||
{0x00, 0x20, 0x30, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x10, 0x10}, // , 0x00}, // '1'
|
||||
{0x10, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x30, 0x00, 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x18}, // , 0x00}, // '2'
|
||||
{0x10, 0x18, 0x88, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x08, 0x18, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '3'
|
||||
{0x80, 0xC0, 0x60, 0x30, 0xF8, 0xF8, 0x00, 0x00, 0x01, 0x01, 0x01, 0x11, 0x1F, 0x1F, 0x11}, // , 0x00}, // '4'
|
||||
{0xF8, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x08, 0x00, 0x08, 0x18, 0x10, 0x10, 0x11, 0x1F, 0x0F}, // , 0x00}, // '5'
|
||||
{0xE0, 0xF0, 0x98, 0x88, 0x88, 0x80, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '6'
|
||||
{0x18, 0x18, 0x08, 0x08, 0x88, 0xF8, 0x78, 0x00, 0x00, 0x00, 0x1E, 0x1F, 0x01, 0x00, 0x00}, // , 0x00}, // '7'
|
||||
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '8'
|
||||
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0xF0, 0x00, 0x00, 0x10, 0x10, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // '9'
|
||||
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // , 0x00}, // ':'
|
||||
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1C, 0x0C, 0x00, 0x00}, // , 0x00}, // ';'
|
||||
{0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x10, 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x18, 0x10}, // , 0x00}, // '<'
|
||||
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}, // , 0x00}, // '='
|
||||
{0x00, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x10, 0x18, 0x0C, 0x06, 0x03, 0x01}, // , 0x00}, // '>'
|
||||
{0x30, 0x38, 0x08, 0x88, 0xC8, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '?'
|
||||
{0xE0, 0xF0, 0x10, 0x90, 0x90, 0xF0, 0xE0, 0x00, 0x0F, 0x1F, 0x10, 0x17, 0x17, 0x17, 0x03}, // , 0x00}, // '@'
|
||||
{0xC0, 0xE0, 0x30, 0x18, 0x30, 0xE0, 0xC0, 0x00, 0x1F, 0x1F, 0x01, 0x01, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'A'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'B'
|
||||
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x10, 0x18, 0x0C}, // , 0x00}, // 'C'
|
||||
{0x08, 0xF8, 0xF8, 0x08, 0x18, 0xF0, 0xE0, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'D'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x11, 0x18, 0x1C}, // , 0x00}, // 'E'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x01, 0x00, 0x00}, // , 0x00}, // 'F'
|
||||
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, 0x00, 0x07, 0x0F, 0x18, 0x11, 0x11, 0x0F, 0x1F}, // , 0x00}, // 'G'
|
||||
{0xF8, 0xF8, 0x80, 0x80, 0x80, 0xF8, 0xF8, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'H'
|
||||
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'I'
|
||||
{0x00, 0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, 0x00, 0x0E, 0x1E, 0x10, 0x10, 0x1F, 0x0F, 0x00}, // , 0x00}, // 'J'
|
||||
{0x08, 0xF8, 0xF8, 0x80, 0xE0, 0x78, 0x18, 0x00, 0x10, 0x1F, 0x1F, 0x01, 0x03, 0x1E, 0x1C}, // , 0x00}, // 'K'
|
||||
{0x08, 0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x18, 0x1C}, // , 0x00}, // 'L'
|
||||
{0xF8, 0xF8, 0x70, 0xE0, 0x70, 0xF8, 0xF8, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'M'
|
||||
{0xF8, 0xF8, 0x70, 0xE0, 0xC0, 0xF8, 0xF8, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'N'
|
||||
{0xE0, 0xF0, 0x18, 0x08, 0x18, 0xF0, 0xE0, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'O'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'P'
|
||||
{0xF0, 0xF8, 0x08, 0x08, 0x08, 0xF8, 0xF0, 0x00, 0x0F, 0x1F, 0x10, 0x1C, 0x78, 0x7F, 0x4F}, // , 0x00}, // 'Q'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x10, 0x1F, 0x1F, 0x00, 0x01, 0x1F, 0x1E}, // , 0x00}, // 'R'
|
||||
{0x30, 0x78, 0xC8, 0x88, 0x88, 0x38, 0x30, 0x00, 0x0C, 0x1C, 0x10, 0x10, 0x11, 0x1F, 0x0E}, // , 0x00}, // 'S'
|
||||
{0x00, 0x38, 0x18, 0xF8, 0xF8, 0x18, 0x38, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'T'
|
||||
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'U'
|
||||
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0x00, 0x03, 0x07, 0x0C, 0x18, 0x0C, 0x07, 0x03}, // , 0x00}, // 'V'
|
||||
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0x00, 0x07, 0x1F, 0x1C, 0x07, 0x1C, 0x1F, 0x07}, // , 0x00}, // 'W'
|
||||
{0x18, 0x78, 0xE0, 0x80, 0xE0, 0x78, 0x18, 0x00, 0x18, 0x1E, 0x07, 0x01, 0x07, 0x1E, 0x18}, // , 0x00}, // 'X'
|
||||
{0x00, 0x78, 0xF8, 0x80, 0x80, 0xF8, 0x78, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'Y'
|
||||
{0x38, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x38, 0x00, 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x1C}, // , 0x00}, // 'Z'
|
||||
{0x00, 0x00, 0xF8, 0xF8, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x10, 0x10, 0x00}, // , 0x00}, // '['
|
||||
{0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x1C}, // , 0x00}, // '"\'
|
||||
{0x00, 0x00, 0x08, 0x08, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x00}, // , 0x00}, // ']'
|
||||
{0x10, 0x18, 0x0E, 0x07, 0x0E, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '^'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}, // , 0x40}, // '_'
|
||||
{0x00, 0x00, 0x07, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '`'
|
||||
{0x00, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x00, 0x0E, 0x1F, 0x11, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'a'
|
||||
{0x08, 0xF8, 0xF8, 0x40, 0xC0, 0x80, 0x00, 0x00, 0x10, 0x1F, 0x0F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'b'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x18, 0x08}, // , 0x00}, // 'c'
|
||||
{0x00, 0x80, 0xC0, 0x48, 0xF8, 0xF8, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'd'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x0F, 0x1F, 0x11, 0x11, 0x11, 0x19, 0x09}, // , 0x00}, // 'e'
|
||||
{0x80, 0xF0, 0xF8, 0x88, 0x18, 0x30, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'f'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, 0x00, 0x4F, 0xDF, 0x90, 0x90, 0xFF, 0x7F, 0x00}, // , 0x00}, // 'g'
|
||||
{0x08, 0xF8, 0xF8, 0x80, 0x40, 0xC0, 0x80, 0x00, 0x10, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'h'
|
||||
{0x00, 0x00, 0x40, 0xD8, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'i'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x40, 0xD8, 0xD8, 0x00, 0x00, 0x60, 0xE0, 0x80, 0x80, 0xFF, 0x7F}, // , 0x00}, // 'j'
|
||||
{0x08, 0xF8, 0xF8, 0x00, 0x80, 0xC0, 0x40, 0x00, 0x10, 0x1F, 0x1F, 0x03, 0x07, 0x1C, 0x18}, // , 0x00}, // 'k'
|
||||
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'l'
|
||||
{0xC0, 0xC0, 0xC0, 0x80, 0xC0, 0xC0, 0x80, 0x00, 0x1F, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'm'
|
||||
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'n'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'o'
|
||||
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x80, 0xFF, 0xFF, 0x90, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'p'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, 0x00, 0x0F, 0x1F, 0x10, 0x90, 0xFF, 0xFF, 0x80}, // , 0x00}, // 'q'
|
||||
{0x40, 0xC0, 0x80, 0xC0, 0x40, 0xC0, 0x80, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x01}, // , 0x00}, // 'r'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x08, 0x19, 0x13, 0x12, 0x16, 0x1C, 0x08}, // , 0x00}, // 's'
|
||||
{0x40, 0x40, 0xF0, 0xF8, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x18, 0x08}, // , 0x00}, // 't'
|
||||
{0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'u'
|
||||
{0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x07, 0x0F, 0x18, 0x18, 0x0F, 0x07}, // , 0x00}, // 'v'
|
||||
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x0F, 0x1F, 0x18, 0x0E, 0x18, 0x1F, 0x0F}, // , 0x00}, // 'w'
|
||||
{0x40, 0xC0, 0x80, 0x00, 0x80, 0xC0, 0x40, 0x00, 0x10, 0x18, 0x0F, 0x07, 0x0F, 0x18, 0x10}, // , 0x00}, // 'x'
|
||||
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x8F, 0x9F, 0x90, 0x90, 0xD0, 0x7F, 0x3F}, // , 0x00}, // 'y'
|
||||
{0xC0, 0xC0, 0x40, 0x40, 0xC0, 0xC0, 0x40, 0x00, 0x18, 0x1C, 0x16, 0x13, 0x11, 0x18, 0x18}, // , 0x00}, // 'z'
|
||||
{0x00, 0x80, 0x80, 0xF0, 0x78, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10}, // , 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}, // '}'
|
||||
{0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->'
|
||||
};
|
||||
#if 0
|
||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' '
|
||||
{0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!'
|
||||
{0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"'
|
||||
{0x40, 0xF0, 0xF0, 0x40, 0xF0, 0xF0, 0x40, /*0x00,*/ 0x04, 0x1F, 0x1F, 0x04, 0x1F, 0x1F, 0x04}, // , 0x00}, // '#'
|
||||
{0x70, 0xF8, 0x88, 0x8F, 0x8F, 0x98, 0x30, /*0x00,*/ 0x06, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // , 0x00}, // '$'
|
||||
{0x60, 0x60, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x18, 0x18}, // , 0x00}, // '%'
|
||||
{0x00, 0xB0, 0xF8, 0xC8, 0x78, 0xB0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // '&'
|
||||
{0x00, 0x20, 0x3E, 0x1E, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '''
|
||||
{0x00, 0x00, 0xE0, 0xF0, 0x18, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x00}, // , 0x00}, // '('
|
||||
{0x00, 0x00, 0x08, 0x18, 0xF0, 0xE0, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x18, 0x0F, 0x07, 0x00}, // , 0x00}, // ')'
|
||||
{0x00, 0x40, 0xC0, 0x80, 0x80, 0xC0, 0x40, /*0x00,*/ 0x01, 0x05, 0x07, 0x03, 0x03, 0x07, 0x05}, // , 0x01}, // '*'
|
||||
{0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, /*0x00,*/ 0x00, 0x01, 0x01, 0x07, 0x07, 0x01, 0x01}, // , 0x00}, // '+'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x20, 0x3C, 0x1C, 0x00, 0x00}, // , 0x00}, // ','
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, // , 0x00}, // '-'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}, // , 0x00}, // '.'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00}, // , 0x00}, // '/'
|
||||
{0xF0, 0xF8, 0x08, 0x88, 0x48, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x12, 0x11, 0x10, 0x1F, 0x0F}, // , 0x00}, // '0'
|
||||
{0x00, 0x20, 0x30, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x10, 0x10}, // , 0x00}, // '1'
|
||||
{0x10, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x18}, // , 0x00}, // '2'
|
||||
{0x10, 0x18, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '3'
|
||||
{0x80, 0xC0, 0x60, 0x30, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x11, 0x1F, 0x1F, 0x11}, // , 0x00}, // '4'
|
||||
{0xF8, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x08, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x11, 0x1F, 0x0F}, // , 0x00}, // '5'
|
||||
{0xE0, 0xF0, 0x98, 0x88, 0x88, 0x80, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '6'
|
||||
{0x18, 0x18, 0x08, 0x08, 0x88, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x1E, 0x1F, 0x01, 0x00, 0x00}, // , 0x00}, // '7'
|
||||
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '8'
|
||||
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0xF0, /*0x00,*/ 0x00, 0x10, 0x10, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // '9'
|
||||
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // , 0x00}, // ':'
|
||||
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1C, 0x0C, 0x00, 0x00}, // , 0x00}, // ';'
|
||||
{0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x10, /*0x00,*/ 0x00, 0x01, 0x03, 0x06, 0x0C, 0x18, 0x10}, // , 0x00}, // '<'
|
||||
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}, // , 0x00}, // '='
|
||||
{0x00, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, /*0x00,*/ 0x00, 0x10, 0x18, 0x0C, 0x06, 0x03, 0x01}, // , 0x00}, // '>'
|
||||
{0x30, 0x38, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '?'
|
||||
{0xE0, 0xF0, 0x10, 0x90, 0x90, 0xF0, 0xE0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x17, 0x17, 0x17, 0x03}, // , 0x00}, // '@'
|
||||
{0xC0, 0xE0, 0x30, 0x18, 0x30, 0xE0, 0xC0, /*0x00,*/ 0x1F, 0x1F, 0x01, 0x01, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'A'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'B'
|
||||
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x10, 0x18, 0x0C}, // , 0x00}, // 'C'
|
||||
{0x08, 0xF8, 0xF8, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'D'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x11, 0x18, 0x1C}, // , 0x00}, // 'E'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x01, 0x00, 0x00}, // , 0x00}, // 'F'
|
||||
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x11, 0x11, 0x0F, 0x1F}, // , 0x00}, // 'G'
|
||||
{0xF8, 0xF8, 0x80, 0x80, 0x80, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'H'
|
||||
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'I'
|
||||
{0x00, 0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, /*0x00,*/ 0x0E, 0x1E, 0x10, 0x10, 0x1F, 0x0F, 0x00}, // , 0x00}, // 'J'
|
||||
{0x08, 0xF8, 0xF8, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x01, 0x03, 0x1E, 0x1C}, // , 0x00}, // 'K'
|
||||
{0x08, 0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x18, 0x1C}, // , 0x00}, // 'L'
|
||||
{0xF8, 0xF8, 0x70, 0xE0, 0x70, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'M'
|
||||
{0xF8, 0xF8, 0x70, 0xE0, 0xC0, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'N'
|
||||
{0xE0, 0xF0, 0x18, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'O'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'P'
|
||||
{0xF0, 0xF8, 0x08, 0x08, 0x08, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x1C, 0x78, 0x7F, 0x4F}, // , 0x00}, // 'Q'
|
||||
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x01, 0x1F, 0x1E}, // , 0x00}, // 'R'
|
||||
{0x30, 0x78, 0xC8, 0x88, 0x88, 0x38, 0x30, /*0x00,*/ 0x0C, 0x1C, 0x10, 0x10, 0x11, 0x1F, 0x0E}, // , 0x00}, // 'S'
|
||||
{0x00, 0x38, 0x18, 0xF8, 0xF8, 0x18, 0x38, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'T'
|
||||
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'U'
|
||||
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x03, 0x07, 0x0C, 0x18, 0x0C, 0x07, 0x03}, // , 0x00}, // 'V'
|
||||
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x07, 0x1F, 0x1C, 0x07, 0x1C, 0x1F, 0x07}, // , 0x00}, // 'W'
|
||||
{0x18, 0x78, 0xE0, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x18, 0x1E, 0x07, 0x01, 0x07, 0x1E, 0x18}, // , 0x00}, // 'X'
|
||||
{0x00, 0x78, 0xF8, 0x80, 0x80, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'Y'
|
||||
{0x38, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x38, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x1C}, // , 0x00}, // 'Z'
|
||||
{0x00, 0x00, 0xF8, 0xF8, 0x08, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x1F, 0x1F, 0x10, 0x10, 0x00}, // , 0x00}, // '['
|
||||
{0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x1C}, // , 0x00}, // '"\'
|
||||
{0x00, 0x00, 0x08, 0x08, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x00}, // , 0x00}, // ']'
|
||||
{0x10, 0x18, 0x0E, 0x07, 0x0E, 0x18, 0x10, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '^'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}, // , 0x40}, // '_'
|
||||
{0x00, 0x00, 0x07, 0x0F, 0x08, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '`'
|
||||
{0x00, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x0E, 0x1F, 0x11, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'a'
|
||||
{0x08, 0xF8, 0xF8, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x10, 0x1F, 0x0F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'b'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x18, 0x08}, // , 0x00}, // 'c'
|
||||
{0x00, 0x80, 0xC0, 0x48, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'd'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x11, 0x11, 0x11, 0x19, 0x09}, // , 0x00}, // 'e'
|
||||
{0x80, 0xF0, 0xF8, 0x88, 0x18, 0x30, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'f'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x4F, 0xDF, 0x90, 0x90, 0xFF, 0x7F, 0x00}, // , 0x00}, // 'g'
|
||||
{0x08, 0xF8, 0xF8, 0x80, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'h'
|
||||
{0x00, 0x00, 0x40, 0xD8, 0xD8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'i'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x40, 0xD8, 0xD8, /*0x00,*/ 0x00, 0x60, 0xE0, 0x80, 0x80, 0xFF, 0x7F}, // , 0x00}, // 'j'
|
||||
{0x08, 0xF8, 0xF8, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x03, 0x07, 0x1C, 0x18}, // , 0x00}, // 'k'
|
||||
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'l'
|
||||
{0xC0, 0xC0, 0xC0, 0x80, 0xC0, 0xC0, 0x80, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'm'
|
||||
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'n'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'o'
|
||||
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x80, 0xFF, 0xFF, 0x90, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'p'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x90, 0xFF, 0xFF, 0x80}, // , 0x00}, // 'q'
|
||||
{0x40, 0xC0, 0x80, 0xC0, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x01}, // , 0x00}, // 'r'
|
||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x08, 0x19, 0x13, 0x12, 0x16, 0x1C, 0x08}, // , 0x00}, // 's'
|
||||
{0x40, 0x40, 0xF0, 0xF8, 0x40, 0x40, 0x00, /*0x00,*/ 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x18, 0x08}, // , 0x00}, // 't'
|
||||
{0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'u'
|
||||
{0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x00, 0x07, 0x0F, 0x18, 0x18, 0x0F, 0x07}, // , 0x00}, // 'v'
|
||||
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x0F, 0x1F, 0x18, 0x0E, 0x18, 0x1F, 0x0F}, // , 0x00}, // 'w'
|
||||
{0x40, 0xC0, 0x80, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x18, 0x0F, 0x07, 0x0F, 0x18, 0x10}, // , 0x00}, // 'x'
|
||||
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x8F, 0x9F, 0x90, 0x90, 0xD0, 0x7F, 0x3F}, // , 0x00}, // 'y'
|
||||
{0xC0, 0xC0, 0x40, 0x40, 0xC0, 0xC0, 0x40, /*0x00,*/ 0x18, 0x1C, 0x16, 0x13, 0x11, 0x18, 0x18}, // , 0x00}, // 'z'
|
||||
{0x00, 0x80, 0x80, 0xF0, 0x78, 0x08, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10}, // , 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}, // '}'
|
||||
{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}, // '0'
|
||||
{0x00, 0x10, 0x18, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08}, // '1'
|
||||
{0x18, 0x1C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // '2'
|
||||
{0x18, 0x1C, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '3'
|
||||
{0x80, 0xC0, 0x60, 0x30, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x0F}, // '4'
|
||||
{0x7C, 0x7C, 0x44, 0x44, 0x44, 0xC4, 0x84, /*0x00,*/ 0x04, 0x0C, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '5'
|
||||
{0xF0, 0xF8, 0x4C, 0x44, 0x44, 0xC4, 0x80, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '6'
|
||||
{0x04, 0x04, 0x04, 0x84, 0xE4, 0x7C, 0x1C, /*0x00,*/ 0x00, 0x00, 0x0E, 0x0F, 0x01, 0x00, 0x00}, // '7'
|
||||
{0xB8, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '8'
|
||||
{0x78, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, /*0x00,*/ 0x00, 0x08, 0x08, 0x08, 0x0C, 0x07, 0x03}, // '9'
|
||||
{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}, // 'A'
|
||||
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'B'
|
||||
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0x1C, 0x18, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0E, 0x06}, // 'C'
|
||||
{0xFC, 0xFC, 0x04, 0x04, 0x0C, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x0C, 0x07, 0x03}, // 'D'
|
||||
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'E'
|
||||
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'F'
|
||||
{0xF8, 0xFC, 0x04, 0x84, 0x84, 0x9C, 0x98, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'G'
|
||||
{0xFC, 0xFC, 0x40, 0x40, 0x40, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'H'
|
||||
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'I'
|
||||
{0x00, 0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x0F, 0x07, 0x00}, // 'J'
|
||||
{0xFC, 0xFC, 0xE0, 0x30, 0x18, 0x0C, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'K'
|
||||
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'L'
|
||||
{0xFC, 0xFC, 0x18, 0x70, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'M'
|
||||
{0xFC, 0xFC, 0x60, 0xC0, 0x80, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0F}, // 'N'
|
||||
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'O'
|
||||
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'P'
|
||||
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0C, 0x0C, 0x1F, 0x17}, // 'Q'
|
||||
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'R'
|
||||
{0x38, 0x7C, 0x44, 0x44, 0x44, 0xCC, 0x88, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'S'
|
||||
{0x00, 0x04, 0x04, 0xFC, 0xFC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'T'
|
||||
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'U'
|
||||
{0x7C, 0xFC, 0x80, 0x00, 0x80, 0xFC, 0x7C, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'V'
|
||||
{0xFC, 0xFC, 0x00, 0x80, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x06, 0x03, 0x06, 0x0F, 0x0F}, // 'W'
|
||||
{0x0C, 0x3C, 0xF0, 0xC0, 0xF0, 0x3C, 0x0C, /*0x00,*/ 0x0C, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0x0C}, // 'X'
|
||||
{0x00, 0x3C, 0x7C, 0xC0, 0xC0, 0x7C, 0x3C, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'Y'
|
||||
{0x04, 0x04, 0x84, 0xC4, 0x64, 0x3C, 0x1C, /*0x00,*/ 0x0E, 0x0F, 0x09, 0x08, 0x08, 0x08, 0x08}, // 'Z'
|
||||
{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}, // 'a'
|
||||
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'b'
|
||||
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x60, 0x40, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0C, 0x04}, // 'c'
|
||||
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'd'
|
||||
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x09, 0x09, 0x09, 0x09, 0x01}, // 'e'
|
||||
{0x20, 0x20, 0xF8, 0xFC, 0x24, 0x24, 0x04, /*0x00,*/ 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00}, // 'f'
|
||||
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'g'
|
||||
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'h'
|
||||
{0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'i'
|
||||
{0x00, 0x00, 0x00, 0x00, 0x20, 0xEC, 0xEC, /*0x00,*/ 0x00, 0x30, 0x70, 0x40, 0x40, 0x7F, 0x3F}, // 'j'
|
||||
{0xFC, 0xFC, 0x00, 0x80, 0xC0, 0x60, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'k'
|
||||
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'l'
|
||||
{0xE0, 0xE0, 0x20, 0xE0, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x0F}, // 'm'
|
||||
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'n'
|
||||
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'o'
|
||||
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x7F, 0x7F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'p'
|
||||
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x7F, 0x7F}, // 'q'
|
||||
{0xE0, 0xE0, 0x60, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'r'
|
||||
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x08, 0x09, 0x09, 0x09, 0x09, 0x0F, 0x06}, // 's'
|
||||
{0x20, 0x20, 0xFC, 0xFC, 0x20, 0x20, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08}, // 't'
|
||||
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'u'
|
||||
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'v'
|
||||
{0xE0, 0xE0, 0x00, 0x80, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0F, 0x08, 0x0F, 0x07}, // 'w'
|
||||
{0x60, 0xE0, 0x80, 0x00, 0x80, 0xE0, 0x60, /*0x00,*/ 0x0C, 0x0E, 0x03, 0x01, 0x03, 0x0E, 0x0C}, // 'x'
|
||||
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'y'
|
||||
{0x20, 0x20, 0x20, 0xA0, 0xE0, 0x60, 0x20, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // 'z'
|
||||
{0x00, 0x00, 0x40, 0xF8, 0xBC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08}, // '{'
|
||||
{0x00, 0x00, 0x00, 0xBC, 0xBC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // '|'
|
||||
{0x00, 0x04, 0x04, 0xBC, 0xF8, 0x40, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x07, 0x00, 0x00}, // '}'
|
||||
{0x08, 0x0C, 0x04, 0x0C, 0x08, 0x0C, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // '->'
|
||||
#endif
|
||||
};
|
||||
|
||||
#if 0
|
||||
// original font
|
||||
@@ -132,21 +231,40 @@ const uint8_t gFontBig[95][15] =
|
||||
{0x00, 0xF0, 0xF8, 0xB8, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0xB8, 0xF0, 0xE0, 0x00, 0x11, 0x33, 0x77, 0x67, 0x66, 0x66, 0x66, 0x76, 0x33, 0x3F, 0x1F, 0x07},
|
||||
{0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}
|
||||
};
|
||||
#else
|
||||
|
||||
// 6 Empty columns removed
|
||||
#elif 0
|
||||
// VCR font
|
||||
const uint8_t gFontBigDigits[11][26] =
|
||||
const uint8_t gFontBigDigits[11][26 - 6] =
|
||||
{
|
||||
{0x00, 0x00, 0xF8, 0xFC, 0x06, 0x86, 0xC6, 0xE6, 0xF6, 0x76, 0xFC, 0xF8, 0x00, 0x00, 0x00, 0x1F, 0x3F, 0x77, 0x67, 0x63, 0x61, 0x60, 0x70, 0x3F, 0x1F, 0x00},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x60, 0x60, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x18, 0x1C, 0x86, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, 0x00, 0x00, 0x00, 0x7E, 0x7F, 0x63, 0x61, 0x61, 0x61, 0x61, 0x61, 0x60, 0x60, 0x00},
|
||||
{0x00, 0x00, 0x18, 0x1C, 0x06, 0x06, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, 0x00, 0x00, 0x00, 0x18, 0x38, 0x70, 0x60, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, 0x00},
|
||||
{0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x7F, 0x7F, 0x06, 0x06, 0x00},
|
||||
{0x00, 0x00, 0x7E, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x66, 0xE6, 0xC6, 0x86, 0x00, 0x00, 0x00, 0x18, 0x38, 0x70, 0x60, 0x60, 0x60, 0x60, 0x70, 0x3F, 0x1F, 0x00},
|
||||
{0x00, 0x00, 0xF8, 0xFC, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x1C, 0x18, 0x00, 0x00, 0x00, 0x1F, 0x3F, 0x71, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, 0x00},
|
||||
{0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x86, 0xC6, 0xE6, 0x7E, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x01, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, 0x00, 0x00, 0x00, 0x1E, 0x3F, 0x73, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, 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,*/ 0xF8, 0xFC, 0x06, 0x86, 0xC6, 0xE6, 0xF6, 0x76, 0xFC, 0xF8, /*0x00,*/ /*0x00, 0x00,*/ 0x1F, 0x3F, 0x77, 0x67, 0x63, 0x61, 0x60, 0x70, 0x3F, 0x1F, /*0x00*/},
|
||||
{/*0x00, 0x00,*/ 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x60, 0x60, 0x00, 0x00, /*0x00*/},
|
||||
{/*0x00, 0x00,*/ 0x18, 0x1C, 0x86, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, /*0x00,*/ /*0x00, 0x00,*/ 0x7E, 0x7F, 0x63, 0x61, 0x61, 0x61, 0x61, 0x61, 0x60, 0x60, /*0x00*/},
|
||||
{/*0x00, 0x00,*/ 0x18, 0x1C, 0x06, 0x06, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, /*0x00,*/ /*0x00, 0x00,*/ 0x18, 0x38, 0x70, 0x60, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, /*0x00*/},
|
||||
{/*0x00, 0x00,*/ 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0xFE, 0xFE, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x7F, 0x7F, 0x06, 0x06, /*0x00*/},
|
||||
{/*0x00, 0x00,*/ 0x7E, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x66, 0xE6, 0xC6, 0x86, /*0x00,*/ /*0x00, 0x00,*/ 0x18, 0x38, 0x70, 0x60, 0x60, 0x60, 0x60, 0x70, 0x3F, 0x1F, /*0x00*/},
|
||||
{/*0x00, 0x00,*/ 0xF8, 0xFC, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x1C, 0x18, /*0x00,*/ /*0x00, 0x00,*/ 0x1F, 0x3F, 0x71, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, /*0x00*/},
|
||||
{/*0x00, 0x00,*/ 0x06, 0x06, 0x06, 0x06, 0x06, 0x86, 0xC6, 0xE6, 0x7E, 0x3E, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x01, 0x00, 0x00, 0x00, /*0x00*/},
|
||||
{/*0x00, 0x00,*/ 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, /*0x00,*/ /*0x00, 0x00,*/ 0x1E, 0x3F, 0x73, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, /*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*/}
|
||||
};
|
||||
#else
|
||||
// Terminus font
|
||||
|
||||
const uint8_t gFontBigDigits[11][26 - 6] =
|
||||
{
|
||||
{/*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
|
||||
/*
|
||||
@@ -165,177 +283,9 @@ const uint8_t gFontSmallDigits[11][7] =
|
||||
{0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00} // '-'
|
||||
};
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_SPECTRUM
|
||||
|
||||
const uint8_t gFont3x5[160][3] = {
|
||||
{0x00, 0x00, 0x00}, // 32 - space
|
||||
{0x00, 0x17, 0x00}, // 33 - exclam
|
||||
{0x03, 0x00, 0x03}, // 34 - quotedbl
|
||||
{0x1f, 0x0a, 0x1f}, // 35 - numbersign
|
||||
{0x0a, 0x1f, 0x05}, // 36 - dollar
|
||||
{0x09, 0x04, 0x12}, // 37 - percent
|
||||
{0x0f, 0x17, 0x1c}, // 38 - ampersand
|
||||
{0x00, 0x03, 0x00}, // 39 - quotesingle
|
||||
{0x00, 0x0e, 0x11}, // 40 - parenleft
|
||||
{0x11, 0x0e, 0x00}, // 41 - parenright
|
||||
{0x05, 0x02, 0x05}, // 42 - asterisk
|
||||
{0x04, 0x0e, 0x04}, // 43 - plus
|
||||
{0x10, 0x08, 0x00}, // 44 - comma
|
||||
{0x04, 0x04, 0x04}, // 45 - hyphen
|
||||
{0x00, 0x10, 0x00}, // 46 - period
|
||||
{0x18, 0x04, 0x03}, // 47 - slash
|
||||
{0x1e, 0x11, 0x0f}, // 48 - zero
|
||||
{0x02, 0x1f, 0x00}, // 49 - one
|
||||
{0x19, 0x15, 0x12}, // 50 - two
|
||||
{0x11, 0x15, 0x0a}, // 51 - three
|
||||
{0x07, 0x04, 0x1f}, // 52 - four
|
||||
{0x17, 0x15, 0x09}, // 53 - five
|
||||
{0x1e, 0x15, 0x1d}, // 54 - six
|
||||
{0x19, 0x05, 0x03}, // 55 - seven
|
||||
{0x1f, 0x15, 0x1f}, // 56 - eight
|
||||
{0x17, 0x15, 0x0f}, // 57 - nine
|
||||
{0x00, 0x0a, 0x00}, // 58 - colon
|
||||
{0x10, 0x0a, 0x00}, // 59 - semicolon
|
||||
{0x04, 0x0a, 0x11}, // 60 - less
|
||||
{0x0a, 0x0a, 0x0a}, // 61 - equal
|
||||
{0x11, 0x0a, 0x04}, // 62 - greater
|
||||
{0x01, 0x15, 0x03}, // 63 - question
|
||||
{0x0e, 0x15, 0x16}, // 64 - at
|
||||
{0x1e, 0x05, 0x1e}, // 65 - A
|
||||
{0x1f, 0x15, 0x0a}, // 66 - B
|
||||
{0x0e, 0x11, 0x11}, // 67 - C
|
||||
{0x1f, 0x11, 0x0e}, // 68 - D
|
||||
{0x1f, 0x15, 0x15}, // 69 - E
|
||||
{0x1f, 0x05, 0x05}, // 70 - F
|
||||
{0x0e, 0x15, 0x1d}, // 71 - G
|
||||
{0x1f, 0x04, 0x1f}, // 72 - H
|
||||
{0x11, 0x1f, 0x11}, // 73 - I
|
||||
{0x08, 0x10, 0x0f}, // 74 - J
|
||||
{0x1f, 0x04, 0x1b}, // 75 - K
|
||||
{0x1f, 0x10, 0x10}, // 76 - L
|
||||
{0x1f, 0x06, 0x1f}, // 77 - M
|
||||
{0x1f, 0x0e, 0x1f}, // 78 - N
|
||||
{0x0e, 0x11, 0x0e}, // 79 - O
|
||||
{0x1f, 0x05, 0x02}, // 80 - P
|
||||
{0x0e, 0x19, 0x1e}, // 81 - Q
|
||||
{0x1f, 0x0d, 0x16}, // 82 - R
|
||||
{0x12, 0x15, 0x09}, // 83 - S
|
||||
{0x01, 0x1f, 0x01}, // 84 - T
|
||||
{0x0f, 0x10, 0x1f}, // 85 - U
|
||||
{0x07, 0x18, 0x07}, // 86 - V
|
||||
{0x1f, 0x0c, 0x1f}, // 87 - W
|
||||
{0x1b, 0x04, 0x1b}, // 88 - X
|
||||
{0x03, 0x1c, 0x03}, // 89 - Y
|
||||
{0x19, 0x15, 0x13}, // 90 - Z
|
||||
{0x1f, 0x11, 0x11}, // 91 - bracketleft
|
||||
{0x02, 0x04, 0x08}, // 92 - backslash
|
||||
{0x11, 0x11, 0x1f}, // 93 - bracketright
|
||||
{0x02, 0x01, 0x02}, // 94 - asciicircum
|
||||
{0x10, 0x10, 0x10}, // 95 - underscore
|
||||
{0x01, 0x02, 0x00}, // 96 - grave
|
||||
{0x1a, 0x16, 0x1c}, // 97 - a
|
||||
{0x1f, 0x12, 0x0c}, // 98 - b
|
||||
{0x0c, 0x12, 0x12}, // 99 - c
|
||||
{0x0c, 0x12, 0x1f}, // 100 - d
|
||||
{0x0c, 0x1a, 0x16}, // 101 - e
|
||||
{0x04, 0x1e, 0x05}, // 102 - f
|
||||
{0x0c, 0x2a, 0x1e}, // 103 - g
|
||||
{0x1f, 0x02, 0x1c}, // 104 - h
|
||||
{0x00, 0x1d, 0x00}, // 105 - i
|
||||
{0x10, 0x20, 0x1d}, // 106 - j
|
||||
{0x1f, 0x0c, 0x12}, // 107 - k
|
||||
{0x11, 0x1f, 0x10}, // 108 - l
|
||||
{0x1e, 0x0e, 0x1e}, // 109 - m
|
||||
{0x1e, 0x02, 0x1c}, // 110 - n
|
||||
{0x0c, 0x12, 0x0c}, // 111 - o
|
||||
{0x3e, 0x12, 0x0c}, // 112 - p
|
||||
{0x0c, 0x12, 0x3e}, // 113 - q
|
||||
{0x1c, 0x02, 0x02}, // 114 - r
|
||||
{0x14, 0x1e, 0x0a}, // 115 - s
|
||||
{0x02, 0x1f, 0x12}, // 116 - t
|
||||
{0x0e, 0x10, 0x1e}, // 117 - u
|
||||
{0x0e, 0x18, 0x0e}, // 118 - v
|
||||
{0x1e, 0x1c, 0x1e}, // 119 - w
|
||||
{0x12, 0x0c, 0x12}, // 120 - x
|
||||
{0x06, 0x28, 0x1e}, // 121 - y
|
||||
{0x1a, 0x1e, 0x16}, // 122 - z
|
||||
{0x04, 0x1b, 0x11}, // 123 - braceleft
|
||||
{0x00, 0x1b, 0x00}, // 124 - bar
|
||||
{0x11, 0x1b, 0x04}, // 125 - braceright
|
||||
{0x02, 0x03, 0x01}, // 126 - asciitilde
|
||||
{0x00, 0x00, 0x00}, // 127 - empty
|
||||
{0x00, 0x00, 0x00}, // 128 - empty
|
||||
{0x00, 0x00, 0x00}, // 129 - empty
|
||||
{0x00, 0x00, 0x00}, // 130 - empty
|
||||
{0x00, 0x00, 0x00}, // 131 - empty
|
||||
{0x00, 0x00, 0x00}, // 132 - empty
|
||||
{0x00, 0x00, 0x00}, // 133 - empty
|
||||
{0x00, 0x00, 0x00}, // 134 - empty
|
||||
{0x00, 0x00, 0x00}, // 135 - empty
|
||||
{0x00, 0x00, 0x00}, // 136 - empty
|
||||
{0x00, 0x00, 0x00}, // 137 - empty
|
||||
{0x00, 0x00, 0x00}, // 138 - empty
|
||||
{0x00, 0x00, 0x00}, // 139 - empty
|
||||
{0x00, 0x00, 0x00}, // 140 - empty
|
||||
{0x00, 0x00, 0x00}, // 141 - empty
|
||||
{0x00, 0x00, 0x00}, // 142 - empty
|
||||
{0x00, 0x00, 0x00}, // 143 - empty
|
||||
{0x00, 0x00, 0x00}, // 144 - empty
|
||||
{0x00, 0x00, 0x00}, // 145 - empty
|
||||
{0x00, 0x00, 0x00}, // 146 - empty
|
||||
{0x00, 0x00, 0x00}, // 147 - empty
|
||||
{0x00, 0x00, 0x00}, // 148 - empty
|
||||
{0x00, 0x00, 0x00}, // 149 - empty
|
||||
{0x00, 0x00, 0x00}, // 150 - empty
|
||||
{0x00, 0x00, 0x00}, // 151 - empty
|
||||
{0x00, 0x00, 0x00}, // 152 - empty
|
||||
{0x00, 0x00, 0x00}, // 153 - empty
|
||||
{0x00, 0x00, 0x00}, // 154 - empty
|
||||
{0x00, 0x00, 0x00}, // 155 - empty
|
||||
{0x00, 0x00, 0x00}, // 156 - empty
|
||||
{0x00, 0x00, 0x00}, // 157 - empty
|
||||
{0x00, 0x00, 0x00}, // 158 - empty
|
||||
{0x00, 0x00, 0x00}, // 159 - empty
|
||||
{0x00, 0x00, 0x00}, // 160 - empty
|
||||
{0x00, 0x1d, 0x00}, // 161 - exclamdown
|
||||
{0x0e, 0x1b, 0x0a}, // 162 - cent
|
||||
{0x14, 0x1f, 0x15}, // 163 - sterling
|
||||
{0x15, 0x0e, 0x15}, // 164 - currency
|
||||
{0x0b, 0x1c, 0x0b}, // 165 - yen
|
||||
{0x00, 0x1b, 0x00}, // 166 - brokenbar
|
||||
{0x14, 0x1b, 0x05}, // 167 - section
|
||||
{0x01, 0x00, 0x01}, // 168 - dieresis
|
||||
{0x02, 0x05, 0x05}, // 169 - copyright
|
||||
{0x16, 0x15, 0x17}, // 170 - ordfeminine
|
||||
{0x02, 0x05, 0x00}, // 171 - guillemotleft
|
||||
{0x02, 0x02, 0x06}, // 172 - logicalnot
|
||||
{0x04, 0x04, 0x00}, // 173 - softhyphen
|
||||
{0x07, 0x03, 0x04}, // 174 - registered
|
||||
{0x01, 0x01, 0x01}, // 175 - macron
|
||||
{0x02, 0x05, 0x02}, // 176 - degree
|
||||
{0x12, 0x17, 0x12}, // 177 - plusminus
|
||||
{0x01, 0x07, 0x04}, // 178 - twosuperior
|
||||
{0x05, 0x07, 0x07}, // 179 - threesuperior
|
||||
{0x00, 0x02, 0x01}, // 180 - acute
|
||||
{0x1f, 0x08, 0x07}, // 181 - mu
|
||||
{0x02, 0x1d, 0x1f}, // 182 - paragraph
|
||||
{0x0e, 0x0e, 0x0e}, // 183 - periodcentered
|
||||
{0x10, 0x14, 0x08}, // 184 - cedilla
|
||||
{0x00, 0x07, 0x00}, // 185 - onesuperior
|
||||
{0x12, 0x15, 0x12}, // 186 - ordmasculine
|
||||
{0x00, 0x05, 0x02}, // 187 - guillemotright
|
||||
{0x03, 0x08, 0x18}, // 188 - onequarter
|
||||
{0x0b, 0x18, 0x10}, // 189 - onehalf
|
||||
{0x03, 0x0b, 0x18}, // 190 - threequarters
|
||||
{0x18, 0x15, 0x10}, // 191 - questiondown
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
const uint8_t gFontSmall[95][6] =
|
||||
const uint8_t gFontSmall[95-1][6] =
|
||||
{
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
||||
{0x00, 0x00, 0x5E, 0x00, 0x00, 0x00}, // '!'
|
||||
{0x00, 0x06, 0x00, 0x06, 0x00, 0x00}, // '"'
|
||||
{0x14, 0x3E, 0x14, 0x3E, 0x14, 0x00}, // '#'
|
||||
@@ -433,9 +383,9 @@ const uint8_t gFontSmall[95][6] =
|
||||
};
|
||||
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
const uint8_t gFontSmallBold[95][6] =
|
||||
const uint8_t gFontSmallBold[95 - 1][6] =
|
||||
{
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x5E, 0x5E, 0x00, 0x00},
|
||||
{0x06, 0x06, 0x00, 0x06, 0x06, 0x00},
|
||||
{0x14, 0x3E, 0x14, 0x3E, 0x14, 0x00},
|
||||
@@ -502,10 +452,10 @@ const uint8_t gFontSmall[95][6] =
|
||||
{0x00, 0x03, 0x07, 0x06, 0x00, 0x00},
|
||||
{0x20, 0x76, 0x56, 0x56, 0x7E, 0x3C},
|
||||
{0x7F, 0x7F, 0x6C, 0x6C, 0x7C, 0x38},
|
||||
{0x3C, 0x7E, 0x66, 0x66, 0x66, 0x24},
|
||||
{0x38, 0x7C, 0x6C, 0x6C, 0x6C, 0x00},
|
||||
{0x38, 0x7C, 0x6C, 0x6C, 0x7F, 0x7F},
|
||||
{0x3C, 0x7E, 0x56, 0x56, 0x5E, 0x0C},
|
||||
{0x7C, 0x7E, 0x36, 0x36, 0x06, 0x00},
|
||||
{0x7E, 0x7F, 0x1B, 0x1B, 0x02, 0x00},
|
||||
{0x0C, 0x5E, 0x56, 0x56, 0x7E, 0x3C},
|
||||
{0x7F, 0x7F, 0x0C, 0x0C, 0x7C, 0x78},
|
||||
{0x00, 0x00, 0x7A, 0x7A, 0x00, 0x00},
|
||||
@@ -516,7 +466,7 @@ const uint8_t gFontSmall[95][6] =
|
||||
{0x7C, 0x7C, 0x0C, 0x0C, 0x7C, 0x78},
|
||||
{0x3C, 0x7E, 0x66, 0x66, 0x7E, 0x3C},
|
||||
{0x7E, 0x7E, 0x36, 0x36, 0x3E, 0x1C},
|
||||
{0x1C, 0x3E, 0x36, 0x3E, 0x7E, 0x40},
|
||||
{0x1C, 0x3E, 0x36, 0x7E, 0x7E, 0x60},
|
||||
{0x7C, 0x7C, 0x0C, 0x0C, 0x18, 0x00},
|
||||
{0x4C, 0x5E, 0x56, 0x56, 0x76, 0x20},
|
||||
{0x3F, 0x7F, 0x6C, 0x6C, 0x60, 0x00},
|
||||
@@ -524,11 +474,181 @@ const uint8_t gFontSmall[95][6] =
|
||||
{0x0C, 0x3C, 0x70, 0x70, 0x3C, 0x0C},
|
||||
{0x3C, 0x7C, 0x30, 0x30, 0x7C, 0x3C},
|
||||
{0x44, 0x6C, 0x38, 0x38, 0x6C, 0x44},
|
||||
{0x06, 0x6E, 0x6C, 0x6C, 0x7E, 0x3E},
|
||||
{0x06, 0x6E, 0x68, 0x68, 0x7E, 0x3E},
|
||||
{0x66, 0x76, 0x7E, 0x6E, 0x66, 0x00},
|
||||
{0x08, 0x3E, 0x77, 0x41, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x7F, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x41, 0x77, 0x3E, 0x08, 0x00},
|
||||
{0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00},
|
||||
{0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00}
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SPECTRUM
|
||||
const uint8_t gFont3x5[][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
|
||||
|
||||
{0x12, 0x17, 0x12}, // 127 - plusminus
|
||||
|
||||
|
||||
// {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
|
||||
|
||||
13
font.h
@@ -19,14 +19,13 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//extern const uint8_t gFontBig[95][16];
|
||||
extern const uint8_t gFontBig[95][15];
|
||||
extern const uint8_t gFontBigDigits[11][26];
|
||||
//extern const uint8_t gFontSmallDigits[11][7];
|
||||
extern const uint8_t gFont3x5[160][3];
|
||||
extern const uint8_t gFontSmall[95][6];
|
||||
|
||||
extern const uint8_t gFontBig[95 - 1][16 - 2];
|
||||
extern const uint8_t gFontBigDigits[11][26 - 6];
|
||||
extern const uint8_t gFont3x5[96][3];
|
||||
extern const uint8_t gFontSmall[95 - 1][6];
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
extern const uint8_t gFontSmallBold[95][6];
|
||||
extern const uint8_t gFontSmallBold[95 - 1][6];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
167
frequencies.c
@@ -19,52 +19,29 @@
|
||||
#include "settings.h"
|
||||
|
||||
// the BK4819 has 2 bands it covers, 18MHz ~ 630MHz and 760MHz ~ 1300MHz
|
||||
const freq_band_table_t BX4819_band1 = { 1800000, 63000000};
|
||||
const freq_band_table_t BX4819_band2 = {84000000, 130000000};
|
||||
|
||||
const uint32_t bx_start1_Hz = 1800000; // 18MHz
|
||||
const uint32_t bx_stop1_Hz = 63000000; // 630MHz
|
||||
|
||||
//const uint32_t bx_start2_Hz = 76000000; // 760MHz // my one radio the BK chip managed to lock down to this frequency
|
||||
const uint32_t bx_start2_Hz = 84000000; // 840MHz // but best to go with datasheet specification really
|
||||
const uint32_t bx_stop2_Hz = 130000000; // 1300MHz
|
||||
|
||||
const uint32_t LowerLimitFrequencyBandTable[7] =
|
||||
const freq_band_table_t frequencyBandTable[7] =
|
||||
{
|
||||
#ifndef ENABLE_WIDE_RX
|
||||
5000000,
|
||||
// QS original
|
||||
{.lower = 5000000, .upper = 7600000},
|
||||
{.lower = 10800000, .upper = 13700000},
|
||||
{.lower = 13700000, .upper = 17400000},
|
||||
{.lower = 17400000, .upper = 35000000},
|
||||
{.lower = 35000000, .upper = 40000000},
|
||||
{.lower = 40000000, .upper = 47000000},
|
||||
{.lower = 47000000, .upper = 60000000}
|
||||
#else
|
||||
1800000,
|
||||
#endif
|
||||
10800000,
|
||||
13600000,
|
||||
17400000,
|
||||
35000000,
|
||||
40000000,
|
||||
47000000
|
||||
};
|
||||
|
||||
const uint32_t MiddleFrequencyBandTable[7] =
|
||||
{
|
||||
6500000,
|
||||
12200000,
|
||||
15000000,
|
||||
26000000,
|
||||
37000000,
|
||||
43500000,
|
||||
55000000
|
||||
};
|
||||
|
||||
const uint32_t UpperLimitFrequencyBandTable[7] =
|
||||
{
|
||||
7600000,
|
||||
13599990,
|
||||
17399990,
|
||||
34999990,
|
||||
39999990,
|
||||
46999990,
|
||||
#ifndef ENABLE_WIDE_RX
|
||||
60000000
|
||||
#else
|
||||
130000000
|
||||
// extended range
|
||||
{.lower = BX4819_band1.lower, .upper = 10800000},
|
||||
{.lower = 10800000, .upper = 13700000},
|
||||
{.lower = 13700000, .upper = 17400000},
|
||||
{.lower = 17400000, .upper = 35000000},
|
||||
{.lower = 35000000, .upper = 40000000},
|
||||
{.lower = 40000000, .upper = 47000000},
|
||||
{.lower = 47000000, .upper = BX4819_band2.upper}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -84,37 +61,24 @@ const uint32_t UpperLimitFrequencyBandTable[7] =
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
const uint16_t StepFrequencyTable[7] =
|
||||
{
|
||||
250,
|
||||
500,
|
||||
625,
|
||||
1000,
|
||||
1250,
|
||||
2500,
|
||||
833
|
||||
};
|
||||
#ifndef ENABLE_12_5KHZ_STEP
|
||||
// QS steps (*10 Hz)
|
||||
const uint16_t StepFrequencyTable[7] = {250, 500, 625, 1000, 1250, 2500, 833};
|
||||
#else
|
||||
const uint16_t StepFrequencyTable[7] =
|
||||
{
|
||||
125,
|
||||
250,
|
||||
625,
|
||||
1000,
|
||||
1250,
|
||||
2500,
|
||||
833
|
||||
};
|
||||
// includes 1.25kHz step
|
||||
const uint16_t StepFrequencyTable[7] = {125, 250, 625, 1000, 1250, 2500, 833};
|
||||
#endif
|
||||
|
||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
|
||||
{
|
||||
int band;
|
||||
for (band = BAND7_470MHz; band >= BAND1_50MHz; band--)
|
||||
if (Frequency >= LowerLimitFrequencyBandTable[band])
|
||||
return band;
|
||||
for (band = ARRAY_SIZE(frequencyBandTable) - 1; band >= 0; band--)
|
||||
if (Frequency >= frequencyBandTable[band].lower)
|
||||
// if (Frequency < frequencyBandTable[band].upper)
|
||||
return (FREQUENCY_Band_t)band;
|
||||
|
||||
return BAND1_50MHz;
|
||||
// return BAND_NONE;
|
||||
}
|
||||
|
||||
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency)
|
||||
@@ -136,61 +100,47 @@ uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t T
|
||||
return TxpMid;
|
||||
}
|
||||
|
||||
uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)
|
||||
static int32_t rnd(int32_t freq, uint16_t step)
|
||||
{
|
||||
uint32_t Index;
|
||||
return (freq + (step + 1) / 2) / step * step;
|
||||
}
|
||||
|
||||
if (Step == 833)
|
||||
{
|
||||
const uint32_t Delta = Upper - Lower;
|
||||
uint32_t Base = (Delta / 2500) * 2500;
|
||||
const uint32_t Index = ((Delta - Base) % 2500) / 833;
|
||||
|
||||
if (Index == 2)
|
||||
Base++;
|
||||
|
||||
return Lower + Base + (Index * 833);
|
||||
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step)
|
||||
{
|
||||
if(step == 833) {
|
||||
uint32_t base = freq/2500*2500;
|
||||
int f = rnd(freq - base, step);
|
||||
int x = f / step;
|
||||
return base + f + (x == 3);
|
||||
}
|
||||
|
||||
Index = (Upper - Lower) / Step;
|
||||
|
||||
return Lower + (Step * Index);
|
||||
return rnd(freq, step);
|
||||
}
|
||||
/*
|
||||
int TX_FREQUENCY_Check(VFO_Info_t *pInfo)
|
||||
{ // return '0' if TX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
const uint32_t Frequency = pInfo->pTX->Frequency;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (pInfo->CHANNEL_SAVE > FREQ_CHANNEL_LAST)
|
||||
return -1;
|
||||
#endif
|
||||
*/
|
||||
int TX_FREQUENCY_Check(const uint32_t Frequency)
|
||||
int TX_freq_check(const uint32_t Frequency)
|
||||
{ // return '0' if TX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6])
|
||||
return -1;
|
||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
||||
return -1;
|
||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||
return -1; // not allowed outside this range
|
||||
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
return -1; // BX chip does not work in this range
|
||||
|
||||
switch (gSetting_F_LOCK)
|
||||
{
|
||||
case F_LOCK_OFF:
|
||||
if (Frequency >= 13600000 && Frequency < 17400000)
|
||||
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < frequencyBandTable[BAND3_137MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= 17400000 && Frequency < 35000000)
|
||||
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower && Frequency < frequencyBandTable[BAND4_174MHz].upper)
|
||||
if (gSetting_200TX)
|
||||
return 0;
|
||||
if (Frequency >= 35000000 && Frequency < 40000000)
|
||||
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower && Frequency < frequencyBandTable[BAND5_350MHz].upper)
|
||||
if (gSetting_350TX && gSetting_350EN)
|
||||
return 0;
|
||||
if (Frequency >= 40000000 && Frequency < 47000000)
|
||||
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower && Frequency < frequencyBandTable[BAND6_400MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= 47000000 && Frequency <= 60000000)
|
||||
if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000)
|
||||
if (gSetting_500TX)
|
||||
return 0;
|
||||
break;
|
||||
@@ -205,6 +155,8 @@ int TX_FREQUENCY_Check(const uint32_t Frequency)
|
||||
case F_LOCK_CE:
|
||||
if (Frequency >= 14400000 && Frequency < 14600000)
|
||||
return 0;
|
||||
if (Frequency >= 43000000 && Frequency < 44000000)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case F_LOCK_GB:
|
||||
@@ -215,14 +167,14 @@ int TX_FREQUENCY_Check(const uint32_t Frequency)
|
||||
break;
|
||||
|
||||
case F_LOCK_430:
|
||||
if (Frequency >= 13600000 && Frequency < 17400000)
|
||||
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000)
|
||||
return 0;
|
||||
if (Frequency >= 40000000 && Frequency < 43000000)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case F_LOCK_438:
|
||||
if (Frequency >= 13600000 && Frequency < 17400000)
|
||||
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000)
|
||||
return 0;
|
||||
if (Frequency >= 40000000 && Frequency < 43800000)
|
||||
return 0;
|
||||
@@ -233,13 +185,14 @@ int TX_FREQUENCY_Check(const uint32_t Frequency)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int RX_FREQUENCY_Check(const uint32_t Frequency)
|
||||
int RX_freq_check(const uint32_t Frequency)
|
||||
{ // return '0' if RX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6])
|
||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||
return -1;
|
||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
||||
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
return -1;
|
||||
|
||||
return 0; // OK frequency
|
||||
|
||||
@@ -19,45 +19,66 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "radio.h"
|
||||
#define ENABLE_12_5KHZ_STEP
|
||||
|
||||
extern const uint32_t bx_start1_Hz;
|
||||
extern const uint32_t bx_stop1_Hz;
|
||||
typedef struct {
|
||||
const uint32_t lower;
|
||||
const uint32_t upper;
|
||||
} freq_band_table_t;
|
||||
|
||||
extern const uint32_t bx_start2_Hz;
|
||||
extern const uint32_t bx_stop2_Hz;
|
||||
extern const freq_band_table_t BX4819_band1;
|
||||
extern const freq_band_table_t BX4819_band2;
|
||||
|
||||
enum FREQUENCY_Band_t
|
||||
{
|
||||
BAND1_NONE = -1,
|
||||
extern const freq_band_table_t frequencyBandTable[7];
|
||||
|
||||
enum FREQUENCY_Band_t {
|
||||
BAND_NONE = -1,
|
||||
BAND1_50MHz = 0,
|
||||
BAND2_108MHz,
|
||||
BAND3_136MHz,
|
||||
BAND3_137MHz,
|
||||
BAND4_174MHz,
|
||||
BAND5_350MHz,
|
||||
BAND6_400MHz,
|
||||
BAND7_470MHz
|
||||
};
|
||||
|
||||
typedef enum FREQUENCY_Band_t FREQUENCY_Band_t;
|
||||
|
||||
extern const uint32_t LowerLimitFrequencyBandTable[7];
|
||||
extern const uint32_t MiddleFrequencyBandTable[7];
|
||||
extern const uint32_t UpperLimitFrequencyBandTable[7];
|
||||
#ifndef ENABLE_12_5KHZ_STEP
|
||||
// QS steps
|
||||
enum STEP_Setting_t {
|
||||
STEP_2_5kHz = 0,
|
||||
STEP_5_0kHz,
|
||||
STEP_6_25kHz,
|
||||
STEP_10_0kHz,
|
||||
STEP_12_5kHz,
|
||||
STEP_25_0kHz,
|
||||
STEP_8_33kHz
|
||||
};
|
||||
#else
|
||||
// includes 1.25kHz step
|
||||
enum STEP_Setting_t {
|
||||
STEP_1_25kHz = 0,
|
||||
STEP_2_5kHz,
|
||||
STEP_6_25kHz,
|
||||
STEP_10_0kHz,
|
||||
STEP_12_5kHz,
|
||||
STEP_25_0kHz,
|
||||
STEP_8_33kHz
|
||||
};
|
||||
#endif
|
||||
typedef enum STEP_Setting_t STEP_Setting_t;
|
||||
|
||||
extern const uint16_t StepFrequencyTable[7];
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
extern const uint32_t NoaaFrequencyTable[10];
|
||||
extern const uint32_t NoaaFrequencyTable[10];
|
||||
#endif
|
||||
|
||||
extern const uint16_t StepFrequencyTable[7];
|
||||
|
||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency);
|
||||
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency);
|
||||
uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower);
|
||||
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step);
|
||||
|
||||
//int TX_FREQUENCY_Check(VFO_Info_t *pInfo);
|
||||
int TX_FREQUENCY_Check(const uint32_t Frequency);
|
||||
int RX_FREQUENCY_Check(const uint32_t Frequency);
|
||||
int TX_freq_check(const uint32_t Frequency);
|
||||
int RX_freq_check(const uint32_t Frequency);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
106
functions.c
@@ -22,12 +22,14 @@
|
||||
#endif
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "dcs.h"
|
||||
#include "driver/backlight.h"
|
||||
#if defined(ENABLE_FMRADIO)
|
||||
#include "driver/bk1080.h"
|
||||
#endif
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/system.h"
|
||||
#include "frequencies.h"
|
||||
#include "functions.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
@@ -41,7 +43,7 @@ FUNCTION_Type_t gCurrentFunction;
|
||||
void FUNCTION_Init(void)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#endif
|
||||
{
|
||||
gCurrentCodeType = gSelectedCodeType;
|
||||
@@ -53,20 +55,16 @@ void FUNCTION_Init(void)
|
||||
gCurrentCodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
#endif
|
||||
|
||||
gDTMF_RequestPending = false;
|
||||
DTMF_clear_RX();
|
||||
|
||||
gDTMF_RecvTimeout = 0;
|
||||
gDTMF_WriteIndex = 0;
|
||||
memset(gDTMF_Received, 0, sizeof(gDTMF_Received));
|
||||
|
||||
// gDTMF_RX_timeout_live = 0;
|
||||
// gDTMF_RX_timeout_live[0] = '\0';
|
||||
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
g_CDCSS_Lost = false;
|
||||
g_CTCSS_Lost = false;
|
||||
|
||||
g_VOX_Lost = false;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
g_VOX_Lost = false;
|
||||
#endif
|
||||
|
||||
g_SquelchLost = false;
|
||||
|
||||
gFlagTailNoteEliminationComplete = false;
|
||||
@@ -80,6 +78,8 @@ void FUNCTION_Init(void)
|
||||
#ifdef ENABLE_NOAA
|
||||
gNOAACountdown_10ms = 0;
|
||||
#endif
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
@@ -93,7 +93,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
{
|
||||
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
||||
gRxIdleMode = false;
|
||||
UI_DisplayStatus(false);
|
||||
UI_DisplayStatus();
|
||||
}
|
||||
|
||||
switch (Function)
|
||||
@@ -116,45 +116,57 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
||||
#endif
|
||||
|
||||
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);
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT ||
|
||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||
{
|
||||
gDTMF_auto_reset_time_500ms = gEeprom.DTMF_auto_reset_time * 2;
|
||||
}
|
||||
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
|
||||
|
||||
case FUNCTION_MONITOR:
|
||||
gMonitor = true;
|
||||
break;
|
||||
|
||||
|
||||
case FUNCTION_INCOMING:
|
||||
case FUNCTION_RECEIVE:
|
||||
break;
|
||||
|
||||
|
||||
case FUNCTION_POWER_SAVE:
|
||||
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
|
||||
gPowerSaveCountdownExpired = false;
|
||||
|
||||
gRxIdleMode = true;
|
||||
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
BK4819_DisableVox();
|
||||
BK4819_DisableVox();
|
||||
BK4819_Sleep();
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, false);
|
||||
|
||||
gUpdateStatus = true;
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
|
||||
return;
|
||||
|
||||
|
||||
case FUNCTION_TRANSMIT:
|
||||
|
||||
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
|
||||
BK4819_DisableDTMF();
|
||||
|
||||
// clear the DTMF RX buffer
|
||||
DTMF_clear_RX();
|
||||
|
||||
// clear the DTMF RX live decoder buffer
|
||||
gDTMF_RX_live_timeout = 0;
|
||||
gDTMF_RX_live[0] = 0;
|
||||
|
||||
gDTMF_RX_live_timeout = 0;
|
||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||
|
||||
#if defined(ENABLE_FMRADIO)
|
||||
if (gFmRadioMode)
|
||||
BK1080_Init(0, false);
|
||||
@@ -167,13 +179,13 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
SYSTEM_DelayMs(20);
|
||||
BK4819_PlayTone(500, 0);
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOn();
|
||||
|
||||
gEnableSpeaker = true;
|
||||
|
||||
@@ -184,33 +196,51 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
gUpdateStatus = true;
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
RADIO_SetTxParameters();
|
||||
|
||||
// turn the LED on RED
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
||||
|
||||
// turn the RED LED on
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||
|
||||
DTMF_Reply();
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
|
||||
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
||||
BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE);
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (gAlarmState != ALARM_STATE_OFF)
|
||||
{
|
||||
BK4819_TransmitTone(true, (gAlarmState == ALARM_STATE_TX1750) ? 1750 : 500);
|
||||
#ifdef ENABLE_TX1750
|
||||
if (gAlarmState == ALARM_STATE_TX1750)
|
||||
BK4819_TransmitTone(true, 1750);
|
||||
#endif
|
||||
#ifdef ENABLE_ALARM
|
||||
if (gAlarmState == ALARM_STATE_TXALARM)
|
||||
BK4819_TransmitTone(true, 500);
|
||||
#endif
|
||||
SYSTEM_DelayMs(2);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
gAlarmToneCounter = 0;
|
||||
gEnableSpeaker = true;
|
||||
AUDIO_AudioPathOn();
|
||||
#ifdef ENABLE_ALARM
|
||||
gAlarmToneCounter = 0;
|
||||
#endif
|
||||
gEnableSpeaker = true;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
|
||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
|
||||
if (gSetting_backlight_on_tx_rx == BACKLIGHT_ON_TR_TX ||
|
||||
gSetting_backlight_on_tx_rx == BACKLIGHT_ON_TR_TXRX)
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
break;
|
||||
|
||||
case FUNCTION_BAND_SCOPE:
|
||||
|
||||
125
helper/battery.c
@@ -17,6 +17,7 @@
|
||||
#include "battery.h"
|
||||
#include "driver/backlight.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/battery.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
@@ -34,95 +35,67 @@ uint16_t gBatteryCheckCounter;
|
||||
|
||||
volatile uint16_t gPowerSave_10ms;
|
||||
|
||||
/*
|
||||
Based on real measurement
|
||||
|
||||
Volts Percent Volts Percent Volts Percent Volts Percent
|
||||
8.28 100 7.95099 73 7.7184 46 7.48116 19
|
||||
8.22 99 7.94188 72 7.71091 45 7.46364 18
|
||||
8.17 98 7.9338 71 7.70911 44 7.44789 17
|
||||
8.13632 97 7.92684 70 7.70098 43 7.43318 16
|
||||
8.12308 96 7.9178 69 7.69619 42 7.41864 15
|
||||
8.09688 95 7.90823 68 7.69018 41 7.40579 14
|
||||
8.08124 94 7.89858 67 7.68473 40 7.39289 13
|
||||
8.06912 93 7.88667 66 7.67911 39 7.37839 12
|
||||
8.05826 92 7.87673 65 7.67087 38 7.36017 11
|
||||
8.05008 91 7.86864 64 7.66601 37 7.33704 10
|
||||
8.04192 90 7.85802 63 7.6599 36 7.3079 9
|
||||
8.03866 89 7.84816 62 7.65418 35 7.26793 8
|
||||
8.03089 88 7.83744 61 7.64775 34 7.21291 7
|
||||
8.0284 87 7.82748 60 7.64065 33 7.13416 6
|
||||
8.02044 86 7.81983 59 7.63136 32 7.02785 5
|
||||
8.01832 85 7.80929 58 7.6244 31 6.89448 4
|
||||
8.01072 84 7.79955 57 7.61636 30 6.72912 3
|
||||
8.00965 83 7.79017 56 7.60738 29 6.5164 2
|
||||
8.00333 82 7.78107 55 7.597 28 6.19272 1
|
||||
7.99973 81 7.77167 54 7.5876 27 5.63138 0
|
||||
7.99218 80 7.76509 53 7.57732 26
|
||||
7.98999 79 7.75649 52 7.56563 25
|
||||
7.98234 78 7.74939 51 7.55356 24
|
||||
7.97892 77 7.7411 50 7.54088 23
|
||||
7.97043 76 7.73648 49 7.52683 22
|
||||
7.96478 75 7.72911 48 7.51285 21
|
||||
7.95983 74 7.72097 47 7.49832 20
|
||||
*/
|
||||
uint8_t BATTERY_VoltsToPercent(uint16_t voltage_10mV)
|
||||
unsigned int BATTERY_VoltsToPercent(const unsigned int voltage_10mV)
|
||||
{
|
||||
if(voltage_10mV>814)
|
||||
return 100;
|
||||
else if(voltage_10mV>756)
|
||||
return 132*voltage_10mV/100-974;
|
||||
else if(voltage_10mV>729)
|
||||
return 63*voltage_10mV/100-452;
|
||||
else if(voltage_10mV>600)
|
||||
return 52*voltage_10mV/1000-31;
|
||||
else
|
||||
return 0;
|
||||
const uint16_t crv1600[][2] = {
|
||||
{814, 100},
|
||||
{756, 24 },
|
||||
{729, 7 },
|
||||
{597, 0 },
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
const uint16_t crv2200[][2] = {
|
||||
{823, 100},
|
||||
{740, 60},
|
||||
{707, 21},
|
||||
{680, 5},
|
||||
{505, 0},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
const BATTERY_Type_t type = gEeprom.BATTERY_TYPE;
|
||||
const uint16_t(*crv)[2];
|
||||
uint8_t size;
|
||||
if (type == BATTERY_TYPE_2200_MAH) {
|
||||
crv = crv2200;
|
||||
size = ARRAY_SIZE(crv2200);
|
||||
}
|
||||
else {
|
||||
crv = crv1600;
|
||||
size = ARRAY_SIZE(crv1600);
|
||||
}
|
||||
|
||||
const int mulipl = 1000;
|
||||
for (int i = 1; i < size; i++) {
|
||||
if (voltage_10mV > crv[i][0]) {
|
||||
int a = (crv[i - 1][1] - crv[i][1]) * mulipl / (crv[i - 1][0] - crv[i][0]);
|
||||
int b = crv[i][1] - a * crv[i][0] / mulipl;
|
||||
int p = a * voltage_10mV / mulipl + b;
|
||||
return MIN(p, 100);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BATTERY_GetReadings(bool bDisplayBatteryLevel)
|
||||
void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
|
||||
{
|
||||
const uint8_t PreviousBatteryLevel = gBatteryDisplayLevel;
|
||||
const uint16_t Voltage = (gBatteryVoltages[0] + gBatteryVoltages[1] + gBatteryVoltages[2] + gBatteryVoltages[3]) / 4;
|
||||
|
||||
gBatteryDisplayLevel = 0;
|
||||
|
||||
if (Voltage >= gBatteryCalibration[5])
|
||||
gBatteryDisplayLevel = 11;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[4] + gBatteryCalibration[5]) / 2))
|
||||
gBatteryDisplayLevel = 10;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[4])
|
||||
gBatteryDisplayLevel = 9;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[3] + gBatteryCalibration[4]) / 2))
|
||||
gBatteryDisplayLevel = 8;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[3])
|
||||
gBatteryDisplayLevel = 7;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[2] + gBatteryCalibration[3]) / 2))
|
||||
gBatteryDisplayLevel = 6;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[2])
|
||||
gBatteryDisplayLevel = 5;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[1] + gBatteryCalibration[2]) / 2))
|
||||
gBatteryDisplayLevel = 4;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[1])
|
||||
gBatteryDisplayLevel = 3;
|
||||
else
|
||||
if (Voltage >= ((gBatteryCalibration[0] + gBatteryCalibration[1]) / 2))
|
||||
gBatteryDisplayLevel = 2;
|
||||
else
|
||||
if (Voltage >= gBatteryCalibration[0])
|
||||
gBatteryDisplayLevel = 1;
|
||||
for(uint8_t i = 6; i > 0; i--){
|
||||
if (Voltage > gBatteryCalibration[i-1]) {
|
||||
gBatteryDisplayLevel = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
|
||||
|
||||
if ((gScreenToDisplay == DISPLAY_MENU) && gMenuCursor == MENU_VOL)
|
||||
if ((gScreenToDisplay == DISPLAY_MENU) && GetCurrentMenuId() == MENU_VOL)
|
||||
gUpdateDisplay = true;
|
||||
|
||||
if (gBatteryCurrent < 501)
|
||||
|
||||
@@ -33,8 +33,14 @@ extern uint16_t gBatteryCheckCounter;
|
||||
|
||||
extern volatile uint16_t gPowerSave_10ms;
|
||||
|
||||
uint8_t BATTERY_VoltsToPercent(uint16_t voltage_10mV);
|
||||
void BATTERY_GetReadings(bool bDisplayBatteryLevel);
|
||||
typedef enum {
|
||||
BATTERY_TYPE_1600_MAH,
|
||||
BATTERY_TYPE_2200_MAH,
|
||||
BATTERY_TYPE_UNKNOWN
|
||||
} BATTERY_Type_t;
|
||||
|
||||
unsigned int BATTERY_VoltsToPercent(const unsigned int voltage_10mV);
|
||||
void BATTERY_GetReadings(const bool bDisplayBatteryLevel);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,15 +39,16 @@ BOOT_Mode_t BOOT_GetMode(void)
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||
return BOOT_MODE_NORMAL;
|
||||
return BOOT_MODE_NORMAL; // PTT not pressed
|
||||
Keys[i] = KEYBOARD_Poll();
|
||||
SYSTEM_DelayMs(20);
|
||||
}
|
||||
|
||||
if (Keys[0] == Keys[1])
|
||||
{
|
||||
gKeyReading0 = Keys[0];
|
||||
gKeyReading1 = Keys[0];
|
||||
gKeyReading0 = Keys[0];
|
||||
gKeyReading1 = Keys[0];
|
||||
|
||||
gDebounceCounter = 2;
|
||||
|
||||
if (Keys[0] == KEY_SIDE1)
|
||||
@@ -66,16 +67,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
||||
{
|
||||
if (Mode == BOOT_MODE_F_LOCK)
|
||||
{
|
||||
// enable all the menu items
|
||||
gMenuListCount = 0;
|
||||
// while (MenuList[gMenuListCount].name != NULL)
|
||||
while (MenuList[gMenuListCount].name[0] != '\0')
|
||||
gMenuListCount++;
|
||||
|
||||
gMenuCursor = MENU_350TX;
|
||||
gSubMenuSelection = gSetting_350TX;
|
||||
GUI_SelectNextDisplay(DISPLAY_MENU);
|
||||
gF_LOCK = true;
|
||||
}
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
else
|
||||
@@ -83,18 +75,21 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
||||
{
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||
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.AUTO_KEYPAD_LOCK = false;
|
||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = 0;
|
||||
gEeprom.KEY_1_LONG_PRESS_ACTION = 0;
|
||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = 0;
|
||||
gEeprom.KEY_2_LONG_PRESS_ACTION = 0;
|
||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_2_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_M_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
|
||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 5, 41002500);
|
||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 41002500);
|
||||
|
||||
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
||||
gRxVfo->OUTPUT_POWER = 0;
|
||||
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_WIDE;
|
||||
gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
|
||||
@@ -105,6 +100,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
||||
BK4819_ResetFSK();
|
||||
|
||||
gAircopyState = AIRCOPY_READY;
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
||||
}
|
||||
#endif
|
||||
|
||||
BIN
images/batcal.jpg
Normal file
|
After Width: | Height: | Size: 28 KiB |
|
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
@@ -30,21 +30,17 @@ void DATA_Init(void);
|
||||
void BSS_Init(void)
|
||||
{
|
||||
uint32_t *pBss;
|
||||
|
||||
for (pBss = __bss_start__; pBss < __bss_end__; pBss++) {
|
||||
for (pBss = __bss_start__; pBss < __bss_end__; pBss++)
|
||||
*pBss = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DATA_Init(void)
|
||||
{
|
||||
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
|
||||
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
|
||||
volatile uint32_t *pDataFlash = (volatile uint32_t *)flash_data_start;
|
||||
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
|
||||
uint32_t i;
|
||||
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < Size / 4; i++) {
|
||||
for (i = 0; i < (Size / 4); i++)
|
||||
*pDataRam++ = *pDataFlash++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
88
main.c
@@ -50,6 +50,7 @@ void _putchar(char c)
|
||||
void Main(void)
|
||||
{
|
||||
unsigned int i;
|
||||
BOOT_Mode_t BootMode;
|
||||
|
||||
// Enable clock gating of blocks we need
|
||||
SYSCON_DEV_CLK_GATE = 0
|
||||
@@ -60,14 +61,15 @@ void Main(void)
|
||||
| SYSCON_DEV_CLK_GATE_SPI0_BITS_ENABLE
|
||||
| SYSCON_DEV_CLK_GATE_SARADC_BITS_ENABLE
|
||||
| SYSCON_DEV_CLK_GATE_CRC_BITS_ENABLE
|
||||
| SYSCON_DEV_CLK_GATE_AES_BITS_ENABLE;
|
||||
| SYSCON_DEV_CLK_GATE_AES_BITS_ENABLE
|
||||
| SYSCON_DEV_CLK_GATE_PWM_PLUS0_BITS_ENABLE;
|
||||
|
||||
SYSTICK_Init();
|
||||
BOARD_Init();
|
||||
UART_Init();
|
||||
|
||||
boot_counter_10ms = 250; // 2.5 sec
|
||||
|
||||
|
||||
UART_Send(UART_Version, strlen(UART_Version));
|
||||
|
||||
// Not implementing authentic device checks
|
||||
@@ -83,7 +85,7 @@ void Main(void)
|
||||
|
||||
BOARD_EEPROM_Init();
|
||||
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
|
||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||
@@ -101,28 +103,55 @@ void Main(void)
|
||||
AM_fix_init();
|
||||
#endif
|
||||
|
||||
// count the number of menu list items
|
||||
gMenuListCount = 0;
|
||||
while (MenuList[gMenuListCount].name[0] != '\0')
|
||||
gMenuListCount++;
|
||||
gMenuListCount -= 8; // disable the last 'n' items
|
||||
BootMode = BOOT_GetMode();
|
||||
|
||||
if (!gChargingWithTypeC && !gBatteryDisplayLevel)
|
||||
if (BootMode == BOOT_MODE_F_LOCK)
|
||||
{
|
||||
gF_LOCK = true; // flag to say include the hidden menu items
|
||||
}
|
||||
|
||||
// count the number of menu items
|
||||
gMenuListCount = 0;
|
||||
while (MenuList[gMenuListCount].name[0] != '\0') {
|
||||
if(!gF_LOCK && MenuList[gMenuListCount].menu_id == FIRST_HIDDEN_MENU_ITEM)
|
||||
break;
|
||||
|
||||
gMenuListCount++;
|
||||
}
|
||||
|
||||
// wait for user to release all butts before moving on
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||
KEYBOARD_Poll() != KEY_INVALID ||
|
||||
BootMode != BOOT_MODE_NORMAL)
|
||||
{ // keys are pressed
|
||||
UI_DisplayReleaseKeys();
|
||||
BACKLIGHT_TurnOn();
|
||||
i = 0;
|
||||
while (i < 50) // 500ms
|
||||
{
|
||||
i = (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && KEYBOARD_Poll() == KEY_INVALID) ? i + 1 : 0;
|
||||
SYSTEM_DelayMs(10);
|
||||
}
|
||||
gKeyReading0 = KEY_INVALID;
|
||||
gKeyReading1 = KEY_INVALID;
|
||||
gDebounceCounter = 0;
|
||||
}
|
||||
|
||||
if (!gChargingWithTypeC && gBatteryDisplayLevel == 0)
|
||||
{
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
|
||||
if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||
if (gEeprom.BACKLIGHT_TIME < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) // backlight is not set to be always on
|
||||
BACKLIGHT_TurnOff(); // turn the backlight OFF
|
||||
else
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON
|
||||
BACKLIGHT_TurnOn(); // turn the backlight ON
|
||||
|
||||
gReducedService = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOT_Mode_t BootMode;
|
||||
|
||||
UI_DisplayWelcome();
|
||||
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE)
|
||||
@@ -131,24 +160,24 @@ void Main(void)
|
||||
{
|
||||
if (KEYBOARD_Poll() != KEY_INVALID)
|
||||
{ // halt boot beeps
|
||||
boot_counter_10ms = 0;
|
||||
boot_counter_10ms = 0;
|
||||
break;
|
||||
}
|
||||
#ifdef ENABLE_BOOT_BEEPS
|
||||
if ((boot_counter_10ms % 25) == 0)
|
||||
AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL);
|
||||
#endif
|
||||
#ifdef ENABLE_BOOT_BEEPS
|
||||
if ((boot_counter_10ms % 25) == 0)
|
||||
AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
BootMode = BOOT_GetMode();
|
||||
|
||||
#ifdef ENABLE_PWRON_PASSWORD
|
||||
if (gEeprom.POWER_ON_PASSWORD < 1000000)
|
||||
{
|
||||
bIsInLockScreen = true;
|
||||
UI_DisplayLock();
|
||||
bIsInLockScreen = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOT_ProcessMode(BootMode);
|
||||
|
||||
@@ -156,29 +185,30 @@ void Main(void)
|
||||
|
||||
gUpdateStatus = true;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
{
|
||||
uint8_t Channel;
|
||||
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_WELCOME);
|
||||
|
||||
Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL];
|
||||
Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
{
|
||||
AUDIO_SetVoiceID(1, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(2, Channel + 1);
|
||||
}
|
||||
else
|
||||
if (IS_FREQ_CHANNEL(Channel))
|
||||
else if (IS_FREQ_CHANNEL(Channel))
|
||||
AUDIO_SetVoiceID(1, VOICE_ID_FREQUENCY_MODE);
|
||||
|
||||
AUDIO_PlaySingleVoice(0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
RADIO_ConfigureNOAA();
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
RADIO_ConfigureNOAA();
|
||||
#endif
|
||||
|
||||
// ******************
|
||||
}
|
||||
|
||||
while (1)
|
||||
|
||||
108
misc.c
@@ -17,18 +17,21 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
|
||||
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
||||
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
||||
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
||||
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
||||
|
||||
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
||||
const uint8_t vfo_state_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||
|
||||
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||
|
||||
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
||||
const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds
|
||||
const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
|
||||
const uint8_t DTMF_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
||||
|
||||
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
|
||||
@@ -44,20 +47,27 @@ 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_2_10ms = 3600 / 10; // 3.6 sec
|
||||
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 scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
||||
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
|
||||
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
||||
const uint16_t scan_pause_delay_in_5_10ms = 1000 / 10; // 1 sec
|
||||
const uint16_t scan_pause_delay_in_6_10ms = 100 / 10; // 100ms
|
||||
const uint16_t scan_pause_delay_in_7_10ms = 3600 / 10; // 3.6 seconds
|
||||
|
||||
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
||||
|
||||
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
||||
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_2_10ms = 500 / 10; // 500ms
|
||||
@@ -76,6 +86,8 @@ bool gSetting_TX_EN;
|
||||
uint8_t gSetting_F_LOCK;
|
||||
bool gSetting_ScrambleEnable;
|
||||
|
||||
uint8_t gSetting_backlight_on_tx_rx;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
bool gSetting_AM_fix;
|
||||
#endif
|
||||
@@ -95,12 +107,7 @@ bool bHasCustomAesKey;
|
||||
uint32_t gChallenge[4];
|
||||
uint8_t gTryCount;
|
||||
|
||||
uint8_t gEEPROM_1EC0_0[8];
|
||||
uint8_t gEEPROM_1EC0_1[8];
|
||||
uint8_t gEEPROM_1EC0_2[8];
|
||||
uint8_t gEEPROM_1EC0_3[8];
|
||||
|
||||
uint16_t gEEPROM_RSSI_CALIB[2][4];
|
||||
uint16_t gEEPROM_RSSI_CALIB[7][4];
|
||||
|
||||
uint16_t gEEPROM_1F8A;
|
||||
uint16_t gEEPROM_1F8C;
|
||||
@@ -115,9 +122,10 @@ volatile bool gSchedulePowerSave;
|
||||
volatile bool gScheduleDualWatch = true;
|
||||
|
||||
volatile uint16_t gDualWatchCountdown_10ms;
|
||||
volatile bool gDualWatchCountdownExpired = true;
|
||||
bool gDualWatchActive = false;
|
||||
|
||||
volatile uint8_t gSerialConfigCountDown_500ms;
|
||||
|
||||
volatile bool gNextTimeslice_500ms;
|
||||
|
||||
volatile uint16_t gTxTimerCountdown_500ms;
|
||||
@@ -125,6 +133,8 @@ volatile bool gTxTimeoutReached;
|
||||
|
||||
volatile uint16_t gTailNoteEliminationCountdown_10ms;
|
||||
|
||||
volatile uint8_t gVFOStateResumeCountdown_500ms;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
volatile uint16_t gNOAA_Countdown_10ms;
|
||||
#endif
|
||||
@@ -146,10 +156,10 @@ uint8_t gReducedService;
|
||||
uint8_t gBatteryVoltageIndex;
|
||||
CssScanMode_t gCssScanMode;
|
||||
bool gUpdateRSSI;
|
||||
#ifdef ENABLE_ALARM
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
AlarmState_t gAlarmState;
|
||||
#endif
|
||||
uint8_t gVoltageMenuCountdown;
|
||||
uint16_t gMenuCountdown;
|
||||
bool gPttWasReleased;
|
||||
bool gPttWasPressed;
|
||||
uint8_t gKeypadLocked;
|
||||
@@ -163,35 +173,35 @@ bool gRequestSaveSettings;
|
||||
bool gRequestSaveFM;
|
||||
#endif
|
||||
bool gFlagPrepareTX;
|
||||
|
||||
bool gFlagAcceptSetting;
|
||||
bool gFlagRefreshSetting;
|
||||
|
||||
bool gFlagSaveVfo;
|
||||
bool gFlagSaveSettings;
|
||||
bool gFlagSaveChannel;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
bool gFlagSaveFM;
|
||||
#endif
|
||||
uint8_t gDTMF_RequestPending;
|
||||
bool g_CDCSS_Lost;
|
||||
uint8_t gCDCSSCodeType;
|
||||
bool g_CTCSS_Lost;
|
||||
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;
|
||||
uint8_t gFlashLightState;
|
||||
bool gVOX_NoiseDetected;
|
||||
uint16_t gVoxResumeCountdown;
|
||||
uint16_t gVoxPauseCountdown;
|
||||
volatile uint16_t gFlashLightBlinkCounter;
|
||||
bool gFlagEndTransmission;
|
||||
uint16_t gLowBatteryCountdown;
|
||||
uint8_t gNextMrChannel;
|
||||
ReceptionMode_t gRxReceptionMode;
|
||||
uint8_t gRestoreMrChannel;
|
||||
uint8_t gCurrentScanList;
|
||||
uint8_t gPreviousMrChannel;
|
||||
uint32_t gRestoreFrequency;
|
||||
uint8_t gRxVfoIsActive;
|
||||
|
||||
bool gRxVfoIsActive;
|
||||
#ifdef ENABLE_ALARM
|
||||
uint8_t gAlarmToneCounter;
|
||||
uint16_t gAlarmRunningCounter;
|
||||
@@ -200,13 +210,12 @@ bool gKeyBeingHeld;
|
||||
bool gPttIsPressed;
|
||||
uint8_t gPttDebounceCounter;
|
||||
uint8_t gMenuListCount;
|
||||
uint8_t gBackupCROSS_BAND_RX_TX;
|
||||
uint8_t gBackup_CROSS_BAND_RX_TX;
|
||||
uint8_t gScanDelay_10ms;
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
uint8_t gAircopySendCountdown;
|
||||
#endif
|
||||
uint8_t gFSKWriteIndex;
|
||||
uint8_t gNeverUsed;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
bool gIsNoaaMode;
|
||||
@@ -214,13 +223,17 @@ uint8_t gNeverUsed;
|
||||
#endif
|
||||
|
||||
bool gUpdateDisplay;
|
||||
bool gF_LOCK;
|
||||
|
||||
bool gF_LOCK = false;
|
||||
|
||||
uint8_t gShowChPrefix;
|
||||
|
||||
volatile bool gNextTimeslice;
|
||||
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||
volatile uint16_t gVoxStopCountdown_10ms;
|
||||
#ifdef ENABLE_VOX
|
||||
volatile uint16_t gVoxStopCountdown_10ms;
|
||||
#endif
|
||||
volatile bool gNextTimeslice40ms;
|
||||
#ifdef ENABLE_NOAA
|
||||
volatile uint16_t gNOAACountdown_10ms = 0;
|
||||
@@ -237,34 +250,7 @@ int16_t gCurrentRSSI[2] = {0, 0}; // now one per VFO
|
||||
|
||||
uint8_t gIsLocked = 0xFF;
|
||||
|
||||
// --------
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
||||
{
|
||||
unsigned int i;
|
||||
uint32_t Multiplier = 10000000;
|
||||
uint32_t Value = 0;
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if (pDigits[i] > 9)
|
||||
break;
|
||||
Value += pDigits[i] * Multiplier;
|
||||
Multiplier /= 10U;
|
||||
}
|
||||
*pInteger = Value;
|
||||
}
|
||||
|
||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
const uint32_t Result = Value / 10U;
|
||||
pDigits[7 - i] = Value - (Result * 10U);
|
||||
Value = Result;
|
||||
}
|
||||
pDigits[8] = 0;
|
||||
}
|
||||
|
||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit)
|
||||
{
|
||||
@@ -278,3 +264,15 @@ int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit,
|
||||
|
||||
return Base;
|
||||
}
|
||||
|
||||
unsigned long StrToUL(const char * str)
|
||||
{
|
||||
unsigned long ul = 0;
|
||||
for(uint8_t i = 0; i < strlen(str); i++){
|
||||
char c = str[i];
|
||||
if(c < '0' || c > '9')
|
||||
break;
|
||||
ul = ul * 10 + (uint8_t)(c-'0');
|
||||
}
|
||||
return ul;
|
||||
}
|
||||
113
misc.h
@@ -24,31 +24,34 @@
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
#define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST)
|
||||
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
||||
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
|
||||
#define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
|
||||
#endif
|
||||
|
||||
#define IS_MR_CHANNEL(x) ((x) <= MR_CHANNEL_LAST)
|
||||
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
||||
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
|
||||
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
|
||||
|
||||
enum {
|
||||
MR_CHANNEL_FIRST = 0,
|
||||
MR_CHANNEL_LAST = 199u,
|
||||
FREQ_CHANNEL_FIRST = 200u,
|
||||
FREQ_CHANNEL_LAST = 206u,
|
||||
#ifdef ENABLE_NOAA
|
||||
NOAA_CHANNEL_FIRST = 207u,
|
||||
NOAA_CHANNEL_LAST = 216u,
|
||||
#endif
|
||||
NOAA_CHANNEL_FIRST = 207u,
|
||||
NOAA_CHANNEL_LAST = 216u,
|
||||
LAST_CHANNEL
|
||||
};
|
||||
|
||||
enum {
|
||||
FLASHLIGHT_OFF = 0,
|
||||
FLASHLIGHT_ON,
|
||||
FLASHLIGHT_BLINK
|
||||
FLASHLIGHT_BLINK,
|
||||
FLASHLIGHT_SOS
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -63,7 +66,6 @@ enum AlarmState_t {
|
||||
ALARM_STATE_ALARM,
|
||||
ALARM_STATE_TX1750
|
||||
};
|
||||
|
||||
typedef enum AlarmState_t AlarmState_t;
|
||||
|
||||
enum ReceptionMode_t {
|
||||
@@ -71,7 +73,6 @@ enum ReceptionMode_t {
|
||||
RX_MODE_DETECTED, // signal detected
|
||||
RX_MODE_LISTENING //
|
||||
};
|
||||
|
||||
typedef enum ReceptionMode_t ReceptionMode_t;
|
||||
|
||||
enum CssScanMode_t
|
||||
@@ -80,16 +81,24 @@ enum CssScanMode_t
|
||||
CSS_SCAN_MODE_SCANNING,
|
||||
CSS_SCAN_MODE_FOUND,
|
||||
};
|
||||
|
||||
typedef enum CssScanMode_t CssScanMode_t;
|
||||
|
||||
extern const uint8_t fm_resume_countdown_500ms;
|
||||
enum BacklightOnRxTx_t {
|
||||
BACKLIGHT_ON_TR_OFF,
|
||||
BACKLIGHT_ON_TR_TX,
|
||||
BACKLIGHT_ON_TR_RX,
|
||||
BACKLIGHT_ON_TR_TXRX
|
||||
};
|
||||
|
||||
extern const uint8_t fm_radio_countdown_500ms;
|
||||
extern const uint16_t fm_play_countdown_scan_10ms;
|
||||
extern const uint16_t fm_play_countdown_noscan_10ms;
|
||||
extern const uint16_t fm_restore_countdown_10ms;
|
||||
|
||||
extern const uint8_t vfo_state_resume_countdown_500ms;
|
||||
|
||||
extern const uint8_t menu_timeout_500ms;
|
||||
extern const uint16_t menu_timeout_long_500ms;
|
||||
|
||||
extern const uint8_t DTMF_RX_live_timeout_500ms;
|
||||
extern const uint8_t DTMF_RX_timeout_500ms;
|
||||
@@ -109,7 +118,9 @@ extern const uint16_t battery_save_count_10ms;
|
||||
extern const uint16_t power_save1_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_2_10ms;
|
||||
@@ -121,12 +132,20 @@ 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_toggle_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_2_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_3_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_4_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_5_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_6_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_7_10ms;
|
||||
|
||||
//extern const uint16_t gMax_bat_v;
|
||||
//extern const uint16_t gMin_bat_v;
|
||||
|
||||
extern const uint8_t gMicGain_dB2[5];
|
||||
|
||||
@@ -139,6 +158,8 @@ extern bool gSetting_TX_EN;
|
||||
extern uint8_t gSetting_F_LOCK;
|
||||
extern bool gSetting_ScrambleEnable;
|
||||
|
||||
extern uint8_t gSetting_backlight_on_tx_rx;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
extern bool gSetting_AM_fix;
|
||||
#endif
|
||||
@@ -159,12 +180,7 @@ extern bool bHasCustomAesKey;
|
||||
extern uint32_t gChallenge[4];
|
||||
extern uint8_t gTryCount;
|
||||
|
||||
extern uint8_t gEEPROM_1EC0_0[8];
|
||||
extern uint8_t gEEPROM_1EC0_1[8];
|
||||
extern uint8_t gEEPROM_1EC0_2[8];
|
||||
extern uint8_t gEEPROM_1EC0_3[8];
|
||||
|
||||
extern uint16_t gEEPROM_RSSI_CALIB[2][4];
|
||||
extern uint16_t gEEPROM_RSSI_CALIB[7][4];
|
||||
|
||||
extern uint16_t gEEPROM_1F8A;
|
||||
extern uint16_t gEEPROM_1F8C;
|
||||
@@ -179,9 +195,10 @@ extern volatile bool gSchedulePowerSave;
|
||||
extern volatile bool gScheduleDualWatch;
|
||||
|
||||
extern volatile uint16_t gDualWatchCountdown_10ms;
|
||||
extern volatile bool gDualWatchCountdownExpired;
|
||||
extern bool gDualWatchActive;
|
||||
|
||||
extern volatile uint8_t gSerialConfigCountDown_500ms;
|
||||
|
||||
extern volatile bool gNextTimeslice_500ms;
|
||||
|
||||
extern volatile uint16_t gTxTimerCountdown_500ms;
|
||||
@@ -208,12 +225,16 @@ extern bool gEndOfRxDetectedMaybe;
|
||||
extern int16_t gVFO_RSSI[2];
|
||||
extern uint8_t gVFO_RSSI_bar_level[2];
|
||||
|
||||
// battery critical, limit functionality to minimum
|
||||
extern uint8_t gReducedService;
|
||||
extern uint8_t gBatteryVoltageIndex;
|
||||
|
||||
// if not equal CSS_SCAN_MODE_OFF we are scanning CTCSS/DCS
|
||||
// this is a scanning inside RX ctcss/dcs menu
|
||||
extern CssScanMode_t gCssScanMode;
|
||||
extern bool gUpdateRSSI;
|
||||
extern AlarmState_t gAlarmState;
|
||||
extern uint8_t gVoltageMenuCountdown;
|
||||
extern uint16_t gMenuCountdown;
|
||||
extern bool gPttWasReleased;
|
||||
extern bool gPttWasPressed;
|
||||
extern bool gFlagReconfigureVfos;
|
||||
@@ -227,68 +248,73 @@ extern bool gRequestSaveSettings;
|
||||
#endif
|
||||
extern uint8_t gKeypadLocked;
|
||||
extern bool gFlagPrepareTX;
|
||||
extern bool gFlagAcceptSetting;
|
||||
extern bool gFlagRefreshSetting;
|
||||
|
||||
extern bool gFlagAcceptSetting; // accept menu setting
|
||||
extern bool gFlagRefreshSetting; // refresh menu display
|
||||
|
||||
extern bool gFlagSaveVfo;
|
||||
extern bool gFlagSaveSettings;
|
||||
extern bool gFlagSaveChannel;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
extern bool gFlagSaveFM;
|
||||
#endif
|
||||
extern uint8_t gDTMF_RequestPending;
|
||||
extern bool g_CDCSS_Lost;
|
||||
extern uint8_t gCDCSSCodeType;
|
||||
extern bool g_CTCSS_Lost;
|
||||
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
|
||||
|
||||
// true means we are receiving signal
|
||||
extern bool g_SquelchLost;
|
||||
extern uint8_t gFlashLightState;
|
||||
extern bool gVOX_NoiseDetected;
|
||||
extern uint16_t gVoxResumeCountdown;
|
||||
extern uint16_t gVoxPauseCountdown;
|
||||
extern volatile uint16_t gFlashLightBlinkCounter;
|
||||
extern bool gFlagEndTransmission;
|
||||
extern uint16_t gLowBatteryCountdown;
|
||||
extern uint8_t gNextMrChannel;
|
||||
extern ReceptionMode_t gRxReceptionMode;
|
||||
extern uint8_t gRestoreMrChannel;
|
||||
extern uint8_t gCurrentScanList;
|
||||
extern uint8_t gPreviousMrChannel;
|
||||
extern uint32_t gRestoreFrequency;
|
||||
extern uint8_t gRxVfoIsActive;
|
||||
|
||||
//TRUE when dual watch is momentarly suspended and RX_VFO is locked to either last TX or RX
|
||||
extern bool gRxVfoIsActive;
|
||||
extern uint8_t gAlarmToneCounter;
|
||||
extern uint16_t gAlarmRunningCounter;
|
||||
extern bool gKeyBeingHeld;
|
||||
extern bool gPttIsPressed;
|
||||
extern uint8_t gPttDebounceCounter;
|
||||
extern uint8_t gMenuListCount;
|
||||
extern uint8_t gBackupCROSS_BAND_RX_TX;
|
||||
extern uint8_t gBackup_CROSS_BAND_RX_TX;
|
||||
extern uint8_t gScanDelay_10ms;
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
extern uint8_t gAircopySendCountdown;
|
||||
#endif
|
||||
extern uint8_t gFSKWriteIndex;
|
||||
extern uint8_t gNeverUsed;
|
||||
#ifdef ENABLE_NOAA
|
||||
extern bool gIsNoaaMode;
|
||||
extern uint8_t gNoaaChannel;
|
||||
#endif
|
||||
extern volatile bool gNextTimeslice;
|
||||
extern bool gUpdateDisplay;
|
||||
extern bool gF_LOCK;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
extern uint8_t gFM_ChannelPosition;
|
||||
#endif
|
||||
extern bool gF_LOCK;
|
||||
extern uint8_t gShowChPrefix;
|
||||
extern volatile uint8_t gFoundCDCSSCountdown_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;
|
||||
#ifdef ENABLE_NOAA
|
||||
extern volatile uint16_t gNOAACountdown_10ms;
|
||||
extern volatile bool gScheduleNOAA;
|
||||
#endif
|
||||
extern volatile bool gFlagTailNoteEliminationComplete;
|
||||
extern volatile uint8_t gVFOStateResumeCountdown_500ms;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
extern volatile bool gScheduleFM;
|
||||
#endif
|
||||
@@ -296,9 +322,8 @@ extern int16_t gCurrentRSSI[2]; // now one per VFO
|
||||
extern uint8_t gIsLocked;
|
||||
extern volatile uint8_t boot_counter_10ms;
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger);
|
||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits);
|
||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit);
|
||||
unsigned long StrToUL(const char * str);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
477
radio.c
@@ -97,12 +97,12 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i <= MR_CHANNEL_LAST; i++)
|
||||
for (i = 0; IS_MR_CHANNEL(i); i++)
|
||||
{
|
||||
if (Channel == 0xFF)
|
||||
Channel = MR_CHANNEL_LAST;
|
||||
else
|
||||
if (Channel > MR_CHANNEL_LAST)
|
||||
if (!IS_MR_CHANNEL(Channel))
|
||||
Channel = MR_CHANNEL_FIRST;
|
||||
|
||||
if (RADIO_CheckValidChannel(Channel, bCheckScanList, VFO))
|
||||
@@ -114,26 +114,23 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32_t Frequency)
|
||||
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency)
|
||||
{
|
||||
memset(pInfo, 0, sizeof(*pInfo));
|
||||
|
||||
pInfo->Band = Band;
|
||||
pInfo->SCANLIST1_PARTICIPATION = true;
|
||||
pInfo->SCANLIST2_PARTICIPATION = true;
|
||||
pInfo->STEP_SETTING = STEP_12_5kHz;
|
||||
pInfo->StepFrequency = 2500;
|
||||
pInfo->CHANNEL_SAVE = ChannelSave;
|
||||
pInfo->FrequencyReverse = false;
|
||||
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||
pInfo->freq_config_RX.Frequency = Frequency;
|
||||
pInfo->freq_config_TX.Frequency = Frequency;
|
||||
pInfo->pRX = &pInfo->freq_config_RX;
|
||||
pInfo->pTX = &pInfo->freq_config_TX;
|
||||
pInfo->TX_OFFSET_FREQUENCY = 1000000;
|
||||
#ifdef ENABLE_COMPANDER
|
||||
pInfo->Compander = 0; // off
|
||||
#endif
|
||||
pInfo->Band = FREQUENCY_GetBand(Frequency);
|
||||
pInfo->SCANLIST1_PARTICIPATION = true;
|
||||
pInfo->SCANLIST2_PARTICIPATION = true;
|
||||
pInfo->STEP_SETTING = STEP_12_5kHz;
|
||||
pInfo->StepFrequency = StepFrequencyTable[pInfo->STEP_SETTING];
|
||||
pInfo->CHANNEL_SAVE = ChannelSave;
|
||||
pInfo->FrequencyReverse = false;
|
||||
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||
pInfo->freq_config_RX.Frequency = Frequency;
|
||||
pInfo->freq_config_TX.Frequency = Frequency;
|
||||
pInfo->pRX = &pInfo->freq_config_RX;
|
||||
pInfo->pTX = &pInfo->freq_config_TX;
|
||||
pInfo->Compander = 0; // off
|
||||
|
||||
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
||||
pInfo->AM_mode = 1;
|
||||
@@ -164,20 +161,20 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
|
||||
if (IS_VALID_CHANNEL(Channel))
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (Channel >= NOAA_CHANNEL_FIRST)
|
||||
{
|
||||
RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], 2, NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]);
|
||||
#ifdef ENABLE_NOAA
|
||||
if (Channel >= NOAA_CHANNEL_FIRST)
|
||||
{
|
||||
RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]);
|
||||
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
return;
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
|
||||
gUpdateStatus = true;
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
{
|
||||
@@ -211,7 +208,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
|
||||
Index = Channel - FREQ_CHANNEL_FIRST;
|
||||
|
||||
RADIO_InitInfo(pRadio, Channel, Index, LowerLimitFrequencyBandTable[Index]);
|
||||
RADIO_InitInfo(pRadio, Channel, frequencyBandTable[Index].lower);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -219,7 +216,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
if (Band > BAND7_470MHz)
|
||||
{
|
||||
Band = BAND6_400MHz;
|
||||
// Band = FREQUENCY_GetBand(gEeprom.ScreenChannel[VFO]); // 1of11 bug fix, or have I broke it ?
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
@@ -336,16 +332,16 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
if (Data[5] == 0xFF)
|
||||
{
|
||||
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false;
|
||||
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = 0;
|
||||
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = !!((Data[5] >> 0) & 1u);
|
||||
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = ((Data[5] >> 1) & 3u);
|
||||
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = ((Data[5] >> 0) & 1u) ? true : false;
|
||||
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = ((Data[5] >> 1) & 7u);
|
||||
}
|
||||
|
||||
// ***************
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t Frequency;
|
||||
@@ -365,27 +361,24 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
|
||||
Frequency = pRadio->freq_config_RX.Frequency;
|
||||
|
||||
#if 1
|
||||
// fix previously set incorrect band
|
||||
Band = FREQUENCY_GetBand(Frequency);
|
||||
#endif
|
||||
|
||||
if (Frequency < LowerLimitFrequencyBandTable[Band])
|
||||
Frequency = LowerLimitFrequencyBandTable[Band];
|
||||
if (Frequency < frequencyBandTable[Band].lower)
|
||||
Frequency = frequencyBandTable[Band].lower;
|
||||
else
|
||||
if (Frequency > UpperLimitFrequencyBandTable[Band])
|
||||
Frequency = UpperLimitFrequencyBandTable[Band];
|
||||
if (Frequency > frequencyBandTable[Band].upper)
|
||||
Frequency = frequencyBandTable[Band].upper;
|
||||
else
|
||||
if (Channel >= FREQ_CHANNEL_FIRST)
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, LowerLimitFrequencyBandTable[Band]);
|
||||
Frequency = FREQUENCY_RoundToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency);
|
||||
|
||||
pRadio->freq_config_RX.Frequency = Frequency;
|
||||
|
||||
if (Frequency >= 10800000 && Frequency < 13600000)
|
||||
if (Frequency >= frequencyBandTable[BAND2_108MHz].upper && Frequency < frequencyBandTable[BAND2_108MHz].upper)
|
||||
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
||||
else
|
||||
if (!IS_MR_CHANNEL(Channel))
|
||||
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency, 0);
|
||||
else if (!IS_MR_CHANNEL(Channel))
|
||||
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_RoundToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency);
|
||||
|
||||
RADIO_ApplyOffset(pRadio);
|
||||
|
||||
@@ -422,9 +415,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
||||
#endif
|
||||
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
||||
}
|
||||
@@ -432,23 +423,27 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
{
|
||||
uint8_t Txp[3];
|
||||
FREQUENCY_Band_t Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
|
||||
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
||||
FREQUENCY_Band_t Band;
|
||||
|
||||
// *******************************
|
||||
// squelch
|
||||
|
||||
Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
|
||||
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
||||
|
||||
if (gEeprom.SQUELCH_LEVEL == 0)
|
||||
{
|
||||
pInfo->SquelchOpenRSSIThresh = 0;
|
||||
pInfo->SquelchOpenNoiseThresh = 127;
|
||||
pInfo->SquelchCloseGlitchThresh = 255;
|
||||
{ // squelch == 0 (off)
|
||||
pInfo->SquelchOpenRSSIThresh = 0; // 0 ~ 255
|
||||
pInfo->SquelchOpenNoiseThresh = 127; // 127 ~ 0
|
||||
pInfo->SquelchCloseGlitchThresh = 255; // 255 ~ 0
|
||||
|
||||
pInfo->SquelchCloseRSSIThresh = 0;
|
||||
pInfo->SquelchCloseNoiseThresh = 127;
|
||||
pInfo->SquelchOpenGlitchThresh = 255;
|
||||
pInfo->SquelchCloseRSSIThresh = 0; // 0 ~ 255
|
||||
pInfo->SquelchCloseNoiseThresh = 127; // 127 ~ 0
|
||||
pInfo->SquelchOpenGlitchThresh = 255; // 255 ~ 0
|
||||
}
|
||||
else
|
||||
{
|
||||
Base += gEeprom.SQUELCH_LEVEL;
|
||||
// my squelch-1
|
||||
{ // squelch >= 1
|
||||
Base += gEeprom.SQUELCH_LEVEL; // my eeprom squelch-1
|
||||
// VHF UHF
|
||||
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
|
||||
EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1); // 40 5
|
||||
@@ -459,53 +454,90 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
|
||||
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
|
||||
|
||||
#if ENABLE_SQUELCH1_LOWER
|
||||
// make squelch-1 more sensitive
|
||||
if (gEeprom.SQUELCH_LEVEL == 1)
|
||||
{
|
||||
if (Band < BAND4_174MHz)
|
||||
{
|
||||
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 11) / 12;
|
||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 9) / 10;
|
||||
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;
|
||||
|
||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 10) / 9;
|
||||
#if ENABLE_SQUELCH_MORE_SENSITIVE
|
||||
// make squelch a little more sensitive
|
||||
//
|
||||
// getting the best setting here is still experimental, bare with me
|
||||
//
|
||||
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
||||
|
||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 10) / 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 3) / 4;
|
||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 9) / 10;
|
||||
#if 0
|
||||
rssi_open = (rssi_open * 8) / 9;
|
||||
noise_open = (noise_open * 9) / 8;
|
||||
glitch_open = (glitch_open * 9) / 8;
|
||||
#else
|
||||
// even more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
||||
rssi_open = (rssi_open * 1) / 2;
|
||||
noise_open = (noise_open * 2) / 1;
|
||||
glitch_open = (glitch_open * 2) / 1;
|
||||
#endif
|
||||
|
||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 4) / 3;
|
||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 10) / 9;
|
||||
|
||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 4) / 3;
|
||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 10) / 9;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
||||
rssi_open = (rssi_open * 3) / 4;
|
||||
noise_open = (noise_open * 4) / 3;
|
||||
glitch_open = (glitch_open * 4) / 3;
|
||||
#endif
|
||||
|
||||
if (pInfo->SquelchOpenNoiseThresh > 127)
|
||||
pInfo->SquelchOpenNoiseThresh = 127;
|
||||
if (pInfo->SquelchCloseNoiseThresh > 127)
|
||||
pInfo->SquelchCloseNoiseThresh = 127;
|
||||
rssi_close = (rssi_open * 9) / 10;
|
||||
noise_close = (noise_open * 10) / 9;
|
||||
glitch_close = (glitch_open * 10) / 9;
|
||||
|
||||
// ensure the 'close' threshold is lower than the 'open' threshold
|
||||
if (rssi_close == rssi_open && rssi_close >= 2)
|
||||
rssi_close -= 2;
|
||||
if (noise_close == noise_open && noise_close <= 125)
|
||||
noise_close += 2;
|
||||
if (glitch_close == glitch_open && glitch_close <= 253)
|
||||
glitch_close += 2;
|
||||
|
||||
pInfo->SquelchOpenRSSIThresh = (rssi_open > 255) ? 255 : rssi_open;
|
||||
pInfo->SquelchCloseRSSIThresh = (rssi_close > 255) ? 255 : rssi_close;
|
||||
pInfo->SquelchOpenNoiseThresh = (noise_open > 127) ? 127 : noise_open;
|
||||
pInfo->SquelchCloseNoiseThresh = (noise_close > 127) ? 127 : noise_close;
|
||||
pInfo->SquelchOpenGlitchThresh = (glitch_open > 255) ? 255 : glitch_open;
|
||||
pInfo->SquelchCloseGlitchThresh = (glitch_close > 255) ? 255 : glitch_close;
|
||||
}
|
||||
|
||||
// *******************************
|
||||
// output power
|
||||
|
||||
Band = FREQUENCY_GetBand(pInfo->pTX->Frequency);
|
||||
|
||||
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->OUTPUT_POWER * 3), Txp, 3);
|
||||
|
||||
|
||||
#ifdef ENABLE_REDUCE_LOW_MID_TX_POWER
|
||||
// make low and mid even lower
|
||||
if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) {
|
||||
Txp[0] /= 5;
|
||||
Txp[1] /= 5;
|
||||
Txp[2] /= 5;
|
||||
}
|
||||
else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_MID){
|
||||
Txp[0] /= 3;
|
||||
Txp[1] /= 3;
|
||||
Txp[2] /= 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
pInfo->TXP_CalculatedSetting = FREQUENCY_CalculateOutputPower(
|
||||
Txp[0],
|
||||
Txp[1],
|
||||
Txp[2],
|
||||
LowerLimitFrequencyBandTable[Band],
|
||||
MiddleFrequencyBandTable[Band],
|
||||
UpperLimitFrequencyBandTable[Band],
|
||||
frequencyBandTable[Band].lower,
|
||||
(frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2,
|
||||
frequencyBandTable[Band].upper,
|
||||
pInfo->pTX->Frequency);
|
||||
|
||||
// *******************************
|
||||
}
|
||||
|
||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||
@@ -524,87 +556,68 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// limit to 50MHz to 600MHz
|
||||
if (Frequency < 5000000)
|
||||
Frequency = 5000000;
|
||||
else
|
||||
if (Frequency > 60000000)
|
||||
Frequency = 60000000;
|
||||
#else
|
||||
if (Frequency < LowerLimitFrequencyBandTable[0])
|
||||
Frequency = LowerLimitFrequencyBandTable[0];
|
||||
else
|
||||
if (Frequency > UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1])
|
||||
Frequency = UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1];
|
||||
#endif
|
||||
if (Frequency < frequencyBandTable[0].lower)
|
||||
Frequency = frequencyBandTable[0].lower;
|
||||
else
|
||||
if (Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||
Frequency = frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper;
|
||||
|
||||
pInfo->freq_config_TX.Frequency = Frequency;
|
||||
}
|
||||
|
||||
static void RADIO_SelectCurrentVfo(void)
|
||||
{
|
||||
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gRxVfo : &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
// if crossband is active and DW not the gCurrentVfo is gTxVfo (gTxVfo/TX_VFO is only ever changed by the user)
|
||||
// otherwise it is set to gRxVfo which is set to gTxVfo in RADIO_SelectVfos
|
||||
// so in the end gCurrentVfo is equal to gTxVfo unless dual watch changes it on incomming transmition (again, this can only happen when XB off)
|
||||
// note: it is called only in certain situations so could be not up-to-date
|
||||
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gRxVfo : gTxVfo;
|
||||
}
|
||||
|
||||
void RADIO_SelectVfos(void)
|
||||
{
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||
gEeprom.TX_CHANNEL = 1;
|
||||
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 crossband without DW is used then RX_VFO is the opposite to the TX_VFO
|
||||
gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gEeprom.TX_VFO : !gEeprom.TX_VFO;
|
||||
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
||||
else
|
||||
gEeprom.RX_CHANNEL = (gEeprom.TX_CHANNEL == 0) ? 1 : 0;
|
||||
|
||||
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
||||
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||
|
||||
RADIO_SelectCurrentVfo();
|
||||
}
|
||||
|
||||
void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
void RADIO_SetupRegisters(bool switchToForeground)
|
||||
{
|
||||
BK4819_FilterBandwidth_t Bandwidth;
|
||||
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||
uint16_t InterruptMask;
|
||||
uint32_t Frequency;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
gEnableSpeaker = false;
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||
|
||||
Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||
switch (Bandwidth)
|
||||
{
|
||||
default:
|
||||
Bandwidth = BK4819_FILTER_BW_WIDE;
|
||||
[[fallthrough]];
|
||||
case BK4819_FILTER_BW_WIDE:
|
||||
case BK4819_FILTER_BW_NARROW:
|
||||
#ifdef ENABLE_AM_FIX
|
||||
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||
#else
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -621,7 +634,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
BK4819_WriteRegister(BK4819_REG_7D, 0xE940 | (gEeprom.MIC_SENSITIVITY_TUNING & 0x1f));
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) || !gIsNoaaMode)
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) || !gIsNoaaMode)
|
||||
Frequency = gRxVfo->pRX->Frequency;
|
||||
else
|
||||
Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
@@ -637,7 +650,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
|
||||
// what does this in do ?
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, true);
|
||||
|
||||
// AF RX Gain and DAC
|
||||
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8); // 1011 00 111010 1000
|
||||
@@ -645,11 +659,11 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
InterruptMask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#endif
|
||||
{
|
||||
if (gRxVfo->AM_mode == 0)
|
||||
{
|
||||
{ // FM
|
||||
uint8_t CodeType = gSelectedCodeType;
|
||||
uint8_t Code = gSelectedCode;
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
@@ -721,35 +735,32 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||
#ifdef ENABLE_VOX
|
||||
#ifdef ENABLE_NOAA
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && !IS_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||
#else
|
||||
if (gEeprom.VOX_SWITCH && !IS_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||
#endif
|
||||
#else
|
||||
if (gEeprom.VOX_SWITCH && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||
#endif
|
||||
#else
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && gCurrentVfo->AM_mode == 0)
|
||||
#else
|
||||
if (gEeprom.VOX_SWITCH && gCurrentVfo->AM_mode == 0)
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && gCurrentVfo->AM_mode == 0)
|
||||
#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
|
||||
{
|
||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
||||
}
|
||||
else
|
||||
BK4819_DisableVox();
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
// RX expander
|
||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
|
||||
#endif
|
||||
// RX expander
|
||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
|
||||
|
||||
#if 0
|
||||
// there's no reason the DTMF decoder can't be used in AM RX mode too
|
||||
// aircraft comms use it on HF (AM and SSB)
|
||||
// if (gRxVfo->AM_mode || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED))
|
||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||
{
|
||||
BK4819_DisableDTMF();
|
||||
@@ -760,8 +771,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||
}
|
||||
#else
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT && gSetting_live_DTMF_decoder)
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
BK4819_DisableDTMF();
|
||||
BK4819_EnableDTMF();
|
||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||
}
|
||||
@@ -776,7 +788,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
FUNCTION_Init();
|
||||
|
||||
if (bSwitchToFunction0)
|
||||
if (switchToForeground)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
}
|
||||
|
||||
@@ -791,9 +803,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
{
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
|
||||
if (!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
|
||||
{
|
||||
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||
if (!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||
{
|
||||
gIsNoaaMode = false;
|
||||
return;
|
||||
@@ -827,24 +839,24 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
void RADIO_SetTxParameters(void)
|
||||
{
|
||||
BK4819_FilterBandwidth_t Bandwidth;
|
||||
BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
gEnableSpeaker = false;
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, false);
|
||||
|
||||
Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
||||
switch (Bandwidth)
|
||||
{
|
||||
default:
|
||||
Bandwidth = BK4819_FILTER_BW_WIDE;
|
||||
[[fallthrough]];
|
||||
case BK4819_FILTER_BW_WIDE:
|
||||
case BK4819_FILTER_BW_NARROW:
|
||||
#ifdef ENABLE_AM_FIX
|
||||
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||
#else
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
#endif
|
||||
@@ -853,10 +865,8 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
// TX compressor
|
||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
||||
#endif
|
||||
// TX compressor
|
||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
||||
|
||||
BK4819_PrepareTransmit();
|
||||
|
||||
@@ -864,7 +874,7 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(gCurrentVfo->pTX->Frequency);
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, true);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
|
||||
|
||||
SYSTEM_DelayMs(5);
|
||||
|
||||
@@ -885,9 +895,7 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
BK4819_SetCDCSSCodeWord(
|
||||
DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code)
|
||||
);
|
||||
BK4819_SetCDCSSCodeWord(DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -898,10 +906,7 @@ void RADIO_SetVfoState(VfoState_t State)
|
||||
{
|
||||
VfoState[0] = VFO_STATE_NORMAL;
|
||||
VfoState[1] = VFO_STATE_NORMAL;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFM_ResumeCountdown_500ms = 0;
|
||||
#endif
|
||||
gVFOStateResumeCountdown_500ms = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -911,14 +916,12 @@ void RADIO_SetVfoState(VfoState_t State)
|
||||
VfoState[1] = VFO_STATE_TX_DISABLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint8_t Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
||||
VfoState[Channel] = State;
|
||||
{ // 1of11
|
||||
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
VfoState[vfo] = State;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFM_ResumeCountdown_500ms = fm_resume_countdown_500ms;
|
||||
#endif
|
||||
gVFOStateResumeCountdown_500ms = vfo_state_resume_countdown_500ms;
|
||||
}
|
||||
|
||||
gUpdateDisplay = true;
|
||||
@@ -935,10 +938,10 @@ void RADIO_PrepareTX(void)
|
||||
gScheduleDualWatch = false;
|
||||
|
||||
if (!gRxVfoIsActive)
|
||||
{
|
||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
gRxVfoIsActive = true;
|
||||
{ // use the current RX vfo
|
||||
gEeprom.RX_VFO = gEeprom.TX_VFO;
|
||||
gRxVfo = gTxVfo;
|
||||
gRxVfoIsActive = true;
|
||||
}
|
||||
|
||||
// let the user see that DW is not active
|
||||
@@ -948,10 +951,16 @@ void RADIO_PrepareTX(void)
|
||||
|
||||
RADIO_SelectCurrentVfo();
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750)
|
||||
if (gAlarmState == ALARM_STATE_OFF ||
|
||||
gAlarmState == ALARM_STATE_TX1750 ||
|
||||
(gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE))
|
||||
#elif defined(ENABLE_ALARM)
|
||||
if (gAlarmState == ALARM_STATE_OFF ||
|
||||
(gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE))
|
||||
#elif defined(ENABLE_TX1750)
|
||||
if (gAlarmState == ALARM_STATE_OFF ||
|
||||
gAlarmState == ALARM_STATE_TX1750)
|
||||
#endif
|
||||
{
|
||||
#ifndef ENABLE_TX_WHEN_AM
|
||||
@@ -961,13 +970,12 @@ void RADIO_PrepareTX(void)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!gSetting_TX_EN)
|
||||
{ // TX is disabled
|
||||
if (!gSetting_TX_EN || gSerialConfigCountDown_500ms > 0)
|
||||
{ // TX is disabled or config upload/download in progress
|
||||
State = VFO_STATE_TX_DISABLE;
|
||||
}
|
||||
else
|
||||
//if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST)
|
||||
if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0)
|
||||
if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0)
|
||||
{ // TX frequency is allowed
|
||||
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
|
||||
State = VFO_STATE_BUSY; // busy RX'ing a station
|
||||
@@ -975,8 +983,7 @@ void RADIO_PrepareTX(void)
|
||||
if (gBatteryDisplayLevel == 0)
|
||||
State = VFO_STATE_BAT_LOW; // charge your battery !
|
||||
else
|
||||
//if (gBatteryDisplayLevel >= 6)
|
||||
if (gBatteryDisplayLevel >= 11) // I've increased the battery level bar resolution
|
||||
if (gBatteryDisplayLevel >= 6)
|
||||
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
|
||||
}
|
||||
else
|
||||
@@ -986,16 +993,19 @@ void RADIO_PrepareTX(void)
|
||||
if (State != VFO_STATE_NORMAL)
|
||||
{ // TX not allowed
|
||||
RADIO_SetVfoState(State);
|
||||
#ifdef ENABLE_ALARM
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
gAlarmState = ALARM_STATE_OFF;
|
||||
#endif
|
||||
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
return;
|
||||
}
|
||||
|
||||
// TX is allowed
|
||||
|
||||
|
||||
if (gDTMF_ReplyState == DTMF_REPLY_ANI)
|
||||
{
|
||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||
@@ -1014,15 +1024,18 @@ void RADIO_PrepareTX(void)
|
||||
FUNCTION_Select(FUNCTION_TRANSMIT);
|
||||
|
||||
gTxTimerCountdown_500ms = 0; // no timeout
|
||||
#ifdef ENABLE_ALARM
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (gAlarmState == ALARM_STATE_OFF)
|
||||
#endif
|
||||
{
|
||||
if (gEeprom.TX_TIMEOUT_TIMER == 1)
|
||||
if (gEeprom.TX_TIMEOUT_TIMER == 0)
|
||||
gTxTimerCountdown_500ms = 60; // 30 sec
|
||||
else
|
||||
if (gEeprom.TX_TIMEOUT_TIMER >= 2)
|
||||
gTxTimerCountdown_500ms = (gEeprom.TX_TIMEOUT_TIMER - 1) * 120; // minutes
|
||||
if (gEeprom.TX_TIMEOUT_TIMER < (ARRAY_SIZE(gSubMenu_TOT) - 1))
|
||||
gTxTimerCountdown_500ms = 120 * gEeprom.TX_TIMEOUT_TIMER; // minutes
|
||||
else
|
||||
gTxTimerCountdown_500ms = 120 * 15; // 15 minutes
|
||||
}
|
||||
gTxTimeoutReached = false;
|
||||
|
||||
@@ -1033,23 +1046,17 @@ void RADIO_PrepareTX(void)
|
||||
|
||||
void RADIO_EnableCxCSS(void)
|
||||
{
|
||||
switch (gCurrentVfo->pTX->CodeType)
|
||||
{
|
||||
default:
|
||||
case CODE_TYPE_OFF:
|
||||
break;
|
||||
|
||||
case CODE_TYPE_CONTINUOUS_TONE:
|
||||
BK4819_EnableCTCSS();
|
||||
SYSTEM_DelayMs(200);
|
||||
break;
|
||||
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
BK4819_EnableCDCSS();
|
||||
SYSTEM_DelayMs(200);
|
||||
break;
|
||||
switch (gCurrentVfo->pTX->CodeType) {
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
BK4819_EnableCDCSS();
|
||||
break;
|
||||
default:
|
||||
BK4819_EnableCTCSS();
|
||||
break;
|
||||
}
|
||||
|
||||
SYSTEM_DelayMs(200);
|
||||
}
|
||||
|
||||
void RADIO_PrepareCssTX(void)
|
||||
@@ -1070,11 +1077,16 @@ void RADIO_SendEndOfTransmission(void)
|
||||
if (gEeprom.ROGER == ROGER_MODE_MDC)
|
||||
BK4819_PlayRogerMDC();
|
||||
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE && (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_EOT || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
|
||||
{
|
||||
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
||||
BK4819_PlaySingleTone(2475, 250, 28, gEeprom.DTMF_SIDE_TONE);
|
||||
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||
(gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
|
||||
{ // end-of-tx
|
||||
if (gEeprom.DTMF_SIDE_TONE)
|
||||
{
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
AUDIO_AudioPathOn();
|
||||
gEnableSpeaker = true;
|
||||
SYSTEM_DelayMs(60);
|
||||
}
|
||||
@@ -1082,15 +1094,14 @@ void RADIO_SendEndOfTransmission(void)
|
||||
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
||||
|
||||
BK4819_PlayDTMFString(
|
||||
gEeprom.DTMF_DOWN_CODE,
|
||||
0,
|
||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_CODE_INTERVAL_TIME);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
gEeprom.DTMF_DOWN_CODE,
|
||||
0,
|
||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_CODE_INTERVAL_TIME);
|
||||
|
||||
AUDIO_AudioPathOff();
|
||||
gEnableSpeaker = false;
|
||||
}
|
||||
|
||||
|
||||
63
radio.h
@@ -21,12 +21,11 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "dcs.h"
|
||||
#include "frequencies.h"
|
||||
|
||||
enum {
|
||||
MR_CH_BAND_MASK = 0x0F << 0,
|
||||
#ifdef ENABLE_COMPANDER
|
||||
MR_CH_COMPAND = 3u << 4, // new
|
||||
#endif
|
||||
MR_CH_COMPAND = 3u << 4, // new
|
||||
MR_CH_SCANLIST2 = 1u << 6,
|
||||
MR_CH_SCANLIST1 = 1u << 7
|
||||
};
|
||||
@@ -42,40 +41,14 @@ enum {
|
||||
};
|
||||
|
||||
enum PTT_ID_t {
|
||||
PTT_ID_OFF = 0,
|
||||
PTT_ID_BOT,
|
||||
PTT_ID_EOT,
|
||||
PTT_ID_BOTH
|
||||
PTT_ID_OFF = 0, // OFF
|
||||
PTT_ID_TX_UP, // BEGIN OF TX
|
||||
PTT_ID_TX_DOWN, // END OF TX
|
||||
PTT_ID_BOTH, // BOTH
|
||||
PTT_ID_APOLLO // Apolo quindar tones
|
||||
};
|
||||
|
||||
typedef enum PTT_ID_t PTT_ID_t;
|
||||
|
||||
#if 0
|
||||
enum STEP_Setting_t
|
||||
{
|
||||
STEP_2_5kHz,
|
||||
STEP_5_0kHz,
|
||||
STEP_6_25kHz,
|
||||
STEP_10_0kHz,
|
||||
STEP_12_5kHz,
|
||||
STEP_25_0kHz,
|
||||
STEP_8_33kHz
|
||||
};
|
||||
#else
|
||||
enum STEP_Setting_t
|
||||
{
|
||||
STEP_1_25kHz,
|
||||
STEP_2_5kHz,
|
||||
STEP_6_25kHz,
|
||||
STEP_10_0kHz,
|
||||
STEP_12_5kHz,
|
||||
STEP_25_0kHz,
|
||||
STEP_8_33kHz
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef enum STEP_Setting_t STEP_Setting_t;
|
||||
|
||||
enum VfoState_t
|
||||
{
|
||||
VFO_STATE_NORMAL = 0,
|
||||
@@ -86,7 +59,6 @@ enum VfoState_t
|
||||
VFO_STATE_ALARM,
|
||||
VFO_STATE_VOLTAGE_HIGH
|
||||
};
|
||||
|
||||
typedef enum VfoState_t VfoState_t;
|
||||
|
||||
typedef struct
|
||||
@@ -101,7 +73,14 @@ typedef struct VFO_Info_t
|
||||
{
|
||||
FREQ_Config_t freq_config_RX;
|
||||
FREQ_Config_t freq_config_TX;
|
||||
|
||||
// this is for a purpose of the FrequencyReverse function
|
||||
// it points to freq_config_RX normally and to freq_config_TX if reverse function is active
|
||||
//
|
||||
FREQ_Config_t *pRX;
|
||||
|
||||
// this is for a purpose of the FrequencyReverse function
|
||||
// it points to freq_config_TX normally and to freq_config_RX if reverse function is active
|
||||
FREQ_Config_t *pTX;
|
||||
|
||||
uint32_t TX_OFFSET_FREQUENCY;
|
||||
@@ -138,15 +117,21 @@ typedef struct VFO_Info_t
|
||||
|
||||
uint8_t AM_mode;
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
uint8_t Compander;
|
||||
#endif
|
||||
uint8_t Compander;
|
||||
|
||||
char Name[16];
|
||||
} VFO_Info_t;
|
||||
|
||||
// Settings of the main VFO that is selected by the user
|
||||
// The pointer follows gEeprom.RX_VFO index
|
||||
extern VFO_Info_t *gTxVfo;
|
||||
|
||||
// Settings of the actual VFO that is now used for RX,
|
||||
// It is being alternated by dual watch, and flipped by crossband
|
||||
// The pointer follows gEeprom.RX_VFO
|
||||
extern VFO_Info_t *gRxVfo;
|
||||
|
||||
// Equal to gTxVfo unless dual watch changes it on incomming transmition (this can only happen when XB off and DW on)
|
||||
extern VFO_Info_t *gCurrentVfo;
|
||||
|
||||
extern DCS_CodeType_t gSelectedCodeType;
|
||||
@@ -159,7 +144,7 @@ extern VfoState_t VfoState[2];
|
||||
|
||||
bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum);
|
||||
uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum);
|
||||
void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t ChIndex, uint32_t Frequency);
|
||||
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency);
|
||||
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure);
|
||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
||||
|
||||
13
scheduler.c
@@ -57,6 +57,7 @@ void SystickHandler(void)
|
||||
gNextTimeslice_500ms = true;
|
||||
|
||||
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
||||
DECREMENT(gSerialConfigCountDown_500ms);
|
||||
}
|
||||
|
||||
if ((gGlobalSysTickCounter & 3) == 0)
|
||||
@@ -76,20 +77,20 @@ void SystickHandler(void)
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
DECREMENT_AND_TRIGGER(gPowerSave_10ms, gPowerSaveCountdownExpired);
|
||||
|
||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
|
||||
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch);
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
||||
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
||||
if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE)
|
||||
DECREMENT_AND_TRIGGER(gNOAA_Countdown_10ms, gScheduleNOAA);
|
||||
#endif
|
||||
|
||||
if (gScanState != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING)
|
||||
if (gScanStateDir != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING)
|
||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
DECREMENT_AND_TRIGGER(ScanPauseDelayIn_10ms, gScheduleScanListen);
|
||||
DECREMENT_AND_TRIGGER(gScanPauseDelayIn_10ms, gScheduleScanListen);
|
||||
|
||||
DECREMENT_AND_TRIGGER(gTailNoteEliminationCountdown_10ms, gFlagTailNoteEliminationComplete);
|
||||
|
||||
@@ -103,7 +104,9 @@ void SystickHandler(void)
|
||||
DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM);
|
||||
#endif
|
||||
|
||||
DECREMENT(gVoxStopCountdown_10ms);
|
||||
#ifdef ENABLE_VOX
|
||||
DECREMENT(gVoxStopCountdown_10ms);
|
||||
#endif
|
||||
|
||||
DECREMENT(boot_counter_10ms);
|
||||
}
|
||||
|
||||
82
settings.c
@@ -86,22 +86,28 @@ void SETTINGS_SaveSettings(void)
|
||||
State[3] = false;
|
||||
#endif
|
||||
State[4] = gEeprom.KEY_LOCK;
|
||||
State[5] = gEeprom.VOX_SWITCH;
|
||||
State[6] = gEeprom.VOX_LEVEL;
|
||||
#ifdef ENABLE_VOX
|
||||
State[5] = gEeprom.VOX_SWITCH;
|
||||
State[6] = gEeprom.VOX_LEVEL;
|
||||
#else
|
||||
State[5] = false;
|
||||
State[6] = 0;
|
||||
#endif
|
||||
State[7] = gEeprom.MIC_SENSITIVITY;
|
||||
EEPROM_WriteBuffer(0x0E70, State);
|
||||
|
||||
State[0] = 0xFF;
|
||||
State[0] = (gEeprom.BACKLIGHT_MIN << 4) + gEeprom.BACKLIGHT_MAX;
|
||||
State[1] = gEeprom.CHANNEL_DISPLAY_MODE;
|
||||
State[2] = gEeprom.CROSS_BAND_RX_TX;
|
||||
State[3] = gEeprom.BATTERY_SAVE;
|
||||
State[4] = gEeprom.DUAL_WATCH;
|
||||
State[5] = gEeprom.BACKLIGHT;
|
||||
State[6] = gEeprom.TAIL_NOTE_ELIMINATION;
|
||||
State[5] = gEeprom.BACKLIGHT_TIME;
|
||||
State[6] = gEeprom.TAIL_TONE_ELIMINATION;
|
||||
State[7] = gEeprom.VFO_OPEN;
|
||||
EEPROM_WriteBuffer(0x0E78, State);
|
||||
|
||||
State[0] = gEeprom.BEEP_CONTROL;
|
||||
State[0] |= gEeprom.KEY_M_LONG_PRESS_ACTION << 1;
|
||||
State[1] = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
||||
State[2] = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
||||
State[3] = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
||||
@@ -112,30 +118,33 @@ void SETTINGS_SaveSettings(void)
|
||||
EEPROM_WriteBuffer(0x0E90, State);
|
||||
|
||||
memset(Password, 0xFF, sizeof(Password));
|
||||
Password[0] = gEeprom.POWER_ON_PASSWORD;
|
||||
EEPROM_WriteBuffer(0x0E98, State);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
memset(State, 0xFF, sizeof(State));
|
||||
State[0] = gEeprom.VOICE_PROMPT;
|
||||
EEPROM_WriteBuffer(0x0EA0, State);
|
||||
#ifdef ENABLE_PWRON_PASSWORD
|
||||
Password[0] = gEeprom.POWER_ON_PASSWORD;
|
||||
#endif
|
||||
EEPROM_WriteBuffer(0x0E98, Password);
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
memset(State, 0xFF, sizeof(State));
|
||||
#ifdef ENABLE_VOICE
|
||||
State[0] = gEeprom.VOICE_PROMPT;
|
||||
EEPROM_WriteBuffer(0x0EA0, State);
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
State[0] = gEeprom.ALARM_MODE;
|
||||
#else
|
||||
State[0] = false;
|
||||
#endif
|
||||
State[1] = gEeprom.ROGER;
|
||||
State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION;
|
||||
State[3] = gEeprom.TX_CHANNEL;
|
||||
State[3] = gEeprom.TX_VFO;
|
||||
State[4] = gEeprom.BATTERY_TYPE;
|
||||
EEPROM_WriteBuffer(0x0EA8, State);
|
||||
|
||||
State[0] = gEeprom.DTMF_SIDE_TONE;
|
||||
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
||||
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
||||
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[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
||||
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
||||
@@ -174,17 +183,15 @@ void SETTINGS_SaveSettings(void)
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
|
||||
#endif
|
||||
State[7] = (State[7] & ~(3u << 6)) | ((gSetting_backlight_on_tx_rx & 3u) << 6);
|
||||
|
||||
EEPROM_WriteBuffer(0x0F40, State);
|
||||
}
|
||||
|
||||
void SETTINGS_LoadChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO)
|
||||
{
|
||||
}
|
||||
|
||||
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
||||
if (!IS_NOAA_CHANNEL(Channel))
|
||||
#endif
|
||||
{
|
||||
const uint16_t OffsetMR = Channel * 16;
|
||||
@@ -214,7 +221,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
||||
| (pVFO->OUTPUT_POWER << 2)
|
||||
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
||||
| (pVFO->FrequencyReverse << 0);
|
||||
State[5] = (pVFO->DTMF_PTT_ID_TX_MODE << 1) | (pVFO->DTMF_DECODING_ENABLE < 0);
|
||||
State[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1) | ((pVFO->DTMF_DECODING_ENABLE & 1u) << 0);
|
||||
State[6] = pVFO->STEP_SETTING;
|
||||
State[7] = pVFO->SCRAMBLING_TYPE;
|
||||
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
||||
@@ -222,8 +229,9 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
||||
SETTINGS_UpdateChannel(Channel, pVFO, true);
|
||||
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
{
|
||||
#ifndef KEEP_MEM_NAME
|
||||
{ // it's a memory channel
|
||||
|
||||
#ifndef ENABLE_KEEP_MEM_NAME
|
||||
// clear/reset the channel name
|
||||
//memset(&State, 0xFF, sizeof(State));
|
||||
memset(&State, 0x00, sizeof(State)); // follow the QS way
|
||||
@@ -245,28 +253,33 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
||||
}
|
||||
}
|
||||
|
||||
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration)
|
||||
{
|
||||
uint16_t buf[4];
|
||||
EEPROM_WriteBuffer(0x1F40, batteryCalibration);
|
||||
EEPROM_ReadBuffer( 0x1F48, buf, sizeof(buf));
|
||||
buf[0] = batteryCalibration[4];
|
||||
buf[1] = batteryCalibration[5];
|
||||
EEPROM_WriteBuffer(0x1F48, buf);
|
||||
}
|
||||
|
||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
||||
if (!IS_NOAA_CHANNEL(Channel))
|
||||
#endif
|
||||
{
|
||||
uint8_t State[8];
|
||||
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);
|
||||
|
||||
Attributes &= (uint8_t)(~MR_CH_COMPAND); // default to '0' = compander disabled
|
||||
|
||||
EEPROM_ReadBuffer(Offset, State, sizeof(State));
|
||||
|
||||
if (keep)
|
||||
{
|
||||
#ifdef ENABLE_COMPANDER
|
||||
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
|
||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Compander << 4) | (pVFO->Band << 0);
|
||||
if (State[Channel & 7u] == Attributes)
|
||||
return; // no change in the attributes
|
||||
}
|
||||
@@ -277,9 +290,10 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
||||
|
||||
gMR_ChannelAttributes[Channel] = Attributes;
|
||||
|
||||
// #ifndef KEEP_MEM_NAME
|
||||
// #ifndef ENABLE_KEEP_MEM_NAME
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
{
|
||||
{ // it's a memory channel
|
||||
|
||||
const uint16_t OffsetMR = Channel * 16;
|
||||
if (!keep)
|
||||
{ // clear/reset the channel name
|
||||
|
||||
64
settings.h
@@ -20,6 +20,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "frequencies.h"
|
||||
#include <helper/battery.h>
|
||||
#include "radio.h"
|
||||
|
||||
enum POWER_OnDisplayMode_t {
|
||||
@@ -28,7 +30,6 @@ enum POWER_OnDisplayMode_t {
|
||||
POWER_ON_DISPLAY_MODE_VOLTAGE,
|
||||
POWER_ON_DISPLAY_MODE_NONE
|
||||
};
|
||||
|
||||
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
|
||||
|
||||
enum {
|
||||
@@ -80,6 +81,9 @@ enum {
|
||||
ACTION_OPT_ALARM,
|
||||
ACTION_OPT_FM,
|
||||
ACTION_OPT_1750,
|
||||
ACTION_OPT_KEYLOCK,
|
||||
ACTION_OPT_A_B,
|
||||
ACTION_OPT_VFO_MR,
|
||||
ACTION_OPT_LEN
|
||||
};
|
||||
|
||||
@@ -90,7 +94,6 @@ enum {
|
||||
VOICE_PROMPT_CHINESE,
|
||||
VOICE_PROMPT_ENGLISH
|
||||
};
|
||||
|
||||
typedef enum VOICE_Prompt_t VOICE_Prompt_t;
|
||||
#endif
|
||||
|
||||
@@ -98,7 +101,6 @@ enum ALARM_Mode_t {
|
||||
ALARM_MODE_SITE = 0,
|
||||
ALARM_MODE_TONE
|
||||
};
|
||||
|
||||
typedef enum ALARM_Mode_t ALARM_Mode_t;
|
||||
|
||||
enum ROGER_Mode_t {
|
||||
@@ -106,7 +108,6 @@ enum ROGER_Mode_t {
|
||||
ROGER_MODE_ROGER,
|
||||
ROGER_MODE_MDC
|
||||
};
|
||||
|
||||
typedef enum ROGER_Mode_t ROGER_Mode_t;
|
||||
|
||||
enum CHANNEL_DisplayMode_t {
|
||||
@@ -115,7 +116,6 @@ enum CHANNEL_DisplayMode_t {
|
||||
MDF_NAME,
|
||||
MDF_NAME_FREQ
|
||||
};
|
||||
|
||||
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -125,13 +125,27 @@ typedef struct {
|
||||
#ifdef ENABLE_NOAA
|
||||
uint8_t NoaaChannel[2];
|
||||
#endif
|
||||
uint8_t RX_CHANNEL;
|
||||
uint8_t TX_CHANNEL;
|
||||
|
||||
// The actual VFO index (0-upper/1-lower) that is now used for RX,
|
||||
// It is being alternated by dual watch, and flipped by crossband
|
||||
uint8_t RX_VFO;
|
||||
|
||||
// The main VFO index (0-upper/1-lower) selected by the user
|
||||
//
|
||||
uint8_t TX_VFO;
|
||||
|
||||
uint8_t field7_0xa;
|
||||
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 TX_TIMEOUT_TIMER;
|
||||
bool KEY_LOCK;
|
||||
@@ -142,12 +156,12 @@ typedef struct {
|
||||
#endif
|
||||
bool BEEP_CONTROL;
|
||||
uint8_t CHANNEL_DISPLAY_MODE;
|
||||
bool TAIL_NOTE_ELIMINATION;
|
||||
bool TAIL_TONE_ELIMINATION;
|
||||
bool VFO_OPEN;
|
||||
uint8_t DUAL_WATCH;
|
||||
uint8_t CROSS_BAND_RX_TX;
|
||||
uint8_t BATTERY_SAVE;
|
||||
uint8_t BACKLIGHT;
|
||||
uint8_t BACKLIGHT_TIME;
|
||||
uint8_t SCAN_RESUME_MODE;
|
||||
uint8_t SCAN_LIST_DEFAULT;
|
||||
bool SCAN_LIST_ENABLED[2];
|
||||
@@ -156,27 +170,12 @@ typedef struct {
|
||||
|
||||
uint8_t field29_0x26;
|
||||
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 field38_0x33;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
uint16_t FM_LowerLimit;
|
||||
uint16_t FM_UpperLimit;
|
||||
#endif
|
||||
|
||||
bool AUTO_KEYPAD_LOCK;
|
||||
#ifdef ENABLE_ALARM
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
ALARM_Mode_t ALARM_MODE;
|
||||
#endif
|
||||
POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE;
|
||||
@@ -205,7 +204,7 @@ typedef struct {
|
||||
char DTMF_SEPARATE_CODE;
|
||||
char DTMF_GROUP_CALL_CODE;
|
||||
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_FIRST_CODE_PERSIST_TIME;
|
||||
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
||||
@@ -220,11 +219,19 @@ typedef struct {
|
||||
uint8_t VOLUME_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 field78_0x96;
|
||||
uint8_t field79_0x97;
|
||||
|
||||
VFO_Info_t VfoInfo[2];
|
||||
uint8_t KEY_M_LONG_PRESS_ACTION;
|
||||
uint8_t BACKLIGHT_MIN;
|
||||
uint8_t BACKLIGHT_MAX;
|
||||
BATTERY_Type_t BATTERY_TYPE;
|
||||
} EEPROM_Config_t;
|
||||
|
||||
extern EEPROM_Config_t gEeprom;
|
||||
@@ -235,6 +242,7 @@ extern EEPROM_Config_t gEeprom;
|
||||
void SETTINGS_SaveVfoIndices(void);
|
||||
void SETTINGS_SaveSettings(void);
|
||||
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode);
|
||||
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration);
|
||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep);
|
||||
|
||||
#endif
|
||||
|
||||
17
ui/aircopy.c
@@ -44,12 +44,19 @@ void UI_DisplayAircopy(void)
|
||||
|
||||
if (gInputBoxIndex == 0)
|
||||
{
|
||||
NUMBER_ToDigits(gRxVfo->freq_config_RX.Frequency, String);
|
||||
UI_DisplayFrequency(String, 16, 2, 0, 0);
|
||||
UI_DisplaySmallDigits(2, String + 6, 97, 3, true);
|
||||
uint32_t frequency = gRxVfo->freq_config_RX.Frequency;
|
||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
||||
// show the remaining 2 small frequency digits
|
||||
UI_PrintStringSmall(String + 7, 97, 0, 3);
|
||||
String[7] = 0;
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 16, 2, false);
|
||||
}
|
||||
else {
|
||||
const char * ascii = INPUTBOX_GetAscii();
|
||||
sprintf(String, "%.3s.%.3s",ascii, ascii + 3);
|
||||
UI_DisplayFrequency(String, 16, 2, false);
|
||||
}
|
||||
else
|
||||
UI_DisplayFrequency(gInputBox, 16, 2, 1, 0);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gAirCopyIsSendMode == 0)
|
||||
|
||||
83
ui/battery.c
@@ -22,66 +22,35 @@
|
||||
#include "functions.h"
|
||||
#include "ui/battery.h"
|
||||
|
||||
void UI_DisplayBattery(const uint8_t level, const uint8_t blink)
|
||||
void UI_DrawBattery(uint8_t* bitmap, uint8_t level, uint8_t blink)
|
||||
{
|
||||
// if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
if (level < 2 && blink == 1) {
|
||||
memset(bitmap, 0, sizeof(BITMAP_BatteryLevel1));
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t bitmap[sizeof(BITMAP_BatteryLevel1)];
|
||||
|
||||
#if 1
|
||||
|
||||
if (level >= 2)
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
if (level > 1)
|
||||
{
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||
uint8_t *pb = bitmap + sizeof(BITMAP_BatteryLevel1);
|
||||
if (level >= 2)
|
||||
memmove(pb - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 5)
|
||||
memmove(pb - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 7)
|
||||
memmove(pb - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 9)
|
||||
memmove(pb - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#else
|
||||
if (level >= 2)
|
||||
memmove(bitmap + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 5)
|
||||
memmove(bitmap + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 7)
|
||||
memmove(bitmap + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 9)
|
||||
memmove(bitmap + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#endif
|
||||
unsigned int i;
|
||||
uint8_t bars = level - 1;
|
||||
if (bars > 4)
|
||||
bars = 4;
|
||||
for (i = 0; i < bars; i++)
|
||||
{
|
||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||
memcpy(bitmap + sizeof(BITMAP_BatteryLevel1) - 4 - (i * 3), BITMAP_BatteryLevel, 2);
|
||||
#else
|
||||
memcpy(bitmap + 3 + (i * 3) + 0, BITMAP_BatteryLevel, 2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
if (blink == 1)
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
else
|
||||
memset(bitmap, 0, sizeof(bitmap));
|
||||
|
||||
#else
|
||||
|
||||
if (level > 0)
|
||||
{
|
||||
const uint8_t lev = (level <= 11) ? level : 11;
|
||||
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
|
||||
#ifdef ENABLE_REVERSE_BAT_SYMBOL
|
||||
for (uint8_t i = 0; i < lev; i++)
|
||||
bitmap[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#else
|
||||
for (uint8_t i = 0; i < lev; i++)
|
||||
bitmap[sizeof(bitmap) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
memset(bitmap, 0, sizeof(bitmap));
|
||||
|
||||
#endif
|
||||
|
||||
// col lne, siz, bm
|
||||
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
void UI_DisplayBattery(uint8_t level, uint8_t blink)
|
||||
{
|
||||
uint8_t bitmap[sizeof(BITMAP_BatteryLevel1)];
|
||||
UI_DrawBattery(bitmap, level, blink);
|
||||
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#define UI_BATTERY_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void UI_DisplayBattery(const uint8_t Level, const uint8_t blink);
|
||||
void UI_DrawBattery(uint8_t* bitmap, uint8_t level, uint8_t blink);
|
||||
void UI_DisplayBattery(uint8_t Level, uint8_t blink);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
11
ui/fmradio.c
@@ -90,11 +90,14 @@ void UI_DisplayFM(void)
|
||||
{
|
||||
if (gInputBoxIndex == 0)
|
||||
{
|
||||
NUMBER_ToDigits(gEeprom.FM_FrequencyPlaying * 10000, String);
|
||||
UI_DisplayFrequency(String, 23, 4, false, true);
|
||||
sprintf(String, "%3d.%d", gEeprom.FM_FrequencyPlaying / 10, gEeprom.FM_FrequencyPlaying % 10);
|
||||
UI_DisplayFrequency(String, 32, 4, true);
|
||||
}
|
||||
else {
|
||||
const char * ascii = INPUTBOX_GetAscii();
|
||||
sprintf(String, "%.3s.%.1s",ascii, ascii + 3);
|
||||
UI_DisplayFrequency(String, 32, 4, false);
|
||||
}
|
||||
else
|
||||
UI_DisplayFrequency(gInputBox, 23, 4, true, false);
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
|
||||
140
ui/helper.c
@@ -72,12 +72,12 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
|
||||
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
if (pString[i] >= ' ' && pString[i] < 127)
|
||||
const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||
if (pString[i] > ' ' && pString[i] < 127)
|
||||
{
|
||||
const unsigned int index = pString[i] - ' ';
|
||||
const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||
memmove(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 8);
|
||||
memmove(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][8], 7);
|
||||
const unsigned int index = pString[i] - ' ' - 1;
|
||||
memmove(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 7);
|
||||
memmove(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][7], 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,9 +95,9 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
||||
uint8_t *pFb = gFrameBuffer[Line] + Start;
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
if (pString[i] >= 32)
|
||||
if (pString[i] > ' ')
|
||||
{
|
||||
const unsigned int index = (unsigned int)pString[i] - 32;
|
||||
const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
|
||||
if (index < ARRAY_SIZE(gFontSmall))
|
||||
memmove(pFb + (i * char_spacing) + 1, &gFontSmall[index], char_width);
|
||||
}
|
||||
@@ -118,9 +118,9 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
||||
uint8_t *pFb = gFrameBuffer[Line] + Start;
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
if (pString[i] >= 32)
|
||||
if (pString[i] > ' ')
|
||||
{
|
||||
const unsigned int index = (unsigned int)pString[i] - 32;
|
||||
const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
|
||||
if (index < ARRAY_SIZE(gFontSmallBold))
|
||||
memmove(pFb + (i * char_spacing) + 1, &gFontSmallBold[index], char_width);
|
||||
}
|
||||
@@ -135,126 +135,46 @@ void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
|
||||
const unsigned int char_spacing = char_width + 1;
|
||||
for (i = 0; i < strlen(pString); i++)
|
||||
{
|
||||
if (pString[i] >= 32)
|
||||
if (pString[i] > ' ')
|
||||
{
|
||||
const unsigned int index = (unsigned int)pString[i] - 32;
|
||||
const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
|
||||
if (index < ARRAY_SIZE(gFontSmall))
|
||||
memmove(buffer + (i * char_spacing) + 1, &gFontSmall[index], char_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag)
|
||||
void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
|
||||
{
|
||||
const unsigned int char_width = 13;
|
||||
uint8_t *pFb0 = gFrameBuffer[Y] + X;
|
||||
uint8_t *pFb1 = pFb0 + 128;
|
||||
bool bCanDisplay = false;
|
||||
unsigned int i = 0;
|
||||
|
||||
// MHz
|
||||
while (i < 3)
|
||||
{
|
||||
const unsigned int Digit = pDigits[i++];
|
||||
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
|
||||
|
||||
uint8_t len = strlen(string);
|
||||
for(int i = 0; i < len; i++) {
|
||||
char c = string[i];
|
||||
if(c=='-') c = '9' + 1;
|
||||
if (bCanDisplay || c != ' ')
|
||||
{
|
||||
bCanDisplay = true;
|
||||
memmove(pFb0, gFontBigDigits[Digit], char_width);
|
||||
memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
|
||||
if(c>='0' && c<='9' + 1) {
|
||||
memcpy(pFb0 + 2, gFontBigDigits[c-'0'], char_width - 3);
|
||||
memcpy(pFb1 + 2, gFontBigDigits[c-'0'] + char_width - 3, char_width - 3);
|
||||
}
|
||||
else if(c=='.') {
|
||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
if (bFlag)
|
||||
{
|
||||
else if (center) {
|
||||
pFb0 -= 6;
|
||||
pFb1 -= 6;
|
||||
}
|
||||
pFb0 += char_width;
|
||||
pFb1 += char_width;
|
||||
}
|
||||
|
||||
// decimal point
|
||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||
|
||||
// kHz
|
||||
while (i < 6)
|
||||
{
|
||||
const unsigned int Digit = pDigits[i++];
|
||||
memmove(pFb0, gFontBigDigits[Digit], char_width);
|
||||
memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
|
||||
pFb0 += char_width;
|
||||
pFb1 += char_width;
|
||||
}
|
||||
}
|
||||
|
||||
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero)
|
||||
{
|
||||
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
|
||||
const unsigned int spacing = 1 + char_width;
|
||||
uint8_t *pFb = gFrameBuffer[Y] + X;
|
||||
bool bCanDisplay = false;
|
||||
unsigned int i = 0;
|
||||
|
||||
// MHz
|
||||
while (i < 3)
|
||||
{
|
||||
const unsigned int c = pDigits[i++];
|
||||
if (bDisplayLeadingZero || bCanDisplay || c > 0)
|
||||
{
|
||||
#if 0
|
||||
memmove(pFb + 1, gFontSmallDigits[c], char_width);
|
||||
#else
|
||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
||||
memmove(pFb + 1, gFontSmall[index], char_width);
|
||||
#endif
|
||||
pFb += spacing;
|
||||
bCanDisplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
// decimal point
|
||||
pFb++;
|
||||
pFb++;
|
||||
*pFb++ = 0x60;
|
||||
*pFb++ = 0x60;
|
||||
pFb++;
|
||||
|
||||
// kHz
|
||||
while (i < 8)
|
||||
{
|
||||
const unsigned int c = pDigits[i++];
|
||||
#if 0
|
||||
memmove(pFb + 1, gFontSmallDigits[c], char_width);
|
||||
#else
|
||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
||||
memmove(pFb + 1, gFontSmall[index], char_width);
|
||||
#endif
|
||||
pFb += spacing;
|
||||
}
|
||||
}
|
||||
|
||||
void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros)
|
||||
{
|
||||
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
|
||||
const unsigned int spacing = 1 + char_width;
|
||||
bool display = display_leading_zeros;
|
||||
unsigned int xx;
|
||||
unsigned int i;
|
||||
for (i = 0, xx = x; i < size; i++)
|
||||
{
|
||||
const unsigned int c = (unsigned int)str[i];
|
||||
if (c > 0)
|
||||
display = true; // non '0'
|
||||
if (display && c < 11)
|
||||
{
|
||||
#if 0
|
||||
memmove(gFrameBuffer[y] + xx, gFontSmallDigits[c], char_width);
|
||||
#else
|
||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
||||
memmove(gFrameBuffer[y] + xx + 1, gFontSmall[index], char_width);
|
||||
#endif
|
||||
xx += spacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
||||
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||
#endif
|
||||
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer);
|
||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag);
|
||||
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);
|
||||
void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros);
|
||||
void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,9 +19,10 @@
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
char gInputBox[8];
|
||||
char inputBoxAscii[9];
|
||||
uint8_t gInputBoxIndex;
|
||||
|
||||
void INPUTBOX_Append(char Digit)
|
||||
void INPUTBOX_Append(const KEY_Code_t Digit)
|
||||
{
|
||||
if (gInputBoxIndex >= sizeof(gInputBox))
|
||||
return;
|
||||
@@ -29,6 +30,15 @@ void INPUTBOX_Append(char Digit)
|
||||
if (gInputBoxIndex == 0)
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
|
||||
gInputBox[gInputBoxIndex++] = Digit;
|
||||
if (Digit != KEY_INVALID)
|
||||
gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0);
|
||||
}
|
||||
|
||||
const char* INPUTBOX_GetAscii()
|
||||
{
|
||||
for(int i = 0; i < 8; i++) {
|
||||
char c = gInputBox[i];
|
||||
inputBoxAscii[i] = (c==10)? '-' : '0' + c;
|
||||
}
|
||||
return inputBoxAscii;
|
||||
}
|
||||
@@ -19,10 +19,13 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
extern char gInputBox[8];
|
||||
extern uint8_t gInputBoxIndex;
|
||||
|
||||
void INPUTBOX_Append(char Digit);
|
||||
void INPUTBOX_Append(const KEY_Code_t Digit);
|
||||
const char* INPUTBOX_GetAscii();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_PWRON_PASSWORD
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "ARMCM0.h"
|
||||
@@ -100,10 +102,9 @@ void UI_DisplayLock(void)
|
||||
uint32_t Password;
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
Password = StrToUL(INPUTBOX_GetAscii());
|
||||
|
||||
NUMBER_Get(gInputBox, &Password);
|
||||
|
||||
if ((gEeprom.POWER_ON_PASSWORD * 100) == Password)
|
||||
if ((gEeprom.POWER_ON_PASSWORD) == Password)
|
||||
{
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
return;
|
||||
@@ -156,3 +157,5 @@ void UI_DisplayLock(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
#ifndef UI_LOCK_H
|
||||
#define UI_LOCK_H
|
||||
|
||||
void UI_DisplayLock(void);
|
||||
#ifdef ENABLE_PWRON_PASSWORD
|
||||
void UI_DisplayLock(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
13
ui/main.h
@@ -17,6 +17,19 @@
|
||||
#ifndef 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_UpdateRSSI(const int16_t rssi, const int vfo);
|
||||
void UI_DisplayMain(void);
|
||||
|
||||
631
ui/menu.c
@@ -18,6 +18,7 @@
|
||||
#include <stdlib.h> // abs()
|
||||
|
||||
#include "app/dtmf.h"
|
||||
#include "app/menu.h"
|
||||
#include "bitmaps.h"
|
||||
#include "board.h"
|
||||
#include "dcs.h"
|
||||
@@ -35,102 +36,112 @@
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
// NOTE. this menu list is half way through a change, what might seem
|
||||
// pointless at this time is for there for a reason.
|
||||
//
|
||||
const t_menu_item MenuList[] =
|
||||
{
|
||||
// text, voice ID, menu ID
|
||||
{"Step", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
||||
{"TxPwr", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||
{"RxDCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||
{"RxCTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||
{"TxDCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||
{"TxCTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||
{"TxODir", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||
{"TxOffs", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
||||
{"Scramb", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||
{"BusyCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
||||
{"Compnd", VOICE_ID_INVALID, MENU_COMPAND },
|
||||
{"Demodu", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||
{"ScAdd1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||
{"ScAdd2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||
{"ChSave", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||
{"ChDele", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||
{"ChName", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||
|
||||
{"SQL", VOICE_ID_SQUELCH, MENU_SQL },
|
||||
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
||||
{"T-PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||
{"R-DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||
{"R-CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||
{"T-DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||
{"T-CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||
{"T-DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||
{"T-OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||
{"T-VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
||||
{"T-TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
||||
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
||||
{"CH-SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||
{"CH-DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||
{"CH-NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||
{"CH-DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
||||
{"BACKLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
||||
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||
#ifdef ENABLE_VOICE
|
||||
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||
{"SList", VOICE_ID_INVALID, MENU_S_LIST },
|
||||
{"SList1", VOICE_ID_INVALID, MENU_SLIST1 },
|
||||
{"SList2", VOICE_ID_INVALID, MENU_SLIST2 },
|
||||
{"ScnRev", VOICE_ID_INVALID, MENU_SC_REV },
|
||||
#ifdef ENABLE_NOAA
|
||||
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
||||
#endif
|
||||
{"SC-REV", VOICE_ID_INVALID, MENU_SC_REV },
|
||||
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||
{"S-ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||
{"S-ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||
{"STE", VOICE_ID_INVALID, MENU_STE },
|
||||
{"RP-STE", VOICE_ID_INVALID, MENU_RP_STE },
|
||||
{"MIC", VOICE_ID_INVALID, MENU_MIC },
|
||||
|
||||
{"F1Shrt", VOICE_ID_INVALID, MENU_F1SHRT },
|
||||
{"F1Long", VOICE_ID_INVALID, MENU_F1LONG },
|
||||
{"F2Shrt", VOICE_ID_INVALID, MENU_F2SHRT },
|
||||
{"F2Long", VOICE_ID_INVALID, MENU_F2LONG },
|
||||
{"M Long", VOICE_ID_INVALID, MENU_MLONG },
|
||||
|
||||
{"KeyLck", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||
{"TxTOut", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"BatSav", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||
{"Mic", VOICE_ID_INVALID, MENU_MIC },
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||
{"MicBar", VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||
#endif
|
||||
{"ChDisp", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||
{"POnMsg", VOICE_ID_INVALID, MENU_PONMSG },
|
||||
{"BatTxt", VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||
{"BackLt", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||
{"BLMin", VOICE_ID_INVALID, MENU_ABR_MIN },
|
||||
{"BLMax", VOICE_ID_INVALID, MENU_ABR_MAX },
|
||||
{"BltTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX },
|
||||
{"Beep", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||
#ifdef ENABLE_VOICE
|
||||
{"Voice", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||
#endif
|
||||
#ifdef ENABLE_COMPANDER
|
||||
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
|
||||
#endif
|
||||
{"1-CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
||||
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
|
||||
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
|
||||
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
|
||||
{"Roger", VOICE_ID_INVALID, MENU_ROGER },
|
||||
{"STE", VOICE_ID_INVALID, MENU_STE },
|
||||
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
|
||||
{"1 Call", VOICE_ID_INVALID, MENU_1_CALL },
|
||||
#ifdef ENABLE_ALARM
|
||||
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||
{"AlarmT", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||
#endif
|
||||
{"ANI-ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
|
||||
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
|
||||
{"D-ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||
{"D-RSP", VOICE_ID_INVALID, MENU_D_RSP },
|
||||
{"D-HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||
{"D-PRE", VOICE_ID_INVALID, MENU_D_PRE },
|
||||
{"PTT-ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||
{"D-DCD", VOICE_ID_INVALID, MENU_D_DCD },
|
||||
{"D-LIST", VOICE_ID_INVALID, MENU_D_LIST },
|
||||
{"D-LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
|
||||
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
|
||||
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||
{"UPCode", VOICE_ID_INVALID, MENU_UPCODE },
|
||||
{"DWCode", VOICE_ID_INVALID, MENU_DWCODE },
|
||||
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||
{"D Resp", VOICE_ID_INVALID, MENU_D_RSP },
|
||||
{"D Hold", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||
{"D Prel", VOICE_ID_INVALID, MENU_D_PRE },
|
||||
{"D Decd", VOICE_ID_INVALID, MENU_D_DCD },
|
||||
{"D List", VOICE_ID_INVALID, MENU_D_LIST },
|
||||
{"D Live", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||
#ifdef ENABLE_AM_FIX
|
||||
{"AM-FIX", VOICE_ID_INVALID, MENU_AM_FIX },
|
||||
{"AM Fix", VOICE_ID_INVALID, MENU_AM_FIX },
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
{"AM-FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
|
||||
{"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1 },
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
||||
#ifdef ENABLE_VOX
|
||||
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
||||
#endif
|
||||
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||
{"BatVol", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||
{"RxMode", VOICE_ID_DUAL_STANDBY, MENU_TDR },
|
||||
{"Sql", VOICE_ID_SQUELCH, MENU_SQL },
|
||||
|
||||
// hidden menu items from here on
|
||||
// enabled if pressing both the PTT and upper side button at power-on
|
||||
{"F Lock", VOICE_ID_INVALID, MENU_F_LOCK },
|
||||
{"Tx 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
||||
{"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
||||
{"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||
{"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||
{"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||
{"TxEnab", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
{"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
#endif
|
||||
{"BatCal", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
||||
{"BatTyp", VOICE_ID_INVALID, MENU_BATTYP }, // battery type 1600/2200mAh
|
||||
{"Reset", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||
|
||||
{"F-LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
|
||||
{"TX-200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
||||
{"TX-350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
||||
{"TX-500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||
{"350-EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||
{"SCR-EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||
|
||||
{"TX-EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
{"F-CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
|
||||
{"", 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 uint8_t FIRST_HIDDEN_MENU_ITEM = MENU_F_LOCK;
|
||||
|
||||
const char gSubMenu_TXP[3][5] =
|
||||
{
|
||||
"LOW",
|
||||
@@ -168,7 +179,6 @@ const char gSubMenu_SAVE[5][4] =
|
||||
|
||||
const char gSubMenu_TOT[11][7] =
|
||||
{
|
||||
"OFF",
|
||||
"30 sec",
|
||||
"1 min",
|
||||
"2 min",
|
||||
@@ -178,14 +188,16 @@ const char gSubMenu_TOT[11][7] =
|
||||
"6 min",
|
||||
"7 min",
|
||||
"8 min",
|
||||
"9 min"
|
||||
"9 min",
|
||||
"15 min"
|
||||
};
|
||||
|
||||
const char gSubMenu_CHAN[3][7] =
|
||||
const char* gSubMenu_RXMode[4] =
|
||||
{
|
||||
"OFF",
|
||||
"CHAN_A",
|
||||
"CHAN_B"
|
||||
"MAIN\nONLY", // TX and RX on main only
|
||||
"DUAL RX\nRESPOND", // Watch both and respond
|
||||
"CROSS\nBAND", // TX on main, RX on secondary
|
||||
"MAIN TX\nDUAL RX" // always TX on main, but RX on both
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -197,19 +209,19 @@ const char gSubMenu_CHAN[3][7] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_SC_REV[3][3] =
|
||||
const char gSubMenu_SC_REV[3][8] =
|
||||
{
|
||||
"TO",
|
||||
"CO",
|
||||
"SE"
|
||||
"TIMEOUT",
|
||||
"CARRIER",
|
||||
"STOP"
|
||||
};
|
||||
|
||||
const char gSubMenu_MDF[4][8] =
|
||||
const char* gSubMenu_MDF[4] =
|
||||
{
|
||||
"FREQ",
|
||||
"CHAN",
|
||||
"CHANNEL\nNUMBER",
|
||||
"NAME",
|
||||
"NAM+FRE"
|
||||
"NAME\n+\nFREQ"
|
||||
};
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
@@ -220,35 +232,36 @@ const char gSubMenu_MDF[4][8] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_D_RSP[4][6] =
|
||||
const char gSubMenu_D_RSP[4][11] =
|
||||
{
|
||||
"NULL",
|
||||
"DO\nNOTHING",
|
||||
"RING",
|
||||
"REPLY",
|
||||
"BOTH"
|
||||
};
|
||||
|
||||
const char gSubMenu_PTT_ID[4][5] =
|
||||
const char* gSubMenu_PTT_ID[5] =
|
||||
{
|
||||
"OFF",
|
||||
"BOT",
|
||||
"EOT",
|
||||
"BOTH"
|
||||
"KEY\nUP",
|
||||
"KEY\nDOWN",
|
||||
"KEY\nUP+DOWN",
|
||||
"APOLLO\nQUINDAR"
|
||||
};
|
||||
|
||||
const char gSubMenu_PONMSG[4][5] =
|
||||
const char gSubMenu_PONMSG[4][8] =
|
||||
{
|
||||
"FULL",
|
||||
"MSG",
|
||||
"VOL",
|
||||
"MESSAGE",
|
||||
"VOLTAGE",
|
||||
"NONE"
|
||||
};
|
||||
|
||||
const char gSubMenu_ROGER[3][6] =
|
||||
const char* gSubMenu_ROGER[3] =
|
||||
{
|
||||
"OFF",
|
||||
"ROGER",
|
||||
"MDC"
|
||||
"MDC\n1200"
|
||||
};
|
||||
|
||||
const char gSubMenu_RESET[2][4] =
|
||||
@@ -279,15 +292,13 @@ const char gSubMenu_BACKLIGHT[8][7] =
|
||||
"ON"
|
||||
};
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
const char gSubMenu_Compand[4][6] =
|
||||
{
|
||||
"OFF",
|
||||
"TX",
|
||||
"RX",
|
||||
"TX/RX"
|
||||
};
|
||||
#endif
|
||||
const char gSubMenu_RX_TX[4][6] =
|
||||
{
|
||||
"OFF",
|
||||
"TX",
|
||||
"RX",
|
||||
"TX/RX"
|
||||
};
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
const char gSubMenu_AM_fix_test1[4][8] =
|
||||
@@ -306,6 +317,12 @@ const char gSubMenu_BAT_TXT[3][8] =
|
||||
"PERCENT"
|
||||
};
|
||||
|
||||
const char gSubMenu_BATTYP[2][9] =
|
||||
{
|
||||
"1600mAh",
|
||||
"2200mAh"
|
||||
};
|
||||
|
||||
const char gSubMenu_SCRAMBLER[11][7] =
|
||||
{
|
||||
"OFF",
|
||||
@@ -321,8 +338,41 @@ const char gSubMenu_SCRAMBLER[11][7] =
|
||||
"3500Hz"
|
||||
};
|
||||
|
||||
|
||||
const t_sidefunction SIDEFUNCTIONS[] =
|
||||
{
|
||||
{"NONE", ACTION_OPT_NONE},
|
||||
{"FLASH\nLIGHT", ACTION_OPT_FLASHLIGHT},
|
||||
{"POWER", ACTION_OPT_POWER},
|
||||
{"MONITOR", ACTION_OPT_MONITOR},
|
||||
{"SCAN", ACTION_OPT_SCAN},
|
||||
#ifdef ENABLE_VOX
|
||||
{"VOX", ACTION_OPT_VOX},
|
||||
#endif
|
||||
#ifdef ENABLE_ALARM
|
||||
{"ALARM", ACTION_OPT_ALARM},
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
{"FM RADIO", ACTION_OPT_FM},
|
||||
#endif
|
||||
#ifdef ENABLE_TX1750
|
||||
{"1750HZ", ACTION_OPT_1750},
|
||||
#endif
|
||||
{"LOCK\nKEYPAD", ACTION_OPT_KEYLOCK},
|
||||
{"SWITCH\nVFO", ACTION_OPT_A_B},
|
||||
{"VFO/MR", ACTION_OPT_VFO_MR},
|
||||
};
|
||||
const t_sidefunction* gSubMenu_SIDEFUNCTIONS = SIDEFUNCTIONS;
|
||||
const uint8_t gSubMenu_SIDEFUNCTIONS_size = ARRAY_SIZE(SIDEFUNCTIONS);
|
||||
|
||||
bool gIsInSubMenu;
|
||||
uint8_t gMenuCursor;
|
||||
int GetCurrentMenuId() {
|
||||
if(gMenuCursor < ARRAY_SIZE(MenuList))
|
||||
return MenuList[gMenuCursor].menu_id;
|
||||
else
|
||||
return MenuList[ARRAY_SIZE(MenuList)-1].menu_id;
|
||||
}
|
||||
int8_t gMenuScrollDirection;
|
||||
int32_t gSubMenuSelection;
|
||||
|
||||
@@ -337,40 +387,96 @@ void UI_DisplayMenu(void)
|
||||
const unsigned int menu_item_x1 = (8 * menu_list_width) + 2;
|
||||
const unsigned int menu_item_x2 = LCD_WIDTH - 1;
|
||||
unsigned int i;
|
||||
char String[16];
|
||||
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||
char Contact[16];
|
||||
|
||||
// clear the screen buffer
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gMenuCursor > 0 || i > 0)
|
||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
||||
#if 0
|
||||
// original menu layout
|
||||
|
||||
// invert the menu list text pixels
|
||||
for (i = 0; i < (8 * menu_list_width); i++)
|
||||
{
|
||||
gFrameBuffer[2][i] ^= 0xFF;
|
||||
gFrameBuffer[3][i] ^= 0xFF;
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gMenuCursor > 0 || i > 0)
|
||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
||||
|
||||
// invert the current menu list item pixels
|
||||
for (i = 0; i < (8 * menu_list_width); i++)
|
||||
{
|
||||
gFrameBuffer[2][i] ^= 0xFF;
|
||||
gFrameBuffer[3][i] ^= 0xFF;
|
||||
}
|
||||
|
||||
// draw vertical separating dotted line
|
||||
for (i = 0; i < 7; i++)
|
||||
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
||||
|
||||
// draw the little sub-menu triangle marker
|
||||
if (gIsInSubMenu)
|
||||
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
|
||||
// draw the menu index number/count
|
||||
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
|
||||
UI_PrintStringSmall(String, 2, 0, 6);
|
||||
|
||||
#else
|
||||
{ // new menu layout .. experimental & unfinished
|
||||
|
||||
const int menu_index = gMenuCursor; // current selected menu item
|
||||
i = 1;
|
||||
|
||||
if (!gIsInSubMenu)
|
||||
{
|
||||
while (i < 2)
|
||||
{ // leading menu items - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k < 0)
|
||||
UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
|
||||
else
|
||||
if (k >= 0 && k < (int)gMenuListCount)
|
||||
UI_PrintStringSmall(MenuList[k].name, 0, 0, i);
|
||||
i++;
|
||||
}
|
||||
|
||||
// current menu item - keep big n fat
|
||||
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
|
||||
UI_PrintString(MenuList[menu_index].name, 0, 0, 2, 8);
|
||||
i++;
|
||||
|
||||
while (i < 4)
|
||||
{ // trailing menu item - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k >= 0 && k < (int)gMenuListCount)
|
||||
UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i);
|
||||
else
|
||||
if (k >= (int)gMenuListCount)
|
||||
UI_PrintStringSmall(MenuList[gMenuListCount - k].name, 0, 0, 1 + i); // wrap-a-round
|
||||
i++;
|
||||
}
|
||||
|
||||
// draw the menu index number/count
|
||||
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
|
||||
UI_PrintStringSmall(String, 2, 0, 6);
|
||||
}
|
||||
else
|
||||
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
|
||||
{ // current menu item
|
||||
strcpy(String, MenuList[menu_index].name);
|
||||
// strcat(String, ":");
|
||||
UI_PrintString(String, 0, 0, 0, 8);
|
||||
// UI_PrintStringSmall(String, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// draw vertical separating dotted line
|
||||
for (i = 0; i < 7; i++)
|
||||
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
||||
|
||||
// draw the menu index number/count
|
||||
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
|
||||
UI_PrintStringSmall(String, 8, 0, 6);
|
||||
|
||||
// draw the little marker
|
||||
if (gIsInSubMenu)
|
||||
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
// **************
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
bool already_printed = false;
|
||||
|
||||
switch (gMenuCursor)
|
||||
switch (GetCurrentMenuId())
|
||||
{
|
||||
case MENU_SQL:
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
@@ -390,7 +496,7 @@ void UI_DisplayMenu(void)
|
||||
#endif
|
||||
|
||||
case MENU_STEP:
|
||||
sprintf(String, "%d.%02uKHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
|
||||
sprintf(String, "%d.%02ukHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
|
||||
break;
|
||||
|
||||
case MENU_TXP:
|
||||
@@ -410,11 +516,41 @@ void UI_DisplayMenu(void)
|
||||
|
||||
case MENU_R_CTCS:
|
||||
case MENU_T_CTCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||
{
|
||||
#if 1
|
||||
unsigned int Code;
|
||||
FREQ_Config_t *pConfig = (GetCurrentMenuId() == MENU_R_CTCS) ? &gTxVfo->freq_config_RX : &gTxVfo->freq_config_TX;
|
||||
if (gSubMenuSelection == 0)
|
||||
{
|
||||
strcpy(String, "OFF");
|
||||
|
||||
if (pConfig->CodeType != CODE_TYPE_CONTINUOUS_TONE)
|
||||
break;
|
||||
Code = 0;
|
||||
pConfig->CodeType = CODE_TYPE_OFF;
|
||||
pConfig->Code = Code;
|
||||
|
||||
BK4819_ExitSubAu();
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||
|
||||
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
Code = gSubMenuSelection - 1;
|
||||
pConfig->Code = Code;
|
||||
|
||||
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||
}
|
||||
#else
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_SFT_D:
|
||||
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
|
||||
@@ -423,21 +559,13 @@ void UI_DisplayMenu(void)
|
||||
case MENU_OFFSET:
|
||||
if (!gIsInSubMenu || gInputBoxIndex == 0)
|
||||
{
|
||||
sprintf(String, "%d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||
sprintf(String, "%3d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
String[i ] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
||||
String[3] = '.';
|
||||
for (i = 3; i < 6; i++)
|
||||
String[i + 1] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
||||
String[ 7] = '-';
|
||||
String[ 8] = '-';
|
||||
String[ 9] = 0;
|
||||
String[10] = 0;
|
||||
String[11] = 0;
|
||||
const char * ascii = INPUTBOX_GetAscii();
|
||||
sprintf(String, "%.3s.%.3s ",ascii, ascii + 3);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
}
|
||||
|
||||
@@ -452,19 +580,37 @@ void UI_DisplayMenu(void)
|
||||
|
||||
case MENU_SCR:
|
||||
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
||||
#if 1
|
||||
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MENU_VOX:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
break;
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ABR:
|
||||
strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]);
|
||||
BACKLIGHT_SetBrightness(-1);
|
||||
break;
|
||||
|
||||
case MENU_ABR_MIN:
|
||||
case MENU_ABR_MAX:
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
if(gIsInSubMenu)
|
||||
BACKLIGHT_SetBrightness(gSubMenuSelection);
|
||||
else
|
||||
BACKLIGHT_SetBrightness(-1);
|
||||
break;
|
||||
|
||||
case MENU_AM:
|
||||
strcpy(String, (gSubMenuSelection == 0) ? "FM" : "AM");
|
||||
break;
|
||||
@@ -472,6 +618,7 @@ void UI_DisplayMenu(void)
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
case MENU_AM_FIX_TEST1:
|
||||
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
|
||||
// gSetting_AM_fix = gSubMenuSelection;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -479,11 +626,10 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "AUTO");
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
strcpy(String, gSubMenu_Compand[gSubMenuSelection]);
|
||||
break;
|
||||
#endif
|
||||
case MENU_COMPAND:
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
strcpy(String, gSubMenu_RX_TX[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
case MENU_AM_FIX:
|
||||
@@ -522,7 +668,6 @@ void UI_DisplayMenu(void)
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
||||
}
|
||||
|
||||
already_printed = true;
|
||||
@@ -552,7 +697,6 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
||||
if (edit_index < 10)
|
||||
UI_PrintString( "^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
||||
// UI_PrintStringSmall("^", menu_item_x1 + (8 * edit_index), 0, 4);
|
||||
}
|
||||
|
||||
if (!gAskForConfirmation)
|
||||
@@ -562,7 +706,6 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
else
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,8 +718,7 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
case MENU_XB:
|
||||
strcpy(String, gSubMenu_CHAN[gSubMenuSelection]);
|
||||
strcpy(String, gSubMenu_RXMode[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_TOT:
|
||||
@@ -605,7 +747,10 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
sprintf(String, "LIST%u", gSubMenuSelection);
|
||||
if (gSubMenuSelection < 2)
|
||||
sprintf(String, "LIST%u", 1 + gSubMenuSelection);
|
||||
else
|
||||
strcpy(String, "ALL");
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
@@ -663,22 +808,9 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_VOL:
|
||||
// 1st text line
|
||||
sprintf(String, "%u.%02uV", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
|
||||
{ // 2nd text line .. percentage
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
const uint16_t percent = BATTERY_VoltsToPercent(gBatteryVoltageAverage);
|
||||
sprintf(String, "%u%%", percent);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8);
|
||||
#if 0
|
||||
sprintf(String, "Curr %u", gBatteryCurrent); // needs scaling into mA
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
already_printed = true;
|
||||
sprintf(String, "%u.%02uV\n%u%%",
|
||||
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
||||
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
break;
|
||||
|
||||
case MENU_RESET:
|
||||
@@ -689,32 +821,99 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
{
|
||||
const uint32_t value = 22656 + gSubMenuSelection;
|
||||
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value
|
||||
BK4819_WriteRegister(BK4819_REG_3B, value);
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
{
|
||||
const uint32_t value = 22656 + gSubMenuSelection;
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
writeXtalFreqCal(gSubMenuSelection, false);
|
||||
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
sprintf(String, "%u.%06u", xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||
gSubMenuSelection,
|
||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
already_printed = true;
|
||||
}
|
||||
case MENU_BATCAL:
|
||||
{
|
||||
const uint16_t vol = (uint32_t)gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
||||
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, gSubMenuSelection);
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_BATTYP:
|
||||
strcpy(String, gSubMenu_BATTYP[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_F1SHRT:
|
||||
case MENU_F1LONG:
|
||||
case MENU_F2SHRT:
|
||||
case MENU_F2LONG:
|
||||
case MENU_MLONG:
|
||||
strcpy(String, gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].name);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (!already_printed)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
||||
{ // we now do multi-line text in a single string
|
||||
|
||||
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
|
||||
unsigned int y;
|
||||
unsigned int lines = 1;
|
||||
unsigned int len = strlen(String);
|
||||
bool small = false;
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
// count number of lines
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (String[i] == '\n' && i < (len - 1))
|
||||
{ // found new line char
|
||||
lines++;
|
||||
String[i] = 0; // null terminate the line
|
||||
}
|
||||
}
|
||||
|
||||
if (lines > 3)
|
||||
{ // use small text
|
||||
small = true;
|
||||
if (lines > 7)
|
||||
lines = 7;
|
||||
}
|
||||
|
||||
// center vertically'ish
|
||||
if (small)
|
||||
y = 3 - ((lines + 0) / 2); // untested
|
||||
else
|
||||
y = 2 - ((lines + 0) / 2);
|
||||
|
||||
// draw the text lines
|
||||
for (i = 0; i < len && lines > 0; lines--)
|
||||
{
|
||||
if (small)
|
||||
UI_PrintStringSmall(String + i, menu_item_x1, menu_item_x2, y);
|
||||
else
|
||||
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8);
|
||||
|
||||
// look for start of next line
|
||||
while (i < len && String[i] >= 32)
|
||||
i++;
|
||||
|
||||
// hop over the null term char(s)
|
||||
while (i < len && String[i] < 32)
|
||||
i++;
|
||||
|
||||
y += small ? 1 : 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GetCurrentMenuId() == MENU_SLIST1 || GetCurrentMenuId() == MENU_SLIST2)
|
||||
{
|
||||
i = (gMenuCursor == MENU_SLIST1) ? 0 : 1;
|
||||
i = (GetCurrentMenuId() == MENU_SLIST1) ? 0 : 1;
|
||||
|
||||
// if (gSubMenuSelection == 0xFF)
|
||||
if (gSubMenuSelection < 0)
|
||||
@@ -759,9 +958,9 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_MEM_CH ||
|
||||
gMenuCursor == MENU_DEL_CH ||
|
||||
gMenuCursor == MENU_1_CALL)
|
||||
if (GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
GetCurrentMenuId() == MENU_1_CALL)
|
||||
{ // display the channel name
|
||||
char s[11];
|
||||
BOARD_fetchChannelName(s, gSubMenuSelection);
|
||||
@@ -770,18 +969,18 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(s, menu_item_x1, menu_item_x2, 2, 8);
|
||||
}
|
||||
|
||||
if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
if ((GetCurrentMenuId() == MENU_R_CTCS || GetCurrentMenuId() == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_UPCODE)
|
||||
if (GetCurrentMenuId() == MENU_UPCODE)
|
||||
if (strlen(gEeprom.DTMF_UP_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_UP_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_DWCODE)
|
||||
if (GetCurrentMenuId() == MENU_DWCODE)
|
||||
if (strlen(gEeprom.DTMF_DOWN_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid)
|
||||
if (GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid)
|
||||
{
|
||||
Contact[11] = 0;
|
||||
memmove(&gDTMF_ID, Contact + 8, 4);
|
||||
@@ -789,22 +988,20 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_R_CTCS ||
|
||||
gMenuCursor == MENU_T_CTCS ||
|
||||
gMenuCursor == MENU_R_DCS ||
|
||||
gMenuCursor == MENU_T_DCS ||
|
||||
gMenuCursor == MENU_D_LIST)
|
||||
if (GetCurrentMenuId() == MENU_R_CTCS ||
|
||||
GetCurrentMenuId() == MENU_T_CTCS ||
|
||||
GetCurrentMenuId() == MENU_R_DCS ||
|
||||
GetCurrentMenuId() == MENU_T_DCS ||
|
||||
GetCurrentMenuId() == MENU_D_LIST)
|
||||
{
|
||||
unsigned int Offset;
|
||||
NUMBER_ToDigits(gSubMenuSelection, String);
|
||||
Offset = (gMenuCursor == MENU_D_LIST) ? 2 : 3;
|
||||
UI_DisplaySmallDigits(Offset, String + (8 - Offset), 105, 0, false);
|
||||
sprintf(String, "%2d", gSubMenuSelection);
|
||||
UI_PrintStringSmall(String, 105, 0, 0);
|
||||
}
|
||||
|
||||
if ((gMenuCursor == MENU_RESET ||
|
||||
gMenuCursor == MENU_MEM_CH ||
|
||||
gMenuCursor == MENU_MEM_NAME ||
|
||||
gMenuCursor == MENU_DEL_CH) && gAskForConfirmation)
|
||||
if ((GetCurrentMenuId() == MENU_RESET ||
|
||||
GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_MEM_NAME ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation)
|
||||
{ // display confirmation
|
||||
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
|
||||
89
ui/menu.h
@@ -39,7 +39,6 @@ enum
|
||||
MENU_T_CTCS,
|
||||
MENU_SFT_D,
|
||||
MENU_OFFSET,
|
||||
MENU_XB,
|
||||
MENU_TOT,
|
||||
MENU_W_N,
|
||||
MENU_SCR,
|
||||
@@ -49,13 +48,18 @@ enum
|
||||
MENU_MEM_NAME,
|
||||
MENU_MDF,
|
||||
MENU_SAVE,
|
||||
#ifdef ENABLE_VOX
|
||||
MENU_VOX,
|
||||
#endif
|
||||
MENU_ABR,
|
||||
MENU_ABR_ON_TX_RX,
|
||||
MENU_ABR_MIN,
|
||||
MENU_ABR_MAX,
|
||||
MENU_TDR,
|
||||
MENU_BEEP,
|
||||
#ifdef ENABLE_VOICE
|
||||
MENU_VOICE,
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
MENU_VOICE,
|
||||
#endif
|
||||
MENU_SC_REV,
|
||||
MENU_AUTOLK,
|
||||
MENU_S_ADD1,
|
||||
@@ -63,27 +67,25 @@ enum
|
||||
MENU_STE,
|
||||
MENU_RP_STE,
|
||||
MENU_MIC,
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
MENU_MIC_BAR,
|
||||
#endif
|
||||
#ifdef ENABLE_COMPANDER
|
||||
MENU_COMPAND,
|
||||
#endif
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
MENU_MIC_BAR,
|
||||
#endif
|
||||
MENU_COMPAND,
|
||||
MENU_1_CALL,
|
||||
MENU_S_LIST,
|
||||
MENU_SLIST1,
|
||||
MENU_SLIST2,
|
||||
#ifdef ENABLE_ALARM
|
||||
MENU_AL_MOD,
|
||||
#endif
|
||||
#ifdef ENABLE_ALARM
|
||||
MENU_AL_MOD,
|
||||
#endif
|
||||
MENU_ANI_ID,
|
||||
MENU_UPCODE,
|
||||
MENU_DWCODE,
|
||||
MENU_PTT_ID,
|
||||
MENU_D_ST,
|
||||
MENU_D_RSP,
|
||||
MENU_D_HOLD,
|
||||
MENU_D_PRE,
|
||||
MENU_PTT_ID,
|
||||
MENU_D_DCD,
|
||||
MENU_D_LIST,
|
||||
MENU_D_LIVE_DEC,
|
||||
@@ -92,19 +94,16 @@ enum
|
||||
MENU_VOL,
|
||||
MENU_BAT_TXT,
|
||||
MENU_AM,
|
||||
#ifdef ENABLE_AM_FIX
|
||||
MENU_AM_FIX,
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
MENU_AM_FIX_TEST1,
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
MENU_NOAA_S,
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX
|
||||
MENU_AM_FIX,
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
MENU_AM_FIX_TEST1,
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
MENU_NOAA_S,
|
||||
#endif
|
||||
MENU_RESET,
|
||||
|
||||
// items after here are normally hidden
|
||||
|
||||
MENU_F_LOCK,
|
||||
MENU_200TX,
|
||||
MENU_350TX,
|
||||
@@ -113,9 +112,19 @@ enum
|
||||
MENU_SCREN,
|
||||
|
||||
MENU_TX_EN, // enable TX
|
||||
MENU_F_CALI // reference xtal calibration
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
MENU_F_CALI, // reference xtal calibration
|
||||
#endif
|
||||
MENU_BATCAL, // battery voltage calibration
|
||||
MENU_F1SHRT,
|
||||
MENU_F1LONG,
|
||||
MENU_F2SHRT,
|
||||
MENU_F2LONG,
|
||||
MENU_MLONG,
|
||||
MENU_BATTYP
|
||||
};
|
||||
|
||||
extern const uint8_t FIRST_HIDDEN_MENU_ITEM;
|
||||
extern const t_menu_item MenuList[];
|
||||
|
||||
extern const char gSubMenu_TXP[3][5];
|
||||
@@ -124,35 +133,39 @@ extern const char gSubMenu_W_N[2][7];
|
||||
extern const char gSubMenu_OFF_ON[2][4];
|
||||
extern const char gSubMenu_SAVE[5][4];
|
||||
extern const char gSubMenu_TOT[11][7];
|
||||
extern const char gSubMenu_CHAN[3][7];
|
||||
extern const char* gSubMenu_RXMode[4];
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
extern const char gSubMenu_VOICE[3][4];
|
||||
#endif
|
||||
extern const char gSubMenu_SC_REV[3][3];
|
||||
extern const char gSubMenu_MDF[4][8];
|
||||
extern const char gSubMenu_SC_REV[3][8];
|
||||
extern const char* gSubMenu_MDF[4];
|
||||
#ifdef ENABLE_ALARM
|
||||
extern const char gSubMenu_AL_MOD[2][5];
|
||||
#endif
|
||||
extern const char gSubMenu_D_RSP[4][6];
|
||||
extern const char gSubMenu_PTT_ID[4][5];
|
||||
extern const char gSubMenu_PONMSG[4][5];
|
||||
extern const char gSubMenu_ROGER[3][6];
|
||||
extern const char gSubMenu_D_RSP[4][11];
|
||||
extern const char* gSubMenu_PTT_ID[5];
|
||||
extern const char gSubMenu_PONMSG[4][8];
|
||||
extern const char* gSubMenu_ROGER[3];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char gSubMenu_F_LOCK[6][4];
|
||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||
#ifdef ENABLE_COMPANDER
|
||||
extern const char gSubMenu_Compand[4][6];
|
||||
#endif
|
||||
extern const char gSubMenu_RX_TX[4][6];
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
extern const char gSubMenu_AM_fix_test1[4][8];
|
||||
#endif
|
||||
extern const char gSubMenu_BAT_TXT[3][8];
|
||||
|
||||
extern const char gSubMenu_BATTYP[2][9];
|
||||
extern const char gSubMenu_SCRAMBLER[11][7];
|
||||
|
||||
typedef struct {char* name; uint8_t id;} t_sidefunction;
|
||||
extern const uint8_t gSubMenu_SIDEFUNCTIONS_size;
|
||||
extern const t_sidefunction* gSubMenu_SIDEFUNCTIONS;
|
||||
|
||||
extern bool gIsInSubMenu;
|
||||
|
||||
extern uint8_t gMenuCursor;
|
||||
int GetCurrentMenuId();
|
||||
extern int8_t gMenuScrollDirection;
|
||||
extern int32_t gSubMenuSelection;
|
||||
|
||||
|
||||
167
ui/status.c
@@ -28,11 +28,12 @@
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/battery.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/status.h"
|
||||
|
||||
void UI_DisplayStatus(const bool test_display)
|
||||
void UI_DisplayStatus()
|
||||
{
|
||||
uint8_t *line = gStatusLine;
|
||||
unsigned int x = 0;
|
||||
@@ -45,16 +46,30 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// **************
|
||||
|
||||
// POWER-SAVE indicator
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{
|
||||
memmove(line + x, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
|
||||
x1 = x + sizeof(BITMAP_PowerSave);
|
||||
memmove(line + x, BITMAP_TX, sizeof(BITMAP_TX));
|
||||
x1 = x + sizeof(BITMAP_TX);
|
||||
}
|
||||
x += sizeof(BITMAP_PowerSave);
|
||||
else
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING)
|
||||
{
|
||||
memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX));
|
||||
x1 = x + sizeof(BITMAP_RX);
|
||||
}
|
||||
else
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
{
|
||||
memmove(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
|
||||
x1 = x + sizeof(BITMAP_POWERSAVE);
|
||||
}
|
||||
x += sizeof(BITMAP_POWERSAVE);
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
// NOASS SCAN indicator
|
||||
if (gIsNoaaMode || test_display)
|
||||
if (gIsNoaaMode)
|
||||
{
|
||||
memmove(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
x1 = x + sizeof(BITMAP_NOAA);
|
||||
@@ -70,63 +85,69 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x1 = x + 10;
|
||||
}
|
||||
else
|
||||
#ifdef ENABLE_FMRADIO
|
||||
// FM indicator
|
||||
if (gFmRadioMode || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
x1 = x + sizeof(BITMAP_FM);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
// SCAN indicator
|
||||
if (gScanState != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
||||
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER)
|
||||
{
|
||||
memmove(line + x, BITMAP_SC, sizeof(BITMAP_SC));
|
||||
x1 = x + sizeof(BITMAP_SC);
|
||||
char * s = "";
|
||||
if (IS_MR_CHANNEL(gNextMrChannel) && gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{ // channel mode
|
||||
switch(gEeprom.SCAN_LIST_DEFAULT) {
|
||||
case 0: s = "1"; break;
|
||||
case 1: s = "2"; break;
|
||||
case 2: s = "*"; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
s = "S";
|
||||
}
|
||||
UI_PrintStringSmallBuffer(s, line + x);
|
||||
x1 = x + 7;
|
||||
}
|
||||
x += sizeof(BITMAP_SC);
|
||||
x += 7; // font character width
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
// VOICE indicator
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF || test_display)
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF)
|
||||
{
|
||||
memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
x1 = x + sizeof(BITMAP_VoicePrompt);
|
||||
}
|
||||
x += sizeof(BITMAP_VoicePrompt);
|
||||
x += sizeof(BITMAP_VoicePrompt) + 1;
|
||||
#else
|
||||
// hmmm, what to put in it's place
|
||||
#endif
|
||||
|
||||
// DUAL-WATCH indicator
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display)
|
||||
{
|
||||
if (gDualWatchActive || test_display)
|
||||
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1));
|
||||
else
|
||||
memmove(line + x, BITMAP_TDR2, sizeof(BITMAP_TDR2));
|
||||
x++;
|
||||
if(gScreenToDisplay != DISPLAY_SCANNER) {
|
||||
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
|
||||
if(dw == 1 || dw == 3) { // DWR - dual watch + respond
|
||||
if(gDualWatchActive)
|
||||
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
|
||||
else
|
||||
memmove(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
|
||||
}
|
||||
else if(dw == 2) { // XB - crossband
|
||||
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB));
|
||||
}
|
||||
}
|
||||
x += sizeof(BITMAP_TDR1);
|
||||
|
||||
// CROSS-VFO indicator
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB));
|
||||
x1 = x + sizeof(BITMAP_XB);
|
||||
}
|
||||
x += sizeof(BITMAP_XB);
|
||||
x += sizeof(BITMAP_TDR1) + 2;
|
||||
|
||||
// VOX indicator
|
||||
if (gEeprom.VOX_SWITCH || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
x1 = x + sizeof(BITMAP_VOX);
|
||||
}
|
||||
x += sizeof(BITMAP_VOX);
|
||||
#ifdef ENABLE_VOX
|
||||
// VOX indicator
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
{
|
||||
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
x1 = x + sizeof(BITMAP_VOX);
|
||||
}
|
||||
x += sizeof(BITMAP_VOX) + 2;
|
||||
#endif
|
||||
|
||||
x = MAX(x, 61u);
|
||||
x1 = x;
|
||||
|
||||
// KEY-LOCK indicator
|
||||
if (gEeprom.KEY_LOCK || test_display)
|
||||
if (gEeprom.KEY_LOCK)
|
||||
{
|
||||
memmove(line + x, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
|
||||
x += sizeof(BITMAP_KeyLock);
|
||||
@@ -169,8 +190,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
|
||||
case 2: // percentage
|
||||
{
|
||||
const uint16_t percent = BATTERY_VoltsToPercent(gBatteryVoltageAverage);
|
||||
sprintf(s, "%u%%", percent);
|
||||
sprintf(s, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
space_needed = (7 * strlen(s));
|
||||
if (x2 >= (x1 + space_needed))
|
||||
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
|
||||
@@ -183,60 +203,13 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - sizeof(BITMAP_USB_C);
|
||||
|
||||
// USB-C charge indicator
|
||||
if (gChargingWithTypeC || test_display)
|
||||
if (gChargingWithTypeC)
|
||||
memmove(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
x += sizeof(BITMAP_USB_C);
|
||||
|
||||
// BATTERY LEVEL indicator
|
||||
#if 1
|
||||
if (gBatteryDisplayLevel >= 2 && !gLowBattery)
|
||||
{
|
||||
line += x;
|
||||
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||
line += sizeof(BITMAP_BatteryLevel1);
|
||||
if (gBatteryDisplayLevel >= 2)
|
||||
memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 5)
|
||||
memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 7)
|
||||
memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 9)
|
||||
memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#else
|
||||
if (gBatteryDisplayLevel >= 2)
|
||||
memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 5)
|
||||
memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 7)
|
||||
memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 9)
|
||||
memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if (gLowBatteryBlink == 1)
|
||||
memmove(line + x, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#else
|
||||
// UI_DisplayBattery(gBatteryDisplayLevel);
|
||||
|
||||
line += x;
|
||||
if (gBatteryDisplayLevel > 0)
|
||||
{
|
||||
const uint8_t level = (gBatteryDisplayLevel <= 11) ? gBatteryDisplayLevel : 11;
|
||||
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#ifdef ENABLE_REVERSE_BAT_SYMBOL
|
||||
for (uint8_t i = 0; i < level; i++)
|
||||
line[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#else
|
||||
for (uint8_t i = 0; i < level; i++)
|
||||
line[sizeof(BITMAP_BatteryLevel1) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
memset(line, 0, sizeof(BITMAP_BatteryLevel1));
|
||||
#endif
|
||||
|
||||
UI_DrawBattery(line + x, gBatteryDisplayLevel, gLowBatteryBlink);
|
||||
|
||||
// **************
|
||||
|
||||
ST7565_BlitStatusLine();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#ifndef UI_STATUS_H
|
||||
#define UI_STATUS_H
|
||||
|
||||
void UI_DisplayStatus(const bool test_display);
|
||||
void UI_DisplayStatus();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
46
ui/ui.c
@@ -77,34 +77,28 @@ void GUI_DisplayScreen(void)
|
||||
|
||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||
{
|
||||
if (Display != DISPLAY_INVALID)
|
||||
if (Display == DISPLAY_INVALID)
|
||||
return;
|
||||
|
||||
if (gScreenToDisplay != Display)
|
||||
{
|
||||
if (gScreenToDisplay != Display)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
gIsInSubMenu = false;
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
gScanState = SCAN_OFF;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
#endif
|
||||
gAskForConfirmation = 0;
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputIndex = 0;
|
||||
gF_LOCK = false;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
DTMF_clear_input_box();
|
||||
|
||||
if (gWasFKeyPressed)
|
||||
{
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
gInputBoxIndex = 0;
|
||||
gIsInSubMenu = false;
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
gScanStateDir = SCAN_OFF;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
#endif
|
||||
gAskForConfirmation = 0;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
gWasFKeyPressed = false;
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
gUpdateDisplay = true;
|
||||
gScreenToDisplay = Display;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
gScreenToDisplay = Display;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
30
ui/welcome.c
@@ -27,11 +27,22 @@
|
||||
#include "ui/status.h"
|
||||
#include "version.h"
|
||||
|
||||
void UI_DisplayReleaseKeys(void)
|
||||
{
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
UI_PrintString("RELEASE", 0, 127, 1, 10);
|
||||
UI_PrintString("ALL KEYS", 0, 127, 3, 10);
|
||||
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
||||
void UI_DisplayWelcome(void)
|
||||
{
|
||||
char WelcomeString0[16];
|
||||
char WelcomeString1[16];
|
||||
char WelcomeString2[16];
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
@@ -49,7 +60,6 @@ void UI_DisplayWelcome(void)
|
||||
{
|
||||
memset(WelcomeString0, 0, sizeof(WelcomeString0));
|
||||
memset(WelcomeString1, 0, sizeof(WelcomeString1));
|
||||
memset(WelcomeString2, 0, sizeof(WelcomeString2));
|
||||
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE)
|
||||
{
|
||||
@@ -58,10 +68,6 @@ void UI_DisplayWelcome(void)
|
||||
gBatteryVoltageAverage / 100,
|
||||
gBatteryVoltageAverage % 100,
|
||||
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
|
||||
#if 0
|
||||
sprintf(WelcomeString2, "Current %u", gBatteryCurrent); // needs scaling into mA
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -71,17 +77,9 @@ void UI_DisplayWelcome(void)
|
||||
|
||||
UI_PrintString(WelcomeString0, 0, 127, 0, 10);
|
||||
UI_PrintString(WelcomeString1, 0, 127, 2, 10);
|
||||
#if 0
|
||||
UI_PrintStringSmall(WelcomeString2, 0, 127, 4);
|
||||
#endif
|
||||
UI_PrintStringSmall(Version, 0, 0, 6);
|
||||
UI_PrintStringSmall(Version, 0, 0, 6);
|
||||
|
||||
#if 1
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
#else
|
||||
UI_DisplayStatus(true); // show all status line symbols (test)
|
||||
#endif
|
||||
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#ifndef UI_WELCOME_H
|
||||
#define UI_WELCOME_H
|
||||
|
||||
void UI_DisplayReleaseKeys(void);
|
||||
void UI_DisplayWelcome(void);
|
||||
|
||||
#endif
|
||||
|
||||
123
utils/main.cpp
@@ -93,15 +93,29 @@ void create_gain_table(const char *filename)
|
||||
mixer_dB[orig_mixer] +
|
||||
pga_dB[orig_pga];
|
||||
|
||||
const uint8_t lna_short_min = 0; // 0
|
||||
const uint8_t lna_min = 0; // 0
|
||||
const uint8_t mixer_min = 0; // 0
|
||||
const uint8_t pga_min = 0; // 0
|
||||
#if 1
|
||||
// full table
|
||||
const uint8_t lna_short_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_max = 7; // 5
|
||||
const uint8_t mixer_max = 3; // 3
|
||||
const uint8_t pga_max = 7; // 7
|
||||
const uint8_t lna_short_max = 3; // 3
|
||||
const uint8_t lna_max = 7; // 5
|
||||
const uint8_t mixer_max = 3; // 3
|
||||
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 = lna_min;
|
||||
@@ -244,37 +258,90 @@ void create_gain_table(const char *filename)
|
||||
return;
|
||||
|
||||
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\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",
|
||||
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);
|
||||
reg_val = ((uint16_t)orig_lna_short << 8) | ((uint16_t)orig_lna << 5) | ((uint16_t)orig_mixer << 3) | ((uint16_t)orig_pga << 0);
|
||||
sum_dB = lna_short_dB[orig_lna_short] + lna_dB[orig_lna] + mixer_dB[orig_mixer] + pga_dB[orig_pga];
|
||||
fprintf(file, "\t\t{0x%04X, %-3d}, // 0 .. %u %u %u %u .. 0dB -14dB 0dB -3dB .. -17dB original\n\n",
|
||||
reg_val,
|
||||
sum_dB,
|
||||
orig_lna_short,
|
||||
orig_lna,
|
||||
orig_mixer,
|
||||
orig_pga);
|
||||
|
||||
if (i == original_index)
|
||||
strcat(s, " original");
|
||||
for (unsigned int i = 0; i < gain_table.size(); i++)
|
||||
{
|
||||
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, "\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);
|
||||
}
|
||||
|
||||