Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ced053ba63 | ||
|
|
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 | ||
|
|
fa4ae2caa6 | ||
|
|
b45043aab2 | ||
|
|
ba3decad78 | ||
|
|
7df7461d31 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
firmware
|
firmware
|
||||||
/firmware.packed.bin
|
/firmware.packed.bin
|
||||||
/firmware.bin
|
/firmware.bin
|
||||||
|
/compiled-firmware
|
||||||
|
|||||||
12
Dockerfile
Normal file
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/
|
||||||
88
Makefile
88
Makefile
@@ -4,37 +4,48 @@
|
|||||||
# 1 = enable
|
# 1 = enable
|
||||||
#
|
#
|
||||||
ENABLE_SWD := 0
|
ENABLE_SWD := 0
|
||||||
ENABLE_OVERLAY := 1
|
ENABLE_OVERLAY := 0
|
||||||
|
ENABLE_LTO := 1
|
||||||
ENABLE_UART := 1
|
ENABLE_UART := 1
|
||||||
ENABLE_AIRCOPY := 0
|
ENABLE_AIRCOPY := 0
|
||||||
ENABLE_FMRADIO := 0
|
ENABLE_FMRADIO := 1
|
||||||
ENABLE_NOAA := 0
|
ENABLE_NOAA := 0
|
||||||
ENABLE_VOICE := 0
|
ENABLE_VOICE := 0
|
||||||
|
ENABLE_VOX := 1
|
||||||
ENABLE_ALARM := 0
|
ENABLE_ALARM := 0
|
||||||
|
ENABLE_TX1750 := 1
|
||||||
ENABLE_BIG_FREQ := 1
|
ENABLE_BIG_FREQ := 1
|
||||||
ENABLE_SMALL_BOLD := 1
|
ENABLE_SMALL_BOLD := 1
|
||||||
ENABLE_KEEP_MEM_NAME := 1
|
ENABLE_KEEP_MEM_NAME := 1
|
||||||
ENABLE_WIDE_RX := 1
|
ENABLE_WIDE_RX := 1
|
||||||
ENABLE_TX_WHEN_AM := 0
|
ENABLE_TX_WHEN_AM := 0
|
||||||
|
ENABLE_F_CAL_MENU := 0
|
||||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||||
ENABLE_MAIN_KEY_HOLD := 1
|
ENABLE_MAIN_KEY_HOLD := 1
|
||||||
ENABLE_BOOT_BEEPS := 0
|
ENABLE_BOOT_BEEPS := 0
|
||||||
ENABLE_COMPANDER := 1
|
|
||||||
ENABLE_SHOW_CHARGE_LEVEL := 1
|
ENABLE_SHOW_CHARGE_LEVEL := 1
|
||||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||||
ENABLE_NO_SCAN_TIMEOUT := 1
|
ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||||
ENABLE_AM_FIX := 1
|
ENABLE_AM_FIX := 1
|
||||||
ENABLE_AM_FIX_SHOW_DATA := 1
|
ENABLE_AM_FIX_SHOW_DATA := 0
|
||||||
ENABLE_SQUELCH_LOWER := 1
|
ENABLE_SQUELCH_LOWER := 0
|
||||||
|
ENABLE_FASTER_CHANNEL_SCAN := 1
|
||||||
ENABLE_RSSI_BAR := 1
|
ENABLE_RSSI_BAR := 1
|
||||||
ENABLE_AUDIO_BAR := 1
|
ENABLE_AUDIO_BAR := 1
|
||||||
|
ENABLE_COPY_CHAN_TO_VFO := 1
|
||||||
|
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||||
ENABLE_SPECTRUM := 1
|
ENABLE_SPECTRUM := 1
|
||||||
#ENABLE_COPY_CHAN_TO_VFO := 1
|
#ENABLE_BAND_SCOPE := 1
|
||||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
|
||||||
#ENABLE_BAND_SCOPE := 1
|
#############################################################
|
||||||
|
|
||||||
TARGET = firmware
|
TARGET = firmware
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO), 1)
|
||||||
|
# can't have LTO and OVERLAY enabled at same time
|
||||||
|
ENABLE_OVERLAY := 0
|
||||||
|
endif
|
||||||
|
|
||||||
BSP_DEFINITIONS := $(wildcard hardware/*/*.def)
|
BSP_DEFINITIONS := $(wildcard hardware/*/*.def)
|
||||||
BSP_HEADERS := $(patsubst hardware/%,bsp/%,$(BSP_DEFINITIONS))
|
BSP_HEADERS := $(patsubst hardware/%,bsp/%,$(BSP_DEFINITIONS))
|
||||||
BSP_HEADERS := $(patsubst %.def,%.h,$(BSP_HEADERS))
|
BSP_HEADERS := $(patsubst %.def,%.h,$(BSP_HEADERS))
|
||||||
@@ -96,7 +107,9 @@ OBJS += app/scanner.o
|
|||||||
ifeq ($(ENABLE_UART),1)
|
ifeq ($(ENABLE_UART),1)
|
||||||
OBJS += app/uart.o
|
OBJS += app/uart.o
|
||||||
endif
|
endif
|
||||||
OBJS += am_fix.o
|
ifeq ($(ENABLE_AM_FIX), 1)
|
||||||
|
OBJS += am_fix.o
|
||||||
|
endif
|
||||||
OBJS += audio.o
|
OBJS += audio.o
|
||||||
OBJS += bitmaps.o
|
OBJS += bitmaps.o
|
||||||
OBJS += board.o
|
OBJS += board.o
|
||||||
@@ -129,7 +142,7 @@ OBJS += ui/welcome.o
|
|||||||
OBJS += version.o
|
OBJS += version.o
|
||||||
OBJS += main.o
|
OBJS += main.o
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
else
|
else
|
||||||
TOP := $(shell pwd)
|
TOP := $(shell pwd)
|
||||||
@@ -158,6 +171,17 @@ CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delet
|
|||||||
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
|
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
|
||||||
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
|
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO), 1)
|
||||||
|
# CFLAGS += -flto
|
||||||
|
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
|
||||||
|
|
||||||
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
||||||
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
||||||
|
|
||||||
@@ -167,15 +191,15 @@ endif
|
|||||||
ifeq ($(ENABLE_SWD),1)
|
ifeq ($(ENABLE_SWD),1)
|
||||||
CFLAGS += -DENABLE_SWD
|
CFLAGS += -DENABLE_SWD
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_OVERLAY),1)
|
||||||
|
CFLAGS += -DENABLE_OVERLAY
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_AIRCOPY),1)
|
ifeq ($(ENABLE_AIRCOPY),1)
|
||||||
CFLAGS += -DENABLE_AIRCOPY
|
CFLAGS += -DENABLE_AIRCOPY
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_FMRADIO),1)
|
ifeq ($(ENABLE_FMRADIO),1)
|
||||||
CFLAGS += -DENABLE_FMRADIO
|
CFLAGS += -DENABLE_FMRADIO
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_OVERLAY),1)
|
|
||||||
CFLAGS += -DENABLE_OVERLAY
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_UART),1)
|
ifeq ($(ENABLE_UART),1)
|
||||||
CFLAGS += -DENABLE_UART
|
CFLAGS += -DENABLE_UART
|
||||||
endif
|
endif
|
||||||
@@ -191,11 +215,17 @@ endif
|
|||||||
ifeq ($(ENABLE_VOICE),1)
|
ifeq ($(ENABLE_VOICE),1)
|
||||||
CFLAGS += -DENABLE_VOICE
|
CFLAGS += -DENABLE_VOICE
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_VOX),1)
|
||||||
|
CFLAGS += -DENABLE_VOX
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_ALARM),1)
|
ifeq ($(ENABLE_ALARM),1)
|
||||||
CFLAGS += -DENABLE_ALARM
|
CFLAGS += -DENABLE_ALARM
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_TX1750),1)
|
||||||
|
CFLAGS += -DENABLE_TX1750
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
|
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
|
||||||
CFLAGS += -DKEEP_MEM_NAME
|
CFLAGS += -DENABLE_KEEP_MEM_NAME
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_WIDE_RX),1)
|
ifeq ($(ENABLE_WIDE_RX),1)
|
||||||
CFLAGS += -DENABLE_WIDE_RX
|
CFLAGS += -DENABLE_WIDE_RX
|
||||||
@@ -203,6 +233,9 @@ endif
|
|||||||
ifeq ($(ENABLE_TX_WHEN_AM),1)
|
ifeq ($(ENABLE_TX_WHEN_AM),1)
|
||||||
CFLAGS += -DENABLE_TX_WHEN_AM
|
CFLAGS += -DENABLE_TX_WHEN_AM
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_F_CAL_MENU),1)
|
||||||
|
CFLAGS += -DENABLE_F_CAL_MENU
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
||||||
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||||
endif
|
endif
|
||||||
@@ -212,17 +245,14 @@ endif
|
|||||||
ifeq ($(ENABLE_BOOT_BEEPS),1)
|
ifeq ($(ENABLE_BOOT_BEEPS),1)
|
||||||
CFLAGS += -DENABLE_BOOT_BEEPS
|
CFLAGS += -DENABLE_BOOT_BEEPS
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_COMPANDER),1)
|
|
||||||
CFLAGS += -DENABLE_COMPANDER
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_SHOW_CHARGE_LEVEL),1)
|
ifeq ($(ENABLE_SHOW_CHARGE_LEVEL),1)
|
||||||
CFLAGS += -DENABLE_SHOW_CHARGE_LEVEL
|
CFLAGS += -DENABLE_SHOW_CHARGE_LEVEL
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_REVERSE_BAT_SYMBOL),1)
|
ifeq ($(ENABLE_REVERSE_BAT_SYMBOL),1)
|
||||||
CFLAGS += -DENABLE_REVERSE_BAT_SYMBOL
|
CFLAGS += -DENABLE_REVERSE_BAT_SYMBOL
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_NO_SCAN_TIMEOUT),1)
|
ifeq ($(ENABLE_CODE_SCAN_TIMEOUT),1)
|
||||||
CFLAGS += -DENABLE_NO_SCAN_TIMEOUT
|
CFLAGS += -DENABLE_CODE_SCAN_TIMEOUT
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_AM_FIX),1)
|
ifeq ($(ENABLE_AM_FIX),1)
|
||||||
CFLAGS += -DENABLE_AM_FIX
|
CFLAGS += -DENABLE_AM_FIX
|
||||||
@@ -233,8 +263,14 @@ endif
|
|||||||
ifeq ($(ENABLE_AM_FIX_TEST1),1)
|
ifeq ($(ENABLE_AM_FIX_TEST1),1)
|
||||||
CFLAGS += -DENABLE_AM_FIX_TEST1
|
CFLAGS += -DENABLE_AM_FIX_TEST1
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_SQUELCH_LOWER),1)
|
ifeq ($(ENABLE_SQUELCH_MORE_SENSITIVE),1)
|
||||||
CFLAGS += -DENABLE_SQUELCH_LOWER
|
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
|
endif
|
||||||
ifeq ($(ENABLE_RSSI_BAR),1)
|
ifeq ($(ENABLE_RSSI_BAR),1)
|
||||||
CFLAGS += -DENABLE_RSSI_BAR
|
CFLAGS += -DENABLE_RSSI_BAR
|
||||||
@@ -254,6 +290,14 @@ endif
|
|||||||
|
|
||||||
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
||||||
|
|
||||||
|
# Use newlib-nano instead of newlib
|
||||||
|
LDFLAGS += --specs=nano.specs
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO), 0)
|
||||||
|
# Throw away unneeded func/data sections like LTO does
|
||||||
|
LDFLAGS += -Wl,--gc-sections
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
ASFLAGS += -g
|
ASFLAGS += -g
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
|||||||
57
README.md
57
README.md
@@ -3,7 +3,6 @@
|
|||||||
- fagci spectrum analyzer (**F+5** to turn on)
|
- fagci spectrum analyzer (**F+5** to turn on)
|
||||||
- better battery percentage calculation (based on real measurement, battery calibration recommended)
|
- better battery percentage calculation (based on real measurement, battery calibration recommended)
|
||||||
- battery calibration option available available in the menu (instructions below)
|
- battery calibration option available available in the menu (instructions below)
|
||||||
- there is no FM radio nor Aircopy, not enough memory space
|
|
||||||
|
|
||||||
<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 />
|
<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 />
|
||||||
|
|
||||||
@@ -13,12 +12,10 @@
|
|||||||
|
|
||||||
To enter the calibration:
|
To enter the calibration:
|
||||||
|
|
||||||
1. turn the radio on holding PTT and the first side button
|
1. turn the radio on while holding PTT and the first side button
|
||||||
2. imediately go to BATVOL option and adjust the voltage with UP/DOWN buttons
|
2. go to BATCAL option and adjust the voltage with UP/DOWN buttons
|
||||||
3. confirm the setting, calibration will be saved to EEPROM
|
3. confirm the setting, calibration will be saved to EEPROM
|
||||||
|
|
||||||
The calibration option becomes unavailable if you leave the menu screen and you have to repeat from step 1.
|
|
||||||
|
|
||||||
|
|
||||||
# Open reimplementation of the Quan Sheng UV-K5 v2.1.27 firmware
|
# Open reimplementation of the Quan Sheng UV-K5 v2.1.27 firmware
|
||||||
|
|
||||||
@@ -39,9 +36,11 @@ Anyway, have fun.
|
|||||||
Please note that the Quansheng uv-k radios are not professional quality transceivers, their
|
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
|
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
|
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
|
and all signals over a wide frequency range.
|
||||||
will nearly always destroy your reception, the receiver simply doesn't have a great dynamic
|
Using the radio in high intensity RF environments will nearly always destroy your reception,
|
||||||
range, though are quite sensitive (weak signal wise).
|
the receiver simply doesn't have a great dynamic range, which means distorted AM audio with
|
||||||
|
strong received signals, there is nothing more anyone can do in firmware/software to stop that
|
||||||
|
happening once the RX gain adjustment I do (AM fix) reaches the hardwares limit.
|
||||||
|
|
||||||
Saying that, they are nice toys for the price, fun to play with.
|
Saying that, they are nice toys for the price, fun to play with.
|
||||||
|
|
||||||
@@ -52,35 +51,45 @@ You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) .
|
|||||||
|
|
||||||
```
|
```
|
||||||
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
|
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
|
||||||
ENABLE_OVERLAY := 1 cpu FLASH stuff
|
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed
|
||||||
ENABLE_UART := 1 without this you can't configure radio via PC
|
ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (overlay will be disabled if you enable this)
|
||||||
ENABLE_AIRCOPY := 0 easier to just enter frequency
|
ENABLE_UART := 1 without this you can't configure radio via PC !
|
||||||
ENABLE_FMRADIO := 1 WBFM VHF band 2 RX
|
ENABLE_AIRCOPY := 0 easier to just enter frequency with butts
|
||||||
ENABLE_NOAA := 0 everything NOAA
|
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_VOICE := 0 want to hear voices ?
|
||||||
|
ENABLE_VOX := 0
|
||||||
ENABLE_ALARM := 0 TX alarms
|
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_BIG_FREQ := 0 big font frequencies (like original QS firmware)
|
||||||
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
|
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
|
||||||
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
|
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
|
||||||
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_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_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_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead just hold down keys 0-9 to access the secondary butt functions
|
||||||
ENABLE_BOOT_BEEPS := 0 give user audio feedback on volume knob position at boot-up
|
ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up
|
||||||
ENABLE_COMPANDER := 1 compander option (per channel)
|
|
||||||
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
|
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
|
||||||
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
||||||
ENABLE_NO_SCAN_TIMEOUT := 1 remove the 32 sec timeout from the CTCSS/DCS scan (press exit butt to end scan)
|
ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan)
|
||||||
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation - ignore the on-screen RSSI (for now)
|
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
|
||||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix
|
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
||||||
ENABLE_SQUELCH_LOWER := 1 squelch settings more sensitive - plan to let user adjust it in the menu
|
ENABLE_SQUELCH_MORE_SENSITIVE := 0 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
||||||
ENABLE_RSSI_BAR := 1 enable a dBm/Sx RSSI bar graph level
|
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_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_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
|
||||||
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# New/modified function keys
|
||||||
|
|
||||||
|
* Long-press 'M' = Copy selected channel into the same VFO, then switches to frequency mode
|
||||||
|
* Long-press '5' = Toggle a selected channels scanlist setting .. if NOAA is disable in Makefile
|
||||||
|
* Long-press '*' = Toggles the scanlist number 1, 2 or ALL channels .. if in channel scan mode
|
||||||
|
|
||||||
# Some changes made from the Quansheng firmware
|
# Some changes made from the Quansheng firmware
|
||||||
|
|
||||||
* Various Quansheng firmware bugs fixed
|
* Various Quansheng firmware bugs fixed
|
||||||
|
|||||||
328
am_fix.c
328
am_fix.c
@@ -30,30 +30,13 @@
|
|||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "misc.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
|
#ifdef ENABLE_AM_FIX
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#if 1
|
uint16_t reg_val;
|
||||||
// bitfields take up less flash bytes
|
int8_t gain_dB;
|
||||||
uint8_t lna_short:2; // 0 ~ 3
|
} __attribute__((packed)) t_gain_table;
|
||||||
uint8_t lna:3; // 0 ~ 7
|
|
||||||
uint8_t mixer:2; // 0 ~ 3
|
|
||||||
uint8_t pga:3; // 0 ~ 7
|
|
||||||
#else
|
|
||||||
uint8_t lna_short; // 0 ~ 3
|
|
||||||
uint8_t lna; // 0 ~ 7
|
|
||||||
uint8_t mixer; // 0 ~ 3
|
|
||||||
uint8_t pga; // 0 ~ 7
|
|
||||||
#endif
|
|
||||||
} t_gain_table;
|
|
||||||
//} __attribute__((packed)) t_gain_table;
|
|
||||||
|
|
||||||
// REG_10 AGC gain table
|
// REG_10 AGC gain table
|
||||||
//
|
//
|
||||||
@@ -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 !!!
|
// if I don't add the brackets, reading the table returns unexpected/different values !!!
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
//// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
||||||
static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
// static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
||||||
static const int16_t lna_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 0};
|
// static const int16_t lna_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 0};
|
||||||
static const int16_t mixer_dB[] = { ( -8), ( -6), ( -3), 0};
|
// static const int16_t mixer_dB[] = { ( -8), ( -6), ( -3), 0};
|
||||||
static const int16_t pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
// static const int16_t pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
||||||
|
|
||||||
// lookup table is hugely easier than writing code to do the same
|
// lookup table is hugely easier than writing code to do the same
|
||||||
//
|
//
|
||||||
static const t_gain_table gain_table[] =
|
static const t_gain_table gain_table[] =
|
||||||
{
|
{
|
||||||
{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original
|
{0x035E, -17}, // 0 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
|
|
||||||
// test table that lets me manually set the lna-short register
|
// test table that lets me manually set the lna-short register
|
||||||
// to measure it's actual dB change using an RF signal generator
|
// to measure it's actual dB change using an RF signal generator
|
||||||
|
|
||||||
{0, 2, 3, 6}, // 1 .. -33dB -14dB 0dB -3dB .. -50dB
|
{0x005E, -50}, // 1 .. 0 2 3 6 .. -33dB -14dB 0dB -3dB .. -50dB
|
||||||
{1, 2, 3, 6}, // 2 .. -30dB -14dB 0dB -3dB .. -47dB
|
{0x015E, -47}, // 2 .. 1 2 3 6 .. -30dB -14dB 0dB -3dB .. -47dB
|
||||||
{2, 2, 3, 6}, // 3 .. -24dB -14dB 0dB -3dB .. -41dB
|
{0x025E, -41}, // 3 .. 2 2 3 6 .. -24dB -14dB 0dB -3dB .. -41dB
|
||||||
{3, 2, 3, 6} // 4 .. 0dB -14dB 0dB -3dB .. -17dB
|
{0x035E, -17} // 4 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned int original_index = 1;
|
static const unsigned int original_index = 1;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
{0, 0, 0, 0}, // 1 .. -33dB -24dB -8dB -33dB .. -98dB
|
{0x0000, -98}, // 1 .. 0 0 0 0 .. -33dB -24dB -8dB -33dB .. -98dB
|
||||||
{0, 0, 1, 0}, // 2 .. -33dB -24dB -6dB -33dB .. -96dB
|
{0x0008, -96}, // 2 .. 0 0 1 0 .. -33dB -24dB -6dB -33dB .. -96dB
|
||||||
{1, 0, 0, 0}, // 3 .. -30dB -24dB -8dB -33dB .. -95dB
|
{0x0100, -95}, // 3 .. 1 0 0 0 .. -30dB -24dB -8dB -33dB .. -95dB
|
||||||
{0, 1, 0, 0}, // 4 .. -33dB -19dB -8dB -33dB .. -93dB
|
{0x0020, -93}, // 4 .. 0 1 0 0 .. -33dB -19dB -8dB -33dB .. -93dB
|
||||||
{0, 0, 0, 1}, // 5 .. -33dB -24dB -8dB -27dB .. -92dB
|
{0x0001, -92}, // 5 .. 0 0 0 1 .. -33dB -24dB -8dB -27dB .. -92dB
|
||||||
{0, 1, 1, 0}, // 6 .. -33dB -19dB -6dB -33dB .. -91dB
|
{0x0028, -91}, // 6 .. 0 1 1 0 .. -33dB -19dB -6dB -33dB .. -91dB
|
||||||
{0, 0, 1, 1}, // 7 .. -33dB -24dB -6dB -27dB .. -90dB
|
{0x0009, -90}, // 7 .. 0 0 1 1 .. -33dB -24dB -6dB -27dB .. -90dB
|
||||||
{1, 0, 0, 1}, // 8 .. -30dB -24dB -8dB -27dB .. -89dB
|
{0x0101, -89}, // 8 .. 1 0 0 1 .. -30dB -24dB -8dB -27dB .. -89dB
|
||||||
{0, 1, 2, 0}, // 9 .. -33dB -19dB -3dB -33dB .. -88dB
|
{0x0030, -88}, // 9 .. 0 1 2 0 .. -33dB -19dB -3dB -33dB .. -88dB
|
||||||
{1, 0, 3, 0}, // 10 .. -30dB -24dB 0dB -33dB .. -87dB
|
{0x0118, -87}, // 10 .. 1 0 3 0 .. -30dB -24dB 0dB -33dB .. -87dB
|
||||||
{0, 0, 0, 2}, // 11 .. -33dB -24dB -8dB -21dB .. -86dB
|
{0x0002, -86}, // 11 .. 0 0 0 2 .. -33dB -24dB -8dB -21dB .. -86dB
|
||||||
{1, 1, 2, 0}, // 12 .. -30dB -19dB -3dB -33dB .. -85dB
|
{0x0130, -85}, // 12 .. 1 1 2 0 .. -30dB -19dB -3dB -33dB .. -85dB
|
||||||
{0, 0, 3, 1}, // 13 .. -33dB -24dB 0dB -27dB .. -84dB
|
{0x0019, -84}, // 13 .. 0 0 3 1 .. -33dB -24dB 0dB -27dB .. -84dB
|
||||||
{0, 3, 0, 0}, // 14 .. -33dB -9dB -8dB -33dB .. -83dB
|
{0x0060, -83}, // 14 .. 0 3 0 0 .. -33dB -9dB -8dB -33dB .. -83dB
|
||||||
{1, 1, 3, 0}, // 15 .. -30dB -19dB 0dB -33dB .. -82dB
|
{0x0138, -82}, // 15 .. 1 1 3 0 .. -30dB -19dB 0dB -33dB .. -82dB
|
||||||
{1, 0, 3, 1}, // 16 .. -30dB -24dB 0dB -27dB .. -81dB
|
{0x0119, -81}, // 16 .. 1 0 3 1 .. -30dB -24dB 0dB -27dB .. -81dB
|
||||||
{0, 2, 3, 0}, // 17 .. -33dB -14dB 0dB -33dB .. -80dB
|
{0x0058, -80}, // 17 .. 0 2 3 0 .. -33dB -14dB 0dB -33dB .. -80dB
|
||||||
{1, 2, 0, 1}, // 18 .. -30dB -14dB -8dB -27dB .. -79dB
|
{0x0141, -79}, // 18 .. 1 2 0 1 .. -30dB -14dB -8dB -27dB .. -79dB
|
||||||
{0, 3, 2, 0}, // 19 .. -33dB -9dB -3dB -33dB .. -78dB
|
{0x0070, -78}, // 19 .. 0 3 2 0 .. -33dB -9dB -3dB -33dB .. -78dB
|
||||||
{1, 4, 0, 0}, // 20 .. -30dB -6dB -8dB -33dB .. -77dB
|
{0x0180, -77}, // 20 .. 1 4 0 0 .. -30dB -6dB -8dB -33dB .. -77dB
|
||||||
{1, 1, 3, 1}, // 21 .. -30dB -19dB 0dB -27dB .. -76dB
|
{0x0139, -76}, // 21 .. 1 1 3 1 .. -30dB -19dB 0dB -27dB .. -76dB
|
||||||
{0, 0, 2, 3}, // 22 .. -33dB -24dB -3dB -15dB .. -75dB
|
{0x0013, -75}, // 22 .. 0 0 2 3 .. -33dB -24dB -3dB -15dB .. -75dB
|
||||||
{1, 3, 0, 1}, // 23 .. -30dB -9dB -8dB -27dB .. -74dB
|
{0x0161, -74}, // 23 .. 1 3 0 1 .. -30dB -9dB -8dB -27dB .. -74dB
|
||||||
{1, 6, 0, 0}, // 24 .. -30dB -2dB -8dB -33dB .. -73dB
|
{0x01C0, -73}, // 24 .. 1 6 0 0 .. -30dB -2dB -8dB -33dB .. -73dB
|
||||||
{0, 7, 1, 0}, // 25 .. -33dB 0dB -6dB -33dB .. -72dB
|
{0x00E8, -72}, // 25 .. 0 7 1 0 .. -33dB 0dB -6dB -33dB .. -72dB
|
||||||
{0, 6, 2, 0}, // 26 .. -33dB -2dB -3dB -33dB .. -71dB
|
{0x00D0, -71}, // 26 .. 0 6 2 0 .. -33dB -2dB -3dB -33dB .. -71dB
|
||||||
{2, 1, 3, 1}, // 27 .. -24dB -19dB 0dB -27dB .. -70dB
|
{0x0239, -70}, // 27 .. 2 1 3 1 .. -24dB -19dB 0dB -27dB .. -70dB
|
||||||
{0, 3, 1, 2}, // 28 .. -33dB -9dB -6dB -21dB .. -69dB
|
{0x006A, -69}, // 28 .. 0 3 1 2 .. -33dB -9dB -6dB -21dB .. -69dB
|
||||||
{0, 0, 0, 6}, // 29 .. -33dB -24dB -8dB -3dB .. -68dB
|
{0x0006, -68}, // 29 .. 0 0 0 6 .. -33dB -24dB -8dB -3dB .. -68dB
|
||||||
{0, 5, 2, 1}, // 30 .. -33dB -4dB -3dB -27dB .. -67dB
|
{0x00B1, -67}, // 30 .. 0 5 2 1 .. -33dB -4dB -3dB -27dB .. -67dB
|
||||||
{0, 0, 1, 6}, // 31 .. -33dB -24dB -6dB -3dB .. -66dB
|
{0x000E, -66}, // 31 .. 0 0 1 6 .. -33dB -24dB -6dB -3dB .. -66dB
|
||||||
{1, 2, 3, 2}, // 32 .. -30dB -14dB 0dB -21dB .. -65dB
|
{0x015A, -65}, // 32 .. 1 2 3 2 .. -30dB -14dB 0dB -21dB .. -65dB
|
||||||
{2, 1, 1, 3}, // 33 .. -24dB -19dB -6dB -15dB .. -64dB
|
{0x022B, -64}, // 33 .. 2 1 1 3 .. -24dB -19dB -6dB -15dB .. -64dB
|
||||||
{1, 7, 3, 0}, // 34 .. -30dB 0dB 0dB -33dB .. -63dB
|
{0x01F8, -63}, // 34 .. 1 7 3 0 .. -30dB 0dB 0dB -33dB .. -63dB
|
||||||
{1, 3, 0, 3}, // 35 .. -30dB -9dB -8dB -15dB .. -62dB
|
{0x0163, -62}, // 35 .. 1 3 0 3 .. -30dB -9dB -8dB -15dB .. -62dB
|
||||||
{0, 1, 2, 5}, // 36 .. -33dB -19dB -3dB -6dB .. -61dB
|
{0x0035, -61}, // 36 .. 0 1 2 5 .. -33dB -19dB -3dB -6dB .. -61dB
|
||||||
{2, 0, 2, 4}, // 37 .. -24dB -24dB -3dB -9dB .. -60dB
|
{0x0214, -60}, // 37 .. 2 0 2 4 .. -24dB -24dB -3dB -9dB .. -60dB
|
||||||
{1, 6, 3, 1}, // 38 .. -30dB -2dB 0dB -27dB .. -59dB
|
{0x01D9, -59}, // 38 .. 1 6 3 1 .. -30dB -2dB 0dB -27dB .. -59dB
|
||||||
{1, 2, 0, 5}, // 39 .. -30dB -14dB -8dB -6dB .. -58dB
|
{0x0145, -58}, // 39 .. 1 2 0 5 .. -30dB -14dB -8dB -6dB .. -58dB
|
||||||
{2, 5, 0, 2}, // 40 .. -24dB -4dB -8dB -21dB .. -57dB
|
{0x02A2, -57}, // 40 .. 2 5 0 2 .. -24dB -4dB -8dB -21dB .. -57dB
|
||||||
{2, 6, 2, 1}, // 41 .. -24dB -2dB -3dB -27dB .. -56dB
|
{0x02D1, -56}, // 41 .. 2 6 2 1 .. -24dB -2dB -3dB -27dB .. -56dB
|
||||||
{0, 5, 2, 3}, // 42 .. -33dB -4dB -3dB -15dB .. -55dB
|
{0x00B3, -55}, // 42 .. 0 5 2 3 .. -33dB -4dB -3dB -15dB .. -55dB
|
||||||
{2, 0, 2, 6}, // 43 .. -24dB -24dB -3dB -3dB .. -54dB
|
{0x0216, -54}, // 43 .. 2 0 2 6 .. -24dB -24dB -3dB -3dB .. -54dB
|
||||||
{0, 3, 0, 6}, // 44 .. -33dB -9dB -8dB -3dB .. -53dB
|
{0x0066, -53}, // 44 .. 0 3 0 6 .. -33dB -9dB -8dB -3dB .. -53dB
|
||||||
{0, 6, 0, 4}, // 45 .. -33dB -2dB -8dB -9dB .. -52dB
|
{0x00C4, -52}, // 45 .. 0 6 0 4 .. -33dB -2dB -8dB -9dB .. -52dB
|
||||||
{0, 3, 1, 6}, // 46 .. -33dB -9dB -6dB -3dB .. -51dB
|
{0x006E, -51}, // 46 .. 0 3 1 6 .. -33dB -9dB -6dB -3dB .. -51dB
|
||||||
{1, 2, 3, 5}, // 47 .. -30dB -14dB 0dB -6dB .. -50dB
|
{0x015D, -50}, // 47 .. 1 2 3 5 .. -30dB -14dB 0dB -6dB .. -50dB
|
||||||
{0, 5, 1, 5}, // 48 .. -33dB -4dB -6dB -6dB .. -49dB
|
{0x00AD, -49}, // 48 .. 0 5 1 5 .. -33dB -4dB -6dB -6dB .. -49dB
|
||||||
{0, 3, 3, 5}, // 49 .. -33dB -9dB 0dB -6dB .. -48dB
|
{0x007D, -48}, // 49 .. 0 3 3 5 .. -33dB -9dB 0dB -6dB .. -48dB
|
||||||
{0, 6, 2, 4}, // 50 .. -33dB -2dB -3dB -9dB .. -47dB
|
{0x00D4, -47}, // 50 .. 0 6 2 4 .. -33dB -2dB -3dB -9dB .. -47dB
|
||||||
{1, 5, 2, 4}, // 51 .. -30dB -4dB -3dB -9dB .. -46dB
|
{0x01B4, -46}, // 51 .. 1 5 2 4 .. -30dB -4dB -3dB -9dB .. -46dB
|
||||||
{3, 0, 1, 3}, // 52 .. 0dB -24dB -6dB -15dB .. -45dB
|
{0x030B, -45}, // 52 .. 3 0 1 3 .. 0dB -24dB -6dB -15dB .. -45dB
|
||||||
{0, 6, 1, 6}, // 53 .. -33dB -2dB -6dB -3dB .. -44dB
|
{0x00CE, -44}, // 53 .. 0 6 1 6 .. -33dB -2dB -6dB -3dB .. -44dB
|
||||||
{1, 5, 2, 5}, // 54 .. -30dB -4dB -3dB -6dB .. -43dB
|
{0x01B5, -43}, // 54 .. 1 5 2 5 .. -30dB -4dB -3dB -6dB .. -43dB
|
||||||
{0, 4, 2, 7}, // 55 .. -33dB -6dB -3dB 0dB .. -42dB
|
{0x0097, -42}, // 55 .. 0 4 2 7 .. -33dB -6dB -3dB 0dB .. -42dB
|
||||||
{2, 2, 2, 7}, // 56 .. -24dB -14dB -3dB 0dB .. -41dB
|
{0x0257, -41}, // 56 .. 2 2 2 7 .. -24dB -14dB -3dB 0dB .. -41dB
|
||||||
{2, 5, 2, 4}, // 57 .. -24dB -4dB -3dB -9dB .. -40dB
|
{0x02B4, -40}, // 57 .. 2 5 2 4 .. -24dB -4dB -3dB -9dB .. -40dB
|
||||||
{2, 3, 3, 5}, // 58 .. -24dB -9dB 0dB -6dB .. -39dB
|
{0x027D, -39}, // 58 .. 2 3 3 5 .. -24dB -9dB 0dB -6dB .. -39dB
|
||||||
{1, 6, 3, 5}, // 59 .. -30dB -2dB 0dB -6dB .. -38dB
|
{0x01DD, -38}, // 59 .. 1 6 3 5 .. -30dB -2dB 0dB -6dB .. -38dB
|
||||||
{2, 5, 1, 6}, // 60 .. -24dB -4dB -6dB -3dB .. -37dB
|
{0x02AE, -37}, // 60 .. 2 5 1 6 .. -24dB -4dB -6dB -3dB .. -37dB
|
||||||
{3, 3, 3, 1}, // 61 .. 0dB -9dB 0dB -27dB .. -36dB
|
{0x0379, -36}, // 61 .. 3 3 3 1 .. 0dB -9dB 0dB -27dB .. -36dB
|
||||||
{3, 2, 3, 2}, // 62 .. 0dB -14dB 0dB -21dB .. -35dB
|
{0x035A, -35}, // 62 .. 3 2 3 2 .. 0dB -14dB 0dB -21dB .. -35dB
|
||||||
{2, 5, 2, 6}, // 63 .. -24dB -4dB -3dB -3dB .. -34dB
|
{0x02B6, -34}, // 63 .. 2 5 2 6 .. -24dB -4dB -3dB -3dB .. -34dB
|
||||||
{3, 0, 1, 6}, // 64 .. 0dB -24dB -6dB -3dB .. -33dB
|
{0x030E, -33}, // 64 .. 3 0 1 6 .. 0dB -24dB -6dB -3dB .. -33dB
|
||||||
{3, 0, 0, 7}, // 65 .. 0dB -24dB -8dB 0dB .. -32dB
|
{0x0307, -32}, // 65 .. 3 0 0 7 .. 0dB -24dB -8dB 0dB .. -32dB
|
||||||
{2, 5, 3, 6}, // 66 .. -24dB -4dB 0dB -3dB .. -31dB
|
{0x02BE, -31}, // 66 .. 2 5 3 6 .. -24dB -4dB 0dB -3dB .. -31dB
|
||||||
{3, 3, 3, 2}, // 67 .. 0dB -9dB 0dB -21dB .. -30dB
|
{0x037A, -30}, // 67 .. 3 3 3 2 .. 0dB -9dB 0dB -21dB .. -30dB
|
||||||
{2, 6, 3, 6}, // 68 .. -24dB -2dB 0dB -3dB .. -29dB
|
{0x02DE, -29}, // 68 .. 2 6 3 6 .. -24dB -2dB 0dB -3dB .. -29dB
|
||||||
{3, 2, 0, 5}, // 69 .. 0dB -14dB -8dB -6dB .. -28dB
|
{0x0345, -28}, // 69 .. 3 2 0 5 .. 0dB -14dB -8dB -6dB .. -28dB
|
||||||
{3, 5, 0, 3}, // 70 .. 0dB -4dB -8dB -15dB .. -27dB
|
{0x03A3, -27}, // 70 .. 3 5 0 3 .. 0dB -4dB -8dB -15dB .. -27dB
|
||||||
{3, 3, 0, 4}, // 71 .. 0dB -9dB -8dB -9dB .. -26dB
|
{0x0364, -26}, // 71 .. 3 3 0 4 .. 0dB -9dB -8dB -9dB .. -26dB
|
||||||
{3, 1, 1, 7}, // 72 .. 0dB -19dB -6dB 0dB .. -25dB
|
{0x032F, -25}, // 72 .. 3 1 1 7 .. 0dB -19dB -6dB 0dB .. -25dB
|
||||||
{3, 4, 2, 3}, // 73 .. 0dB -6dB -3dB -15dB .. -24dB
|
{0x0393, -24}, // 73 .. 3 4 2 3 .. 0dB -6dB -3dB -15dB .. -24dB
|
||||||
{3, 4, 0, 4}, // 74 .. 0dB -6dB -8dB -9dB .. -23dB
|
{0x0384, -23}, // 74 .. 3 4 0 4 .. 0dB -6dB -8dB -9dB .. -23dB
|
||||||
{3, 2, 0, 7}, // 75 .. 0dB -14dB -8dB 0dB .. -22dB
|
{0x0347, -22}, // 75 .. 3 2 0 7 .. 0dB -14dB -8dB 0dB .. -22dB
|
||||||
{3, 7, 1, 3}, // 76 .. 0dB 0dB -6dB -15dB .. -21dB
|
{0x03EB, -21}, // 76 .. 3 7 1 3 .. 0dB 0dB -6dB -15dB .. -21dB
|
||||||
{3, 6, 2, 3}, // 77 .. 0dB -2dB -3dB -15dB .. -20dB
|
{0x03D3, -20}, // 77 .. 3 6 2 3 .. 0dB -2dB -3dB -15dB .. -20dB
|
||||||
{3, 5, 3, 3}, // 78 .. 0dB -4dB 0dB -15dB .. -19dB
|
{0x03BB, -19}, // 78 .. 3 5 3 3 .. 0dB -4dB 0dB -15dB .. -19dB
|
||||||
{3, 3, 3, 4}, // 79 .. 0dB -9dB 0dB -9dB .. -18dB
|
{0x037C, -18}, // 79 .. 3 3 3 4 .. 0dB -9dB 0dB -9dB .. -18dB
|
||||||
{3, 2, 3, 6}, // 80 .. 0dB -14dB 0dB -3dB .. -17dB original
|
{0x035E, -17}, // 80 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||||
{3, 6, 0, 5}, // 81 .. 0dB -2dB -8dB -6dB .. -16dB
|
{0x03C5, -16}, // 81 .. 3 6 0 5 .. 0dB -2dB -8dB -6dB .. -16dB
|
||||||
{3, 7, 1, 4}, // 82 .. 0dB 0dB -6dB -9dB .. -15dB
|
{0x03EC, -15}, // 82 .. 3 7 1 4 .. 0dB 0dB -6dB -9dB .. -15dB
|
||||||
{3, 2, 3, 7}, // 83 .. 0dB -14dB 0dB 0dB .. -14dB
|
{0x035F, -14}, // 83 .. 3 2 3 7 .. 0dB -14dB 0dB 0dB .. -14dB
|
||||||
{3, 6, 0, 6}, // 84 .. 0dB -2dB -8dB -3dB .. -13dB
|
{0x03C6, -13}, // 84 .. 3 6 0 6 .. 0dB -2dB -8dB -3dB .. -13dB
|
||||||
{3, 3, 2, 7}, // 85 .. 0dB -9dB -3dB 0dB .. -12dB
|
{0x0377, -12}, // 85 .. 3 3 2 7 .. 0dB -9dB -3dB 0dB .. -12dB
|
||||||
{3, 7, 0, 6}, // 86 .. 0dB 0dB -8dB -3dB .. -11dB
|
{0x03E6, -11}, // 86 .. 3 7 0 6 .. 0dB 0dB -8dB -3dB .. -11dB
|
||||||
{3, 5, 3, 5}, // 87 .. 0dB -4dB 0dB -6dB .. -10dB
|
{0x03BD, -10}, // 87 .. 3 5 3 5 .. 0dB -4dB 0dB -6dB .. -10dB
|
||||||
{3, 7, 2, 5}, // 88 .. 0dB 0dB -3dB -6dB .. -9dB
|
{0x03F5, -9}, // 88 .. 3 7 2 5 .. 0dB 0dB -3dB -6dB .. -9dB
|
||||||
{3, 6, 3, 5}, // 89 .. 0dB -2dB 0dB -6dB .. -8dB
|
{0x03DD, -8}, // 89 .. 3 6 3 5 .. 0dB -2dB 0dB -6dB .. -8dB
|
||||||
{3, 5, 2, 7}, // 90 .. 0dB -4dB -3dB 0dB .. -7dB
|
{0x03B7, -7}, // 90 .. 3 5 2 7 .. 0dB -4dB -3dB 0dB .. -7dB
|
||||||
{3, 7, 2, 6}, // 91 .. 0dB 0dB -3dB -3dB .. -6dB
|
{0x03F6, -6}, // 91 .. 3 7 2 6 .. 0dB 0dB -3dB -3dB .. -6dB
|
||||||
{3, 6, 2, 7}, // 92 .. 0dB -2dB -3dB 0dB .. -5dB
|
{0x03D7, -5}, // 92 .. 3 6 2 7 .. 0dB -2dB -3dB 0dB .. -5dB
|
||||||
{3, 5, 3, 7}, // 93 .. 0dB -4dB 0dB 0dB .. -4dB
|
{0x03BF, -4}, // 93 .. 3 5 3 7 .. 0dB -4dB 0dB 0dB .. -4dB
|
||||||
{3, 7, 2, 7}, // 94 .. 0dB 0dB -3dB 0dB .. -3dB
|
{0x03F7, -3}, // 94 .. 3 7 2 7 .. 0dB 0dB -3dB 0dB .. -3dB
|
||||||
{3, 6, 3, 7}, // 95 .. 0dB -2dB 0dB 0dB .. -2dB
|
{0x03DF, -2}, // 95 .. 3 6 3 7 .. 0dB -2dB 0dB 0dB .. -2dB
|
||||||
{3, 7, 3, 7} // 96 .. 0dB 0dB 0dB 0dB .. 0dB
|
{0x03FF, 0} // 96 .. 3 7 3 7 .. 0dB 0dB 0dB 0dB .. 0dB
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned int original_index = 80;
|
static const unsigned int original_index = 80;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// total RF gain for each table index
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
int8_t gain_dB[ARRAY_SIZE(gain_table)] = {0};
|
// display update rate
|
||||||
|
static const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
||||||
// display update rate
|
unsigned int counter = 0;
|
||||||
const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
#endif
|
||||||
unsigned int counter = 0;
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
// user manually sets the table index .. used to calibrate the desired dB gain table
|
// user manually sets the table index .. used to calibrate the desired dB gain table
|
||||||
@@ -280,13 +262,6 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// pre-compute the total gain for each table index .. saves doing it in real time
|
|
||||||
for (i = 0; i < ARRAY_SIZE(gain_table); i++)
|
|
||||||
{
|
|
||||||
const t_gain_table gains = gain_table[i];
|
|
||||||
gain_dB[i] = lna_short_dB[gains.lna_short] + lna_dB[gains.lna] + mixer_dB[gains.mixer] + pga_dB[gains.pga];
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{ // set a maximum gain to use
|
{ // set a maximum gain to use
|
||||||
// const int16_t max_gain_dB = gain_dB[original_index];
|
// const int16_t max_gain_dB = gain_dB[original_index];
|
||||||
@@ -294,7 +269,8 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
|
|
||||||
max_index = ARRAY_SIZE(gain_table);
|
max_index = ARRAY_SIZE(gain_table);
|
||||||
while (--max_index > 1)
|
while (--max_index > 1)
|
||||||
if (gain_dB[max_index] <= max_gain_dB)
|
// if (gain_dB[max_index] <= max_gain_dB)
|
||||||
|
if (gain_table[max_index].gain_dB <= max_gain_dB)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -306,7 +282,9 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
void AM_fix_reset(const int vfo)
|
void AM_fix_reset(const int vfo)
|
||||||
{ // reset the AM fixer upper
|
{ // reset the AM fixer upper
|
||||||
|
|
||||||
counter = 0;
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
counter = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
prev_rssi[vfo] = 0;
|
prev_rssi[vfo] = 0;
|
||||||
|
|
||||||
@@ -340,7 +318,9 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
case FUNCTION_TRANSMIT:
|
case FUNCTION_TRANSMIT:
|
||||||
case FUNCTION_BAND_SCOPE:
|
case FUNCTION_BAND_SCOPE:
|
||||||
case FUNCTION_POWER_SAVE:
|
case FUNCTION_POWER_SAVE:
|
||||||
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// only adjust stuff if we're in one of these modes
|
// only adjust stuff if we're in one of these modes
|
||||||
@@ -351,14 +331,16 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter > 0)
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
{
|
if (counter > 0)
|
||||||
if (++counter >= display_update_rate)
|
{
|
||||||
{ // trigger a display update
|
if (++counter >= display_update_rate)
|
||||||
counter = 0;
|
{ // trigger a display update
|
||||||
gUpdateDisplay = true;
|
counter = 0;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
{ // sample the current RSSI level
|
{ // sample the current RSSI level
|
||||||
// average it with the previous rssi (a bit of noise/spike immunity)
|
// average it with the previous rssi (a bit of noise/spike immunity)
|
||||||
@@ -367,11 +349,14 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
prev_rssi[vfo] = new_rssi;
|
prev_rssi[vfo] = new_rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // save the corrected RSSI level
|
// save the corrected RSSI level
|
||||||
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
{
|
||||||
const int16_t new_rssi = rssi - rssi_gain_diff[vfo];
|
const int16_t new_rssi = rssi - rssi_gain_diff[vfo];
|
||||||
if (gCurrentRSSI[vfo] != new_rssi)
|
if (gCurrentRSSI[vfo] != new_rssi)
|
||||||
{
|
{
|
||||||
gCurrentRSSI[vfo] = new_rssi;
|
gCurrentRSSI[vfo] = new_rssi;
|
||||||
|
|
||||||
if (counter == 0)
|
if (counter == 0)
|
||||||
{ // trigger a display update
|
{ // trigger a display update
|
||||||
counter = 1;
|
counter = 1;
|
||||||
@@ -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
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
// user is manually adjusting a gain register - don't do anything automatically
|
// user is manually adjusting a gain register - don't do anything automatically
|
||||||
@@ -411,10 +399,12 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
if (diff_dB >= 10)
|
if (diff_dB >= 10)
|
||||||
{ // jump immediately to a new gain setting
|
{ // jump immediately to a new gain setting
|
||||||
// this greatly speeds up initial gain reduction (but reduces noise/spike immunity)
|
// this greatly speeds up initial gain reduction (but reduces noise/spike immunity)
|
||||||
const int16_t desired_gain_dB = (int16_t)gain_dB[index] - diff_dB + 8; // get no closer than 8dB (bit of noise/spike immunity)
|
|
||||||
|
const int16_t desired_gain_dB = (int16_t)gain_table[index].gain_dB - diff_dB + 8; // get no closer than 8dB (bit of noise/spike immunity)
|
||||||
|
|
||||||
// scan the table to see what index to jump straight too
|
// scan the table to see what index to jump straight too
|
||||||
while (index > 1)
|
while (index > 1)
|
||||||
if (gain_dB[--index] <= desired_gain_dB)
|
if (gain_table[--index].gain_dB <= desired_gain_dB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//index = (gain_table_index[vfo] + index) / 2; // easy does it
|
//index = (gain_table_index[vfo] + index) / 2; // easy does it
|
||||||
@@ -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
|
hold_counter[vfo] = 30; // 300ms hold
|
||||||
|
|
||||||
if (hold_counter[vfo] == 0)
|
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
|
gain_table_index[vfo] = (index <= max_index) ? index : max_index; // limit the gain index
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
#if 0
|
||||||
return; // no gain change
|
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
|
#endif
|
||||||
|
|
||||||
@@ -459,33 +451,35 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
// remember the new table index
|
// remember the new table index
|
||||||
gain_table_index_prev[vfo] = index;
|
gain_table_index_prev[vfo] = index;
|
||||||
|
|
||||||
const t_gain_table gains = gain_table[index];
|
BK4819_WriteRegister(BK4819_REG_13, gain_table[index].reg_val);
|
||||||
BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
|
||||||
|
|
||||||
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
||||||
|
|
||||||
// RF gain difference from original QS setting
|
// RF gain difference from original QS setting
|
||||||
rssi_gain_diff[vfo] = ((int16_t)gain_dB[index] - gain_dB[original_index]) * 2;
|
rssi_gain_diff[vfo] = ((int16_t)gain_table[index].gain_dB - gain_table[original_index].gain_dB) * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the corrected RSSI level
|
// save the corrected RSSI level
|
||||||
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||||
|
|
||||||
if (counter == 0)
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
{
|
if (counter == 0)
|
||||||
counter = 1;
|
{
|
||||||
gUpdateDisplay = true;
|
counter = 1;
|
||||||
}
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
|
||||||
void AM_fix_print_data(const int vfo, char *s)
|
void AM_fix_print_data(const int vfo, char *s)
|
||||||
{
|
{
|
||||||
if (s != NULL)
|
if (s != NULL && vfo >= 0 && vfo < ARRAY_SIZE(gain_table_index))
|
||||||
{
|
{
|
||||||
const unsigned int index = gain_table_index[vfo];
|
const unsigned int index = gain_table_index[vfo];
|
||||||
sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_dB[index], prev_rssi[vfo]);
|
// sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||||
|
sprintf(s, "%2u %4ddB %3u", index, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||||
counter = 0;
|
counter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
am_fix.h
5
am_fix.h
@@ -20,11 +20,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.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
|
#ifdef ENABLE_AM_FIX
|
||||||
extern int16_t rssi_gain_diff[2];
|
extern int16_t rssi_gain_diff[2];
|
||||||
|
|
||||||
|
|||||||
94
app/action.c
94
app/action.c
@@ -109,7 +109,7 @@ void ACTION_Monitor(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
gRequestDisplayScreen = gScreenToDisplay;
|
gRequestDisplayScreen = gScreenToDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACTION_Scan(bool bRestart)
|
void ACTION_Scan(bool bRestart)
|
||||||
@@ -184,10 +184,16 @@ void ACTION_Scan(bool bRestart)
|
|||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
if (gScanState != SCAN_OFF)
|
||||||
{
|
{
|
||||||
SCANNER_Stop();
|
#if 1
|
||||||
|
// keep scanning but toggle between scan lists
|
||||||
|
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
#else
|
||||||
|
SCANNER_Stop();
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -200,7 +206,7 @@ void ACTION_Scan(bool bRestart)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// clear the other vfo's rssi level (to hide the antenna symbol)
|
// clear the other vfo's rssi level (to hide the antenna symbol)
|
||||||
gVFO_RSSI_bar_level[gEeprom.RX_CHANNEL == 0] = 0;
|
gVFO_RSSI_bar_level[(gEeprom.RX_CHANNEL + 1) & 1u] = 0;
|
||||||
|
|
||||||
// let the user see DW is not active
|
// let the user see DW is not active
|
||||||
gDualWatchActive = false;
|
gDualWatchActive = false;
|
||||||
@@ -210,42 +216,60 @@ void ACTION_Scan(bool bRestart)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!bRestart)
|
if (!bRestart)
|
||||||
{ // scanning
|
{ // keep scanning but toggle between scan lists
|
||||||
|
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // stop scanning
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
SCANNER_Stop();
|
SCANNER_Stop();
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACTION_Vox(void)
|
#ifdef ENABLE_VOX
|
||||||
{
|
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)
|
|
||||||
{
|
{
|
||||||
gInputBoxIndex = 0;
|
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
||||||
gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM;
|
gRequestSaveSettings = true;
|
||||||
gAlarmRunningCounter = 0;
|
gFlagReconfigureVfos = true;
|
||||||
gFlagPrepareTX = true;
|
#ifdef ENABLE_VOICE
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gAnotherVoiceID = VOICE_ID_VOX;
|
||||||
|
#endif
|
||||||
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef ENABLE_FMRADIO
|
||||||
void ACTION_FM(void)
|
void ACTION_FM(void)
|
||||||
{
|
{
|
||||||
@@ -256,8 +280,11 @@ void ACTION_Vox(void)
|
|||||||
FM_TurnOff();
|
FM_TurnOff();
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -269,7 +296,8 @@ void ACTION_Vox(void)
|
|||||||
|
|
||||||
FM_Start();
|
FM_Start();
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -355,7 +383,9 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
ACTION_Scan(true);
|
ACTION_Scan(true);
|
||||||
break;
|
break;
|
||||||
case ACTION_OPT_VOX:
|
case ACTION_OPT_VOX:
|
||||||
ACTION_Vox();
|
#ifdef ENABLE_VOX
|
||||||
|
ACTION_Vox();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ACTION_OPT_ALARM:
|
case ACTION_OPT_ALARM:
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@@ -368,7 +398,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case ACTION_OPT_1750:
|
case ACTION_OPT_1750:
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_TX1750
|
||||||
ACTION_AlarmOr1750(true);
|
ACTION_AlarmOr1750(true);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
void ACTION_Power(void);
|
void ACTION_Power(void);
|
||||||
void ACTION_Monitor(void);
|
void ACTION_Monitor(void);
|
||||||
void ACTION_Scan(bool bFlag);
|
void ACTION_Scan(bool bFlag);
|
||||||
void ACTION_Vox(void);
|
#ifdef ENABLE_VOX
|
||||||
|
void ACTION_Vox(void);
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
//static void ACTION_AlarmOr1750(bool b1750)
|
//static void ACTION_AlarmOr1750(bool b1750)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -134,9 +134,9 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
NUMBER_Get(gInputBox, &Frequency);
|
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
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
|
|||||||
@@ -20,8 +20,14 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
#include "frequencies.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
|
|
||||||
|
extern const uint8_t orig_lna_short;
|
||||||
|
extern const uint8_t orig_lna;
|
||||||
|
extern const uint8_t orig_mixer;
|
||||||
|
extern const uint8_t orig_pga;
|
||||||
|
|
||||||
void APP_EndTransmission(void);
|
void APP_EndTransmission(void);
|
||||||
void CHANNEL_Next(bool bFlag, int8_t Direction);
|
void CHANNEL_Next(bool bFlag, int8_t Direction);
|
||||||
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
|
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
|
||||||
|
|||||||
47
app/dtmf.c
47
app/dtmf.c
@@ -54,8 +54,8 @@ char gDTMF_Caller[4];
|
|||||||
char gDTMF_Callee[4];
|
char gDTMF_Callee[4];
|
||||||
DTMF_State_t gDTMF_State;
|
DTMF_State_t gDTMF_State;
|
||||||
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||||
uint8_t gDTMFChosenContact;
|
uint8_t gDTMF_chosen_contact;
|
||||||
uint8_t gDTMF_AUTO_RESET_TIME;
|
uint8_t gDTMF_auto_reset_time_500ms;
|
||||||
DTMF_CallState_t gDTMF_CallState;
|
DTMF_CallState_t gDTMF_CallState;
|
||||||
DTMF_ReplyState_t gDTMF_ReplyState;
|
DTMF_ReplyState_t gDTMF_ReplyState;
|
||||||
DTMF_CallMode_t gDTMF_CallMode;
|
DTMF_CallMode_t gDTMF_CallMode;
|
||||||
@@ -159,7 +159,7 @@ DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
|||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE)
|
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE)
|
||||||
break;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ void DTMF_HandleRequest(void)
|
|||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||||
{ // D-DCD is disabled or we're alive
|
{ // D-DCD is disabled or we're alive
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
@@ -207,7 +207,7 @@ void DTMF_HandleRequest(void)
|
|||||||
|
|
||||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
{ // bugger
|
{ // bugger
|
||||||
|
|
||||||
if (gEeprom.PERMIT_REMOTE_KILL)
|
if (gEeprom.PERMIT_REMOTE_KILL)
|
||||||
{
|
{
|
||||||
gSetting_KILLED = true; // oooerr !
|
gSetting_KILLED = true; // oooerr !
|
||||||
@@ -238,17 +238,17 @@ void DTMF_HandleRequest(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_RX_index >= 9)
|
if (gDTMF_RX_index >= 9)
|
||||||
{ // look for the REVIVE code
|
{ // look for the REVIVE code
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
|
|
||||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
{ // shit, we're back !
|
{ // shit, we're back !
|
||||||
|
|
||||||
gSetting_KILLED = false;
|
gSetting_KILLED = false;
|
||||||
|
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
@@ -268,7 +268,7 @@ void DTMF_HandleRequest(void)
|
|||||||
{ // look for ACK reply
|
{ // look for ACK reply
|
||||||
|
|
||||||
strcpy(String, "AB");
|
strcpy(String, "AB");
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
|
|
||||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
@@ -290,7 +290,7 @@ void DTMF_HandleRequest(void)
|
|||||||
gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP &&
|
gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP &&
|
||||||
gDTMF_RX_index >= 9)
|
gDTMF_RX_index >= 9)
|
||||||
{ // waiting for a reply
|
{ // waiting for a reply
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
@@ -362,9 +362,6 @@ void DTMF_Reply(void)
|
|||||||
|
|
||||||
switch (gDTMF_ReplyState)
|
switch (gDTMF_ReplyState)
|
||||||
{
|
{
|
||||||
case DTMF_REPLY_NONE:
|
|
||||||
return;
|
|
||||||
|
|
||||||
case DTMF_REPLY_ANI:
|
case DTMF_REPLY_ANI:
|
||||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||||
{
|
{
|
||||||
@@ -376,22 +373,27 @@ void DTMF_Reply(void)
|
|||||||
pString = String;
|
pString = String;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTMF_REPLY_AB:
|
case DTMF_REPLY_AB:
|
||||||
pString = "AB";
|
pString = "AB";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTMF_REPLY_AAAAA:
|
case DTMF_REPLY_AAAAA:
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||||
pString = String;
|
pString = String;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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_OFF ||
|
||||||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
||||||
{
|
{
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send TX-UP DTMF
|
||||||
pString = gEeprom.DTMF_UP_CODE;
|
pString = gEeprom.DTMF_UP_CODE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -400,16 +402,15 @@ void DTMF_Reply(void)
|
|||||||
|
|
||||||
if (pString == NULL)
|
if (pString == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Delay = gEeprom.DTMF_PRELOAD_TIME;
|
Delay = (gEeprom.DTMF_PRELOAD_TIME < 200) ? 200 : gEeprom.DTMF_PRELOAD_TIME;
|
||||||
|
|
||||||
if (gEeprom.DTMF_SIDE_TONE)
|
if (gEeprom.DTMF_SIDE_TONE)
|
||||||
{ // the will also hear the transmitted tones
|
{ // the user will also hear the transmitted tones
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
Delay = (gEeprom.DTMF_PRELOAD_TIME < 60) ? 60 : gEeprom.DTMF_PRELOAD_TIME;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSTEM_DelayMs(Delay);
|
SYSTEM_DelayMs(Delay);
|
||||||
|
|
||||||
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ extern char gDTMF_Caller[4];
|
|||||||
extern char gDTMF_Callee[4];
|
extern char gDTMF_Callee[4];
|
||||||
extern DTMF_State_t gDTMF_State;
|
extern DTMF_State_t gDTMF_State;
|
||||||
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||||
extern uint8_t gDTMFChosenContact;
|
extern uint8_t gDTMF_chosen_contact;
|
||||||
extern uint8_t gDTMF_AUTO_RESET_TIME;
|
extern uint8_t gDTMF_auto_reset_time_500ms;
|
||||||
extern DTMF_CallState_t gDTMF_CallState;
|
extern DTMF_CallState_t gDTMF_CallState;
|
||||||
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
||||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
extern DTMF_CallMode_t gDTMF_CallMode;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFM_ScanState == FM_SCAN_OFF)
|
if (gFM_ScanState == FM_SCAN_OFF)
|
||||||
{
|
{
|
||||||
@@ -104,9 +104,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
{
|
{
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
|
||||||
{
|
{
|
||||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
//if (gScreenToDisplay == DISPLAY_MAIN)
|
||||||
{
|
{
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
{
|
{
|
||||||
@@ -127,15 +127,16 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gFlagEndTransmission = false;
|
gFlagEndTransmission = false;
|
||||||
gVOX_NoiseDetected = false;
|
#ifdef ENABLE_VOX
|
||||||
|
gVOX_NoiseDetected = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||||
|
|
||||||
// beep when you release the PTT
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
//gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL; // 1of11
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +150,10 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
|
|
||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
gPttIsPressed = false;
|
gPttIsPressed = false;
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,17 +164,15 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gScreenToDisplay == DISPLAY_MENU || gScreenToDisplay == DISPLAY_FM)
|
if (gScreenToDisplay == DISPLAY_FM)
|
||||||
#else
|
{
|
||||||
if (gScreenToDisplay == DISPLAY_MENU)
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
gPttIsPressed = false;
|
||||||
|
gPttDebounceCounter = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
gPttIsPressed = false;
|
|
||||||
gPttDebounceCounter = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||||
{
|
{
|
||||||
@@ -213,21 +215,26 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
gDTMF_State = DTMF_STATE_0;
|
gDTMF_State = DTMF_STATE_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
gDTMF_InputMode = false;
|
gDTMF_InputMode = false;
|
||||||
gDTMF_InputIndex = 0;
|
gDTMF_InputIndex = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
gFlagPrepareTX = true;
|
gFlagPrepareTX = true;
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
gFlagStopScan = true;
|
gFlagStopScan = true;
|
||||||
@@ -237,7 +244,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
MENU_StopCssScan();
|
MENU_StopCssScan();
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -247,11 +256,10 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gPttWasPressed = true;
|
gPttWasPressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
200
app/main.c
200
app/main.c
@@ -28,6 +28,7 @@
|
|||||||
#include "app/spectrum.h"
|
#include "app/spectrum.h"
|
||||||
#endif
|
#endif
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
#include "board.h"
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
#include "dtmf.h"
|
#include "dtmf.h"
|
||||||
#include "frequencies.h"
|
#include "frequencies.h"
|
||||||
@@ -50,7 +51,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
// TODO: do something useful with the key
|
// TODO: make use of this function key
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -80,6 +81,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
|
|
||||||
gRequestSaveVFO = true;
|
gRequestSaveVFO = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
if (beep)
|
if (beep)
|
||||||
@@ -100,10 +102,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
|
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
|
||||||
else
|
else
|
||||||
gEeprom.TX_CHANNEL = (Vfo == 0);
|
gEeprom.TX_CHANNEL = (Vfo + 1) & 1u;
|
||||||
|
|
||||||
gRequestSaveSettings = 1;
|
gRequestSaveSettings = 1;
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
if (beep)
|
if (beep)
|
||||||
@@ -121,7 +124,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
uint8_t Channel;
|
uint8_t Channel;
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{
|
{ // swap to frequency mode
|
||||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||||
@@ -133,7 +136,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
|
|
||||||
Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 0);
|
Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 0);
|
||||||
if (Channel != 0xFF)
|
if (Channel != 0xFF)
|
||||||
{
|
{ // swap to channel mode
|
||||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
gEeprom.ScreenChannel[Vfo] = Channel;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||||
@@ -165,7 +168,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_5:
|
case KEY_5:
|
||||||
|
if(beep) {
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
|
|
||||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{
|
{
|
||||||
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_CHANNEL];
|
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_CHANNEL];
|
||||||
@@ -182,29 +187,35 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
#elif defined(ENABLE_SPECTRUM)
|
#elif defined(ENABLE_SPECTRUM)
|
||||||
APP_RunSpectrum();
|
APP_RunSpectrum();
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
#else
|
#endif
|
||||||
// toggle scanlist-1 and scanlist 2
|
}
|
||||||
|
else {
|
||||||
|
// toggle the selected channels scanlist setting
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||||
{
|
{
|
||||||
if (gTxVfo->SCANLIST1_PARTICIPATION)
|
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{
|
{
|
||||||
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
if (gTxVfo->SCANLIST1_PARTICIPATION)
|
||||||
gTxVfo->SCANLIST1_PARTICIPATION = 0;
|
{
|
||||||
|
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
||||||
|
gTxVfo->SCANLIST1_PARTICIPATION = 0;
|
||||||
|
else
|
||||||
|
gTxVfo->SCANLIST2_PARTICIPATION = 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
gTxVfo->SCANLIST2_PARTICIPATION = 1;
|
{
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
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
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_6:
|
case KEY_6:
|
||||||
@@ -212,7 +223,15 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_7:
|
case KEY_7:
|
||||||
ACTION_Vox();
|
#ifdef ENABLE_VOX
|
||||||
|
ACTION_Vox();
|
||||||
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: make use of this function key
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_8:
|
case KEY_8:
|
||||||
@@ -302,7 +321,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{ // user is entering channel number
|
{ // user is entering channel number
|
||||||
|
|
||||||
uint16_t Channel;
|
uint16_t Channel;
|
||||||
|
|
||||||
if (gInputBoxIndex != 3)
|
if (gInputBoxIndex != 3)
|
||||||
@@ -341,7 +360,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
// #endif
|
// #endif
|
||||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{ // user is entering frequency
|
{ // user is entering frequency
|
||||||
|
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
if (gInputBoxIndex < 6)
|
if (gInputBoxIndex < 6)
|
||||||
@@ -358,22 +377,22 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
NUMBER_Get(gInputBox, &Frequency);
|
NUMBER_Get(gInputBox, &Frequency);
|
||||||
|
|
||||||
// clamp the frequency entered to some valid value
|
// 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
|
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;
|
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||||
Frequency = (Frequency < center) ? bx_stop1_Hz : bx_start2_Hz;
|
Frequency = (Frequency < center) ? BX4819_band1.upper : BX4819_band2.lower;
|
||||||
}
|
}
|
||||||
else
|
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);
|
const FREQUENCY_Band_t band = FREQUENCY_GetBand(Frequency);
|
||||||
|
|
||||||
@@ -386,35 +405,35 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
gTxVfo->Band = band;
|
gTxVfo->Band = band;
|
||||||
gEeprom.ScreenChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
gEeprom.ScreenChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||||
gEeprom.FreqChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
gEeprom.FreqChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||||
|
|
||||||
SETTINGS_SaveVfoIndices();
|
SETTINGS_SaveVfoIndices();
|
||||||
|
|
||||||
RADIO_ConfigureChannel(Vfo, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(Vfo, VFO_CONFIGURE_RELOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Frequency += 75; // is this meant to be rounding ?
|
// Frequency += 75; // is this meant to be rounding ?
|
||||||
Frequency += gTxVfo->StepFrequency / 2; // no idea, but this is
|
Frequency += gTxVfo->StepFrequency / 2; // no idea, but this is
|
||||||
|
|
||||||
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]);
|
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, frequencyBandTable[gTxVfo->Band].lower);
|
||||||
|
|
||||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||||
{ // clamp the frequency to the limit
|
{ // clamp the frequency to the limit
|
||||||
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2;
|
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||||
Frequency = (Frequency < center) ? bx_stop1_Hz - gTxVfo->StepFrequency : bx_start2_Hz;
|
Frequency = (Frequency < center) ? BX4819_band1.upper - gTxVfo->StepFrequency : BX4819_band2.lower;
|
||||||
}
|
}
|
||||||
|
|
||||||
gTxVfo->freq_config_RX.Frequency = Frequency;
|
gTxVfo->freq_config_RX.Frequency = Frequency;
|
||||||
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
else
|
else
|
||||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{ // user is entering NOAA channel
|
{ // user is entering NOAA channel
|
||||||
|
|
||||||
uint8_t Channel;
|
uint8_t Channel;
|
||||||
|
|
||||||
if (gInputBoxIndex != 2)
|
if (gInputBoxIndex != 2)
|
||||||
@@ -527,7 +546,8 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
{ // menu key held down (long press)
|
{ // menu key held down (long press)
|
||||||
|
|
||||||
if (bKeyPressed)
|
if (bKeyPressed)
|
||||||
{
|
{ // long press MENU key
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex > 0)
|
if (gInputBoxIndex > 0)
|
||||||
@@ -539,50 +559,68 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: long press M-key
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||||
|
if (gEeprom.VFO_OPEN &&
|
||||||
|
gEeprom.DUAL_WATCH == DUAL_WATCH_OFF &&
|
||||||
|
gScanState == SCAN_OFF &&
|
||||||
|
gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{ // copy channel to VFO
|
{ // copy channel to VFO
|
||||||
|
|
||||||
int channel = -1;
|
int channel = -1;
|
||||||
int vfo = -1;
|
int vfo = -1;
|
||||||
//int selected = -1;
|
|
||||||
|
|
||||||
if (IS_FREQ_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
#if 0
|
||||||
{ // VFO mode
|
// copy channel to opposite VFO
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[0]) &&
|
||||||
{ // other VFO is in channel mode
|
IS_MR_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||||
channel = gTxVfo->CHANNEL_SAVE;
|
{
|
||||||
vfo = gRxVfo->CHANNEL_SAVE;
|
channel = gEeprom.ScreenChannel[1];
|
||||||
|
vfo = 0;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[1]) &&
|
||||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
IS_MR_CHANNEL(gEeprom.ScreenChannel[0]))
|
||||||
{ // VFO mode
|
{
|
||||||
if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
channel = gEeprom.ScreenChannel[0];
|
||||||
{ // other VFO is in channel mode
|
vfo = 1;
|
||||||
channel = gRxVfo->CHANNEL_SAVE;
|
|
||||||
vfo = gTxVfo->CHANNEL_SAVE;
|
|
||||||
}
|
}
|
||||||
}
|
#else
|
||||||
|
// copy channel to same VFO
|
||||||
|
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[gEeprom.RX_CHANNEL]))
|
||||||
|
{
|
||||||
|
channel = gEeprom.ScreenChannel[gEeprom.RX_CHANNEL];
|
||||||
|
vfo = gEeprom.RX_CHANNEL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (channel >= 0 && vfo >= 0)
|
if (channel >= 0 && vfo >= 0)
|
||||||
{ // copy the channel into the VFO
|
{ // copy the channel into the VFO
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
|
gEeprom.MrChannel[vfo] = channel;
|
||||||
|
gEeprom.ScreenChannel[vfo] = channel;
|
||||||
|
RADIO_ConfigureChannel(vfo, VFO_CONFIGURE_RELOAD);
|
||||||
|
|
||||||
// TODO: finish this
|
channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
|
||||||
|
gEeprom.MrChannel[vfo] = channel;
|
||||||
|
gEeprom.ScreenChannel[vfo] = channel;
|
||||||
|
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel;
|
||||||
|
|
||||||
//gEeprom.RX_CHANNEL = () & 1; // swap to the VFO
|
// swap to the VFO
|
||||||
|
gEeprom.TX_CHANNEL = vfo;
|
||||||
|
gEeprom.RX_CHANNEL = vfo;
|
||||||
|
RADIO_SelectVfos();
|
||||||
|
|
||||||
|
RADIO_ApplyOffset(gRxVfo);
|
||||||
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
|
|
||||||
// gRequestSaveVFO = true;
|
RADIO_SetupRegisters(true);
|
||||||
// gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
// gRequestDisplayScreen = DISPLAY_MAIN;
|
// SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -599,11 +637,13 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (bFlag)
|
if (bFlag)
|
||||||
{
|
{
|
||||||
gFlagRefreshSetting = true;
|
gFlagRefreshSetting = true;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_MENU;
|
gAnotherVoiceID = VOICE_ID_MENU;
|
||||||
#endif
|
#endif
|
||||||
@@ -635,6 +675,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ACTION_Scan(false);
|
ACTION_Scan(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,6 +689,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
|||||||
gDTMF_InputMode = true;
|
gDTMF_InputMode = true;
|
||||||
memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox));
|
memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox));
|
||||||
gDTMF_InputIndex = 0;
|
gDTMF_InputIndex = 0;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -735,14 +777,14 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
{ // step/down in frequency
|
{ // step/down in frequency
|
||||||
const uint32_t frequency = APP_SetFrequencyByStep(gTxVfo, Direction);
|
const uint32_t frequency = APP_SetFrequencyByStep(gTxVfo, Direction);
|
||||||
|
|
||||||
if (RX_FREQUENCY_Check(frequency) < 0)
|
if (RX_freq_check(frequency) < 0)
|
||||||
{ // frequency not allowed
|
{ // frequency not allowed
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gTxVfo->freq_config_RX.Frequency = frequency;
|
gTxVfo->freq_config_RX.Frequency = frequency;
|
||||||
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -805,7 +847,9 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
DTMF_Append(Character);
|
DTMF_Append(Character);
|
||||||
|
|
||||||
gKeyInputCountdown = key_input_timeout_500ms;
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
|
|||||||
261
app/menu.c
261
app/menu.c
@@ -47,6 +47,34 @@
|
|||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
#endif
|
#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)
|
void MENU_StartCssScan(int8_t Direction)
|
||||||
{
|
{
|
||||||
gCssScanMode = CSS_SCAN_MODE_SCANNING;
|
gCssScanMode = CSS_SCAN_MODE_SCANNING;
|
||||||
@@ -171,12 +199,11 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
case MENU_ABR_ON_TX_RX:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_Compand) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_RX_TX) - 1;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
case MENU_AM_FIX_TEST1:
|
case MENU_AM_FIX_TEST1:
|
||||||
@@ -224,7 +251,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_TOT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_TOT) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
|
case MENU_VOX:
|
||||||
|
#endif
|
||||||
case MENU_RP_STE:
|
case MENU_RP_STE:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = 10;
|
*pMax = 10;
|
||||||
@@ -255,7 +284,8 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
*pMin = 1;
|
*pMin = 0;
|
||||||
|
// *pMax = 1;
|
||||||
*pMax = 2;
|
*pMax = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -269,11 +299,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOL:
|
|
||||||
*pMin = 0;
|
|
||||||
*pMax = 2300;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
||||||
@@ -294,9 +319,16 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = 16;
|
*pMax = 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_F_CALI:
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
*pMin = -50;
|
case MENU_F_CALI:
|
||||||
*pMax = +50;
|
*pMin = -50;
|
||||||
|
*pMax = +50;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case MENU_BATCAL:
|
||||||
|
*pMin = 1600; // 0
|
||||||
|
*pMax = 2200; // 2300
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -378,9 +410,6 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_T_CTCS:
|
case MENU_T_CTCS:
|
||||||
pConfig = &gTxVfo->freq_config_TX;
|
pConfig = &gTxVfo->freq_config_TX;
|
||||||
|
|
||||||
// Fallthrough
|
|
||||||
|
|
||||||
case MENU_R_CTCS:
|
case MENU_R_CTCS:
|
||||||
if (gSubMenuSelection == 0)
|
if (gSubMenuSelection == 0)
|
||||||
{
|
{
|
||||||
@@ -390,14 +419,20 @@ void MENU_AcceptSetting(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Code = 0;
|
Code = 0;
|
||||||
|
pConfig->Code = Code;
|
||||||
pConfig->CodeType = CODE_TYPE_OFF;
|
pConfig->CodeType = CODE_TYPE_OFF;
|
||||||
|
|
||||||
|
BK4819_ExitSubAu();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||||
Code = gSubMenuSelection - 1;
|
Code = gSubMenuSelection - 1;
|
||||||
|
pConfig->Code = Code;
|
||||||
|
|
||||||
|
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||||
}
|
}
|
||||||
pConfig->Code = Code;
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -418,6 +453,12 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
||||||
|
#if 0
|
||||||
|
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||||
|
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||||
|
else
|
||||||
|
BK4819_DisableScramble();
|
||||||
|
#endif
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -459,19 +500,25 @@ void MENU_AcceptSetting(void)
|
|||||||
gEeprom.BATTERY_SAVE = gSubMenuSelection;
|
gEeprom.BATTERY_SAVE = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
case MENU_VOX:
|
||||||
if (gEeprom.VOX_SWITCH)
|
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
||||||
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
if (gEeprom.VOX_SWITCH)
|
||||||
BOARD_EEPROM_LoadMoreSettings();
|
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
||||||
gFlagReconfigureVfos = true;
|
BOARD_EEPROM_LoadMoreSettings();
|
||||||
gUpdateStatus = true;
|
gFlagReconfigureVfos = true;
|
||||||
break;
|
gUpdateStatus = true;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case MENU_ABR:
|
case MENU_ABR:
|
||||||
gEeprom.BACKLIGHT = gSubMenuSelection;
|
gEeprom.BACKLIGHT = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_ON_TX_RX:
|
||||||
|
gSetting_backlight_on_tx_rx = gSubMenuSelection;
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
gEeprom.DUAL_WATCH = gSubMenuSelection;
|
gEeprom.DUAL_WATCH = gSubMenuSelection;
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
@@ -552,20 +599,21 @@ void MENU_AcceptSetting(void)
|
|||||||
gSetting_mic_bar = gSubMenuSelection;
|
gSetting_mic_bar = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
gTxVfo->Compander = gSubMenuSelection;
|
||||||
gTxVfo->Compander = gSubMenuSelection;
|
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||||
gRequestSaveChannel = 1;
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
return;
|
gFlagResetVfos = true;
|
||||||
#endif
|
// gRequestSaveChannel = 1;
|
||||||
|
return;
|
||||||
|
|
||||||
case MENU_1_CALL:
|
case MENU_1_CALL:
|
||||||
gEeprom.CHAN_1_CALL = gSubMenuSelection;
|
gEeprom.CHAN_1_CALL = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection - 1;
|
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@@ -583,7 +631,7 @@ void MENU_AcceptSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
case MENU_D_HOLD:
|
||||||
gEeprom.DTMF_AUTO_RESET_TIME = gSubMenuSelection;
|
gEeprom.DTMF_auto_reset_time = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
@@ -595,12 +643,6 @@ void MENU_AcceptSetting(void)
|
|||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_VOL:
|
|
||||||
if(gF_LOCK) {
|
|
||||||
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
gSetting_battery_text = gSubMenuSelection;
|
gSetting_battery_text = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
@@ -622,7 +664,7 @@ void MENU_AcceptSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_LIST:
|
case MENU_D_LIST:
|
||||||
gDTMFChosenContact = gSubMenuSelection - 1;
|
gDTMF_chosen_contact = gSubMenuSelection - 1;
|
||||||
if (gIsDtmfContactValid)
|
if (gIsDtmfContactValid)
|
||||||
{
|
{
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
@@ -710,26 +752,31 @@ void MENU_AcceptSetting(void)
|
|||||||
gSetting_TX_EN = gSubMenuSelection;
|
gSetting_TX_EN = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_F_CALI:
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection;
|
case MENU_F_CALI:
|
||||||
BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW);
|
writeXtalFreqCal(gSubMenuSelection, true);
|
||||||
{
|
return;
|
||||||
struct
|
#endif
|
||||||
{
|
|
||||||
int16_t BK4819_XtalFreqLow;
|
|
||||||
uint16_t EEPROM_1F8A;
|
|
||||||
uint16_t EEPROM_1F8C;
|
|
||||||
uint8_t VOLUME_GAIN;
|
|
||||||
uint8_t DAC_GAIN;
|
|
||||||
} __attribute__((packed)) Misc;
|
|
||||||
|
|
||||||
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
case MENU_BATCAL:
|
||||||
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
{
|
||||||
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
|
uint16_t buf[4];
|
||||||
Misc.BK4819_XtalFreqLow = gEeprom.BK4819_XTAL_FREQ_LOW;
|
|
||||||
EEPROM_WriteBuffer(0x1F88, &Misc);
|
gBatteryCalibration[0] = (520ul * gSubMenuSelection) / 760; // 5.20V empty, blinking above this value, reduced functionality below
|
||||||
}
|
gBatteryCalibration[1] = (700ul * gSubMenuSelection) / 760; // 7.00V, ~5%, 1 bars above this value
|
||||||
return;
|
gBatteryCalibration[2] = (745ul * gSubMenuSelection) / 760; // 7.45V, ~17%, 2 bars above this value
|
||||||
|
gBatteryCalibration[3] = gSubMenuSelection; // 7.6V, ~29%, 3 bars above this value
|
||||||
|
gBatteryCalibration[4] = (788ul * gSubMenuSelection) / 760; // 7.88V, ~65%, 4 bars above this value
|
||||||
|
gBatteryCalibration[5] = 2300;
|
||||||
|
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
||||||
|
|
||||||
|
EEPROM_ReadBuffer( 0x1F48, buf, sizeof(buf));
|
||||||
|
buf[0] = gBatteryCalibration[4];
|
||||||
|
buf[1] = gBatteryCalibration[5];
|
||||||
|
EEPROM_WriteBuffer(0x1F48, buf);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gRequestSaveSettings = true;
|
gRequestSaveSettings = true;
|
||||||
@@ -886,9 +933,11 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gEeprom.BATTERY_SAVE;
|
gSubMenuSelection = gEeprom.BATTERY_SAVE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
|
case MENU_VOX:
|
||||||
break;
|
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case MENU_ABR:
|
case MENU_ABR:
|
||||||
gSubMenuSelection = gEeprom.BACKLIGHT;
|
gSubMenuSelection = gEeprom.BACKLIGHT;
|
||||||
@@ -897,6 +946,10 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
|
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_ON_TX_RX:
|
||||||
|
gSubMenuSelection = gSetting_backlight_on_tx_rx;
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
gSubMenuSelection = gEeprom.DUAL_WATCH;
|
gSubMenuSelection = gEeprom.DUAL_WATCH;
|
||||||
break;
|
break;
|
||||||
@@ -956,19 +1009,17 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gSetting_mic_bar;
|
gSubMenuSelection = gSetting_mic_bar;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
gSubMenuSelection = gTxVfo->Compander;
|
||||||
gSubMenuSelection = gTxVfo->Compander;
|
return;
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case MENU_1_CALL:
|
case MENU_1_CALL:
|
||||||
gSubMenuSelection = gEeprom.CHAN_1_CALL;
|
gSubMenuSelection = gEeprom.CHAN_1_CALL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT + 1;
|
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_SLIST1:
|
case MENU_SLIST1:
|
||||||
@@ -994,7 +1045,7 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
case MENU_D_HOLD:
|
||||||
gSubMenuSelection = gEeprom.DTMF_AUTO_RESET_TIME;
|
gSubMenuSelection = gEeprom.DTMF_auto_reset_time;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
@@ -1005,10 +1056,6 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOL:
|
|
||||||
gSubMenuSelection = gBatteryCalibration[3];
|
|
||||||
return;
|
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
gSubMenuSelection = gSetting_battery_text;
|
gSubMenuSelection = gSetting_battery_text;
|
||||||
return;
|
return;
|
||||||
@@ -1018,7 +1065,7 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_LIST:
|
case MENU_D_LIST:
|
||||||
gSubMenuSelection = gDTMFChosenContact + 1;
|
gSubMenuSelection = gDTMF_chosen_contact + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
@@ -1042,7 +1089,7 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gSetting_AM_fix;
|
gSubMenuSelection = gSetting_AM_fix;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
case MENU_AM_FIX_TEST1:
|
case MENU_AM_FIX_TEST1:
|
||||||
gSubMenuSelection = gSetting_AM_fix_test1;
|
gSubMenuSelection = gSetting_AM_fix_test1;
|
||||||
@@ -1091,9 +1138,18 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gSetting_TX_EN;
|
gSubMenuSelection = gSetting_TX_EN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_F_CALI:
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
case MENU_F_CALI:
|
||||||
|
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case MENU_BATCAL:
|
||||||
|
gSubMenuSelection = gBatteryCalibration[3];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1143,7 +1199,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
Value = (gInputBox[0] * 10) + gInputBox[1];
|
Value = (gInputBox[0] * 10) + gInputBox[1];
|
||||||
|
|
||||||
if (Value > 0 && Value <= gMenuListCount)
|
if (Value > 0 && Value <= gMenuListCount)
|
||||||
{
|
{
|
||||||
gMenuCursor = Value - 1;
|
gMenuCursor = Value - 1;
|
||||||
@@ -1156,7 +1212,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
gInputBox[0] = gInputBox[1];
|
gInputBox[0] = gInputBox[1];
|
||||||
gInputBoxIndex = 1;
|
gInputBoxIndex = 1;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
Value = gInputBox[0];
|
Value = gInputBox[0];
|
||||||
if (Value > 0 && Value <= gMenuListCount)
|
if (Value > 0 && Value <= gMenuListCount)
|
||||||
@@ -1285,6 +1341,8 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
else
|
else
|
||||||
gInputBox[--gInputBoxIndex] = 10;
|
gInputBox[--gInputBoxIndex] = 10;
|
||||||
|
|
||||||
|
// ***********************
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1294,7 +1352,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
if (gEeprom.BACKLIGHT == 0)
|
if (gEeprom.BACKLIGHT == 0)
|
||||||
{
|
{
|
||||||
gBacklightCountdown = 0;
|
gBacklightCountdown = 0;
|
||||||
@@ -1338,13 +1396,13 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
|
|
||||||
gAskForConfirmation = 0;
|
gAskForConfirmation = 0;
|
||||||
gIsInSubMenu = true;
|
gIsInSubMenu = true;
|
||||||
|
|
||||||
// if (gMenuCursor != MENU_D_LIST)
|
// if (gMenuCursor != MENU_D_LIST)
|
||||||
{
|
{
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
edit_index = -1;
|
edit_index = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1570,8 +1628,10 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
|
|
||||||
if (!gIsInSubMenu)
|
if (!gIsInSubMenu)
|
||||||
{
|
{
|
||||||
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
|
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
|
||||||
gFlagRefreshSetting = true;
|
|
||||||
|
gFlagRefreshSetting = true;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
|
|
||||||
if (gMenuCursor != MENU_ABR && gEeprom.BACKLIGHT == 0)
|
if (gMenuCursor != MENU_ABR && gEeprom.BACKLIGHT == 0)
|
||||||
@@ -1579,7 +1639,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
gBacklightCountdown = 0;
|
gBacklightCountdown = 0;
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1615,7 +1675,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
bCheckScanList = true;
|
bCheckScanList = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
MENU_ClampSelection(Direction);
|
MENU_ClampSelection(Direction);
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
return;
|
return;
|
||||||
@@ -1690,6 +1750,19 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_MENU && gMenuCursor == MENU_VOL)
|
if (gScreenToDisplay == DISPLAY_MENU)
|
||||||
gVoltageMenuCountdown = menu_timeout_500ms;
|
{
|
||||||
|
if (gMenuCursor == MENU_VOL ||
|
||||||
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
|
gMenuCursor == MENU_F_CALI ||
|
||||||
|
#endif
|
||||||
|
gMenuCursor == MENU_BATCAL)
|
||||||
|
{
|
||||||
|
gMenuCountdown = menu_timeout_long_500ms;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gMenuCountdown = menu_timeout_500ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
#include "driver/keyboard.h"
|
#include "driver/keyboard.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
|
void writeXtalFreqCal(const int32_t value, const bool update_eeprom);
|
||||||
|
#endif
|
||||||
|
|
||||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
|
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
|
||||||
void MENU_AcceptSetting(void);
|
void MENU_AcceptSetting(void);
|
||||||
void MENU_SelectNextCode(void);
|
void MENU_SelectNextCode(void);
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
gFlagStopScan = true;
|
gFlagStopScan = true;
|
||||||
@@ -224,7 +225,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
|||||||
case 2:
|
case 2:
|
||||||
if (!gScanSingleFrequency)
|
if (!gScanSingleFrequency)
|
||||||
{
|
{
|
||||||
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, FREQUENCY_GetBand(gScanFrequency), gScanFrequency);
|
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, gScanFrequency);
|
||||||
|
|
||||||
if (gScanUseCssResult)
|
if (gScanUseCssResult)
|
||||||
{
|
{
|
||||||
@@ -367,7 +368,7 @@ void SCANNER_Start(void)
|
|||||||
BackupStep = gRxVfo->STEP_SETTING;
|
BackupStep = gRxVfo->STEP_SETTING;
|
||||||
BackupFrequency = gRxVfo->StepFrequency;
|
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->STEP_SETTING = BackupStep;
|
||||||
gRxVfo->StepFrequency = BackupFrequency;
|
gRxVfo->StepFrequency = BackupFrequency;
|
||||||
@@ -411,7 +412,9 @@ void SCANNER_Start(void)
|
|||||||
g_CDCSS_Lost = false;
|
g_CDCSS_Lost = false;
|
||||||
gCDCSSCodeType = 0;
|
gCDCSSCodeType = 0;
|
||||||
g_CTCSS_Lost = false;
|
g_CTCSS_Lost = false;
|
||||||
g_VOX_Lost = false;
|
#ifdef ENABLE_VOX
|
||||||
|
g_VOX_Lost = false;
|
||||||
|
#endif
|
||||||
g_SquelchLost = false;
|
g_SquelchLost = false;
|
||||||
gScannerEditState = 0;
|
gScannerEditState = 0;
|
||||||
gScanProgressIndicator = 0;
|
gScanProgressIndicator = 0;
|
||||||
|
|||||||
@@ -62,17 +62,17 @@ const char *modulationTypeOptions[] = {" FM", " AM", "USB"};
|
|||||||
const uint8_t modulationTypeTuneSteps[] = {100, 50, 10};
|
const uint8_t modulationTypeTuneSteps[] = {100, 50, 10};
|
||||||
const uint8_t modTypeReg47Values[] = {1, 7, 5};
|
const uint8_t modTypeReg47Values[] = {1, 7, 5};
|
||||||
|
|
||||||
SpectrumSettings settings = {STEPS_64,
|
SpectrumSettings settings = {stepsCount: STEPS_64,
|
||||||
S_STEP_25_0kHz,
|
scanStepIndex: S_STEP_25_0kHz,
|
||||||
80000,
|
frequencyChangeStep: 80000,
|
||||||
3200,
|
scanDelay: 3200,
|
||||||
150,
|
rssiTriggerLevel: 150,
|
||||||
true,
|
backlightState: true,
|
||||||
BK4819_FILTER_BW_WIDE,
|
bw: BK4819_FILTER_BW_WIDE,
|
||||||
BK4819_FILTER_BW_WIDE,
|
listenBw: BK4819_FILTER_BW_WIDE,
|
||||||
false,
|
modulationType: false,
|
||||||
-130,
|
dbMin: -130,
|
||||||
-50};
|
dbMax: -50};
|
||||||
|
|
||||||
uint32_t fMeasure = 0;
|
uint32_t fMeasure = 0;
|
||||||
uint32_t currentFreq, tempFreq;
|
uint32_t currentFreq, tempFreq;
|
||||||
|
|||||||
@@ -122,18 +122,17 @@ typedef enum ScanStep {
|
|||||||
} ScanStep;
|
} ScanStep;
|
||||||
|
|
||||||
typedef struct SpectrumSettings {
|
typedef struct SpectrumSettings {
|
||||||
|
uint32_t frequencyChangeStep;
|
||||||
StepsCount stepsCount;
|
StepsCount stepsCount;
|
||||||
ScanStep scanStepIndex;
|
ScanStep scanStepIndex;
|
||||||
uint32_t frequencyChangeStep;
|
|
||||||
uint16_t scanDelay;
|
uint16_t scanDelay;
|
||||||
uint16_t rssiTriggerLevel;
|
uint16_t rssiTriggerLevel;
|
||||||
|
|
||||||
bool backlightState;
|
|
||||||
BK4819_FilterBandwidth_t bw;
|
BK4819_FilterBandwidth_t bw;
|
||||||
BK4819_FilterBandwidth_t listenBw;
|
BK4819_FilterBandwidth_t listenBw;
|
||||||
ModulationType modulationType;
|
|
||||||
int dbMin;
|
int dbMin;
|
||||||
int dbMax;
|
int dbMax;
|
||||||
|
ModulationType modulationType;
|
||||||
|
bool backlightState;
|
||||||
} SpectrumSettings;
|
} SpectrumSettings;
|
||||||
|
|
||||||
typedef struct KeyboardState {
|
typedef struct KeyboardState {
|
||||||
@@ -161,8 +160,8 @@ typedef struct RegisterSpec {
|
|||||||
typedef struct PeakInfo {
|
typedef struct PeakInfo {
|
||||||
uint16_t t;
|
uint16_t t;
|
||||||
uint16_t rssi;
|
uint16_t rssi;
|
||||||
uint8_t i;
|
|
||||||
uint32_t f;
|
uint32_t f;
|
||||||
|
uint8_t i;
|
||||||
} PeakInfo;
|
} PeakInfo;
|
||||||
|
|
||||||
void APP_RunSpectrum(void);
|
void APP_RunSpectrum(void);
|
||||||
|
|||||||
15
app/uart.c
15
app/uart.c
@@ -225,10 +225,16 @@ static void CMD_0514(const uint8_t *pBuffer)
|
|||||||
const CMD_0514_t *pCmd = (const CMD_0514_t *)pBuffer;
|
const CMD_0514_t *pCmd = (const CMD_0514_t *)pBuffer;
|
||||||
|
|
||||||
Timestamp = pCmd->Timestamp;
|
Timestamp = pCmd->Timestamp;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||||
|
|
||||||
|
// turn the LCD backlight off
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||||
|
|
||||||
SendVersion();
|
SendVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,9 +247,12 @@ static void CMD_051B(const uint8_t *pBuffer)
|
|||||||
if (pCmd->Timestamp != Timestamp)
|
if (pCmd->Timestamp != Timestamp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(&Reply, 0, sizeof(Reply));
|
memset(&Reply, 0, sizeof(Reply));
|
||||||
Reply.Header.ID = 0x051C;
|
Reply.Header.ID = 0x051C;
|
||||||
Reply.Header.Size = pCmd->Size + 4;
|
Reply.Header.Size = pCmd->Size + 4;
|
||||||
@@ -269,11 +278,14 @@ static void CMD_051D(const uint8_t *pBuffer)
|
|||||||
if (pCmd->Timestamp != Timestamp)
|
if (pCmd->Timestamp != Timestamp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||||
|
|
||||||
bReloadEeprom = false;
|
bReloadEeprom = false;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Reply.Header.ID = 0x051E;
|
Reply.Header.ID = 0x051E;
|
||||||
Reply.Header.Size = sizeof(Reply.Data);
|
Reply.Header.Size = sizeof(Reply.Data);
|
||||||
Reply.Data.Offset = pCmd->Offset;
|
Reply.Data.Offset = pCmd->Offset;
|
||||||
@@ -389,8 +401,11 @@ static void CMD_052F(const uint8_t *pBuffer)
|
|||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
|
||||||
|
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||||
|
|
||||||
Timestamp = pCmd->Timestamp;
|
Timestamp = pCmd->Timestamp;
|
||||||
|
|
||||||
|
// turn the LCD backlight off
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||||
|
|
||||||
SendVersion();
|
SendVersion();
|
||||||
|
|||||||
47
audio.c
47
audio.c
@@ -187,7 +187,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
SYSTEM_DelayMs(5);
|
SYSTEM_DelayMs(5);
|
||||||
BK4819_TurnsOffTones_TurnsOnRX();
|
BK4819_TurnsOffTones_TurnsOnRX();
|
||||||
@@ -258,7 +260,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
VoiceID += VOICE_ID_ENG_BASE;
|
VoiceID += VOICE_ID_ENG_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||||
BK4819_SetAF(BK4819_AF_MUTE);
|
BK4819_SetAF(BK4819_AF_MUTE);
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -267,7 +271,11 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gVoxResumeCountdown = 2000;
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 2000;
|
||||||
|
#endif
|
||||||
|
|
||||||
SYSTEM_DelayMs(5);
|
SYSTEM_DelayMs(5);
|
||||||
AUDIO_PlayVoice(VoiceID);
|
AUDIO_PlayVoice(VoiceID);
|
||||||
|
|
||||||
@@ -278,13 +286,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
{
|
{
|
||||||
SYSTEM_DelayMs(Delay * 10);
|
SYSTEM_DelayMs(Delay * 10);
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
{
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
if (gRxVfo->AM_mode)
|
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||||
BK4819_SetAF(BK4819_AF_AM);
|
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||||
else
|
|
||||||
BK4819_SetAF(BK4819_AF_OPEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
@@ -296,7 +301,11 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
|
|
||||||
gVoiceWriteIndex = 0;
|
gVoiceWriteIndex = 0;
|
||||||
gVoiceReadIndex = 0;
|
gVoiceReadIndex = 0;
|
||||||
gVoxResumeCountdown = 80;
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,14 +418,19 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
|
|
||||||
gCountdownToPlayNextVoice_10ms = Delay;
|
gCountdownToPlayNextVoice_10ms = Delay;
|
||||||
gFlagPlayQueuedVoice = false;
|
gFlagPlayQueuedVoice = false;
|
||||||
gVoxResumeCountdown = 2000;
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 2000;
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||||
|
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
@@ -426,7 +440,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
if (!gEnableSpeaker)
|
if (!gEnableSpeaker)
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
gVoiceWriteIndex = 0;
|
gVoiceWriteIndex = 0;
|
||||||
gVoiceReadIndex = 0;
|
gVoiceReadIndex = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
160
bitmaps.c
160
bitmaps.c
@@ -4,7 +4,7 @@
|
|||||||
// all these images are on their right sides
|
// all these images are on their right sides
|
||||||
// turn your monitor 90-deg anti-clockwise to see the images
|
// 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
|
#if 0
|
||||||
// "S"
|
// "S"
|
||||||
@@ -29,6 +29,30 @@ const uint8_t BITMAP_PowerSave[8] =
|
|||||||
#endif
|
#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] =
|
const uint8_t BITMAP_BatteryLevel[2] =
|
||||||
{
|
{
|
||||||
0b01011101,
|
0b01011101,
|
||||||
@@ -114,27 +138,29 @@ const uint8_t BITMAP_F_Key[6] =
|
|||||||
0b01000001
|
0b01000001
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_VOX[18] =
|
#ifdef ENABLE_VOX
|
||||||
{ // "VOX"
|
const uint8_t BITMAP_VOX[18] =
|
||||||
0b00000000,
|
{ // "VOX"
|
||||||
0b00011111,
|
0b00000000,
|
||||||
0b00100000,
|
0b00011111,
|
||||||
0b01000000,
|
0b00100000,
|
||||||
0b00100000,
|
0b01000000,
|
||||||
0b00011111,
|
0b00100000,
|
||||||
0b00000000,
|
0b00011111,
|
||||||
0b00111110,
|
0b00000000,
|
||||||
0b01000001,
|
0b00111110,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b00111110,
|
0b01000001,
|
||||||
0b00000000,
|
0b00111110,
|
||||||
0b01100011,
|
0b00000000,
|
||||||
0b00010100,
|
0b01100011,
|
||||||
0b00001000,
|
0b00010100,
|
||||||
0b00010100,
|
0b00001000,
|
||||||
0b01100011
|
0b00010100,
|
||||||
};
|
0b01100011
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
const uint8_t BITMAP_WX[12] =
|
const uint8_t BITMAP_WX[12] =
|
||||||
@@ -255,24 +281,54 @@ const uint8_t BITMAP_TDR2[12] =
|
|||||||
0b00110001
|
0b00110001
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
const uint8_t BITMAP_SC[12] =
|
const uint8_t BITMAP_SC1[8] =
|
||||||
{ // "SC"
|
{ // "I"
|
||||||
0b00000000,
|
|
||||||
0b01000110,
|
|
||||||
0b01001001,
|
|
||||||
0b01001001,
|
|
||||||
0b01001001,
|
|
||||||
0b00110001,
|
|
||||||
|
|
||||||
0b00000000,
|
|
||||||
0b00111110,
|
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
|
0b01111111,
|
||||||
|
0b01111111,
|
||||||
|
0b01111111,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b00100010
|
0b01000001,
|
||||||
|
0b00000000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t BITMAP_SC2[8] =
|
||||||
|
{ // "II"
|
||||||
|
0b01000001,
|
||||||
|
0b01111111,
|
||||||
|
0b01111111,
|
||||||
|
0b01000001,
|
||||||
|
0b01111111,
|
||||||
|
0b01111111,
|
||||||
|
0b01000001,
|
||||||
|
0b00000000
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
const uint8_t BITMAP_SC1[7] =
|
||||||
|
{ // "1"
|
||||||
|
0b01000000,
|
||||||
|
0b01000000,
|
||||||
|
0b01000110,
|
||||||
|
0b01111111,
|
||||||
|
0b01000000,
|
||||||
|
0b01000000,
|
||||||
|
0b00000000
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t BITMAP_SC2[7] =
|
||||||
|
{ // "2"
|
||||||
|
0b01000010,
|
||||||
|
0b01100001,
|
||||||
|
0b01010001,
|
||||||
|
0b01001001,
|
||||||
|
0b01001001,
|
||||||
|
0b01000110,
|
||||||
|
0b00000000
|
||||||
|
};
|
||||||
|
*/
|
||||||
const uint8_t BITMAP_Antenna[5] =
|
const uint8_t BITMAP_Antenna[5] =
|
||||||
{
|
{
|
||||||
0b00000011,
|
0b00000011,
|
||||||
@@ -324,7 +380,7 @@ const uint8_t BITMAP_AntennaLevel6[3] =
|
|||||||
0b00000000
|
0b00000000
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_CurrentIndicator[8] =
|
const uint8_t BITMAP_MARKER[8] =
|
||||||
{
|
{
|
||||||
0b11111111,
|
0b11111111,
|
||||||
0b11111111,
|
0b11111111,
|
||||||
@@ -359,17 +415,7 @@ const uint8_t BITMAP_VFO_NotDefault[8] =
|
|||||||
0b00010100,
|
0b00010100,
|
||||||
0b00001000
|
0b00001000
|
||||||
};
|
};
|
||||||
/*
|
|
||||||
const uint8_t BITMAP_ScanList[6] =
|
|
||||||
{ // diamond symbol
|
|
||||||
0b00001000,
|
|
||||||
0b00011100,
|
|
||||||
0b00111110,
|
|
||||||
0b00111110,
|
|
||||||
0b00011100,
|
|
||||||
0b00001000
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
const uint8_t BITMAP_ScanList1[6] =
|
const uint8_t BITMAP_ScanList1[6] =
|
||||||
{ // 'I' symbol
|
{ // 'I' symbol
|
||||||
0b00000000,
|
0b00000000,
|
||||||
@@ -390,14 +436,12 @@ const uint8_t BITMAP_ScanList2[6] =
|
|||||||
0b01000010
|
0b01000010
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
const uint8_t BITMAP_compand[6] =
|
||||||
const uint8_t BITMAP_compand[6] =
|
{
|
||||||
{
|
0b00000000,
|
||||||
0b00000000,
|
0b00111100,
|
||||||
0b00111100,
|
0b01000010,
|
||||||
0b01000010,
|
0b01000010,
|
||||||
0b01000010,
|
0b01000010,
|
||||||
0b01000010,
|
0b00100100
|
||||||
0b00100100
|
};
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|||||||
20
bitmaps.h
20
bitmaps.h
@@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#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_BatteryLevel[2];
|
||||||
extern const uint8_t BITMAP_BatteryLevel1[17];
|
extern const uint8_t BITMAP_BatteryLevel1[17];
|
||||||
@@ -19,7 +21,9 @@ extern const uint8_t BITMAP_KeyLock[6];
|
|||||||
|
|
||||||
extern const uint8_t BITMAP_F_Key[6];
|
extern const uint8_t BITMAP_F_Key[6];
|
||||||
|
|
||||||
extern const uint8_t BITMAP_VOX[18];
|
#ifdef ENABLE_VOX
|
||||||
|
extern const uint8_t BITMAP_VOX[18];
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
extern const uint8_t BITMAP_WX[12];
|
extern const uint8_t BITMAP_WX[12];
|
||||||
@@ -42,7 +46,10 @@ extern const uint8_t BITMAP_TDR2[12];
|
|||||||
extern const uint8_t BITMAP_NOAA[12];
|
extern const uint8_t BITMAP_NOAA[12];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const uint8_t BITMAP_SC[12];
|
//extern const uint8_t BITMAP_SC1[8];
|
||||||
|
//extern const uint8_t BITMAP_SC2[8];
|
||||||
|
//extern const uint8_t BITMAP_SC1[7];
|
||||||
|
//extern const uint8_t BITMAP_SC2[7];
|
||||||
|
|
||||||
extern const uint8_t BITMAP_Antenna[5];
|
extern const uint8_t BITMAP_Antenna[5];
|
||||||
extern const uint8_t BITMAP_AntennaLevel1[3];
|
extern const uint8_t BITMAP_AntennaLevel1[3];
|
||||||
@@ -52,18 +59,15 @@ extern const uint8_t BITMAP_AntennaLevel4[3];
|
|||||||
extern const uint8_t BITMAP_AntennaLevel5[3];
|
extern const uint8_t BITMAP_AntennaLevel5[3];
|
||||||
extern const uint8_t BITMAP_AntennaLevel6[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_Default[8];
|
||||||
extern const uint8_t BITMAP_VFO_NotDefault[8];
|
extern const uint8_t BITMAP_VFO_NotDefault[8];
|
||||||
|
|
||||||
//extern const uint8_t BITMAP_ScanList[6];
|
|
||||||
extern const uint8_t BITMAP_ScanList1[6];
|
extern const uint8_t BITMAP_ScanList1[6];
|
||||||
extern const uint8_t BITMAP_ScanList2[6];
|
extern const uint8_t BITMAP_ScanList2[6];
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
extern const uint8_t BITMAP_compand[6];
|
||||||
extern const uint8_t BITMAP_compand[6];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
21
board.c
21
board.c
@@ -532,8 +532,10 @@ void BOARD_EEPROM_Init(void)
|
|||||||
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
||||||
#endif
|
#endif
|
||||||
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
||||||
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
#ifdef ENABLE_VOX
|
||||||
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
||||||
|
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
||||||
|
#endif
|
||||||
gEeprom.MIC_SENSITIVITY = (Data[7] < 5) ? Data[7] : 4;
|
gEeprom.MIC_SENSITIVITY = (Data[7] < 5) ? Data[7] : 4;
|
||||||
|
|
||||||
// 0E78..0E7F
|
// 0E78..0E7F
|
||||||
@@ -622,7 +624,7 @@ void BOARD_EEPROM_Init(void)
|
|||||||
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
|
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
|
||||||
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
|
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
|
||||||
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
|
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
|
||||||
gEeprom.DTMF_AUTO_RESET_TIME = (Data[4] < 61) ? Data[4] : 5;
|
gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 5) ? Data[4] : 10;
|
||||||
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
||||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
||||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
||||||
@@ -705,13 +707,14 @@ void BOARD_EEPROM_Init(void)
|
|||||||
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true;
|
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true;
|
||||||
gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
||||||
gSetting_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false;
|
gSetting_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false;
|
||||||
gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3: 2;
|
gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2;
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
gSetting_mic_bar = (Data[7] & (1u << 4)) ? true : false;
|
gSetting_mic_bar = (Data[7] & (1u << 4)) ? true : false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
|
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
|
||||||
#endif
|
#endif
|
||||||
|
gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u;
|
||||||
|
|
||||||
if (!gEeprom.VFO_OPEN)
|
if (!gEeprom.VFO_OPEN)
|
||||||
{
|
{
|
||||||
@@ -756,9 +759,11 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
|||||||
}
|
}
|
||||||
gBatteryCalibration[5] = 2300;
|
gBatteryCalibration[5] = 2300;
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2);
|
#ifdef ENABLE_VOX
|
||||||
EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2);
|
EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2);
|
||||||
|
EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2);
|
||||||
|
#endif
|
||||||
|
|
||||||
//EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1);
|
//EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1);
|
||||||
//gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15;
|
//gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15;
|
||||||
gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY];
|
gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY];
|
||||||
@@ -861,7 +866,7 @@ void BOARD_FactoryReset(bool bIsAll)
|
|||||||
|
|
||||||
if (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
|
// set the first few memory channels
|
||||||
for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++)
|
for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++)
|
||||||
|
|||||||
4
compile-with-docker.bat
Normal file
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
Normal file
3
compile-with-docker.sh
Normal 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
2
dcs.c
@@ -91,7 +91,7 @@ uint8_t DCS_GetCdcssCode(uint32_t Code)
|
|||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t DCS_GetCtcssCode(uint16_t Code)
|
uint8_t DCS_GetCtcssCode(int Code)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint8_t Result = 0xFF;
|
uint8_t Result = 0xFF;
|
||||||
|
|||||||
2
dcs.h
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);
|
uint32_t DCS_GetGolayCodeWord(DCS_CodeType_t CodeType, uint8_t Option);
|
||||||
uint8_t DCS_GetCdcssCode(uint32_t Code);
|
uint8_t DCS_GetCdcssCode(uint32_t Code);
|
||||||
uint8_t DCS_GetCtcssCode(uint16_t Code);
|
uint8_t DCS_GetCtcssCode(int Code);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
11
driver/adc.h
11
driver/adc.h
@@ -42,8 +42,10 @@ enum ADC_CH_MASK {
|
|||||||
typedef enum ADC_CH_MASK ADC_CH_MASK;
|
typedef enum ADC_CH_MASK ADC_CH_MASK;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t CLK_SEL;
|
uint16_t EXTTRIG_SEL;
|
||||||
|
uint16_t IE_CHx_EOC;
|
||||||
ADC_CH_MASK CH_SEL;
|
ADC_CH_MASK CH_SEL;
|
||||||
|
uint8_t CLK_SEL;
|
||||||
uint8_t AVG;
|
uint8_t AVG;
|
||||||
uint8_t CONT;
|
uint8_t CONT;
|
||||||
uint8_t MEM_MODE;
|
uint8_t MEM_MODE;
|
||||||
@@ -51,13 +53,12 @@ typedef struct {
|
|||||||
uint8_t SMPL_SETUP;
|
uint8_t SMPL_SETUP;
|
||||||
uint8_t SMPL_WIN;
|
uint8_t SMPL_WIN;
|
||||||
uint8_t ADC_TRIG;
|
uint8_t ADC_TRIG;
|
||||||
uint16_t EXTTRIG_SEL;
|
|
||||||
bool CALIB_OFFSET_VALID;
|
|
||||||
bool CALIB_KD_VALID;
|
|
||||||
uint8_t DMA_EN;
|
uint8_t DMA_EN;
|
||||||
uint16_t IE_CHx_EOC;
|
|
||||||
uint8_t IE_FIFO_HFULL;
|
uint8_t IE_FIFO_HFULL;
|
||||||
uint8_t IE_FIFO_FULL;
|
uint8_t IE_FIFO_FULL;
|
||||||
|
bool CALIB_OFFSET_VALID;
|
||||||
|
bool CALIB_KD_VALID;
|
||||||
|
uint8_t _pad[1];
|
||||||
} ADC_Config_t;
|
} ADC_Config_t;
|
||||||
|
|
||||||
uint8_t ADC_GetChannelNumber(ADC_CH_MASK Mask);
|
uint8_t ADC_GetChannelNumber(ADC_CH_MASK Mask);
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ void BK4819_SetCTCSSFrequency(uint32_t FreqControlWord)
|
|||||||
// freq(Hz) * 20.64888 for XTAL 13M/26M or
|
// freq(Hz) * 20.64888 for XTAL 13M/26M or
|
||||||
// freq(Hz) * 20.97152 for XTAL 12.8M/19.2M/25.6M/38.4M
|
// freq(Hz) * 20.97152 for XTAL 12.8M/19.2M/25.6M/38.4M
|
||||||
//
|
//
|
||||||
BK4819_WriteRegister(BK4819_REG_07, BK4819_REG_07_MODE_CTC1 | (((FreqControlWord * 2064888u) + 500000u) / 1000000u)); // with rounding
|
BK4819_WriteRegister(BK4819_REG_07, BK4819_REG_07_MODE_CTC1 | (((FreqControlWord * 206488u) + 50000u) / 100000u)); // with rounding
|
||||||
}
|
}
|
||||||
|
|
||||||
// freq_10Hz is CTCSS Hz * 10
|
// freq_10Hz is CTCSS Hz * 10
|
||||||
@@ -716,15 +716,15 @@ void BK4819_SetupSquelch(
|
|||||||
// 0 ~ 255
|
// 0 ~ 255
|
||||||
//
|
//
|
||||||
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
|
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
|
||||||
#if 0
|
#ifndef ENABLE_FASTER_CHANNEL_SCAN
|
||||||
|
// original
|
||||||
(1u << 14) // 1 ???
|
(1u << 14) // 1 ???
|
||||||
| (5u << 11) // 5 squelch = 1 delay .. 0 ~ 7
|
| (5u << 11) // 5 squelch = 1 delay .. 0 ~ 7
|
||||||
| (3u << 9) // 3 squelch = 0 delay .. 0 ~ 3
|
| (3u << 9) // 3 squelch = 0 delay .. 0 ~ 3
|
||||||
| SquelchOpenGlitchThresh); // 0 ~ 255
|
| SquelchOpenGlitchThresh); // 0 ~ 255
|
||||||
#else
|
#else
|
||||||
|
// faster (but twitchier)
|
||||||
(1u << 14) // 1 ???
|
(1u << 14) // 1 ???
|
||||||
| (2u << 11) // squelch = 1 delay .. 0 ~ 7
|
|
||||||
| (1u << 9) // squelch = 0 delay .. 0 ~ 3
|
|
||||||
| SquelchOpenGlitchThresh); // 0 ~ 255
|
| SquelchOpenGlitchThresh); // 0 ~ 255
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -831,15 +831,14 @@ void BK4819_SetCompander(const unsigned int mode)
|
|||||||
// mode 2 .. RX
|
// mode 2 .. RX
|
||||||
// mode 3 .. TX and RX
|
// mode 3 .. TX and RX
|
||||||
|
|
||||||
|
const uint16_t r31 = BK4819_ReadRegister(BK4819_REG_31);
|
||||||
|
|
||||||
if (mode == 0)
|
if (mode == 0)
|
||||||
{ // disable
|
{ // disable
|
||||||
BK4819_WriteRegister(BK4819_REG_31, BK4819_ReadRegister(BK4819_REG_31) & ~(1u < 3));
|
BK4819_WriteRegister(BK4819_REG_31, r31 & ~(1u << 3));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable
|
|
||||||
BK4819_WriteRegister(BK4819_REG_31, BK4819_ReadRegister(BK4819_REG_31) | (1u < 3));
|
|
||||||
|
|
||||||
// set the compressor ratio
|
// set the compressor ratio
|
||||||
//
|
//
|
||||||
// REG_29 <15:14> 10 Compress (AF Tx) Ratio
|
// REG_29 <15:14> 10 Compress (AF Tx) Ratio
|
||||||
@@ -848,9 +847,19 @@ void BK4819_SetCompander(const unsigned int mode)
|
|||||||
// 10 = 2:1
|
// 10 = 2:1
|
||||||
// 11 = 4:1
|
// 11 = 4:1
|
||||||
//
|
//
|
||||||
const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 3 : 0; // 4:1
|
// REG_29 <13:7> 86 Compress (AF Tx) 0 dB point (dB)
|
||||||
BK4819_WriteRegister(BK4819_REG_29, (BK4819_ReadRegister(BK4819_REG_29) & ~(3u < 14)) | (compress_ratio < 14));
|
//
|
||||||
|
// REG_29 <6:0> 64 Compress (AF Tx) noise point (dB)
|
||||||
|
//
|
||||||
|
const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 2 : 0; // 2:1
|
||||||
|
const uint16_t compress_0dB = 86;
|
||||||
|
const uint16_t compress_noise_dB = 64;
|
||||||
|
// AB40 10 1010110 1000000
|
||||||
|
BK4819_WriteRegister(BK4819_REG_29, // (BK4819_ReadRegister(BK4819_REG_29) & ~(3u < 14)) | (compress_ratio < 14));
|
||||||
|
(compress_ratio << 14)
|
||||||
|
| (compress_0dB << 7)
|
||||||
|
| (compress_noise_dB << 0));
|
||||||
|
|
||||||
// set the expander ratio
|
// set the expander ratio
|
||||||
//
|
//
|
||||||
// REG_28 <15:14> 01 Expander (AF Rx) Ratio
|
// REG_28 <15:14> 01 Expander (AF Rx) Ratio
|
||||||
@@ -859,8 +868,21 @@ void BK4819_SetCompander(const unsigned int mode)
|
|||||||
// 10 = 1:3
|
// 10 = 1:3
|
||||||
// 11 = 1:4
|
// 11 = 1:4
|
||||||
//
|
//
|
||||||
const uint16_t expand_ratio = (mode >= 2) ? 3 : 0; // 1:4
|
// REG_28 <13:7> 86 Expander (AF Rx) 0 dB point (dB)
|
||||||
BK4819_WriteRegister(BK4819_REG_28, (BK4819_ReadRegister(BK4819_REG_28) & ~(3u < 14)) | (expand_ratio < 14));
|
//
|
||||||
|
// REG_28 <6:0> 56 Expander (AF Rx) noise point (dB)
|
||||||
|
//
|
||||||
|
const uint16_t expand_ratio = (mode >= 2) ? 1 : 0; // 1:2
|
||||||
|
const uint16_t expand_0dB = 86;
|
||||||
|
const uint16_t expand_noise_dB = 56;
|
||||||
|
// 6B38 01 1010110 0111000
|
||||||
|
BK4819_WriteRegister(BK4819_REG_28, // (BK4819_ReadRegister(BK4819_REG_28) & ~(3u < 14)) | (expand_ratio < 14));
|
||||||
|
(expand_ratio << 14)
|
||||||
|
| (expand_0dB << 7)
|
||||||
|
| (expand_noise_dB << 0));
|
||||||
|
|
||||||
|
// enable
|
||||||
|
BK4819_WriteRegister(BK4819_REG_31, r31 | (1u << 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BK4819_DisableVox(void)
|
void BK4819_DisableVox(void)
|
||||||
@@ -891,7 +913,7 @@ void BK4819_EnableDTMF(void)
|
|||||||
// REG_24 <3:0> 14 Max symbol number for SelCall detection
|
// REG_24 <3:0> 14 Max symbol number for SelCall detection
|
||||||
|
|
||||||
// const uint16_t threshold = 24; // doesn't decode non-QS radios
|
// const uint16_t threshold = 24; // doesn't decode non-QS radios
|
||||||
const uint16_t threshold = 140; // but 128 ~ 247 does
|
const uint16_t threshold = 160; // but 128 ~ 247 does
|
||||||
BK4819_WriteRegister(BK4819_REG_24, // 1 00011000 1 1 1 1110
|
BK4819_WriteRegister(BK4819_REG_24, // 1 00011000 1 1 1 1110
|
||||||
(1u << BK4819_REG_24_SHIFT_UNKNOWN_15)
|
(1u << BK4819_REG_24_SHIFT_UNKNOWN_15)
|
||||||
| (threshold << BK4819_REG_24_SHIFT_THRESHOLD) // 0 ~ 255
|
| (threshold << BK4819_REG_24_SHIFT_THRESHOLD) // 0 ~ 255
|
||||||
@@ -1161,7 +1183,25 @@ void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency)
|
|||||||
{
|
{
|
||||||
BK4819_EnterTxMute();
|
BK4819_EnterTxMute();
|
||||||
|
|
||||||
BK4819_WriteRegister(BK4819_REG_70, 0 | BK4819_REG_70_MASK_ENABLE_TONE1 | (96U << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
// REG_70 <15> 0 Enable TONE1
|
||||||
|
// 1 = Enable
|
||||||
|
// 0 = Disable
|
||||||
|
//
|
||||||
|
// REG_70 <14:8> 0 TONE1 tuning gain
|
||||||
|
// 0 ~ 127
|
||||||
|
//
|
||||||
|
// REG_70 <7> 0 Enable TONE2
|
||||||
|
// 1 = Enable
|
||||||
|
// 0 = Disable
|
||||||
|
//
|
||||||
|
// REG_70 <6:0> 0 TONE2/FSK tuning gain
|
||||||
|
// 0 ~ 127
|
||||||
|
//
|
||||||
|
// set the tone amplitude
|
||||||
|
//
|
||||||
|
// BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_MASK_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||||
|
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_MASK_ENABLE_TONE1 | (50u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||||
|
|
||||||
BK4819_WriteRegister(BK4819_REG_71, scale_freq(Frequency));
|
BK4819_WriteRegister(BK4819_REG_71, scale_freq(Frequency));
|
||||||
|
|
||||||
BK4819_SetAF(bLocalLoopback ? BK4819_AF_BEEP : BK4819_AF_MUTE);
|
BK4819_SetAF(bLocalLoopback ? BK4819_AF_BEEP : BK4819_AF_MUTE);
|
||||||
@@ -1487,10 +1527,15 @@ void BK4819_PlayRogerMDC(void)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
BK4819_SetAF(BK4819_AF_MUTE);
|
BK4819_SetAF(BK4819_AF_MUTE);
|
||||||
BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable, RX Bandwidth FFSK1200/1800, 0xAA or 0x55 Preamble, 11 RX Gain,
|
|
||||||
// 101 RX Mode, FFSK1200/1800 TX
|
BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable,
|
||||||
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone2 to 1200Hz
|
// RX Bandwidth FFSK 1200/1800
|
||||||
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone2 and Set Tone2 Gain
|
// 0xAA or 0x55 Preamble
|
||||||
|
// 11 RX Gain,
|
||||||
|
// 101 RX Mode
|
||||||
|
// TX FFSK 1200/1800
|
||||||
|
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone-2 to 1200Hz
|
||||||
|
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone-2 and Set Tone2 Gain
|
||||||
BK4819_WriteRegister(BK4819_REG_5D, 0x0D00); // Set FSK data length to 13 bytes
|
BK4819_WriteRegister(BK4819_REG_5D, 0x0D00); // Set FSK data length to 13 bytes
|
||||||
BK4819_WriteRegister(BK4819_REG_59, 0x8068); // 4 byte sync length, 6 byte preamble, clear TX FIFO
|
BK4819_WriteRegister(BK4819_REG_59, 0x8068); // 4 byte sync length, 6 byte preamble, clear TX FIFO
|
||||||
BK4819_WriteRegister(BK4819_REG_59, 0x0068); // Same, but clear TX FIFO is now unset (clearing done)
|
BK4819_WriteRegister(BK4819_REG_59, 0x0068); // Same, but clear TX FIFO is now unset (clearing done)
|
||||||
@@ -1509,7 +1554,7 @@ void BK4819_PlayRogerMDC(void)
|
|||||||
|
|
||||||
SYSTEM_DelayMs(180);
|
SYSTEM_DelayMs(180);
|
||||||
|
|
||||||
// Stop FSK TX, reset Tone2, disable FSK
|
// Stop FSK TX, reset Tone-2, disable FSK
|
||||||
BK4819_WriteRegister(BK4819_REG_59, 0x0068);
|
BK4819_WriteRegister(BK4819_REG_59, 0x0068);
|
||||||
BK4819_WriteRegister(BK4819_REG_70, 0x0000);
|
BK4819_WriteRegister(BK4819_REG_70, 0x0000);
|
||||||
BK4819_WriteRegister(BK4819_REG_58, 0x0000);
|
BK4819_WriteRegister(BK4819_REG_58, 0x0000);
|
||||||
|
|||||||
@@ -24,22 +24,22 @@
|
|||||||
|
|
||||||
enum BK4819_AF_Type_t
|
enum BK4819_AF_Type_t
|
||||||
{
|
{
|
||||||
BK4819_AF_MUTE = 0u,
|
BK4819_AF_MUTE = 0u, //
|
||||||
BK4819_AF_OPEN = 1u,
|
BK4819_AF_FM = 1u, // FM
|
||||||
BK4819_AF_ALAM = 2u,
|
BK4819_AF_ALAM = 2u, //
|
||||||
BK4819_AF_BEEP = 3u,
|
BK4819_AF_BEEP = 3u, //
|
||||||
BK4819_AF_UNKNOWN1 = 4u,
|
BK4819_AF_BASEBAND1 = 4u, // SSB
|
||||||
BK4819_AF_UNKNOWN2 = 5u,
|
BK4819_AF_BASEBAND2 = 5u, // SSB
|
||||||
BK4819_AF_CTCO = 6u,
|
BK4819_AF_CTCO = 6u, // strange LF audio .. maybe the CTCSS LF line ?
|
||||||
BK4819_AF_AM = 7u,
|
BK4819_AF_AM = 7u, // AM
|
||||||
BK4819_AF_FSKO = 8u,
|
BK4819_AF_FSKO = 8u, // nothing
|
||||||
BK4819_AF_UNKNOWN3 = 9u,
|
BK4819_AF_UNKNOWN3 = 9u, // distorted
|
||||||
BK4819_AF_UNKNOWN4 = 10u,
|
BK4819_AF_UNKNOWN4 = 10u, // nothing at all
|
||||||
BK4819_AF_UNKNOWN5 = 11u,
|
BK4819_AF_UNKNOWN5 = 11u, // distorted
|
||||||
BK4819_AF_UNKNOWN6 = 12u,
|
BK4819_AF_UNKNOWN6 = 12u, // distorted
|
||||||
BK4819_AF_UNKNOWN7 = 13u,
|
BK4819_AF_UNKNOWN7 = 13u, // interesting
|
||||||
BK4819_AF_UNKNOWN8 = 14u,
|
BK4819_AF_UNKNOWN8 = 14u, // interesting
|
||||||
BK4819_AF_UNKNOWN9 = 15u
|
BK4819_AF_UNKNOWN9 = 15u // not a lot
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
||||||
|
|||||||
@@ -19,180 +19,122 @@
|
|||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "driver/keyboard.h"
|
#include "driver/keyboard.h"
|
||||||
#include "driver/systick.h"
|
#include "driver/systick.h"
|
||||||
|
#include "driver/i2c.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
KEY_Code_t gKeyReading0 = KEY_INVALID;
|
KEY_Code_t gKeyReading0 = KEY_INVALID;
|
||||||
KEY_Code_t gKeyReading1 = KEY_INVALID;
|
KEY_Code_t gKeyReading1 = KEY_INVALID;
|
||||||
uint16_t gDebounceCounter;
|
uint16_t gDebounceCounter;
|
||||||
bool gWasFKeyPressed;
|
bool gWasFKeyPressed;
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
// Using a 16 bit pre-calculated shift and invert is cheaper
|
||||||
|
// than using 8 bit and doing shift and invert in code.
|
||||||
|
uint16_t set_to_zero_mask;
|
||||||
|
|
||||||
|
//We are very fortunate.
|
||||||
|
//The key and pin defines fit together in a single u8,
|
||||||
|
//making this very efficient
|
||||||
|
struct {
|
||||||
|
uint8_t key : 5; //Key 23 is highest
|
||||||
|
uint8_t pin : 3; //Pin 6 is highest
|
||||||
|
} pins[4];
|
||||||
|
} keyboard[5] = {
|
||||||
|
/* Zero row */
|
||||||
|
{
|
||||||
|
//Set to zero to handle special case of nothing pulled down.
|
||||||
|
.set_to_zero_mask = ~(0),
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_SIDE1, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
/* Duplicate to fill the array with valid values */
|
||||||
|
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* First row */
|
||||||
|
{
|
||||||
|
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_4),
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_MENU, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_1, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_4, .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
|
{ .key = KEY_7, .pin = GPIOA_PIN_KEYBOARD_3},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* Second row */
|
||||||
|
{
|
||||||
|
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_5),
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
|
{ .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* Third row */
|
||||||
|
{
|
||||||
|
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_6),
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_3 , .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_6 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
|
{ .key = KEY_9 , .pin = GPIOA_PIN_KEYBOARD_3},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* Fourth row */
|
||||||
|
{
|
||||||
|
.set_to_zero_mask = ~(1 << GPIOA_PIN_KEYBOARD_7),
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
|
{ .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
KEY_Code_t KEYBOARD_Poll(void)
|
KEY_Code_t KEYBOARD_Poll(void)
|
||||||
{
|
{
|
||||||
KEY_Code_t Key = KEY_INVALID;
|
KEY_Code_t Key = KEY_INVALID;
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
// if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
// return KEY_PTT;
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
|
||||||
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
// *****************
|
// *****************
|
||||||
// Keys connected to gnd
|
for(int j = 0; j < ARRAY_SIZE(keyboard); j++) {
|
||||||
|
//Set all high
|
||||||
|
GPIOA->DATA |= 1 << GPIOA_PIN_KEYBOARD_4 |
|
||||||
|
1 << GPIOA_PIN_KEYBOARD_5 |
|
||||||
|
1 << GPIOA_PIN_KEYBOARD_6 |
|
||||||
|
1 << GPIOA_PIN_KEYBOARD_7 ;
|
||||||
|
//Clear the pin we are selecting
|
||||||
|
GPIOA->DATA &= keyboard[j].set_to_zero_mask;
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
//Wait for the pins to stabilize. 1 works for me.
|
||||||
{
|
SYSTICK_DelayUs(2);
|
||||||
Key = KEY_SIDE1;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
// Read all 4 GPIO pins at once
|
||||||
{
|
uint16_t reg = GPIOA->DATA;
|
||||||
Key = KEY_SIDE2;
|
for(int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++)
|
||||||
goto Bye;
|
{
|
||||||
}
|
uint16_t mask = 1 << keyboard[j].pins[i].pin;
|
||||||
|
if(! (reg & mask)) {
|
||||||
|
Key = keyboard[j].pins[i].key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Original doesn't do PTT
|
if (Key != KEY_INVALID)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// *****************
|
//Create I2C stop condition. Since we might have toggled I2C pins.
|
||||||
// First row
|
//This leaves GPIOA_PIN_KEYBOARD_4 and GPIOA_PIN_KEYBOARD_5 high
|
||||||
|
I2C_Stop();
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
// Reset VOICE pins
|
||||||
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);
|
|
||||||
|
|
||||||
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_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ SECTIONS
|
|||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
*(.text.isr) /* .text sections of code */
|
KEEP(*(.text.isr)) /* .text sections of code */
|
||||||
*(.text) /* .text sections of code */
|
*(.text) /* .text sections of code */
|
||||||
*(.text*) /* .text* sections of code */
|
*(.text*) /* .text* sections of code */
|
||||||
*(.rodata) /* .rodata sections */
|
*(.rodata) /* .rodata sections */
|
||||||
|
|||||||
127
frequencies.c
127
frequencies.c
@@ -19,52 +19,29 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
// the BK4819 has 2 bands it covers, 18MHz ~ 630MHz and 760MHz ~ 1300MHz
|
// 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 freq_band_table_t frequencyBandTable[7] =
|
||||||
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] =
|
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_WIDE_RX
|
#ifndef ENABLE_WIDE_RX
|
||||||
5000000,
|
// QS original
|
||||||
|
{ 5000000, 7600000},
|
||||||
|
{10800000, 13600000},
|
||||||
|
{13600000, 17400000},
|
||||||
|
{17400000, 35000000},
|
||||||
|
{35000000, 40000000},
|
||||||
|
{40000000, 47000000},
|
||||||
|
{47000000, 60000000}
|
||||||
#else
|
#else
|
||||||
1800000,
|
// extended range
|
||||||
#endif
|
{ 1800000, 10800000},
|
||||||
10800000,
|
{10800000, 13600000},
|
||||||
13600000,
|
{13600000, 17400000},
|
||||||
17400000,
|
{17400000, 35000000},
|
||||||
35000000,
|
{35000000, 40000000},
|
||||||
40000000,
|
{40000000, 47000000},
|
||||||
47000000
|
{47000000, 130000000}
|
||||||
};
|
|
||||||
|
|
||||||
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
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,37 +61,24 @@ const uint32_t UpperLimitFrequencyBandTable[7] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#ifndef ENABLE_12_5KHZ_STEP
|
||||||
const uint16_t StepFrequencyTable[7] =
|
// QS steps (*10 Hz)
|
||||||
{
|
const uint16_t StepFrequencyTable[7] = {250, 500, 625, 1000, 1250, 2500, 833};
|
||||||
250,
|
|
||||||
500,
|
|
||||||
625,
|
|
||||||
1000,
|
|
||||||
1250,
|
|
||||||
2500,
|
|
||||||
833
|
|
||||||
};
|
|
||||||
#else
|
#else
|
||||||
const uint16_t StepFrequencyTable[7] =
|
// includes 1.25kHz step
|
||||||
{
|
const uint16_t StepFrequencyTable[7] = {125, 250, 625, 1000, 1250, 2500, 833};
|
||||||
125,
|
|
||||||
250,
|
|
||||||
625,
|
|
||||||
1000,
|
|
||||||
1250,
|
|
||||||
2500,
|
|
||||||
833
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
|
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
|
||||||
{
|
{
|
||||||
int band;
|
int band;
|
||||||
for (band = BAND7_470MHz; band >= BAND1_50MHz; band--)
|
for (band = ARRAY_SIZE(frequencyBandTable) - 1; band >= 0; band--)
|
||||||
if (Frequency >= LowerLimitFrequencyBandTable[band])
|
if (Frequency >= frequencyBandTable[band].lower)
|
||||||
return band;
|
// if (Frequency < frequencyBandTable[band].upper)
|
||||||
|
return (FREQUENCY_Band_t)band;
|
||||||
|
|
||||||
return BAND1_50MHz;
|
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)
|
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency)
|
||||||
@@ -156,26 +120,16 @@ uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)
|
|||||||
|
|
||||||
return Lower + (Step * Index);
|
return Lower + (Step * Index);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
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
|
int TX_freq_check(const uint32_t Frequency)
|
||||||
if (pInfo->CHANNEL_SAVE > FREQ_CHANNEL_LAST)
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
int TX_FREQUENCY_Check(const uint32_t Frequency)
|
|
||||||
{ // return '0' if TX frequency is allowed
|
{ // return '0' if TX frequency is allowed
|
||||||
// otherwise return '-1'
|
// otherwise return '-1'
|
||||||
|
|
||||||
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6])
|
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||||
return -1;
|
return -1; // not allowed outside this range
|
||||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
|
||||||
return -1;
|
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||||
|
return -1; // BX chip does not work in this range
|
||||||
|
|
||||||
switch (gSetting_F_LOCK)
|
switch (gSetting_F_LOCK)
|
||||||
{
|
{
|
||||||
@@ -205,6 +159,8 @@ int TX_FREQUENCY_Check(const uint32_t Frequency)
|
|||||||
case F_LOCK_CE:
|
case F_LOCK_CE:
|
||||||
if (Frequency >= 14400000 && Frequency < 14600000)
|
if (Frequency >= 14400000 && Frequency < 14600000)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (Frequency >= 43000000 && Frequency < 44000000)
|
||||||
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_LOCK_GB:
|
case F_LOCK_GB:
|
||||||
@@ -233,13 +189,14 @@ int TX_FREQUENCY_Check(const uint32_t Frequency)
|
|||||||
return -1;
|
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
|
{ // return '0' if RX frequency is allowed
|
||||||
// otherwise return '-1'
|
// otherwise return '-1'
|
||||||
|
|
||||||
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6])
|
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||||
return -1;
|
return -1;
|
||||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
|
||||||
|
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0; // OK frequency
|
return 0; // OK frequency
|
||||||
|
|||||||
@@ -19,17 +19,20 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "radio.h"
|
#define ENABLE_12_5KHZ_STEP
|
||||||
|
|
||||||
extern const uint32_t bx_start1_Hz;
|
typedef struct {
|
||||||
extern const uint32_t bx_stop1_Hz;
|
const uint32_t lower;
|
||||||
|
const uint32_t upper;
|
||||||
|
} freq_band_table_t;
|
||||||
|
|
||||||
extern const uint32_t bx_start2_Hz;
|
extern const freq_band_table_t BX4819_band1;
|
||||||
extern const uint32_t bx_stop2_Hz;
|
extern const freq_band_table_t BX4819_band2;
|
||||||
|
|
||||||
enum FREQUENCY_Band_t
|
extern const freq_band_table_t frequencyBandTable[7];
|
||||||
{
|
|
||||||
BAND1_NONE = -1,
|
enum FREQUENCY_Band_t {
|
||||||
|
BAND_NONE = -1,
|
||||||
BAND1_50MHz = 0,
|
BAND1_50MHz = 0,
|
||||||
BAND2_108MHz,
|
BAND2_108MHz,
|
||||||
BAND3_136MHz,
|
BAND3_136MHz,
|
||||||
@@ -38,26 +41,44 @@ enum FREQUENCY_Band_t
|
|||||||
BAND6_400MHz,
|
BAND6_400MHz,
|
||||||
BAND7_470MHz
|
BAND7_470MHz
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum FREQUENCY_Band_t FREQUENCY_Band_t;
|
typedef enum FREQUENCY_Band_t FREQUENCY_Band_t;
|
||||||
|
|
||||||
extern const uint32_t LowerLimitFrequencyBandTable[7];
|
#ifndef ENABLE_12_5KHZ_STEP
|
||||||
extern const uint32_t MiddleFrequencyBandTable[7];
|
// QS steps
|
||||||
extern const uint32_t UpperLimitFrequencyBandTable[7];
|
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
|
#ifdef ENABLE_NOAA
|
||||||
extern const uint32_t NoaaFrequencyTable[10];
|
extern const uint32_t NoaaFrequencyTable[10];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const uint16_t StepFrequencyTable[7];
|
|
||||||
|
|
||||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency);
|
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);
|
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_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower);
|
||||||
|
|
||||||
//int TX_FREQUENCY_Check(VFO_Info_t *pInfo);
|
int TX_freq_check(const uint32_t Frequency);
|
||||||
int TX_FREQUENCY_Check(const uint32_t Frequency);
|
int RX_freq_check(const uint32_t Frequency);
|
||||||
int RX_FREQUENCY_Check(const uint32_t Frequency);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
66
functions.c
66
functions.c
@@ -22,12 +22,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "bsp/dp32g030/gpio.h"
|
#include "bsp/dp32g030/gpio.h"
|
||||||
#include "dcs.h"
|
#include "dcs.h"
|
||||||
|
#include "driver/backlight.h"
|
||||||
#if defined(ENABLE_FMRADIO)
|
#if defined(ENABLE_FMRADIO)
|
||||||
#include "driver/bk1080.h"
|
#include "driver/bk1080.h"
|
||||||
#endif
|
#endif
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "driver/system.h"
|
#include "driver/system.h"
|
||||||
|
#include "frequencies.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "helper/battery.h"
|
#include "helper/battery.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
@@ -54,12 +56,15 @@ void FUNCTION_Init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
|
|
||||||
g_CxCSS_TAIL_Found = false;
|
g_CxCSS_TAIL_Found = false;
|
||||||
g_CDCSS_Lost = false;
|
g_CDCSS_Lost = false;
|
||||||
g_CTCSS_Lost = false;
|
g_CTCSS_Lost = false;
|
||||||
|
|
||||||
g_VOX_Lost = false;
|
#ifdef ENABLE_VOX
|
||||||
|
g_VOX_Lost = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
g_SquelchLost = false;
|
g_SquelchLost = false;
|
||||||
|
|
||||||
gFlagTailNoteEliminationComplete = false;
|
gFlagTailNoteEliminationComplete = false;
|
||||||
@@ -73,6 +78,8 @@ void FUNCTION_Init(void)
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
gNOAACountdown_10ms = 0;
|
gNOAACountdown_10ms = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FUNCTION_Select(FUNCTION_Type_t Function)
|
void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||||
@@ -110,36 +117,39 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
||||||
gDTMF_AUTO_RESET_TIME = 1 + (gEeprom.DTMF_AUTO_RESET_TIME * 2);
|
gDTMF_auto_reset_time_500ms = 1 + (gEeprom.DTMF_auto_reset_time * 2);
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FUNCTION_MONITOR:
|
case FUNCTION_MONITOR:
|
||||||
gMonitor = true;
|
gMonitor = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_INCOMING:
|
case FUNCTION_INCOMING:
|
||||||
case FUNCTION_RECEIVE:
|
case FUNCTION_RECEIVE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_POWER_SAVE:
|
case FUNCTION_POWER_SAVE:
|
||||||
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
|
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
|
||||||
gPowerSaveCountdownExpired = false;
|
gPowerSaveCountdownExpired = false;
|
||||||
|
|
||||||
gRxIdleMode = true;
|
gRxIdleMode = true;
|
||||||
|
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
BK4819_DisableVox();
|
BK4819_DisableVox();
|
||||||
BK4819_Sleep();
|
BK4819_Sleep();
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FUNCTION_TRANSMIT:
|
case FUNCTION_TRANSMIT:
|
||||||
|
|
||||||
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
|
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
|
||||||
@@ -152,7 +162,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
|
||||||
#if defined(ENABLE_FMRADIO)
|
#if defined(ENABLE_FMRADIO)
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
BK1080_Init(0, false);
|
BK1080_Init(0, false);
|
||||||
@@ -182,33 +192,47 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
|
||||||
GUI_DisplayScreen();
|
GUI_DisplayScreen();
|
||||||
|
|
||||||
RADIO_SetTxParameters();
|
RADIO_SetTxParameters();
|
||||||
|
|
||||||
// turn the RED LED on
|
// turn the RED LED on
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
||||||
|
|
||||||
DTMF_Reply();
|
DTMF_Reply();
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
if (gAlarmState != ALARM_STATE_OFF)
|
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);
|
SYSTEM_DelayMs(2);
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gAlarmToneCounter = 0;
|
#ifdef ENABLE_ALARM
|
||||||
gEnableSpeaker = true;
|
gAlarmToneCounter = 0;
|
||||||
|
#endif
|
||||||
|
gEnableSpeaker = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
|
if (gCurrentVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||||
else
|
else
|
||||||
BK4819_DisableScramble();
|
BK4819_DisableScramble();
|
||||||
|
|
||||||
|
if (gSetting_backlight_on_tx_rx == 1 || gSetting_backlight_on_tx_rx == 3)
|
||||||
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_BAND_SCOPE:
|
case FUNCTION_BAND_SCOPE:
|
||||||
|
|||||||
@@ -66,58 +66,42 @@ Volts Percent Volts Percent Volts Percent Volts Percent
|
|||||||
7.96478 75 7.72911 48 7.51285 21
|
7.96478 75 7.72911 48 7.51285 21
|
||||||
7.95983 74 7.72097 47 7.49832 20
|
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)
|
if (voltage_10mV > 814)
|
||||||
return 100;
|
return 100;
|
||||||
else if(voltage_10mV>756)
|
if (voltage_10mV > 756)
|
||||||
return 132*voltage_10mV/100-974;
|
return ((132ul * voltage_10mV) / 100) - 974u;
|
||||||
else if(voltage_10mV>729)
|
if (voltage_10mV > 729)
|
||||||
return 63*voltage_10mV/100-452;
|
return ((63ul * voltage_10mV) / 100) - 452u;
|
||||||
else if(voltage_10mV>600)
|
if (voltage_10mV > 600)
|
||||||
return 52*voltage_10mV/1000-31;
|
return ((52ul * voltage_10mV) / 1000) - 31u;
|
||||||
else
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BATTERY_GetReadings(bool bDisplayBatteryLevel)
|
void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
|
||||||
{
|
{
|
||||||
const uint8_t PreviousBatteryLevel = gBatteryDisplayLevel;
|
const uint8_t PreviousBatteryLevel = gBatteryDisplayLevel;
|
||||||
const uint16_t Voltage = (gBatteryVoltages[0] + gBatteryVoltages[1] + gBatteryVoltages[2] + gBatteryVoltages[3]) / 4;
|
const uint16_t Voltage = (gBatteryVoltages[0] + gBatteryVoltages[1] + gBatteryVoltages[2] + gBatteryVoltages[3]) / 4;
|
||||||
|
|
||||||
gBatteryDisplayLevel = 0;
|
gBatteryDisplayLevel = 0;
|
||||||
|
|
||||||
if (Voltage >= gBatteryCalibration[5])
|
if (gBatteryCalibration[5] < Voltage)
|
||||||
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;
|
gBatteryDisplayLevel = 6;
|
||||||
else
|
else
|
||||||
if (Voltage >= gBatteryCalibration[2])
|
if (gBatteryCalibration[4] < Voltage)
|
||||||
gBatteryDisplayLevel = 5;
|
gBatteryDisplayLevel = 5;
|
||||||
else
|
else
|
||||||
if (Voltage >= ((gBatteryCalibration[1] + gBatteryCalibration[2]) / 2))
|
if (gBatteryCalibration[3] < Voltage)
|
||||||
gBatteryDisplayLevel = 4;
|
gBatteryDisplayLevel = 4;
|
||||||
else
|
else
|
||||||
if (Voltage >= gBatteryCalibration[1])
|
if (gBatteryCalibration[2] < Voltage)
|
||||||
gBatteryDisplayLevel = 3;
|
gBatteryDisplayLevel = 3;
|
||||||
else
|
else
|
||||||
if (Voltage >= ((gBatteryCalibration[0] + gBatteryCalibration[1]) / 2))
|
if (gBatteryCalibration[1] < Voltage)
|
||||||
gBatteryDisplayLevel = 2;
|
gBatteryDisplayLevel = 2;
|
||||||
else
|
else
|
||||||
if (Voltage >= gBatteryCalibration[0])
|
if (gBatteryCalibration[0] < Voltage)
|
||||||
gBatteryDisplayLevel = 1;
|
gBatteryDisplayLevel = 1;
|
||||||
|
|
||||||
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
|
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ extern uint16_t gBatteryCheckCounter;
|
|||||||
|
|
||||||
extern volatile uint16_t gPowerSave_10ms;
|
extern volatile uint16_t gPowerSave_10ms;
|
||||||
|
|
||||||
uint8_t BATTERY_VoltsToPercent(uint16_t voltage_10mV);
|
unsigned int BATTERY_VoltsToPercent(const unsigned int voltage_10mV);
|
||||||
void BATTERY_GetReadings(bool bDisplayBatteryLevel);
|
void BATTERY_GetReadings(const bool bDisplayBatteryLevel);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -39,15 +39,16 @@ BOOT_Mode_t BOOT_GetMode(void)
|
|||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
return BOOT_MODE_NORMAL;
|
return BOOT_MODE_NORMAL; // PTT not pressed
|
||||||
Keys[i] = KEYBOARD_Poll();
|
Keys[i] = KEYBOARD_Poll();
|
||||||
SYSTEM_DelayMs(20);
|
SYSTEM_DelayMs(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Keys[0] == Keys[1])
|
if (Keys[0] == Keys[1])
|
||||||
{
|
{
|
||||||
gKeyReading0 = Keys[0];
|
gKeyReading0 = Keys[0];
|
||||||
gKeyReading1 = Keys[0];
|
gKeyReading1 = Keys[0];
|
||||||
|
|
||||||
gDebounceCounter = 2;
|
gDebounceCounter = 2;
|
||||||
|
|
||||||
if (Keys[0] == KEY_SIDE1)
|
if (Keys[0] == KEY_SIDE1)
|
||||||
@@ -66,16 +67,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
|||||||
{
|
{
|
||||||
if (Mode == BOOT_MODE_F_LOCK)
|
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);
|
GUI_SelectNextDisplay(DISPLAY_MENU);
|
||||||
gF_LOCK = true;
|
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
else
|
else
|
||||||
@@ -83,18 +75,20 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
|||||||
{
|
{
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||||
gEeprom.BATTERY_SAVE = 0;
|
gEeprom.BATTERY_SAVE = 0;
|
||||||
gEeprom.VOX_SWITCH = false;
|
#ifdef ENABLE_VOX
|
||||||
|
gEeprom.VOX_SWITCH = false;
|
||||||
|
#endif
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
gEeprom.AUTO_KEYPAD_LOCK = false;
|
gEeprom.AUTO_KEYPAD_LOCK = false;
|
||||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = 0;
|
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
gEeprom.KEY_1_LONG_PRESS_ACTION = 0;
|
gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = 0;
|
gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
gEeprom.KEY_2_LONG_PRESS_ACTION = 0;
|
gEeprom.KEY_2_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->CHANNEL_BANDWIDTH = BANDWIDTH_WIDE;
|
||||||
gRxVfo->OUTPUT_POWER = 0;
|
gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
|
|
||||||
@@ -105,6 +99,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
|||||||
BK4819_ResetFSK();
|
BK4819_ResetFSK();
|
||||||
|
|
||||||
gAircopyState = AIRCOPY_READY;
|
gAircopyState = AIRCOPY_READY;
|
||||||
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 28 KiB |
51
main.c
51
main.c
@@ -50,6 +50,7 @@ void _putchar(char c)
|
|||||||
void Main(void)
|
void Main(void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
BOOT_Mode_t BootMode;
|
||||||
|
|
||||||
// Enable clock gating of blocks we need
|
// Enable clock gating of blocks we need
|
||||||
SYSCON_DEV_CLK_GATE = 0
|
SYSCON_DEV_CLK_GATE = 0
|
||||||
@@ -67,7 +68,7 @@ void Main(void)
|
|||||||
UART_Init();
|
UART_Init();
|
||||||
|
|
||||||
boot_counter_10ms = 250; // 2.5 sec
|
boot_counter_10ms = 250; // 2.5 sec
|
||||||
|
|
||||||
UART_Send(UART_Version, strlen(UART_Version));
|
UART_Send(UART_Version, strlen(UART_Version));
|
||||||
|
|
||||||
// Not implementing authentic device checks
|
// Not implementing authentic device checks
|
||||||
@@ -101,13 +102,46 @@ void Main(void)
|
|||||||
AM_fix_init();
|
AM_fix_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// count the number of menu list items
|
BootMode = BOOT_GetMode();
|
||||||
|
|
||||||
|
// count the number of menu items
|
||||||
gMenuListCount = 0;
|
gMenuListCount = 0;
|
||||||
while (MenuList[gMenuListCount].name[0] != '\0')
|
while (MenuList[gMenuListCount].name[0] != '\0')
|
||||||
gMenuListCount++;
|
gMenuListCount++;
|
||||||
gMenuListCount -= 8; // disable the last 'n' items
|
|
||||||
|
|
||||||
if (!gChargingWithTypeC && !gBatteryDisplayLevel)
|
if (BootMode == BOOT_MODE_F_LOCK)
|
||||||
|
{
|
||||||
|
gF_LOCK = true; // flag to say include the hidden menu items
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // hide the hidden menu items
|
||||||
|
|
||||||
|
gMenuListCount -= 9;
|
||||||
|
|
||||||
|
#ifndef ENABLE_F_CAL_MENU
|
||||||
|
gMenuListCount++;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for user to release all butts before moving on
|
||||||
|
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||||
|
KEYBOARD_Poll() != KEY_INVALID ||
|
||||||
|
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);
|
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||||
|
|
||||||
@@ -120,9 +154,8 @@ void Main(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BOOT_Mode_t BootMode;
|
|
||||||
|
|
||||||
UI_DisplayWelcome();
|
UI_DisplayWelcome();
|
||||||
|
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE)
|
if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE)
|
||||||
@@ -131,7 +164,7 @@ void Main(void)
|
|||||||
{
|
{
|
||||||
if (KEYBOARD_Poll() != KEY_INVALID)
|
if (KEYBOARD_Poll() != KEY_INVALID)
|
||||||
{ // halt boot beeps
|
{ // halt boot beeps
|
||||||
boot_counter_10ms = 0;
|
boot_counter_10ms = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_BOOT_BEEPS
|
#ifdef ENABLE_BOOT_BEEPS
|
||||||
@@ -141,8 +174,6 @@ void Main(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BootMode = BOOT_GetMode();
|
|
||||||
|
|
||||||
if (gEeprom.POWER_ON_PASSWORD < 1000000)
|
if (gEeprom.POWER_ON_PASSWORD < 1000000)
|
||||||
{
|
{
|
||||||
bIsInLockScreen = true;
|
bIsInLockScreen = true;
|
||||||
@@ -179,6 +210,8 @@ void Main(void)
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
RADIO_ConfigureNOAA();
|
RADIO_ConfigureNOAA();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ******************
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
|||||||
57
misc.c
57
misc.c
@@ -24,7 +24,8 @@ const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
|||||||
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
||||||
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
||||||
|
|
||||||
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
||||||
|
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||||
|
|
||||||
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
const uint8_t DTMF_RX_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_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
||||||
@@ -44,25 +45,35 @@ const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec afte
|
|||||||
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
||||||
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
||||||
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
||||||
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
#ifdef ENABLE_VOX
|
||||||
|
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
||||||
|
#endif
|
||||||
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
||||||
|
|
||||||
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||||
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
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_3_10ms = 200 / 10; // 200ms
|
||||||
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
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 battery_save_count_10ms = 10000 / 10; // 10 seconds
|
||||||
|
|
||||||
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
||||||
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
||||||
|
|
||||||
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
#ifdef ENABLE_VOX
|
||||||
|
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
||||||
|
#endif
|
||||||
|
|
||||||
const uint16_t NOAA_countdown_10ms = 5000 / 10; // 5 seconds
|
const uint16_t NOAA_countdown_10ms = 5000 / 10; // 5 seconds
|
||||||
const uint16_t NOAA_countdown_2_10ms = 500 / 10; // 500ms
|
const uint16_t NOAA_countdown_2_10ms = 500 / 10; // 500ms
|
||||||
const uint16_t NOAA_countdown_3_10ms = 200 / 10; // 200ms
|
const uint16_t NOAA_countdown_3_10ms = 200 / 10; // 200ms
|
||||||
|
|
||||||
|
//const uint16_t gMax_bat_v = 840; // 8.4V
|
||||||
|
//const uint16_t gMin_bat_v = 660; // 6.6V
|
||||||
|
|
||||||
const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BBA7F92};
|
const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BBA7F92};
|
||||||
|
|
||||||
const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
|
const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
|
||||||
@@ -76,6 +87,8 @@ bool gSetting_TX_EN;
|
|||||||
uint8_t gSetting_F_LOCK;
|
uint8_t gSetting_F_LOCK;
|
||||||
bool gSetting_ScrambleEnable;
|
bool gSetting_ScrambleEnable;
|
||||||
|
|
||||||
|
uint8_t gSetting_backlight_on_tx_rx;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
bool gSetting_AM_fix;
|
bool gSetting_AM_fix;
|
||||||
#endif
|
#endif
|
||||||
@@ -118,6 +131,8 @@ volatile uint16_t gDualWatchCountdown_10ms;
|
|||||||
volatile bool gDualWatchCountdownExpired = true;
|
volatile bool gDualWatchCountdownExpired = true;
|
||||||
bool gDualWatchActive = false;
|
bool gDualWatchActive = false;
|
||||||
|
|
||||||
|
volatile uint8_t gSerialConfigCountDown_500ms;
|
||||||
|
|
||||||
volatile bool gNextTimeslice_500ms;
|
volatile bool gNextTimeslice_500ms;
|
||||||
|
|
||||||
volatile uint16_t gTxTimerCountdown_500ms;
|
volatile uint16_t gTxTimerCountdown_500ms;
|
||||||
@@ -146,10 +161,10 @@ uint8_t gReducedService;
|
|||||||
uint8_t gBatteryVoltageIndex;
|
uint8_t gBatteryVoltageIndex;
|
||||||
CssScanMode_t gCssScanMode;
|
CssScanMode_t gCssScanMode;
|
||||||
bool gUpdateRSSI;
|
bool gUpdateRSSI;
|
||||||
#ifdef ENABLE_ALARM
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
AlarmState_t gAlarmState;
|
AlarmState_t gAlarmState;
|
||||||
#endif
|
#endif
|
||||||
uint8_t gVoltageMenuCountdown;
|
uint16_t gMenuCountdown;
|
||||||
bool gPttWasReleased;
|
bool gPttWasReleased;
|
||||||
bool gPttWasPressed;
|
bool gPttWasPressed;
|
||||||
uint8_t gKeypadLocked;
|
uint8_t gKeypadLocked;
|
||||||
@@ -163,8 +178,10 @@ bool gRequestSaveSettings;
|
|||||||
bool gRequestSaveFM;
|
bool gRequestSaveFM;
|
||||||
#endif
|
#endif
|
||||||
bool gFlagPrepareTX;
|
bool gFlagPrepareTX;
|
||||||
|
|
||||||
bool gFlagAcceptSetting;
|
bool gFlagAcceptSetting;
|
||||||
bool gFlagRefreshSetting;
|
bool gFlagRefreshSetting;
|
||||||
|
|
||||||
bool gFlagSaveVfo;
|
bool gFlagSaveVfo;
|
||||||
bool gFlagSaveSettings;
|
bool gFlagSaveSettings;
|
||||||
bool gFlagSaveChannel;
|
bool gFlagSaveChannel;
|
||||||
@@ -175,22 +192,25 @@ bool g_CDCSS_Lost;
|
|||||||
uint8_t gCDCSSCodeType;
|
uint8_t gCDCSSCodeType;
|
||||||
bool g_CTCSS_Lost;
|
bool g_CTCSS_Lost;
|
||||||
bool g_CxCSS_TAIL_Found;
|
bool g_CxCSS_TAIL_Found;
|
||||||
bool g_VOX_Lost;
|
#ifdef ENABLE_VOX
|
||||||
|
bool g_VOX_Lost;
|
||||||
|
bool gVOX_NoiseDetected;
|
||||||
|
uint16_t gVoxResumeCountdown;
|
||||||
|
uint16_t gVoxPauseCountdown;
|
||||||
|
#endif
|
||||||
bool g_SquelchLost;
|
bool g_SquelchLost;
|
||||||
uint8_t gFlashLightState;
|
uint8_t gFlashLightState;
|
||||||
bool gVOX_NoiseDetected;
|
|
||||||
uint16_t gVoxResumeCountdown;
|
|
||||||
uint16_t gVoxPauseCountdown;
|
|
||||||
volatile uint16_t gFlashLightBlinkCounter;
|
volatile uint16_t gFlashLightBlinkCounter;
|
||||||
bool gFlagEndTransmission;
|
bool gFlagEndTransmission;
|
||||||
uint16_t gLowBatteryCountdown;
|
uint16_t gLowBatteryCountdown;
|
||||||
uint8_t gNextMrChannel;
|
uint8_t gNextMrChannel;
|
||||||
ReceptionMode_t gRxReceptionMode;
|
ReceptionMode_t gRxReceptionMode;
|
||||||
uint8_t gRestoreMrChannel;
|
|
||||||
uint8_t gCurrentScanList;
|
uint8_t gRestoreMrChannel;
|
||||||
uint8_t gPreviousMrChannel;
|
enum scan_next_chan_t gCurrentScanList;
|
||||||
uint32_t gRestoreFrequency;
|
uint32_t gRestoreFrequency;
|
||||||
uint8_t gRxVfoIsActive;
|
|
||||||
|
bool gRxVfoIsActive;
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
uint8_t gAlarmToneCounter;
|
uint8_t gAlarmToneCounter;
|
||||||
uint16_t gAlarmRunningCounter;
|
uint16_t gAlarmRunningCounter;
|
||||||
@@ -205,7 +225,6 @@ uint8_t gScanDelay_10ms;
|
|||||||
uint8_t gAircopySendCountdown;
|
uint8_t gAircopySendCountdown;
|
||||||
#endif
|
#endif
|
||||||
uint8_t gFSKWriteIndex;
|
uint8_t gFSKWriteIndex;
|
||||||
uint8_t gNeverUsed;
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
bool gIsNoaaMode;
|
bool gIsNoaaMode;
|
||||||
@@ -213,13 +232,17 @@ uint8_t gNeverUsed;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool gUpdateDisplay;
|
bool gUpdateDisplay;
|
||||||
bool gF_LOCK;
|
|
||||||
|
bool gF_LOCK = false;
|
||||||
|
|
||||||
uint8_t gShowChPrefix;
|
uint8_t gShowChPrefix;
|
||||||
|
|
||||||
volatile bool gNextTimeslice;
|
volatile bool gNextTimeslice;
|
||||||
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||||
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||||
volatile uint16_t gVoxStopCountdown_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
volatile uint16_t gVoxStopCountdown_10ms;
|
||||||
|
#endif
|
||||||
volatile bool gNextTimeslice40ms;
|
volatile bool gNextTimeslice40ms;
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
volatile uint16_t gNOAACountdown_10ms = 0;
|
volatile uint16_t gNOAACountdown_10ms = 0;
|
||||||
|
|||||||
63
misc.h
63
misc.h
@@ -63,7 +63,6 @@ enum AlarmState_t {
|
|||||||
ALARM_STATE_ALARM,
|
ALARM_STATE_ALARM,
|
||||||
ALARM_STATE_TX1750
|
ALARM_STATE_TX1750
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum AlarmState_t AlarmState_t;
|
typedef enum AlarmState_t AlarmState_t;
|
||||||
|
|
||||||
enum ReceptionMode_t {
|
enum ReceptionMode_t {
|
||||||
@@ -71,7 +70,6 @@ enum ReceptionMode_t {
|
|||||||
RX_MODE_DETECTED, // signal detected
|
RX_MODE_DETECTED, // signal detected
|
||||||
RX_MODE_LISTENING //
|
RX_MODE_LISTENING //
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum ReceptionMode_t ReceptionMode_t;
|
typedef enum ReceptionMode_t ReceptionMode_t;
|
||||||
|
|
||||||
enum CssScanMode_t
|
enum CssScanMode_t
|
||||||
@@ -80,9 +78,17 @@ enum CssScanMode_t
|
|||||||
CSS_SCAN_MODE_SCANNING,
|
CSS_SCAN_MODE_SCANNING,
|
||||||
CSS_SCAN_MODE_FOUND,
|
CSS_SCAN_MODE_FOUND,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum CssScanMode_t CssScanMode_t;
|
typedef enum CssScanMode_t CssScanMode_t;
|
||||||
|
|
||||||
|
enum scan_next_chan_t {
|
||||||
|
SCAN_NEXT_CHAN_SCANLIST1 = 0,
|
||||||
|
SCAN_NEXT_CHAN_SCANLIST2,
|
||||||
|
SCAN_NEXT_CHAN_DUAL_WATCH,
|
||||||
|
SCAN_NEXT_CHAN_MR,
|
||||||
|
SCAN_NEXT_NUM
|
||||||
|
};
|
||||||
|
typedef enum scan_next_chan_t scan_next_chan_t;
|
||||||
|
|
||||||
extern const uint8_t fm_resume_countdown_500ms;
|
extern const uint8_t fm_resume_countdown_500ms;
|
||||||
extern const uint8_t fm_radio_countdown_500ms;
|
extern const uint8_t fm_radio_countdown_500ms;
|
||||||
extern const uint16_t fm_play_countdown_scan_10ms;
|
extern const uint16_t fm_play_countdown_scan_10ms;
|
||||||
@@ -90,6 +96,7 @@ extern const uint16_t fm_play_countdown_noscan_10ms;
|
|||||||
extern const uint16_t fm_restore_countdown_10ms;
|
extern const uint16_t fm_restore_countdown_10ms;
|
||||||
|
|
||||||
extern const uint8_t menu_timeout_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_live_timeout_500ms;
|
||||||
extern const uint8_t DTMF_RX_timeout_500ms;
|
extern const uint8_t DTMF_RX_timeout_500ms;
|
||||||
@@ -109,7 +116,9 @@ extern const uint16_t battery_save_count_10ms;
|
|||||||
extern const uint16_t power_save1_10ms;
|
extern const uint16_t power_save1_10ms;
|
||||||
extern const uint16_t power_save2_10ms;
|
extern const uint16_t power_save2_10ms;
|
||||||
|
|
||||||
extern const uint16_t vox_stop_count_down_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
extern const uint16_t vox_stop_count_down_10ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const uint16_t NOAA_countdown_10ms;
|
extern const uint16_t NOAA_countdown_10ms;
|
||||||
extern const uint16_t NOAA_countdown_2_10ms;
|
extern const uint16_t NOAA_countdown_2_10ms;
|
||||||
@@ -121,12 +130,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_after_2_10ms;
|
||||||
extern const uint16_t dual_watch_count_toggle_10ms;
|
extern const uint16_t dual_watch_count_toggle_10ms;
|
||||||
extern const uint16_t dual_watch_count_noaa_10ms;
|
extern const uint16_t dual_watch_count_noaa_10ms;
|
||||||
extern const uint16_t dual_watch_count_after_vox_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
extern const uint16_t dual_watch_count_after_vox_10ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const uint16_t scan_pause_delay_in_1_10ms;
|
extern const uint16_t scan_pause_delay_in_1_10ms;
|
||||||
extern const uint16_t scan_pause_delay_in_2_10ms;
|
extern const uint16_t scan_pause_delay_in_2_10ms;
|
||||||
extern const uint16_t scan_pause_delay_in_3_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_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];
|
extern const uint8_t gMicGain_dB2[5];
|
||||||
|
|
||||||
@@ -139,6 +156,8 @@ extern bool gSetting_TX_EN;
|
|||||||
extern uint8_t gSetting_F_LOCK;
|
extern uint8_t gSetting_F_LOCK;
|
||||||
extern bool gSetting_ScrambleEnable;
|
extern bool gSetting_ScrambleEnable;
|
||||||
|
|
||||||
|
extern uint8_t gSetting_backlight_on_tx_rx;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
extern bool gSetting_AM_fix;
|
extern bool gSetting_AM_fix;
|
||||||
#endif
|
#endif
|
||||||
@@ -182,6 +201,8 @@ extern volatile uint16_t gDualWatchCountdown_10ms;
|
|||||||
extern volatile bool gDualWatchCountdownExpired;
|
extern volatile bool gDualWatchCountdownExpired;
|
||||||
extern bool gDualWatchActive;
|
extern bool gDualWatchActive;
|
||||||
|
|
||||||
|
extern volatile uint8_t gSerialConfigCountDown_500ms;
|
||||||
|
|
||||||
extern volatile bool gNextTimeslice_500ms;
|
extern volatile bool gNextTimeslice_500ms;
|
||||||
|
|
||||||
extern volatile uint16_t gTxTimerCountdown_500ms;
|
extern volatile uint16_t gTxTimerCountdown_500ms;
|
||||||
@@ -213,7 +234,7 @@ extern uint8_t gBatteryVoltageIndex;
|
|||||||
extern CssScanMode_t gCssScanMode;
|
extern CssScanMode_t gCssScanMode;
|
||||||
extern bool gUpdateRSSI;
|
extern bool gUpdateRSSI;
|
||||||
extern AlarmState_t gAlarmState;
|
extern AlarmState_t gAlarmState;
|
||||||
extern uint8_t gVoltageMenuCountdown;
|
extern uint16_t gMenuCountdown;
|
||||||
extern bool gPttWasReleased;
|
extern bool gPttWasReleased;
|
||||||
extern bool gPttWasPressed;
|
extern bool gPttWasPressed;
|
||||||
extern bool gFlagReconfigureVfos;
|
extern bool gFlagReconfigureVfos;
|
||||||
@@ -227,8 +248,10 @@ extern bool gRequestSaveSettings;
|
|||||||
#endif
|
#endif
|
||||||
extern uint8_t gKeypadLocked;
|
extern uint8_t gKeypadLocked;
|
||||||
extern bool gFlagPrepareTX;
|
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 gFlagSaveVfo;
|
||||||
extern bool gFlagSaveSettings;
|
extern bool gFlagSaveSettings;
|
||||||
extern bool gFlagSaveChannel;
|
extern bool gFlagSaveChannel;
|
||||||
@@ -239,22 +262,25 @@ extern bool g_CDCSS_Lost;
|
|||||||
extern uint8_t gCDCSSCodeType;
|
extern uint8_t gCDCSSCodeType;
|
||||||
extern bool g_CTCSS_Lost;
|
extern bool g_CTCSS_Lost;
|
||||||
extern bool g_CxCSS_TAIL_Found;
|
extern bool g_CxCSS_TAIL_Found;
|
||||||
extern bool g_VOX_Lost;
|
#ifdef ENABLE_VOX
|
||||||
|
extern bool g_VOX_Lost;
|
||||||
|
extern bool gVOX_NoiseDetected;
|
||||||
|
extern uint16_t gVoxResumeCountdown;
|
||||||
|
extern uint16_t gVoxPauseCountdown;
|
||||||
|
#endif
|
||||||
extern bool g_SquelchLost;
|
extern bool g_SquelchLost;
|
||||||
extern uint8_t gFlashLightState;
|
extern uint8_t gFlashLightState;
|
||||||
extern bool gVOX_NoiseDetected;
|
|
||||||
extern uint16_t gVoxResumeCountdown;
|
|
||||||
extern uint16_t gVoxPauseCountdown;
|
|
||||||
extern volatile uint16_t gFlashLightBlinkCounter;
|
extern volatile uint16_t gFlashLightBlinkCounter;
|
||||||
extern bool gFlagEndTransmission;
|
extern bool gFlagEndTransmission;
|
||||||
extern uint16_t gLowBatteryCountdown;
|
extern uint16_t gLowBatteryCountdown;
|
||||||
extern uint8_t gNextMrChannel;
|
extern uint8_t gNextMrChannel;
|
||||||
extern ReceptionMode_t gRxReceptionMode;
|
extern ReceptionMode_t gRxReceptionMode;
|
||||||
|
|
||||||
extern uint8_t gRestoreMrChannel;
|
extern uint8_t gRestoreMrChannel;
|
||||||
extern uint8_t gCurrentScanList;
|
extern scan_next_chan_t gCurrentScanList;
|
||||||
extern uint8_t gPreviousMrChannel;
|
|
||||||
extern uint32_t gRestoreFrequency;
|
extern uint32_t gRestoreFrequency;
|
||||||
extern uint8_t gRxVfoIsActive;
|
|
||||||
|
extern bool gRxVfoIsActive;
|
||||||
extern uint8_t gAlarmToneCounter;
|
extern uint8_t gAlarmToneCounter;
|
||||||
extern uint16_t gAlarmRunningCounter;
|
extern uint16_t gAlarmRunningCounter;
|
||||||
extern bool gKeyBeingHeld;
|
extern bool gKeyBeingHeld;
|
||||||
@@ -267,21 +293,22 @@ extern uint8_t gScanDelay_10ms;
|
|||||||
extern uint8_t gAircopySendCountdown;
|
extern uint8_t gAircopySendCountdown;
|
||||||
#endif
|
#endif
|
||||||
extern uint8_t gFSKWriteIndex;
|
extern uint8_t gFSKWriteIndex;
|
||||||
extern uint8_t gNeverUsed;
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
extern bool gIsNoaaMode;
|
extern bool gIsNoaaMode;
|
||||||
extern uint8_t gNoaaChannel;
|
extern uint8_t gNoaaChannel;
|
||||||
#endif
|
#endif
|
||||||
extern volatile bool gNextTimeslice;
|
extern volatile bool gNextTimeslice;
|
||||||
extern bool gUpdateDisplay;
|
extern bool gUpdateDisplay;
|
||||||
|
extern bool gF_LOCK;
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
extern uint8_t gFM_ChannelPosition;
|
extern uint8_t gFM_ChannelPosition;
|
||||||
#endif
|
#endif
|
||||||
extern bool gF_LOCK;
|
|
||||||
extern uint8_t gShowChPrefix;
|
extern uint8_t gShowChPrefix;
|
||||||
extern volatile uint8_t gFoundCDCSSCountdown_10ms;
|
extern volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||||
extern volatile uint8_t gFoundCTCSSCountdown_10ms;
|
extern volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||||
extern volatile uint16_t gVoxStopCountdown_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
extern volatile uint16_t gVoxStopCountdown_10ms;
|
||||||
|
#endif
|
||||||
extern volatile bool gNextTimeslice40ms;
|
extern volatile bool gNextTimeslice40ms;
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
extern volatile uint16_t gNOAACountdown_10ms;
|
extern volatile uint16_t gNOAACountdown_10ms;
|
||||||
|
|||||||
201
radio.c
201
radio.c
@@ -114,26 +114,23 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
|
|||||||
return 0xFF;
|
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));
|
memset(pInfo, 0, sizeof(*pInfo));
|
||||||
|
|
||||||
pInfo->Band = Band;
|
pInfo->Band = FREQUENCY_GetBand(Frequency);
|
||||||
pInfo->SCANLIST1_PARTICIPATION = true;
|
pInfo->SCANLIST1_PARTICIPATION = true;
|
||||||
pInfo->SCANLIST2_PARTICIPATION = true;
|
pInfo->SCANLIST2_PARTICIPATION = true;
|
||||||
pInfo->STEP_SETTING = STEP_12_5kHz;
|
pInfo->STEP_SETTING = STEP_12_5kHz;
|
||||||
pInfo->StepFrequency = 2500;
|
pInfo->StepFrequency = StepFrequencyTable[pInfo->STEP_SETTING];
|
||||||
pInfo->CHANNEL_SAVE = ChannelSave;
|
pInfo->CHANNEL_SAVE = ChannelSave;
|
||||||
pInfo->FrequencyReverse = false;
|
pInfo->FrequencyReverse = false;
|
||||||
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||||
pInfo->freq_config_RX.Frequency = Frequency;
|
pInfo->freq_config_RX.Frequency = Frequency;
|
||||||
pInfo->freq_config_TX.Frequency = Frequency;
|
pInfo->freq_config_TX.Frequency = Frequency;
|
||||||
pInfo->pRX = &pInfo->freq_config_RX;
|
pInfo->pRX = &pInfo->freq_config_RX;
|
||||||
pInfo->pTX = &pInfo->freq_config_TX;
|
pInfo->pTX = &pInfo->freq_config_TX;
|
||||||
pInfo->TX_OFFSET_FREQUENCY = 1000000;
|
pInfo->Compander = 0; // off
|
||||||
#ifdef ENABLE_COMPANDER
|
|
||||||
pInfo->Compander = 0; // off
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
||||||
pInfo->AM_mode = 1;
|
pInfo->AM_mode = 1;
|
||||||
@@ -167,7 +164,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (Channel >= NOAA_CHANNEL_FIRST)
|
if (Channel >= NOAA_CHANNEL_FIRST)
|
||||||
{
|
{
|
||||||
RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], 2, NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]);
|
RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]);
|
||||||
|
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||||
return;
|
return;
|
||||||
@@ -211,7 +208,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
|
|
||||||
Index = Channel - FREQ_CHANNEL_FIRST;
|
Index = Channel - FREQ_CHANNEL_FIRST;
|
||||||
|
|
||||||
RADIO_InitInfo(pRadio, Channel, Index, LowerLimitFrequencyBandTable[Index]);
|
RADIO_InitInfo(pRadio, Channel, frequencyBandTable[Index].lower);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +216,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
if (Band > BAND7_470MHz)
|
if (Band > BAND7_470MHz)
|
||||||
{
|
{
|
||||||
Band = BAND6_400MHz;
|
Band = BAND6_400MHz;
|
||||||
// Band = FREQUENCY_GetBand(gEeprom.ScreenChannel[VFO]); // 1of11 bug fix, or have I broke it ?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
@@ -345,7 +341,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ***************
|
// ***************
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
@@ -370,14 +366,14 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
Band = FREQUENCY_GetBand(Frequency);
|
Band = FREQUENCY_GetBand(Frequency);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Frequency < LowerLimitFrequencyBandTable[Band])
|
if (Frequency < frequencyBandTable[Band].lower)
|
||||||
Frequency = LowerLimitFrequencyBandTable[Band];
|
Frequency = frequencyBandTable[Band].lower;
|
||||||
else
|
else
|
||||||
if (Frequency > UpperLimitFrequencyBandTable[Band])
|
if (Frequency > frequencyBandTable[Band].upper)
|
||||||
Frequency = UpperLimitFrequencyBandTable[Band];
|
Frequency = frequencyBandTable[Band].upper;
|
||||||
else
|
else
|
||||||
if (Channel >= FREQ_CHANNEL_FIRST)
|
if (Channel >= FREQ_CHANNEL_FIRST)
|
||||||
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, LowerLimitFrequencyBandTable[Band]);
|
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, frequencyBandTable[Band].lower);
|
||||||
|
|
||||||
pRadio->freq_config_RX.Frequency = Frequency;
|
pRadio->freq_config_RX.Frequency = Frequency;
|
||||||
|
|
||||||
@@ -422,9 +418,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF;
|
gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
||||||
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
||||||
}
|
}
|
||||||
@@ -458,16 +452,20 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
|||||||
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
|
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
|
||||||
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
|
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
|
||||||
|
|
||||||
#if ENABLE_SQUELCH_LOWER
|
#if ENABLE_SQUELCH_MORE_SENSITIVE
|
||||||
// make 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->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9;
|
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9;
|
||||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 7) / 8;
|
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9;
|
||||||
|
|
||||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 8) / 7;
|
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
||||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
||||||
|
|
||||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 8) / 7;
|
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
||||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -486,9 +484,9 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
|||||||
Txp[0],
|
Txp[0],
|
||||||
Txp[1],
|
Txp[1],
|
||||||
Txp[2],
|
Txp[2],
|
||||||
LowerLimitFrequencyBandTable[Band],
|
frequencyBandTable[Band].lower,
|
||||||
MiddleFrequencyBandTable[Band],
|
(frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2,
|
||||||
UpperLimitFrequencyBandTable[Band],
|
frequencyBandTable[Band].upper,
|
||||||
pInfo->pTX->Frequency);
|
pInfo->pTX->Frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,27 +506,18 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
if (Frequency < frequencyBandTable[0].lower)
|
||||||
// limit to 50MHz to 600MHz
|
Frequency = frequencyBandTable[0].lower;
|
||||||
if (Frequency < 5000000)
|
else
|
||||||
Frequency = 5000000;
|
if (Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||||
else
|
Frequency = frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper;
|
||||||
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
|
|
||||||
|
|
||||||
pInfo->freq_config_TX.Frequency = Frequency;
|
pInfo->freq_config_TX.Frequency = Frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RADIO_SelectCurrentVfo(void)
|
static void RADIO_SelectCurrentVfo(void)
|
||||||
{
|
{
|
||||||
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gRxVfo : &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gRxVfo : &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIO_SelectVfos(void)
|
void RADIO_SelectVfos(void)
|
||||||
@@ -558,7 +547,7 @@ void RADIO_SelectVfos(void)
|
|||||||
|
|
||||||
void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||||
{
|
{
|
||||||
BK4819_FilterBandwidth_t Bandwidth;
|
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||||
uint16_t InterruptMask;
|
uint16_t InterruptMask;
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
@@ -568,7 +557,6 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
||||||
|
|
||||||
Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
|
||||||
switch (Bandwidth)
|
switch (Bandwidth)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
@@ -577,7 +565,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
case BK4819_FILTER_BW_NARROW:
|
case BK4819_FILTER_BW_NARROW:
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
|
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||||
#else
|
#else
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||||
#endif
|
#endif
|
||||||
@@ -621,6 +609,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
|
|
||||||
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
|
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
|
||||||
|
|
||||||
|
// what does this in do ?
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
|
||||||
|
|
||||||
// AF RX Gain and DAC
|
// AF RX Gain and DAC
|
||||||
@@ -633,7 +622,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (gRxVfo->AM_mode == 0)
|
if (gRxVfo->AM_mode == 0)
|
||||||
{
|
{ // FM
|
||||||
uint8_t CodeType = gSelectedCodeType;
|
uint8_t CodeType = gSelectedCodeType;
|
||||||
uint8_t Code = gSelectedCode;
|
uint8_t Code = gSelectedCode;
|
||||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
@@ -705,30 +694,30 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_VOX
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_NOAA
|
||||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
#ifdef ENABLE_FMRADIO
|
||||||
|
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||||
|
#else
|
||||||
|
if (gEeprom.VOX_SWITCH && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
if (gEeprom.VOX_SWITCH && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
#ifdef ENABLE_FMRADIO
|
||||||
#endif
|
if (gEeprom.VOX_SWITCH && !gFmRadioMode && gCurrentVfo->AM_mode == 0)
|
||||||
#else
|
#else
|
||||||
#ifdef ENABLE_FMRADIO
|
if (gEeprom.VOX_SWITCH && gCurrentVfo->AM_mode == 0)
|
||||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && gCurrentVfo->AM_mode == 0)
|
#endif
|
||||||
#else
|
|
||||||
if (gEeprom.VOX_SWITCH && gCurrentVfo->AM_mode == 0)
|
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||||
|
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
|
||||||
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
BK4819_DisableVox();
|
BK4819_DisableVox();
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
// RX expander
|
||||||
// RX expander
|
BK4819_SetCompander((gRxVfo->AM_mode == 0 && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
|
||||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||||
@@ -743,6 +732,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
#else
|
#else
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
{
|
{
|
||||||
|
BK4819_DisableDTMF();
|
||||||
BK4819_EnableDTMF();
|
BK4819_EnableDTMF();
|
||||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||||
}
|
}
|
||||||
@@ -808,7 +798,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
|
|
||||||
void RADIO_SetTxParameters(void)
|
void RADIO_SetTxParameters(void)
|
||||||
{
|
{
|
||||||
BK4819_FilterBandwidth_t Bandwidth;
|
BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
@@ -816,7 +806,6 @@ void RADIO_SetTxParameters(void)
|
|||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||||
|
|
||||||
Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
|
||||||
switch (Bandwidth)
|
switch (Bandwidth)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
@@ -825,7 +814,7 @@ void RADIO_SetTxParameters(void)
|
|||||||
case BK4819_FILTER_BW_NARROW:
|
case BK4819_FILTER_BW_NARROW:
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
|
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||||
#else
|
#else
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||||
#endif
|
#endif
|
||||||
@@ -834,10 +823,8 @@ void RADIO_SetTxParameters(void)
|
|||||||
|
|
||||||
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
// TX compressor
|
||||||
// TX compressor
|
BK4819_SetCompander((gRxVfo->AM_mode == 0 && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
||||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BK4819_PrepareTransmit();
|
BK4819_PrepareTransmit();
|
||||||
|
|
||||||
@@ -866,9 +853,7 @@ void RADIO_SetTxParameters(void)
|
|||||||
|
|
||||||
case CODE_TYPE_DIGITAL:
|
case CODE_TYPE_DIGITAL:
|
||||||
case CODE_TYPE_REVERSE_DIGITAL:
|
case CODE_TYPE_REVERSE_DIGITAL:
|
||||||
BK4819_SetCDCSSCodeWord(
|
BK4819_SetCDCSSCodeWord(DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code));
|
||||||
DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -893,8 +878,9 @@ void RADIO_SetVfoState(VfoState_t State)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const uint8_t Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
unsigned int chan = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) ? (gEeprom.RX_CHANNEL + 1) & 1 : gEeprom.RX_CHANNEL; // 1of11
|
||||||
VfoState[Channel] = State;
|
chan = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_CHANNEL : chan;
|
||||||
|
VfoState[chan] = State;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -916,7 +902,7 @@ void RADIO_PrepareTX(void)
|
|||||||
gScheduleDualWatch = false;
|
gScheduleDualWatch = false;
|
||||||
|
|
||||||
if (!gRxVfoIsActive)
|
if (!gRxVfoIsActive)
|
||||||
{
|
{ // use the TX vfo
|
||||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
||||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||||
gRxVfoIsActive = true;
|
gRxVfoIsActive = true;
|
||||||
@@ -929,10 +915,16 @@ void RADIO_PrepareTX(void)
|
|||||||
|
|
||||||
RADIO_SelectCurrentVfo();
|
RADIO_SelectCurrentVfo();
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750)
|
||||||
if (gAlarmState == ALARM_STATE_OFF ||
|
if (gAlarmState == ALARM_STATE_OFF ||
|
||||||
gAlarmState == ALARM_STATE_TX1750 ||
|
gAlarmState == ALARM_STATE_TX1750 ||
|
||||||
(gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE))
|
(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
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_TX_WHEN_AM
|
#ifndef ENABLE_TX_WHEN_AM
|
||||||
@@ -942,13 +934,13 @@ void RADIO_PrepareTX(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (!gSetting_TX_EN)
|
if (!gSetting_TX_EN || gSerialConfigCountDown_500ms > 0)
|
||||||
{ // TX is disabled
|
{ // TX is disabled or config upload/download in progress
|
||||||
State = VFO_STATE_TX_DISABLE;
|
State = VFO_STATE_TX_DISABLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
//if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST)
|
//if (TX_freq_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
|
{ // TX frequency is allowed
|
||||||
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
|
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
|
||||||
State = VFO_STATE_BUSY; // busy RX'ing a station
|
State = VFO_STATE_BUSY; // busy RX'ing a station
|
||||||
@@ -956,8 +948,7 @@ void RADIO_PrepareTX(void)
|
|||||||
if (gBatteryDisplayLevel == 0)
|
if (gBatteryDisplayLevel == 0)
|
||||||
State = VFO_STATE_BAT_LOW; // charge your battery !
|
State = VFO_STATE_BAT_LOW; // charge your battery !
|
||||||
else
|
else
|
||||||
//if (gBatteryDisplayLevel >= 6)
|
if (gBatteryDisplayLevel >= 6)
|
||||||
if (gBatteryDisplayLevel >= 11) // I've increased the battery level bar resolution
|
|
||||||
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
|
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -967,7 +958,7 @@ void RADIO_PrepareTX(void)
|
|||||||
if (State != VFO_STATE_NORMAL)
|
if (State != VFO_STATE_NORMAL)
|
||||||
{ // TX not allowed
|
{ // TX not allowed
|
||||||
RADIO_SetVfoState(State);
|
RADIO_SetVfoState(State);
|
||||||
#ifdef ENABLE_ALARM
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
gAlarmState = ALARM_STATE_OFF;
|
gAlarmState = ALARM_STATE_OFF;
|
||||||
#endif
|
#endif
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||||
@@ -976,7 +967,7 @@ void RADIO_PrepareTX(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TX is allowed
|
// TX is allowed
|
||||||
|
|
||||||
if (gDTMF_ReplyState == DTMF_REPLY_ANI)
|
if (gDTMF_ReplyState == DTMF_REPLY_ANI)
|
||||||
{
|
{
|
||||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||||
@@ -995,15 +986,18 @@ void RADIO_PrepareTX(void)
|
|||||||
FUNCTION_Select(FUNCTION_TRANSMIT);
|
FUNCTION_Select(FUNCTION_TRANSMIT);
|
||||||
|
|
||||||
gTxTimerCountdown_500ms = 0; // no timeout
|
gTxTimerCountdown_500ms = 0; // no timeout
|
||||||
#ifdef ENABLE_ALARM
|
|
||||||
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
if (gAlarmState == ALARM_STATE_OFF)
|
if (gAlarmState == ALARM_STATE_OFF)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (gEeprom.TX_TIMEOUT_TIMER == 1)
|
if (gEeprom.TX_TIMEOUT_TIMER == 0)
|
||||||
gTxTimerCountdown_500ms = 60; // 30 sec
|
gTxTimerCountdown_500ms = 60; // 30 sec
|
||||||
else
|
else
|
||||||
if (gEeprom.TX_TIMEOUT_TIMER >= 2)
|
if (gEeprom.TX_TIMEOUT_TIMER < (ARRAY_SIZE(gSubMenu_TOT) - 1))
|
||||||
gTxTimerCountdown_500ms = (gEeprom.TX_TIMEOUT_TIMER - 1) * 120; // minutes
|
gTxTimerCountdown_500ms = 120 * gEeprom.TX_TIMEOUT_TIMER; // minutes
|
||||||
|
else
|
||||||
|
gTxTimerCountdown_500ms = 120 * 15; // 15 minutes
|
||||||
}
|
}
|
||||||
gTxTimeoutReached = false;
|
gTxTimeoutReached = false;
|
||||||
|
|
||||||
@@ -1051,8 +1045,9 @@ void RADIO_SendEndOfTransmission(void)
|
|||||||
if (gEeprom.ROGER == ROGER_MODE_MDC)
|
if (gEeprom.ROGER == ROGER_MODE_MDC)
|
||||||
BK4819_PlayRogerMDC();
|
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 (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)
|
if (gEeprom.DTMF_SIDE_TONE)
|
||||||
{
|
{
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|||||||
47
radio.h
47
radio.h
@@ -21,12 +21,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "dcs.h"
|
#include "dcs.h"
|
||||||
|
#include "frequencies.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MR_CH_BAND_MASK = 0x0F << 0,
|
MR_CH_BAND_MASK = 0x0F << 0,
|
||||||
#ifdef ENABLE_COMPANDER
|
MR_CH_COMPAND = 3u << 4, // new
|
||||||
MR_CH_COMPAND = 3u << 4, // new
|
|
||||||
#endif
|
|
||||||
MR_CH_SCANLIST2 = 1u << 6,
|
MR_CH_SCANLIST2 = 1u << 6,
|
||||||
MR_CH_SCANLIST1 = 1u << 7
|
MR_CH_SCANLIST1 = 1u << 7
|
||||||
};
|
};
|
||||||
@@ -42,40 +41,13 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum PTT_ID_t {
|
enum PTT_ID_t {
|
||||||
PTT_ID_OFF = 0,
|
PTT_ID_OFF = 0, // OFF
|
||||||
PTT_ID_BOT,
|
PTT_ID_TX_UP, // BEGIN OF TX
|
||||||
PTT_ID_EOT,
|
PTT_ID_TX_DOWN, // END OF TX
|
||||||
PTT_ID_BOTH
|
PTT_ID_BOTH // BOTH
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum PTT_ID_t PTT_ID_t;
|
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
|
enum VfoState_t
|
||||||
{
|
{
|
||||||
VFO_STATE_NORMAL = 0,
|
VFO_STATE_NORMAL = 0,
|
||||||
@@ -86,7 +58,6 @@ enum VfoState_t
|
|||||||
VFO_STATE_ALARM,
|
VFO_STATE_ALARM,
|
||||||
VFO_STATE_VOLTAGE_HIGH
|
VFO_STATE_VOLTAGE_HIGH
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum VfoState_t VfoState_t;
|
typedef enum VfoState_t VfoState_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -138,9 +109,7 @@ typedef struct VFO_Info_t
|
|||||||
|
|
||||||
uint8_t AM_mode;
|
uint8_t AM_mode;
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
uint8_t Compander;
|
||||||
uint8_t Compander;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char Name[16];
|
char Name[16];
|
||||||
} VFO_Info_t;
|
} VFO_Info_t;
|
||||||
@@ -159,7 +128,7 @@ extern VfoState_t VfoState[2];
|
|||||||
|
|
||||||
bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum);
|
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);
|
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_ConfigureChannel(const unsigned int VFO, const unsigned int configure);
|
||||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
||||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ void SystickHandler(void)
|
|||||||
gNextTimeslice_500ms = true;
|
gNextTimeslice_500ms = true;
|
||||||
|
|
||||||
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
||||||
|
DECREMENT(gSerialConfigCountDown_500ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gGlobalSysTickCounter & 3) == 0)
|
if ((gGlobalSysTickCounter & 3) == 0)
|
||||||
@@ -103,7 +104,9 @@ void SystickHandler(void)
|
|||||||
DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM);
|
DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECREMENT(gVoxStopCountdown_10ms);
|
#ifdef ENABLE_VOX
|
||||||
|
DECREMENT(gVoxStopCountdown_10ms);
|
||||||
|
#endif
|
||||||
|
|
||||||
DECREMENT(boot_counter_10ms);
|
DECREMENT(boot_counter_10ms);
|
||||||
}
|
}
|
||||||
|
|||||||
30
settings.c
30
settings.c
@@ -86,8 +86,13 @@ void SETTINGS_SaveSettings(void)
|
|||||||
State[3] = false;
|
State[3] = false;
|
||||||
#endif
|
#endif
|
||||||
State[4] = gEeprom.KEY_LOCK;
|
State[4] = gEeprom.KEY_LOCK;
|
||||||
State[5] = gEeprom.VOX_SWITCH;
|
#ifdef ENABLE_VOX
|
||||||
State[6] = gEeprom.VOX_LEVEL;
|
State[5] = gEeprom.VOX_SWITCH;
|
||||||
|
State[6] = gEeprom.VOX_LEVEL;
|
||||||
|
#else
|
||||||
|
State[5] = false;
|
||||||
|
State[6] = 0;
|
||||||
|
#endif
|
||||||
State[7] = gEeprom.MIC_SENSITIVITY;
|
State[7] = gEeprom.MIC_SENSITIVITY;
|
||||||
EEPROM_WriteBuffer(0x0E70, State);
|
EEPROM_WriteBuffer(0x0E70, State);
|
||||||
|
|
||||||
@@ -121,7 +126,7 @@ void SETTINGS_SaveSettings(void)
|
|||||||
EEPROM_WriteBuffer(0x0EA0, State);
|
EEPROM_WriteBuffer(0x0EA0, State);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
State[0] = gEeprom.ALARM_MODE;
|
State[0] = gEeprom.ALARM_MODE;
|
||||||
#else
|
#else
|
||||||
State[0] = false;
|
State[0] = false;
|
||||||
@@ -135,7 +140,7 @@ void SETTINGS_SaveSettings(void)
|
|||||||
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
||||||
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
||||||
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
|
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
|
||||||
State[4] = gEeprom.DTMF_AUTO_RESET_TIME;
|
State[4] = gEeprom.DTMF_auto_reset_time;
|
||||||
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
||||||
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
||||||
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
||||||
@@ -174,6 +179,8 @@ void SETTINGS_SaveSettings(void)
|
|||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
|
if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
|
||||||
#endif
|
#endif
|
||||||
|
State[7] = (State[7] & ~(3u << 6)) | ((gSetting_backlight_on_tx_rx & 3u) << 6);
|
||||||
|
|
||||||
EEPROM_WriteBuffer(0x0F40, State);
|
EEPROM_WriteBuffer(0x0F40, State);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +230,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
{
|
{
|
||||||
#ifndef KEEP_MEM_NAME
|
#ifndef ENABLE_KEEP_MEM_NAME
|
||||||
// clear/reset the channel name
|
// clear/reset the channel name
|
||||||
//memset(&State, 0xFF, sizeof(State));
|
//memset(&State, 0xFF, sizeof(State));
|
||||||
memset(&State, 0x00, sizeof(State)); // follow the QS way
|
memset(&State, 0x00, sizeof(State)); // follow the QS way
|
||||||
@@ -253,20 +260,15 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
|||||||
{
|
{
|
||||||
uint8_t State[8];
|
uint8_t State[8];
|
||||||
uint8_t Attributes = 0xFF; // default attributes
|
uint8_t Attributes = 0xFF; // default attributes
|
||||||
#ifdef ENABLE_COMPANDER
|
|
||||||
Attributes &= ~MR_CH_COMPAND; // default to '0' = compander disabled
|
|
||||||
#endif
|
|
||||||
uint16_t Offset = 0x0D60 + (Channel & ~7u);
|
uint16_t Offset = 0x0D60 + (Channel & ~7u);
|
||||||
|
|
||||||
|
Attributes &= ~MR_CH_COMPAND; // default to '0' = compander disabled
|
||||||
|
|
||||||
EEPROM_ReadBuffer(Offset, State, sizeof(State));
|
EEPROM_ReadBuffer(Offset, State, sizeof(State));
|
||||||
|
|
||||||
if (keep)
|
if (keep)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_COMPANDER
|
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Compander << 4) | (pVFO->Band << 0);
|
||||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Compander << 4) | (pVFO->Band << 0);
|
|
||||||
#else
|
|
||||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Band << 0);
|
|
||||||
#endif
|
|
||||||
if (State[Channel & 7u] == Attributes)
|
if (State[Channel & 7u] == Attributes)
|
||||||
return; // no change in the attributes
|
return; // no change in the attributes
|
||||||
}
|
}
|
||||||
@@ -277,7 +279,7 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
|||||||
|
|
||||||
gMR_ChannelAttributes[Channel] = Attributes;
|
gMR_ChannelAttributes[Channel] = Attributes;
|
||||||
|
|
||||||
// #ifndef KEEP_MEM_NAME
|
// #ifndef ENABLE_KEEP_MEM_NAME
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
{
|
{
|
||||||
const uint16_t OffsetMR = Channel * 16;
|
const uint16_t OffsetMR = Channel * 16;
|
||||||
|
|||||||
43
settings.h
43
settings.h
@@ -20,6 +20,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "frequencies.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
|
|
||||||
enum POWER_OnDisplayMode_t {
|
enum POWER_OnDisplayMode_t {
|
||||||
@@ -28,7 +29,6 @@ enum POWER_OnDisplayMode_t {
|
|||||||
POWER_ON_DISPLAY_MODE_VOLTAGE,
|
POWER_ON_DISPLAY_MODE_VOLTAGE,
|
||||||
POWER_ON_DISPLAY_MODE_NONE
|
POWER_ON_DISPLAY_MODE_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
|
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -90,7 +90,6 @@ enum {
|
|||||||
VOICE_PROMPT_CHINESE,
|
VOICE_PROMPT_CHINESE,
|
||||||
VOICE_PROMPT_ENGLISH
|
VOICE_PROMPT_ENGLISH
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum VOICE_Prompt_t VOICE_Prompt_t;
|
typedef enum VOICE_Prompt_t VOICE_Prompt_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -98,7 +97,6 @@ enum ALARM_Mode_t {
|
|||||||
ALARM_MODE_SITE = 0,
|
ALARM_MODE_SITE = 0,
|
||||||
ALARM_MODE_TONE
|
ALARM_MODE_TONE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum ALARM_Mode_t ALARM_Mode_t;
|
typedef enum ALARM_Mode_t ALARM_Mode_t;
|
||||||
|
|
||||||
enum ROGER_Mode_t {
|
enum ROGER_Mode_t {
|
||||||
@@ -106,7 +104,6 @@ enum ROGER_Mode_t {
|
|||||||
ROGER_MODE_ROGER,
|
ROGER_MODE_ROGER,
|
||||||
ROGER_MODE_MDC
|
ROGER_MODE_MDC
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum ROGER_Mode_t ROGER_Mode_t;
|
typedef enum ROGER_Mode_t ROGER_Mode_t;
|
||||||
|
|
||||||
enum CHANNEL_DisplayMode_t {
|
enum CHANNEL_DisplayMode_t {
|
||||||
@@ -115,7 +112,6 @@ enum CHANNEL_DisplayMode_t {
|
|||||||
MDF_NAME,
|
MDF_NAME,
|
||||||
MDF_NAME_FREQ
|
MDF_NAME_FREQ
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
|
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -131,7 +127,15 @@ typedef struct {
|
|||||||
uint8_t field7_0xa;
|
uint8_t field7_0xa;
|
||||||
uint8_t field8_0xb;
|
uint8_t field8_0xb;
|
||||||
|
|
||||||
uint32_t POWER_ON_PASSWORD;
|
#ifdef ENABLE_FMRADIO
|
||||||
|
uint16_t FM_SelectedFrequency;
|
||||||
|
uint8_t FM_SelectedChannel;
|
||||||
|
bool FM_IsMrMode;
|
||||||
|
uint16_t FM_FrequencyPlaying;
|
||||||
|
uint16_t FM_LowerLimit;
|
||||||
|
uint16_t FM_UpperLimit;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t SQUELCH_LEVEL;
|
uint8_t SQUELCH_LEVEL;
|
||||||
uint8_t TX_TIMEOUT_TIMER;
|
uint8_t TX_TIMEOUT_TIMER;
|
||||||
bool KEY_LOCK;
|
bool KEY_LOCK;
|
||||||
@@ -156,27 +160,12 @@ typedef struct {
|
|||||||
|
|
||||||
uint8_t field29_0x26;
|
uint8_t field29_0x26;
|
||||||
uint8_t field30_0x27;
|
uint8_t field30_0x27;
|
||||||
|
|
||||||
uint16_t VOX1_THRESHOLD;
|
|
||||||
uint16_t VOX0_THRESHOLD;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
uint16_t FM_SelectedFrequency;
|
|
||||||
uint8_t FM_SelectedChannel;
|
|
||||||
bool FM_IsMrMode;
|
|
||||||
uint16_t FM_FrequencyPlaying;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t field37_0x32;
|
uint8_t field37_0x32;
|
||||||
uint8_t field38_0x33;
|
uint8_t field38_0x33;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
uint16_t FM_LowerLimit;
|
|
||||||
uint16_t FM_UpperLimit;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool AUTO_KEYPAD_LOCK;
|
bool AUTO_KEYPAD_LOCK;
|
||||||
#ifdef ENABLE_ALARM
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
ALARM_Mode_t ALARM_MODE;
|
ALARM_Mode_t ALARM_MODE;
|
||||||
#endif
|
#endif
|
||||||
POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE;
|
POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE;
|
||||||
@@ -205,7 +194,7 @@ typedef struct {
|
|||||||
char DTMF_SEPARATE_CODE;
|
char DTMF_SEPARATE_CODE;
|
||||||
char DTMF_GROUP_CALL_CODE;
|
char DTMF_GROUP_CALL_CODE;
|
||||||
uint8_t DTMF_DECODE_RESPONSE;
|
uint8_t DTMF_DECODE_RESPONSE;
|
||||||
uint8_t DTMF_AUTO_RESET_TIME;
|
uint8_t DTMF_auto_reset_time;
|
||||||
uint16_t DTMF_PRELOAD_TIME;
|
uint16_t DTMF_PRELOAD_TIME;
|
||||||
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
||||||
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
||||||
@@ -220,13 +209,17 @@ typedef struct {
|
|||||||
uint8_t VOLUME_GAIN;
|
uint8_t VOLUME_GAIN;
|
||||||
uint8_t DAC_GAIN;
|
uint8_t DAC_GAIN;
|
||||||
|
|
||||||
|
VFO_Info_t VfoInfo[2];
|
||||||
|
uint32_t POWER_ON_PASSWORD;
|
||||||
|
uint16_t VOX1_THRESHOLD;
|
||||||
|
uint16_t VOX0_THRESHOLD;
|
||||||
|
|
||||||
uint8_t field77_0x95;
|
uint8_t field77_0x95;
|
||||||
uint8_t field78_0x96;
|
uint8_t field78_0x96;
|
||||||
uint8_t field79_0x97;
|
uint8_t field79_0x97;
|
||||||
|
|
||||||
VFO_Info_t VfoInfo[2];
|
uint8_t _pad[1];
|
||||||
} EEPROM_Config_t;
|
} EEPROM_Config_t;
|
||||||
|
|
||||||
extern EEPROM_Config_t gEeprom;
|
extern EEPROM_Config_t gEeprom;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
|
|||||||
366
ui/main.c
366
ui/main.c
@@ -36,10 +36,26 @@
|
|||||||
#include "ui/main.h"
|
#include "ui/main.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
bool center_line_is_free = true;
|
center_line_t center_line = CENTER_LINE_NONE;
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
|
void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||||
|
{
|
||||||
|
switch (level)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case 7: memmove(p + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||||
|
case 6: memmove(p + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||||
|
case 5: memmove(p + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||||
|
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||||
|
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||||
|
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||||
|
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||||
|
case 0: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
|
|
||||||
unsigned int sqrt16(unsigned int value)
|
unsigned int sqrt16(unsigned int value)
|
||||||
@@ -69,11 +85,21 @@ bool center_line_is_free = true;
|
|||||||
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
|
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MAIN)
|
||||||
|
return;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// TX audio level
|
// TX audio level
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||||
return;
|
gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
return; // screen is in use
|
||||||
|
|
||||||
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
|
if (gAlarmState != ALARM_STATE_OFF)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
|
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
|
||||||
|
|
||||||
@@ -96,18 +122,18 @@ bool center_line_is_free = true;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t *pLine = gFrameBuffer[line];
|
uint8_t *p_line = gFrameBuffer[line];
|
||||||
|
|
||||||
memset(pLine, 0, LCD_WIDTH);
|
memset(p_line, 0, LCD_WIDTH);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// solid bar
|
// solid bar
|
||||||
for (i = 0; i < bar_width; i++)
|
for (i = 0; i < bar_width; i++)
|
||||||
pLine[bar_x + i] = (i > len) ? ((i & 1) == 0) ? 0x41 : 0x00 : ((i & 1) == 0) ? 0x7f : 0x3e;
|
p_line[bar_x + i] = (i > len) ? ((i & 1) == 0) ? 0x41 : 0x00 : ((i & 1) == 0) ? 0x7f : 0x3e;
|
||||||
#else
|
#else
|
||||||
// knuled bar
|
// knuled bar
|
||||||
for (i = 0; i < bar_width; i += 2)
|
for (i = 0; i < bar_width; i += 2)
|
||||||
pLine[bar_x + i] = (i <= len) ? 0x7f : 0x41;
|
p_line[bar_x + i] = (i <= len) ? 0x7f : 0x41;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
@@ -124,6 +150,7 @@ bool center_line_is_free = true;
|
|||||||
|
|
||||||
const int16_t s9_dBm = s0_dBm + (6 * 9); // S9 .. 6dB/S-Point
|
const int16_t s9_dBm = s0_dBm + (6 * 9); // S9 .. 6dB/S-Point
|
||||||
const int16_t bar_max_dBm = s9_dBm + 30; // S9+30dB
|
const int16_t bar_max_dBm = s9_dBm + 30; // S9+30dB
|
||||||
|
// const int16_t bar_min_dBm = s0_dBm + (6 * 0); // S0
|
||||||
const int16_t bar_min_dBm = s0_dBm + (6 * 4); // S4
|
const int16_t bar_min_dBm = s0_dBm + (6 * 4); // S4
|
||||||
|
|
||||||
// ************
|
// ************
|
||||||
@@ -138,40 +165,42 @@ bool center_line_is_free = true;
|
|||||||
const unsigned int len = ((clamped_dBm - bar_min_dBm) * bar_width) / bar_range_dB;
|
const unsigned int len = ((clamped_dBm - bar_min_dBm) * bar_width) / bar_range_dB;
|
||||||
|
|
||||||
const unsigned int line = 3;
|
const unsigned int line = 3;
|
||||||
uint8_t *pLine = gFrameBuffer[line];
|
uint8_t *p_line = gFrameBuffer[line];
|
||||||
|
|
||||||
char s[16];
|
char s[16];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
||||||
return; // display is in use
|
return; // display is in use
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN)
|
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
||||||
|
gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
return; // display is in use
|
return; // display is in use
|
||||||
|
|
||||||
if (now)
|
if (now)
|
||||||
memset(pLine, 0, LCD_WIDTH);
|
memset(p_line, 0, LCD_WIDTH);
|
||||||
|
|
||||||
if (rssi_dBm >= (s9_dBm + 6))
|
if (rssi_dBm >= (s9_dBm + 6))
|
||||||
{ // S9+XXdB, 1dB increment
|
{ // S9+XXdB, 1dB increment
|
||||||
const char *fmt[] = {"%-4d +%u ", "%-4d +%u "};
|
const char *fmt[] = {"%3d 9+%u ", "%3d 9+%2u "};
|
||||||
const unsigned int dB = rssi_dBm - s9_dBm;
|
const unsigned int s9_dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
|
||||||
sprintf(s, (dB < 10) ? fmt[0] : fmt[1], rssi_dBm, dB);
|
sprintf(s, (s9_dB < 10) ? fmt[0] : fmt[1], rssi_dBm, s9_dB);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // S0 ~ S9, 6dB per S-point
|
{ // S0 ~ S9, 6dB per S-point
|
||||||
const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0;
|
const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0;
|
||||||
sprintf(s, "%-4d S%u ", rssi_dBm, s_level);
|
sprintf(s, "%4d S%u ", rssi_dBm, s_level);
|
||||||
}
|
}
|
||||||
UI_PrintStringSmall(s, 2, 0, line);
|
UI_PrintStringSmall(s, 2, 0, line);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// solid bar
|
// solid bar
|
||||||
for (i = 0; i < bar_width; i++)
|
for (i = 0; i < bar_width; i++)
|
||||||
pLine[bar_x + i] = (i > len) ? ((i & 1) == 0) ? 0x41 : 0x00 : ((i & 1) == 0) ? 0x7f : 0x3e;
|
p_line[bar_x + i] = (i > len) ? ((i & 1) == 0) ? 0x41 : 0x00 : ((i & 1) == 0) ? 0x7f : 0x3e;
|
||||||
#else
|
#else
|
||||||
// knuled bar
|
// knuled bar
|
||||||
for (i = 0; i < bar_width; i += 2)
|
for (i = 0; i < bar_width; i += 2)
|
||||||
pLine[bar_x + i] = (i <= len) ? 0x7f : 0x41;
|
p_line[bar_x + i] = (i <= len) ? 0x7f : 0x41;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (now)
|
if (now)
|
||||||
@@ -183,27 +212,25 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
|||||||
{
|
{
|
||||||
#ifdef ENABLE_RSSI_BAR
|
#ifdef ENABLE_RSSI_BAR
|
||||||
|
|
||||||
if (!center_line_is_free)
|
// optional larger RSSI dBm, S-point and bar level
|
||||||
|
|
||||||
|
if (center_line != CENTER_LINE_RSSI)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
gCurrentFunction == FUNCTION_MONITOR ||
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
gCurrentFunction == FUNCTION_INCOMING);
|
gCurrentFunction == FUNCTION_INCOMING)
|
||||||
|
{
|
||||||
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
|
UI_DisplayRSSIBar(rssi, true);
|
||||||
if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
|
}
|
||||||
{ // AM test data is currently being shown
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (rx)
|
|
||||||
UI_DisplayRSSIBar(rssi, true);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
// original little RS bars
|
||||||
|
|
||||||
// const int16_t dBm = (rssi / 2) - 160;
|
// const int16_t dBm = (rssi / 2) - 160;
|
||||||
const uint8_t Line = (vfo == 0) ? 3 : 7;
|
const uint8_t Line = (vfo == 0) ? 3 : 7;
|
||||||
uint8_t *pLine = gFrameBuffer[Line - 1];
|
uint8_t *p_line = gFrameBuffer[Line - 1];
|
||||||
|
|
||||||
// TODO: sort out all 8 values from the eeprom
|
// TODO: sort out all 8 values from the eeprom
|
||||||
|
|
||||||
@@ -258,31 +285,18 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
|||||||
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN)
|
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN)
|
||||||
return; // display is in use
|
return; // display is in use
|
||||||
|
|
||||||
pLine = gFrameBuffer[Line - 1];
|
p_line = gFrameBuffer[Line - 1];
|
||||||
|
|
||||||
memset(pLine, 0, 23);
|
memset(p_line, 0, 23);
|
||||||
|
|
||||||
if (rssi_level > 0)
|
// untested !!!
|
||||||
{
|
|
||||||
//if (rssi_level >= 1)
|
if (rssi_level == 0)
|
||||||
memmove(pLine, BITMAP_Antenna, 5);
|
p_line = NULL;
|
||||||
if (rssi_level >= 2)
|
|
||||||
memmove(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
|
||||||
if (rssi_level >= 3)
|
|
||||||
memmove(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
|
||||||
if (rssi_level >= 4)
|
|
||||||
memmove(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
|
||||||
if (rssi_level >= 5)
|
|
||||||
memmove(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
|
||||||
if (rssi_level >= 6)
|
|
||||||
memmove(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
|
||||||
if (rssi_level >= 7)
|
|
||||||
memmove(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
pLine = NULL;
|
UI_drawBars(p_line, rssi_level);
|
||||||
|
|
||||||
ST7565_DrawLine(0, Line, 23, pLine);
|
ST7565_DrawLine(0, Line, 23, p_line);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,10 +304,12 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
|||||||
|
|
||||||
void UI_DisplayMain(void)
|
void UI_DisplayMain(void)
|
||||||
{
|
{
|
||||||
char String[16];
|
const unsigned int line0 = 0; // text screen line
|
||||||
unsigned int vfo_num;
|
const unsigned int line1 = 4;
|
||||||
|
char String[16];
|
||||||
|
unsigned int vfo_num;
|
||||||
|
|
||||||
center_line_is_free = true;
|
center_line = CENTER_LINE_NONE;
|
||||||
|
|
||||||
// #ifdef SINGLE_VFO_CHAN
|
// #ifdef SINGLE_VFO_CHAN
|
||||||
// const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false;
|
// const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false;
|
||||||
@@ -301,6 +317,7 @@ void UI_DisplayMain(void)
|
|||||||
const bool single_vfo = false;
|
const bool single_vfo = false;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// clear the screen
|
||||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||||
|
|
||||||
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
||||||
@@ -313,25 +330,28 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
for (vfo_num = 0; vfo_num < 2; vfo_num++)
|
for (vfo_num = 0; vfo_num < 2; vfo_num++)
|
||||||
{
|
{
|
||||||
uint8_t Channel = gEeprom.TX_CHANNEL;
|
const unsigned int line = (vfo_num == 0) ? line0 : line1;
|
||||||
bool bIsSameVfo = !!(Channel == vfo_num);
|
uint8_t channel = gEeprom.TX_CHANNEL;
|
||||||
uint8_t Line = (vfo_num == 0) ? 0 : 4;
|
// uint8_t tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
||||||
uint8_t *pLine0 = gFrameBuffer[Line + 0];
|
const bool same_vfo = (channel == vfo_num) ? true : false;
|
||||||
uint8_t *pLine1 = gFrameBuffer[Line + 1];
|
uint8_t *p_line0 = gFrameBuffer[line + 0];
|
||||||
|
uint8_t *p_line1 = gFrameBuffer[line + 1];
|
||||||
|
uint8_t mode = 0;
|
||||||
|
uint8_t state;
|
||||||
|
|
||||||
if (single_vfo)
|
if (single_vfo)
|
||||||
{ // we're in single VFO mode - screen is dedicated to just one VFO
|
{ // we're in single VFO mode - screen is dedicated to just one VFO
|
||||||
|
|
||||||
if (!bIsSameVfo)
|
if (!same_vfo)
|
||||||
continue; // skip the unused vfo
|
continue; // skip the unused vfo
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
|
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
|
||||||
Channel = gEeprom.RX_CHANNEL; // we're currently monitoring the other VFO
|
channel = gEeprom.RX_CHANNEL; // we're currently monitoring the other VFO
|
||||||
|
|
||||||
if (Channel != vfo_num)
|
if (channel != vfo_num)
|
||||||
{
|
{
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
|
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
|
||||||
{ // show DTMF stuff
|
{ // show DTMF stuff
|
||||||
@@ -354,7 +374,7 @@ void UI_DisplayMain(void)
|
|||||||
{
|
{
|
||||||
sprintf(String, ">%s", gDTMF_InputBox);
|
sprintf(String, ">%s", gDTMF_InputBox);
|
||||||
|
|
||||||
center_line_is_free = false;
|
center_line = CENTER_LINE_IN_USE;
|
||||||
}
|
}
|
||||||
UI_PrintString(String, 2, 0, vfo_num * 3, 8);
|
UI_PrintString(String, 2, 0, vfo_num * 3, 8);
|
||||||
|
|
||||||
@@ -373,55 +393,66 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
center_line_is_free = false;
|
center_line = CENTER_LINE_IN_USE;
|
||||||
}
|
}
|
||||||
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
||||||
|
|
||||||
center_line_is_free = false;
|
center_line = CENTER_LINE_IN_USE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// highlight the selected/used VFO with a marker
|
// highlight the selected/used VFO with a marker
|
||||||
if (!single_vfo && bIsSameVfo)
|
if (!single_vfo && same_vfo)
|
||||||
memmove(pLine0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
||||||
else
|
else
|
||||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||||
memmove(pLine0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
memmove(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!single_vfo)
|
if (!single_vfo)
|
||||||
{ // highlight the selected/used VFO with a marker
|
{ // highlight the selected/used VFO with a marker
|
||||||
if (bIsSameVfo)
|
if (same_vfo)
|
||||||
memmove(pLine0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
||||||
else
|
else
|
||||||
//if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
//if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||||
memmove(pLine0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
memmove(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t duff_beer = 0;
|
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
{ // transmitting
|
{ // transmitting
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
if (gAlarmState == ALARM_STATE_ALARM)
|
if (gAlarmState == ALARM_STATE_ALARM)
|
||||||
duff_beer = 2;
|
mode = 2;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
||||||
if (Channel == vfo_num)
|
if (channel == vfo_num)
|
||||||
{ // show the TX symbol
|
{ // show the TX symbol
|
||||||
duff_beer = 1;
|
mode = 1;
|
||||||
UI_PrintStringSmall("TX", 14, 0, Line);
|
#ifdef ENABLE_SMALL_BOLD
|
||||||
|
UI_PrintStringSmallBold("TX", 14, 0, line);
|
||||||
|
#else
|
||||||
|
UI_PrintStringSmall("TX", 14, 0, line);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // receiving .. show the RX symbol
|
{ // receiving .. show the RX symbol
|
||||||
duff_beer = 2;
|
mode = 2;
|
||||||
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num)
|
if ((gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
UI_PrintStringSmall("RX", 14, 0, Line);
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING) &&
|
||||||
|
gEeprom.RX_CHANNEL == vfo_num)
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_SMALL_BOLD
|
||||||
|
UI_PrintStringSmallBold("RX", 14, 0, line);
|
||||||
|
#else
|
||||||
|
UI_PrintStringSmall("RX", 14, 0, line);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
|
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
|
||||||
@@ -431,9 +462,9 @@ void UI_DisplayMain(void)
|
|||||||
if (!inputting)
|
if (!inputting)
|
||||||
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number
|
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number
|
||||||
else
|
else
|
||||||
memmove(String + 5, gInputBox, 3); // show the input text
|
memmove(String + 5, gInputBox, 3); // show the input text
|
||||||
UI_PrintStringSmall("M", x, 0, Line + 1);
|
UI_PrintStringSmall("M", x, 0, line + 1);
|
||||||
UI_DisplaySmallDigits(3, String + 5, x + 7, Line + 1, inputting);
|
UI_DisplaySmallDigits(3, String + 5, x + 7, line + 1, inputting);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
|
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
|
||||||
@@ -442,7 +473,7 @@ void UI_DisplayMain(void)
|
|||||||
const unsigned int x = 2; // was 14
|
const unsigned int x = 2; // was 14
|
||||||
// sprintf(String, "FB%u", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST);
|
// sprintf(String, "FB%u", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST);
|
||||||
sprintf(String, "VFO%u", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST);
|
sprintf(String, "VFO%u", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST);
|
||||||
UI_PrintStringSmall(String, x, 0, Line + 1);
|
UI_PrintStringSmall(String, x, 0, line + 1);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
else
|
else
|
||||||
@@ -455,50 +486,43 @@ void UI_DisplayMain(void)
|
|||||||
{ // user entering channel number
|
{ // user entering channel number
|
||||||
sprintf(String, "N%u%u", '0' + gInputBox[0], '0' + gInputBox[1]);
|
sprintf(String, "N%u%u", '0' + gInputBox[0], '0' + gInputBox[1]);
|
||||||
}
|
}
|
||||||
UI_PrintStringSmall(String, 7, 0, Line + 1);
|
UI_PrintStringSmall(String, 7, 0, line + 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************
|
// ************
|
||||||
|
|
||||||
uint8_t State = VfoState[vfo_num];
|
state = VfoState[vfo_num];
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
|
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
|
||||||
{
|
{
|
||||||
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
||||||
if (Channel == vfo_num)
|
if (channel == vfo_num)
|
||||||
State = VFO_STATE_ALARM;
|
state = VFO_STATE_ALARM;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (State != VFO_STATE_NORMAL)
|
if (state != VFO_STATE_NORMAL)
|
||||||
{
|
{
|
||||||
const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"};
|
const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"};
|
||||||
if (State >= 0 && State < ARRAY_SIZE(state_list))
|
if (state >= 0 && state < ARRAY_SIZE(state_list))
|
||||||
{
|
UI_PrintString(state_list[state], 31, 0, line, 8);
|
||||||
UI_PrintString(state_list[State], 31, 0, Line, 8);
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// sprintf(String, "State %u ?", State);
|
|
||||||
// UI_PrintString(String, 31, 0, Line, 8);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
|
if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
|
||||||
{ // user entering a frequency
|
{ // user entering a frequency
|
||||||
UI_DisplayFrequency(gInputBox, 32, Line, true, false);
|
UI_DisplayFrequency(gInputBox, 32, line, true, false);
|
||||||
|
|
||||||
center_line_is_free = false;
|
// center_line = CENTER_LINE_IN_USE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
|
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
{ // transmitting
|
{ // transmitting
|
||||||
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
||||||
if (Channel == vfo_num)
|
if (channel == vfo_num)
|
||||||
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
|
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,14 +532,16 @@ void UI_DisplayMain(void)
|
|||||||
// show the channel symbols
|
// show the channel symbols
|
||||||
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||||
if (attributes & MR_CH_SCANLIST1)
|
if (attributes & MR_CH_SCANLIST1)
|
||||||
memmove(pLine0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
|
memmove(p_line0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
|
||||||
if (attributes & MR_CH_SCANLIST2)
|
if (attributes & MR_CH_SCANLIST2)
|
||||||
memmove(pLine0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
|
memmove(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
|
||||||
#ifndef ENABLE_BIG_FREQ
|
#ifndef ENABLE_BIG_FREQ
|
||||||
#ifdef ENABLE_COMPANDER
|
if ((attributes & MR_CH_COMPAND) > 0)
|
||||||
if ((attributes & MR_CH_COMPAND) > 0)
|
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||||
memmove(pLine0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
#else
|
||||||
#endif
|
|
||||||
|
// TODO: // find somewhere else to put the symbol
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
||||||
@@ -524,19 +550,19 @@ void UI_DisplayMain(void)
|
|||||||
#ifdef ENABLE_BIG_FREQ
|
#ifdef ENABLE_BIG_FREQ
|
||||||
NUMBER_ToDigits(frequency, String);
|
NUMBER_ToDigits(frequency, String);
|
||||||
// show the main large frequency digits
|
// show the main large frequency digits
|
||||||
UI_DisplayFrequency(String, 32, Line, false, false);
|
UI_DisplayFrequency(String, 32, line, false, false);
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
UI_DisplaySmallDigits(2, String + 6, 113, Line + 1, true);
|
UI_DisplaySmallDigits(2, String + 6, 113, line + 1, true);
|
||||||
#else
|
#else
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintString(String, 32, 0, Line, 8);
|
UI_PrintString(String, 32, 0, line, 8);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDF_CHANNEL: // show the channel number
|
case MDF_CHANNEL: // show the channel number
|
||||||
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
|
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||||
UI_PrintString(String, 32, 0, Line, 8);
|
UI_PrintString(String, 32, 0, line, 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDF_NAME: // show the channel name
|
case MDF_NAME: // show the channel name
|
||||||
@@ -550,19 +576,19 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME)
|
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME)
|
||||||
{
|
{
|
||||||
UI_PrintString(String, 32, 0, Line, 8);
|
UI_PrintString(String, 32, 0, line, 8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_SMALL_BOLD
|
#ifdef ENABLE_SMALL_BOLD
|
||||||
UI_PrintStringSmallBold(String, 32 + 4, 0, Line);
|
UI_PrintStringSmallBold(String, 32 + 4, 0, line);
|
||||||
#else
|
#else
|
||||||
UI_PrintStringSmall(String, 32 + 4, 0, Line);
|
UI_PrintStringSmall(String, 32 + 4, 0, line);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// show the channel frequency below the channel number/name
|
// show the channel frequency below the channel number/name
|
||||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintStringSmall(String, 32 + 4, 0, Line + 1);
|
UI_PrintStringSmall(String, 32 + 4, 0, line + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -573,25 +599,23 @@ void UI_DisplayMain(void)
|
|||||||
#ifdef ENABLE_BIG_FREQ
|
#ifdef ENABLE_BIG_FREQ
|
||||||
NUMBER_ToDigits(frequency, String); // 8 digits
|
NUMBER_ToDigits(frequency, String); // 8 digits
|
||||||
// show the main large frequency digits
|
// show the main large frequency digits
|
||||||
UI_DisplayFrequency(String, 32, Line, false, false);
|
UI_DisplayFrequency(String, 32, line, false, false);
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
UI_DisplaySmallDigits(2, String + 6, 113, Line + 1, true);
|
UI_DisplaySmallDigits(2, String + 6, 113, line + 1, true);
|
||||||
#else
|
#else
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintString(String, 32, 0, Line, 8);
|
UI_PrintString(String, 32, 0, line, 8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
// show the channel symbols
|
||||||
// show the channel symbols
|
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||||
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
if ((attributes & MR_CH_COMPAND) > 0)
|
||||||
if ((attributes & MR_CH_COMPAND) > 0)
|
#ifdef ENABLE_BIG_FREQ
|
||||||
#ifdef ENABLE_BIG_FREQ
|
memmove(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
|
||||||
memmove(pLine0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
|
#else
|
||||||
#else
|
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||||
memmove(pLine0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
#endif
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,7 +624,7 @@ void UI_DisplayMain(void)
|
|||||||
{ // show the TX/RX level
|
{ // show the TX/RX level
|
||||||
uint8_t Level = 0;
|
uint8_t Level = 0;
|
||||||
|
|
||||||
if (duff_beer == 1)
|
if (mode == 1)
|
||||||
{ // TX power level
|
{ // TX power level
|
||||||
switch (gRxVfo->OUTPUT_POWER)
|
switch (gRxVfo->OUTPUT_POWER)
|
||||||
{
|
{
|
||||||
@@ -610,7 +634,7 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (duff_beer == 2)
|
if (mode == 2)
|
||||||
{ // RX signal level
|
{ // RX signal level
|
||||||
#ifndef ENABLE_RSSI_BAR
|
#ifndef ENABLE_RSSI_BAR
|
||||||
// bar graph
|
// bar graph
|
||||||
@@ -619,23 +643,7 @@ void UI_DisplayMain(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Level >= 1)
|
UI_drawBars(p_line1 + LCD_WIDTH, Level);
|
||||||
{
|
|
||||||
uint8_t *pLine = pLine1 + LCD_WIDTH;
|
|
||||||
memmove(pLine + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
|
||||||
if (Level >= 2)
|
|
||||||
memmove(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
|
||||||
if (Level >= 3)
|
|
||||||
memmove(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
|
||||||
if (Level >= 4)
|
|
||||||
memmove(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
|
||||||
if (Level >= 5)
|
|
||||||
memmove(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
|
||||||
if (Level >= 6)
|
|
||||||
memmove(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
|
||||||
if (Level >= 7)
|
|
||||||
memmove(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************
|
// ************
|
||||||
@@ -647,21 +655,21 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // or show the CTCSS/DCS symbol
|
{ // or show the CTCSS/DCS symbol
|
||||||
const FREQ_Config_t *pConfig = (duff_beer == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
|
const FREQ_Config_t *pConfig = (mode == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
|
||||||
const unsigned int code_type = pConfig->CodeType;
|
const unsigned int code_type = pConfig->CodeType;
|
||||||
const char *code_list[] = {"", "CT", "DCS", "DCR"};
|
const char *code_list[] = {"", "CT", "DCS", "DCR"};
|
||||||
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list))
|
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list))
|
||||||
strcpy(String, code_list[code_type]);
|
strcpy(String, code_list[code_type]);
|
||||||
}
|
}
|
||||||
UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, Line + 1);
|
UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, line + 1);
|
||||||
|
|
||||||
if (State != VFO_STATE_TX_DISABLE)
|
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM)
|
||||||
{ // show the TX power
|
{ // show the TX power
|
||||||
const char pwr_list[] = "LMH";
|
const char pwr_list[] = "LMH";
|
||||||
const unsigned int i = gEeprom.VfoInfo[vfo_num].OUTPUT_POWER;
|
const unsigned int i = gEeprom.VfoInfo[vfo_num].OUTPUT_POWER;
|
||||||
String[0] = (i >= 0 && i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
|
String[0] = (i >= 0 && i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
|
||||||
String[1] = '\0';
|
String[1] = '\0';
|
||||||
UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, Line + 1);
|
UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, line + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gEeprom.VfoInfo[vfo_num].freq_config_RX.Frequency != gEeprom.VfoInfo[vfo_num].freq_config_TX.Frequency)
|
if (gEeprom.VfoInfo[vfo_num].freq_config_RX.Frequency != gEeprom.VfoInfo[vfo_num].freq_config_TX.Frequency)
|
||||||
@@ -670,12 +678,12 @@ void UI_DisplayMain(void)
|
|||||||
const unsigned int i = gEeprom.VfoInfo[vfo_num].TX_OFFSET_FREQUENCY_DIRECTION;
|
const unsigned int i = gEeprom.VfoInfo[vfo_num].TX_OFFSET_FREQUENCY_DIRECTION;
|
||||||
String[0] = (i < sizeof(dir_list)) ? dir_list[i] : '?';
|
String[0] = (i < sizeof(dir_list)) ? dir_list[i] : '?';
|
||||||
String[1] = '\0';
|
String[1] = '\0';
|
||||||
UI_PrintStringSmall(String, LCD_WIDTH + 54, 0, Line + 1);
|
UI_PrintStringSmall(String, LCD_WIDTH + 54, 0, line + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the TX/RX reverse symbol
|
// show the TX/RX reverse symbol
|
||||||
if (gEeprom.VfoInfo[vfo_num].FrequencyReverse)
|
if (gEeprom.VfoInfo[vfo_num].FrequencyReverse)
|
||||||
UI_PrintStringSmall("R", LCD_WIDTH + 62, 0, Line + 1);
|
UI_PrintStringSmall("R", LCD_WIDTH + 62, 0, line + 1);
|
||||||
|
|
||||||
{ // show the narrow band symbol
|
{ // show the narrow band symbol
|
||||||
String[0] = '\0';
|
String[0] = '\0';
|
||||||
@@ -684,19 +692,19 @@ void UI_DisplayMain(void)
|
|||||||
String[0] = 'N';
|
String[0] = 'N';
|
||||||
String[1] = '\0';
|
String[1] = '\0';
|
||||||
}
|
}
|
||||||
UI_PrintStringSmall(String, LCD_WIDTH + 70, 0, Line + 1);
|
UI_PrintStringSmall(String, LCD_WIDTH + 70, 0, line + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the DTMF decoding symbol
|
// show the DTMF decoding symbol
|
||||||
if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED)
|
if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||||
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, Line + 1);
|
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1);
|
||||||
|
|
||||||
// show the audio scramble symbol
|
// show the audio scramble symbol
|
||||||
if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
|
if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
|
||||||
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, Line + 1);
|
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, line + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (center_line_is_free)
|
if (center_line == CENTER_LINE_NONE)
|
||||||
{ // we're free to use the middle line
|
{ // we're free to use the middle line
|
||||||
|
|
||||||
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
|
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
@@ -705,13 +713,21 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT)
|
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
|
{
|
||||||
|
center_line = CENTER_LINE_AUDIO_BAR;
|
||||||
UI_DisplayAudioBar();
|
UI_DisplayAudioBar();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
|
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
|
||||||
if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
|
if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
|
||||||
{
|
{
|
||||||
|
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
center_line = CENTER_LINE_AM_FIX_DATA;
|
||||||
AM_fix_print_data(gEeprom.RX_CHANNEL, String);
|
AM_fix_print_data(gEeprom.RX_CHANNEL, String);
|
||||||
UI_PrintStringSmall(String, 2, 0, 3);
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
}
|
}
|
||||||
@@ -720,7 +736,10 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
#ifdef ENABLE_RSSI_BAR
|
#ifdef ENABLE_RSSI_BAR
|
||||||
if (rx)
|
if (rx)
|
||||||
|
{
|
||||||
|
center_line = CENTER_LINE_RSSI;
|
||||||
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
|
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -731,6 +750,13 @@ void UI_DisplayMain(void)
|
|||||||
{ // show live DTMF decode
|
{ // show live DTMF decode
|
||||||
const unsigned int len = strlen(gDTMF_RX_live);
|
const unsigned int len = strlen(gDTMF_RX_live);
|
||||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||||
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
center_line = CENTER_LINE_DTMF_DEC;
|
||||||
|
|
||||||
strcpy(String, "DTMF ");
|
strcpy(String, "DTMF ");
|
||||||
strcat(String, gDTMF_RX_live + idx);
|
strcat(String, gDTMF_RX_live + idx);
|
||||||
UI_PrintStringSmall(String, 2, 0, 3);
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
@@ -740,6 +766,13 @@ void UI_DisplayMain(void)
|
|||||||
{ // show live DTMF decode
|
{ // show live DTMF decode
|
||||||
const unsigned int len = gDTMF_RX_index;
|
const unsigned int len = gDTMF_RX_index;
|
||||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||||
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
center_line = CENTER_LINE_DTMF_DEC;
|
||||||
|
|
||||||
strcpy(String, "DTMF ");
|
strcpy(String, "DTMF ");
|
||||||
strcat(String, gDTMF_RX + idx);
|
strcat(String, gDTMF_RX + idx);
|
||||||
UI_PrintStringSmall(String, 2, 0, 3);
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
@@ -750,9 +783,16 @@ void UI_DisplayMain(void)
|
|||||||
else
|
else
|
||||||
if (gChargingWithTypeC)
|
if (gChargingWithTypeC)
|
||||||
{ // charging .. show the battery state
|
{ // charging .. show the battery state
|
||||||
const uint16_t percent = BATTERY_VoltsToPercent(gBatteryVoltageAverage);
|
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
sprintf(String, "Charge %u.%02uV %u%%", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, percent);
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
UI_PrintStringSmall(String, 2, 0, 3);
|
return;
|
||||||
|
|
||||||
|
center_line = CENTER_LINE_CHARGE_DATA;
|
||||||
|
|
||||||
|
sprintf(String, "Charge %u.%02uV %u%%",
|
||||||
|
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
||||||
|
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||||
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
13
ui/main.h
13
ui/main.h
@@ -17,6 +17,19 @@
|
|||||||
#ifndef UI_MAIN_H
|
#ifndef UI_MAIN_H
|
||||||
#define UI_MAIN_H
|
#define UI_MAIN_H
|
||||||
|
|
||||||
|
enum center_line_t {
|
||||||
|
CENTER_LINE_NONE = 0,
|
||||||
|
CENTER_LINE_IN_USE,
|
||||||
|
CENTER_LINE_AUDIO_BAR,
|
||||||
|
CENTER_LINE_RSSI,
|
||||||
|
CENTER_LINE_AM_FIX_DATA,
|
||||||
|
CENTER_LINE_DTMF_DEC,
|
||||||
|
CENTER_LINE_CHARGE_DATA
|
||||||
|
};
|
||||||
|
typedef enum center_line_t center_line_t;
|
||||||
|
|
||||||
|
extern center_line_t center_line;
|
||||||
|
|
||||||
void UI_DisplayAudioBar(void);
|
void UI_DisplayAudioBar(void);
|
||||||
void UI_UpdateRSSI(const int16_t rssi, const int vfo);
|
void UI_UpdateRSSI(const int16_t rssi, const int vfo);
|
||||||
void UI_DisplayMain(void);
|
void UI_DisplayMain(void);
|
||||||
|
|||||||
497
ui/menu.c
497
ui/menu.c
@@ -18,6 +18,7 @@
|
|||||||
#include <stdlib.h> // abs()
|
#include <stdlib.h> // abs()
|
||||||
|
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
|
#include "app/menu.h"
|
||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "dcs.h"
|
#include "dcs.h"
|
||||||
@@ -42,93 +43,97 @@ const t_menu_item MenuList[] =
|
|||||||
{
|
{
|
||||||
// text, voice ID, menu ID
|
// text, voice ID, menu ID
|
||||||
|
|
||||||
{"SQL", VOICE_ID_SQUELCH, MENU_SQL },
|
{"SQL", VOICE_ID_SQUELCH, MENU_SQL },
|
||||||
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
||||||
{"T-PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
{"T PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||||
{"R-DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
{"R DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||||
{"R-CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
{"R CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||||
{"T-DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
{"T DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||||
{"T-CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
{"T CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||||
{"T-DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
{"T DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||||
{"T-OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
{"T OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||||
{"T-VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
{"T VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
||||||
{"T-TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
{"T TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||||
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
||||||
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||||
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
||||||
{"CH-SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
{"CH SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||||
{"CH-DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
{"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||||
{"CH-NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
{"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||||
{"CH-DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||||
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||||
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
#ifdef ENABLE_VOX
|
||||||
{"BACKLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
||||||
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
#endif
|
||||||
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
{"BLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||||
|
{"BLTTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX },
|
||||||
|
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
||||||
|
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||||
#endif
|
#endif
|
||||||
{"SC-REV", VOICE_ID_INVALID, MENU_SC_REV },
|
{"SC REV", VOICE_ID_INVALID, MENU_SC_REV },
|
||||||
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||||
{"S-ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||||
{"S-ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||||
{"STE", VOICE_ID_INVALID, MENU_STE },
|
{"STE", VOICE_ID_INVALID, MENU_STE },
|
||||||
{"RP-STE", VOICE_ID_INVALID, MENU_RP_STE },
|
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
|
||||||
{"MIC", VOICE_ID_INVALID, MENU_MIC },
|
{"MIC", VOICE_ID_INVALID, MENU_MIC },
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
|
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COMPANDER
|
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
|
||||||
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
|
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
||||||
#endif
|
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
|
||||||
{"1-CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
|
||||||
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
|
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
|
||||||
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
|
|
||||||
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
|
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||||
#endif
|
#endif
|
||||||
{"ANI-ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||||
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
|
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
|
||||||
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
|
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
|
||||||
{"D-ST", VOICE_ID_INVALID, MENU_D_ST },
|
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||||
{"D-RSP", VOICE_ID_INVALID, MENU_D_RSP },
|
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||||
{"D-HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
|
{"D RSP", VOICE_ID_INVALID, MENU_D_RSP },
|
||||||
{"D-PRE", VOICE_ID_INVALID, MENU_D_PRE },
|
{"D HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||||
{"PTT-ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
{"D PRE", VOICE_ID_INVALID, MENU_D_PRE },
|
||||||
{"D-DCD", VOICE_ID_INVALID, MENU_D_DCD },
|
{"D DCD", VOICE_ID_INVALID, MENU_D_DCD },
|
||||||
{"D-LIST", VOICE_ID_INVALID, MENU_D_LIST },
|
{"D LIST", VOICE_ID_INVALID, MENU_D_LIST },
|
||||||
{"D-LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
{"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||||
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
|
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
|
||||||
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
|
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
|
||||||
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||||
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
|
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||||
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
{"AM-FIX", VOICE_ID_INVALID, MENU_AM_FIX },
|
{"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
{"AM-FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
|
{"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1 },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
||||||
#endif
|
#endif
|
||||||
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||||
|
|
||||||
// hidden menu items from here on
|
// hidden menu items from here on
|
||||||
// enabled if pressing both the PTT and upper side button at power-on
|
// enabled if pressing both the PTT and upper side button at power-on
|
||||||
|
|
||||||
{"F-LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
|
{"F LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
|
||||||
{"TX-200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
{"TX 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
||||||
{"TX-350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
{"TX 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
||||||
{"TX-500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
{"TX 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||||
{"350-EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
{"350 EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||||
{"SCR-EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||||
|
|
||||||
{"TX-EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
{"TX EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||||
{"F-CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
|
{"F CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||||
|
#endif
|
||||||
|
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
||||||
|
|
||||||
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_TXP[3][5] =
|
const char gSubMenu_TXP[3][5] =
|
||||||
@@ -168,7 +173,6 @@ const char gSubMenu_SAVE[5][4] =
|
|||||||
|
|
||||||
const char gSubMenu_TOT[11][7] =
|
const char gSubMenu_TOT[11][7] =
|
||||||
{
|
{
|
||||||
"OFF",
|
|
||||||
"30 sec",
|
"30 sec",
|
||||||
"1 min",
|
"1 min",
|
||||||
"2 min",
|
"2 min",
|
||||||
@@ -178,21 +182,22 @@ const char gSubMenu_TOT[11][7] =
|
|||||||
"6 min",
|
"6 min",
|
||||||
"7 min",
|
"7 min",
|
||||||
"8 min",
|
"8 min",
|
||||||
"9 min"
|
"9 min",
|
||||||
|
"15 min"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_CHAN[3][7] =
|
const char gSubMenu_CHAN[3][10] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"OFF",
|
||||||
"CHAN A",
|
"UPPER\nVFO",
|
||||||
"CHAN B"
|
"LOWER\nVFO"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_XB[3][7] =
|
const char gSubMenu_XB[3][10] =
|
||||||
{
|
{
|
||||||
"SAME",
|
"MAIN\nVFO",
|
||||||
"CHAN A",
|
"UPPER\nVFO",
|
||||||
"CHAN B"
|
"LOWER\nVFO"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -204,19 +209,19 @@ const char gSubMenu_XB[3][7] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char gSubMenu_SC_REV[3][3] =
|
const char gSubMenu_SC_REV[3][13] =
|
||||||
{
|
{
|
||||||
"TO",
|
"TIME",
|
||||||
"CO",
|
"CARRIER",
|
||||||
"SE"
|
"SEARCH"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_MDF[4][8] =
|
const char gSubMenu_MDF[4][15] =
|
||||||
{
|
{
|
||||||
"FREQ",
|
"FREQ",
|
||||||
"CHAN",
|
"CHANNEL\nNUMBER",
|
||||||
"NAME",
|
"NAME",
|
||||||
"NAM+FRE"
|
"NAME\n+\nFREQ"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@@ -227,35 +232,35 @@ const char gSubMenu_MDF[4][8] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char gSubMenu_D_RSP[4][6] =
|
const char gSubMenu_D_RSP[4][11] =
|
||||||
{
|
{
|
||||||
"NULL",
|
"DO\nNOTHING",
|
||||||
"RING",
|
"RING",
|
||||||
"REPLY",
|
"REPLY",
|
||||||
"BOTH"
|
"BOTH"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_PTT_ID[4][5] =
|
const char gSubMenu_PTT_ID[4][7] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"OFF",
|
||||||
"BOT",
|
"KEY UP",
|
||||||
"EOT",
|
"KEY DN",
|
||||||
"BOTH"
|
"BOTH"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_PONMSG[4][5] =
|
const char gSubMenu_PONMSG[4][8] =
|
||||||
{
|
{
|
||||||
"FULL",
|
"FULL",
|
||||||
"MSG",
|
"MESSAGE",
|
||||||
"VOL",
|
"VOLTAGE",
|
||||||
"NONE"
|
"NONE"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_ROGER[3][6] =
|
const char gSubMenu_ROGER[3][9] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"OFF",
|
||||||
"ROGER",
|
"ROGER",
|
||||||
"MDC"
|
"MDC\n1200"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_RESET[2][4] =
|
const char gSubMenu_RESET[2][4] =
|
||||||
@@ -286,15 +291,13 @@ const char gSubMenu_BACKLIGHT[8][7] =
|
|||||||
"ON"
|
"ON"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
const char gSubMenu_RX_TX[4][6] =
|
||||||
const char gSubMenu_Compand[4][6] =
|
{
|
||||||
{
|
"OFF",
|
||||||
"OFF",
|
"TX",
|
||||||
"TX",
|
"RX",
|
||||||
"RX",
|
"TX/RX"
|
||||||
"TX/RX"
|
};
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
const char gSubMenu_AM_fix_test1[4][8] =
|
const char gSubMenu_AM_fix_test1[4][8] =
|
||||||
@@ -344,34 +347,90 @@ void UI_DisplayMenu(void)
|
|||||||
const unsigned int menu_item_x1 = (8 * menu_list_width) + 2;
|
const unsigned int menu_item_x1 = (8 * menu_list_width) + 2;
|
||||||
const unsigned int menu_item_x2 = LCD_WIDTH - 1;
|
const unsigned int menu_item_x2 = LCD_WIDTH - 1;
|
||||||
unsigned int i;
|
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];
|
char Contact[16];
|
||||||
|
|
||||||
|
// clear the screen buffer
|
||||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
#if 0
|
||||||
if (gMenuCursor > 0 || i > 0)
|
// original menu layout
|
||||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
|
||||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
|
||||||
|
|
||||||
// invert the menu list text pixels
|
for (i = 0; i < 3; i++)
|
||||||
for (i = 0; i < (8 * menu_list_width); i++)
|
if (gMenuCursor > 0 || i > 0)
|
||||||
{
|
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||||
gFrameBuffer[2][i] ^= 0xFF;
|
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
||||||
gFrameBuffer[3][i] ^= 0xFF;
|
|
||||||
|
// 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));
|
memset(String, 0, sizeof(String));
|
||||||
|
|
||||||
@@ -397,7 +456,7 @@ void UI_DisplayMenu(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
case MENU_STEP:
|
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;
|
break;
|
||||||
|
|
||||||
case MENU_TXP:
|
case MENU_TXP:
|
||||||
@@ -417,11 +476,41 @@ void UI_DisplayMenu(void)
|
|||||||
|
|
||||||
case MENU_R_CTCS:
|
case MENU_R_CTCS:
|
||||||
case MENU_T_CTCS:
|
case MENU_T_CTCS:
|
||||||
if (gSubMenuSelection == 0)
|
{
|
||||||
strcpy(String, "OFF");
|
#if 1
|
||||||
else
|
unsigned int Code;
|
||||||
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
FREQ_Config_t *pConfig = (gMenuCursor == MENU_R_CTCS) ? &gTxVfo->freq_config_RX : &gTxVfo->freq_config_TX;
|
||||||
|
if (gSubMenuSelection == 0)
|
||||||
|
{
|
||||||
|
strcpy(String, "OFF");
|
||||||
|
|
||||||
|
if (pConfig->CodeType != CODE_TYPE_CONTINUOUS_TONE)
|
||||||
|
break;
|
||||||
|
Code = 0;
|
||||||
|
pConfig->CodeType = CODE_TYPE_OFF;
|
||||||
|
pConfig->Code = Code;
|
||||||
|
|
||||||
|
BK4819_ExitSubAu();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||||
|
|
||||||
|
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||||
|
Code = gSubMenuSelection - 1;
|
||||||
|
pConfig->Code = Code;
|
||||||
|
|
||||||
|
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (gSubMenuSelection == 0)
|
||||||
|
strcpy(String, "OFF");
|
||||||
|
else
|
||||||
|
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MENU_SFT_D:
|
case MENU_SFT_D:
|
||||||
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
|
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
|
||||||
@@ -459,14 +548,22 @@ void UI_DisplayMenu(void)
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
||||||
|
#if 1
|
||||||
|
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||||
|
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||||
|
else
|
||||||
|
BK4819_DisableScramble();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
if (gSubMenuSelection == 0)
|
case MENU_VOX:
|
||||||
strcpy(String, "OFF");
|
if (gSubMenuSelection == 0)
|
||||||
else
|
strcpy(String, "OFF");
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
else
|
||||||
break;
|
sprintf(String, "%d", gSubMenuSelection);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case MENU_ABR:
|
case MENU_ABR:
|
||||||
strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]);
|
strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]);
|
||||||
@@ -479,6 +576,7 @@ void UI_DisplayMenu(void)
|
|||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
case MENU_AM_FIX_TEST1:
|
case MENU_AM_FIX_TEST1:
|
||||||
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
|
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
|
||||||
|
// gSetting_AM_fix = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -486,11 +584,10 @@ void UI_DisplayMenu(void)
|
|||||||
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "AUTO");
|
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "AUTO");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
case MENU_ABR_ON_TX_RX:
|
||||||
strcpy(String, gSubMenu_Compand[gSubMenuSelection]);
|
strcpy(String, gSubMenu_RX_TX[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
case MENU_AM_FIX:
|
case MENU_AM_FIX:
|
||||||
@@ -529,7 +626,6 @@ void UI_DisplayMenu(void)
|
|||||||
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
||||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
already_printed = true;
|
already_printed = true;
|
||||||
@@ -559,7 +655,6 @@ void UI_DisplayMenu(void)
|
|||||||
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
||||||
if (edit_index < 10)
|
if (edit_index < 10)
|
||||||
UI_PrintString( "^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
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)
|
if (!gAskForConfirmation)
|
||||||
@@ -569,7 +664,6 @@ void UI_DisplayMenu(void)
|
|||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||||
else
|
else
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,7 +709,10 @@ void UI_DisplayMenu(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
sprintf(String, "LIST%u", gSubMenuSelection);
|
if (gSubMenuSelection < 2)
|
||||||
|
sprintf(String, "LIST%u", 1 + gSubMenuSelection);
|
||||||
|
else
|
||||||
|
strcpy(String, "ALL");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@@ -673,29 +770,9 @@ void UI_DisplayMenu(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOL:
|
case MENU_VOL:
|
||||||
|
sprintf(String, "%u.%02uV\n%u%%",
|
||||||
// 1st text line
|
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
||||||
sprintf(String, "%u.%02uV", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100);
|
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
if(gF_LOCK){
|
|
||||||
gBatteryCalibration[3] = gSubMenuSelection;
|
|
||||||
sprintf(String, "%u", gSubMenuSelection);
|
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
already_printed = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_RESET:
|
case MENU_RESET:
|
||||||
@@ -706,28 +783,82 @@ void UI_DisplayMenu(void)
|
|||||||
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_F_CALI:
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
{
|
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
|
const uint32_t value = 22656 + gSubMenuSelection;
|
||||||
BK4819_WriteRegister(BK4819_REG_3B, value);
|
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||||
|
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
writeXtalFreqCal(gSubMenuSelection, false);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
|
||||||
|
|
||||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||||
sprintf(String, "%u.%06u", xtal_Hz / 1000000, xtal_Hz % 1000000);
|
gSubMenuSelection,
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 4, 8);
|
case MENU_BATCAL:
|
||||||
|
{
|
||||||
already_printed = true;
|
const uint16_t vol = (uint32_t)gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
||||||
}
|
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!already_printed)
|
if (!already_printed)
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
{ // we now do multi-line text in a single string
|
||||||
|
|
||||||
|
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 (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
|
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
|
||||||
{
|
{
|
||||||
|
|||||||
70
ui/menu.h
70
ui/menu.h
@@ -49,13 +49,16 @@ enum
|
|||||||
MENU_MEM_NAME,
|
MENU_MEM_NAME,
|
||||||
MENU_MDF,
|
MENU_MDF,
|
||||||
MENU_SAVE,
|
MENU_SAVE,
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
MENU_VOX,
|
MENU_VOX,
|
||||||
|
#endif
|
||||||
MENU_ABR,
|
MENU_ABR,
|
||||||
|
MENU_ABR_ON_TX_RX,
|
||||||
MENU_TDR,
|
MENU_TDR,
|
||||||
MENU_BEEP,
|
MENU_BEEP,
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
MENU_VOICE,
|
MENU_VOICE,
|
||||||
#endif
|
#endif
|
||||||
MENU_SC_REV,
|
MENU_SC_REV,
|
||||||
MENU_AUTOLK,
|
MENU_AUTOLK,
|
||||||
MENU_S_ADD1,
|
MENU_S_ADD1,
|
||||||
@@ -63,27 +66,25 @@ enum
|
|||||||
MENU_STE,
|
MENU_STE,
|
||||||
MENU_RP_STE,
|
MENU_RP_STE,
|
||||||
MENU_MIC,
|
MENU_MIC,
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
MENU_MIC_BAR,
|
MENU_MIC_BAR,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COMPANDER
|
MENU_COMPAND,
|
||||||
MENU_COMPAND,
|
|
||||||
#endif
|
|
||||||
MENU_1_CALL,
|
MENU_1_CALL,
|
||||||
MENU_S_LIST,
|
MENU_S_LIST,
|
||||||
MENU_SLIST1,
|
MENU_SLIST1,
|
||||||
MENU_SLIST2,
|
MENU_SLIST2,
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
MENU_AL_MOD,
|
MENU_AL_MOD,
|
||||||
#endif
|
#endif
|
||||||
MENU_ANI_ID,
|
MENU_ANI_ID,
|
||||||
MENU_UPCODE,
|
MENU_UPCODE,
|
||||||
MENU_DWCODE,
|
MENU_DWCODE,
|
||||||
|
MENU_PTT_ID,
|
||||||
MENU_D_ST,
|
MENU_D_ST,
|
||||||
MENU_D_RSP,
|
MENU_D_RSP,
|
||||||
MENU_D_HOLD,
|
MENU_D_HOLD,
|
||||||
MENU_D_PRE,
|
MENU_D_PRE,
|
||||||
MENU_PTT_ID,
|
|
||||||
MENU_D_DCD,
|
MENU_D_DCD,
|
||||||
MENU_D_LIST,
|
MENU_D_LIST,
|
||||||
MENU_D_LIVE_DEC,
|
MENU_D_LIVE_DEC,
|
||||||
@@ -92,15 +93,15 @@ enum
|
|||||||
MENU_VOL,
|
MENU_VOL,
|
||||||
MENU_BAT_TXT,
|
MENU_BAT_TXT,
|
||||||
MENU_AM,
|
MENU_AM,
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
MENU_AM_FIX,
|
MENU_AM_FIX,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
MENU_AM_FIX_TEST1,
|
MENU_AM_FIX_TEST1,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
MENU_NOAA_S,
|
MENU_NOAA_S,
|
||||||
#endif
|
#endif
|
||||||
MENU_RESET,
|
MENU_RESET,
|
||||||
|
|
||||||
// items after here are normally hidden
|
// items after here are normally hidden
|
||||||
@@ -113,7 +114,10 @@ enum
|
|||||||
MENU_SCREN,
|
MENU_SCREN,
|
||||||
|
|
||||||
MENU_TX_EN, // enable TX
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const t_menu_item MenuList[];
|
extern const t_menu_item MenuList[];
|
||||||
@@ -124,26 +128,24 @@ extern const char gSubMenu_W_N[2][7];
|
|||||||
extern const char gSubMenu_OFF_ON[2][4];
|
extern const char gSubMenu_OFF_ON[2][4];
|
||||||
extern const char gSubMenu_SAVE[5][4];
|
extern const char gSubMenu_SAVE[5][4];
|
||||||
extern const char gSubMenu_TOT[11][7];
|
extern const char gSubMenu_TOT[11][7];
|
||||||
extern const char gSubMenu_CHAN[3][7];
|
extern const char gSubMenu_CHAN[3][10];
|
||||||
extern const char gSubMenu_XB[3][7];
|
extern const char gSubMenu_XB[3][10];
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
extern const char gSubMenu_VOICE[3][4];
|
extern const char gSubMenu_VOICE[3][4];
|
||||||
#endif
|
#endif
|
||||||
extern const char gSubMenu_SC_REV[3][3];
|
extern const char gSubMenu_SC_REV[3][13];
|
||||||
extern const char gSubMenu_MDF[4][8];
|
extern const char gSubMenu_MDF[4][15];
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
extern const char gSubMenu_AL_MOD[2][5];
|
extern const char gSubMenu_AL_MOD[2][5];
|
||||||
#endif
|
#endif
|
||||||
extern const char gSubMenu_D_RSP[4][6];
|
extern const char gSubMenu_D_RSP[4][11];
|
||||||
extern const char gSubMenu_PTT_ID[4][5];
|
extern const char gSubMenu_PTT_ID[4][7];
|
||||||
extern const char gSubMenu_PONMSG[4][5];
|
extern const char gSubMenu_PONMSG[4][8];
|
||||||
extern const char gSubMenu_ROGER[3][6];
|
extern const char gSubMenu_ROGER[3][9];
|
||||||
extern const char gSubMenu_RESET[2][4];
|
extern const char gSubMenu_RESET[2][4];
|
||||||
extern const char gSubMenu_F_LOCK[6][4];
|
extern const char gSubMenu_F_LOCK[6][4];
|
||||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||||
#ifdef ENABLE_COMPANDER
|
extern const char gSubMenu_RX_TX[4][6];
|
||||||
extern const char gSubMenu_Compand[4][6];
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
extern const char gSubMenu_AM_fix_test1[4][8];
|
extern const char gSubMenu_AM_fix_test1[4][8];
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
124
ui/status.c
124
ui/status.c
@@ -45,12 +45,26 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
// **************
|
// **************
|
||||||
|
|
||||||
// POWER-SAVE indicator
|
// POWER-SAVE indicator
|
||||||
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
|
{
|
||||||
|
memmove(line + x, BITMAP_TX, sizeof(BITMAP_TX));
|
||||||
|
x1 = x + sizeof(BITMAP_TX);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING)
|
||||||
|
{
|
||||||
|
memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX));
|
||||||
|
x1 = x + sizeof(BITMAP_RX);
|
||||||
|
}
|
||||||
|
else
|
||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
|
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
|
||||||
{
|
{
|
||||||
memmove(line + x, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
|
memmove(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
|
||||||
x1 = x + sizeof(BITMAP_PowerSave);
|
x1 = x + sizeof(BITMAP_POWERSAVE);
|
||||||
}
|
}
|
||||||
x += sizeof(BITMAP_PowerSave);
|
x += sizeof(BITMAP_POWERSAVE);
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
// NOASS SCAN indicator
|
// NOASS SCAN indicator
|
||||||
@@ -82,10 +96,22 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
// SCAN indicator
|
// SCAN indicator
|
||||||
if (gScanState != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
if (gScanState != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
||||||
{
|
{
|
||||||
memmove(line + x, BITMAP_SC, sizeof(BITMAP_SC));
|
if (gEeprom.SCAN_LIST_DEFAULT == 0)
|
||||||
x1 = x + sizeof(BITMAP_SC);
|
// memmove(line + x, BITMAP_SC1, sizeof(BITMAP_SC1));
|
||||||
|
UI_PrintStringSmallBuffer("1", line + x);
|
||||||
|
else
|
||||||
|
if (gEeprom.SCAN_LIST_DEFAULT == 1)
|
||||||
|
// memmove(line + x, BITMAP_SC2, sizeof(BITMAP_SC2));
|
||||||
|
UI_PrintStringSmallBuffer("2", line + x);
|
||||||
|
else
|
||||||
|
if (gEeprom.SCAN_LIST_DEFAULT == 2)
|
||||||
|
// memmove(line + x, BITMAP_SCA, sizeof(BITMAP_SCA));
|
||||||
|
UI_PrintStringSmallBuffer("*", line + x);
|
||||||
|
// x1 = x + sizeof(BITMAP_SC1);
|
||||||
|
x1 = x + 7;
|
||||||
}
|
}
|
||||||
x += sizeof(BITMAP_SC);
|
// x += sizeof(BITMAP_SC1);
|
||||||
|
x += 7; // font character width
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
// VOICE indicator
|
// VOICE indicator
|
||||||
@@ -117,13 +143,15 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
}
|
}
|
||||||
x += sizeof(BITMAP_XB);
|
x += sizeof(BITMAP_XB);
|
||||||
|
|
||||||
// VOX indicator
|
#ifdef ENABLE_VOX
|
||||||
if (gEeprom.VOX_SWITCH || test_display)
|
// VOX indicator
|
||||||
{
|
if (gEeprom.VOX_SWITCH || test_display)
|
||||||
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
{
|
||||||
x1 = x + sizeof(BITMAP_VOX);
|
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||||
}
|
x1 = x + sizeof(BITMAP_VOX);
|
||||||
x += sizeof(BITMAP_VOX);
|
}
|
||||||
|
x += sizeof(BITMAP_VOX);
|
||||||
|
#endif
|
||||||
|
|
||||||
// KEY-LOCK indicator
|
// KEY-LOCK indicator
|
||||||
if (gEeprom.KEY_LOCK || test_display)
|
if (gEeprom.KEY_LOCK || test_display)
|
||||||
@@ -169,8 +197,7 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
|
|
||||||
case 2: // percentage
|
case 2: // percentage
|
||||||
{
|
{
|
||||||
const uint16_t percent = BATTERY_VoltsToPercent(gBatteryVoltageAverage);
|
sprintf(s, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||||
sprintf(s, "%u%%", percent);
|
|
||||||
space_needed = (7 * strlen(s));
|
space_needed = (7 * strlen(s));
|
||||||
if (x2 >= (x1 + space_needed))
|
if (x2 >= (x1 + space_needed))
|
||||||
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
|
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
|
||||||
@@ -188,54 +215,49 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
x += sizeof(BITMAP_USB_C);
|
x += sizeof(BITMAP_USB_C);
|
||||||
|
|
||||||
// BATTERY LEVEL indicator
|
// BATTERY LEVEL indicator
|
||||||
#if 1
|
|
||||||
if (gBatteryDisplayLevel >= 2 && !gLowBattery)
|
if (gBatteryDisplayLevel >= 2 && !gLowBattery)
|
||||||
{
|
{
|
||||||
line += x;
|
line += x;
|
||||||
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||||
|
|
||||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||||
line += sizeof(BITMAP_BatteryLevel1);
|
line += sizeof(BITMAP_BatteryLevel1);
|
||||||
if (gBatteryDisplayLevel >= 2)
|
{
|
||||||
memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
const int8_t pos[] = {-4, -7, -10, 13};
|
||||||
if (gBatteryDisplayLevel >= 5)
|
for (unsigned int i = 0; i < ARRAY_SIZE(pos); i++)
|
||||||
memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
if (gBatteryDisplayLevel >= (2 + i))
|
||||||
if (gBatteryDisplayLevel >= 7)
|
memmove(line + pos[i], BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (gBatteryDisplayLevel >= 9)
|
/* switch (gBatteryDisplayLevel)
|
||||||
memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
{
|
||||||
|
default:
|
||||||
|
case 5: memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 4: memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 3: memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 2: memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
}
|
||||||
|
*/ }
|
||||||
#else
|
#else
|
||||||
if (gBatteryDisplayLevel >= 2)
|
{
|
||||||
memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
const int8_t pos[] = {3, 6, 9, 12};
|
||||||
if (gBatteryDisplayLevel >= 5)
|
for (unsigned int i = 0; i < ARRAY_SIZE(pos); i++)
|
||||||
memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
if (gBatteryDisplayLevel >= (2 + i))
|
||||||
if (gBatteryDisplayLevel >= 7)
|
memmove(line + pos[i], BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
/*
|
||||||
if (gBatteryDisplayLevel >= 9)
|
switch (gBatteryDisplayLevel)
|
||||||
memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
{
|
||||||
|
default:
|
||||||
|
case 5: memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 4: memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 3: memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
case 2: memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||||
|
}
|
||||||
|
*/ }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (gLowBatteryBlink == 1)
|
if (gLowBatteryBlink == 1)
|
||||||
memmove(line + x, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
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
|
|
||||||
|
|
||||||
// **************
|
// **************
|
||||||
|
|
||||||
|
|||||||
1
ui/ui.c
1
ui/ui.c
@@ -91,7 +91,6 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
|||||||
gAskForConfirmation = 0;
|
gAskForConfirmation = 0;
|
||||||
gDTMF_InputMode = false;
|
gDTMF_InputMode = false;
|
||||||
gDTMF_InputIndex = 0;
|
gDTMF_InputIndex = 0;
|
||||||
gF_LOCK = false;
|
|
||||||
gAskToSave = false;
|
gAskToSave = false;
|
||||||
gAskToDelete = false;
|
gAskToDelete = false;
|
||||||
|
|
||||||
|
|||||||
12
ui/welcome.c
12
ui/welcome.c
@@ -27,6 +27,18 @@
|
|||||||
#include "ui/status.h"
|
#include "ui/status.h"
|
||||||
#include "version.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)
|
void UI_DisplayWelcome(void)
|
||||||
{
|
{
|
||||||
char WelcomeString0[16];
|
char WelcomeString0[16];
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#ifndef UI_WELCOME_H
|
#ifndef UI_WELCOME_H
|
||||||
#define UI_WELCOME_H
|
#define UI_WELCOME_H
|
||||||
|
|
||||||
|
void UI_DisplayReleaseKeys(void);
|
||||||
void UI_DisplayWelcome(void);
|
void UI_DisplayWelcome(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
123
utils/main.cpp
123
utils/main.cpp
@@ -93,15 +93,29 @@ void create_gain_table(const char *filename)
|
|||||||
mixer_dB[orig_mixer] +
|
mixer_dB[orig_mixer] +
|
||||||
pga_dB[orig_pga];
|
pga_dB[orig_pga];
|
||||||
|
|
||||||
const uint8_t lna_short_min = 0; // 0
|
#if 1
|
||||||
const uint8_t lna_min = 0; // 0
|
// full table
|
||||||
const uint8_t mixer_min = 0; // 0
|
const uint8_t lna_short_min = 0; // 0
|
||||||
const uint8_t pga_min = 0; // 0
|
const uint8_t lna_min = 0; // 0
|
||||||
|
const uint8_t mixer_min = 0; // 0
|
||||||
|
const uint8_t pga_min = 0; // 0
|
||||||
|
|
||||||
const uint8_t lna_short_max = 3; // 3
|
const uint8_t lna_short_max = 3; // 3
|
||||||
const uint8_t lna_max = 7; // 5
|
const uint8_t lna_max = 7; // 5
|
||||||
const uint8_t mixer_max = 3; // 3
|
const uint8_t mixer_max = 3; // 3
|
||||||
const uint8_t pga_max = 7; // 7
|
const uint8_t pga_max = 7; // 7
|
||||||
|
#else
|
||||||
|
// just one register changes
|
||||||
|
const uint8_t lna_short_min = 0;
|
||||||
|
const uint8_t lna_min = 2;
|
||||||
|
const uint8_t mixer_min = 3;
|
||||||
|
const uint8_t pga_min = 6;
|
||||||
|
|
||||||
|
const uint8_t lna_short_max = 3;
|
||||||
|
const uint8_t lna_max = 2;
|
||||||
|
const uint8_t mixer_max = 3;
|
||||||
|
const uint8_t pga_max = 6;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t lna_short = lna_short_min;
|
uint8_t lna_short = lna_short_min;
|
||||||
uint8_t lna = lna_min;
|
uint8_t lna = lna_min;
|
||||||
@@ -244,37 +258,90 @@ void create_gain_table(const char *filename)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf(file, "\n");
|
fprintf(file, "\n");
|
||||||
fprintf(file, "\tconst t_am_fix_gain_table am_fix_gain_table[] =\n");
|
fprintf(file, "\tstatic const t_am_fix_gain_table am_fix_gain_table[] =\n");
|
||||||
fprintf(file, "\t{\n");
|
fprintf(file, "\t{\n");
|
||||||
fprintf(file, "\t\t{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original\n\n");
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < gain_table.size(); i++)
|
#if 0
|
||||||
|
fprintf(file, "\t\t{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original\n\n");
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < gain_table.size(); i++)
|
||||||
|
{
|
||||||
|
char s[1024];
|
||||||
|
|
||||||
|
const t_gain_table entry = gain_table[i];
|
||||||
|
|
||||||
|
sprintf(s, "\t\t{%u, %u, %u, %u}, // %3u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
||||||
|
entry.lna_short,
|
||||||
|
entry.lna,
|
||||||
|
entry.mixer,
|
||||||
|
entry.pga,
|
||||||
|
1 + i,
|
||||||
|
entry.lna_short_dB,
|
||||||
|
entry.lna_dB,
|
||||||
|
entry.mixer_dB,
|
||||||
|
entry.pga_dB,
|
||||||
|
entry.sum_dB);
|
||||||
|
|
||||||
|
if (i == original_index)
|
||||||
|
strcat(s, " original");
|
||||||
|
|
||||||
|
fprintf(file, "%s\n", s);
|
||||||
|
}
|
||||||
|
#else
|
||||||
{
|
{
|
||||||
char s[1024];
|
//BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
||||||
|
|
||||||
const t_gain_table entry = gain_table[i];
|
uint16_t reg_val;
|
||||||
|
int16_t sum_dB;
|
||||||
|
|
||||||
sprintf(s, "\t\t{%u, %u, %u, %u}, // %3u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
reg_val = ((uint16_t)orig_lna_short << 8) | ((uint16_t)orig_lna << 5) | ((uint16_t)orig_mixer << 3) | ((uint16_t)orig_pga << 0);
|
||||||
entry.lna_short,
|
sum_dB = lna_short_dB[orig_lna_short] + lna_dB[orig_lna] + mixer_dB[orig_mixer] + pga_dB[orig_pga];
|
||||||
entry.lna,
|
fprintf(file, "\t\t{0x%04X, %-3d}, // 0 .. %u %u %u %u .. 0dB -14dB 0dB -3dB .. -17dB original\n\n",
|
||||||
entry.mixer,
|
reg_val,
|
||||||
entry.pga,
|
sum_dB,
|
||||||
1 + i,
|
orig_lna_short,
|
||||||
entry.lna_short_dB,
|
orig_lna,
|
||||||
entry.lna_dB,
|
orig_mixer,
|
||||||
entry.mixer_dB,
|
orig_pga);
|
||||||
entry.pga_dB,
|
|
||||||
entry.sum_dB);
|
|
||||||
|
|
||||||
if (i == original_index)
|
for (unsigned int i = 0; i < gain_table.size(); i++)
|
||||||
strcat(s, " original");
|
{
|
||||||
|
char s[1024];
|
||||||
|
|
||||||
fprintf(file, "%s\n", s);
|
const t_gain_table entry = gain_table[i];
|
||||||
|
|
||||||
|
reg_val = ((uint16_t)entry.lna_short << 8) | ((uint16_t)entry.lna << 5) | ((uint16_t)entry.mixer << 3) | ((uint16_t)entry.pga << 0);
|
||||||
|
sum_dB = lna_short_dB[entry.lna_short] + lna_dB[entry.lna] + mixer_dB[entry.mixer] + pga_dB[entry.pga];
|
||||||
|
|
||||||
|
sprintf(s, "\t\t{0x%04X, %-3d}, // %3u .. %u %u %u %u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
||||||
|
reg_val,
|
||||||
|
sum_dB,
|
||||||
|
|
||||||
|
1 + i,
|
||||||
|
|
||||||
|
entry.lna_short,
|
||||||
|
entry.lna,
|
||||||
|
entry.mixer,
|
||||||
|
entry.pga,
|
||||||
|
|
||||||
|
entry.lna_short_dB,
|
||||||
|
entry.lna_dB,
|
||||||
|
entry.mixer_dB,
|
||||||
|
entry.pga_dB,
|
||||||
|
|
||||||
|
entry.sum_dB);
|
||||||
|
|
||||||
|
if (i == original_index)
|
||||||
|
strcat(s, " original");
|
||||||
|
|
||||||
|
fprintf(file, "%s\n", s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(file, "\t};\n\n");
|
fprintf(file, "\t};\n\n");
|
||||||
|
|
||||||
fprintf(file, "\tconst unsigned int original_index = %u;\n", 1 + original_index);
|
fprintf(file, "\tstatic const unsigned int original_index = %u;\n", 1 + original_index);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
utils/misc.exe
BIN
utils/misc.exe
Binary file not shown.
Reference in New Issue
Block a user