Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a43a3f949f | ||
|
|
d7b6cdf444 | ||
|
|
7916d79ff1 | ||
|
|
49cec54cd3 | ||
|
|
f154aebd38 | ||
|
|
aaa55c5742 | ||
|
|
345f1444f5 | ||
|
|
7e91d67b53 | ||
|
|
ba29176f33 | ||
|
|
05feff432e | ||
|
|
cf4f85cb22 | ||
|
|
a0c2181197 | ||
|
|
b4abf369e1 | ||
|
|
be0636d69b | ||
|
|
23986a8648 | ||
|
|
b1d3a95ca2 | ||
|
|
1238bf090c | ||
|
|
5987e03141 |
33
.github/workflows/main.yml
vendored
Normal file
33
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: arm-none-eabi-gcc
|
||||
uses: carlosperate/arm-none-eabi-gcc-action@v1
|
||||
with:
|
||||
release: '10.3-2021.10'
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: python -m pip install --upgrade pip crcmod
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Submodules
|
||||
run: git submodule update --init --recursive --depth 1
|
||||
|
||||
- name: Make
|
||||
run: make
|
||||
|
||||
- name: size
|
||||
run: arm-none-eabi-size firmware
|
||||
|
||||
- name: 'Upload Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: firmware
|
||||
path: firmware*.bin
|
||||
45
.github/workflows/release.yaml
vendored
Normal file
45
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: arm-none-eabi-gcc
|
||||
uses: carlosperate/arm-none-eabi-gcc-action@v1
|
||||
with:
|
||||
release: '10.3-2021.10'
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: python3 -m pip install --upgrade pip crcmod
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Submodules
|
||||
run: git submodule update --init --recursive --depth 1
|
||||
|
||||
- name: Make
|
||||
run: make
|
||||
|
||||
- name: size
|
||||
run: arm-none-eabi-size firmware
|
||||
|
||||
- name: 'Upload Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: firmware
|
||||
path: firmware*.bin
|
||||
|
||||
- name: Upload binaries to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: firmware.packed.bin
|
||||
asset_name: egzumer_$tag.packed.bin
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
release_name: release ${{ github.ref_name }}
|
||||
12
Makefile
12
Makefile
@@ -26,7 +26,7 @@ ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0
|
||||
ENABLE_BOOT_BEEPS := 0
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 1
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 0
|
||||
ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||
ENABLE_NO_CODE_SCAN_TIMEOUT := 1
|
||||
ENABLE_AM_FIX := 1
|
||||
ENABLE_AM_FIX_SHOW_DATA := 0
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1
|
||||
@@ -37,7 +37,7 @@ ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
ENABLE_SPECTRUM := 1
|
||||
ENABLE_REDUCE_LOW_MID_TX_POWER:= 0
|
||||
ENABLE_BYP_RAW_DEMODULATORS := 0
|
||||
|
||||
ENABLE_BLMIN_TMP_OFF := 0
|
||||
#############################################################
|
||||
|
||||
TARGET = firmware
|
||||
@@ -99,12 +99,13 @@ ifeq ($(ENABLE_AIRCOPY),1)
|
||||
OBJS += app/aircopy.o
|
||||
endif
|
||||
OBJS += app/app.o
|
||||
OBJS += app/chFrScanner.o
|
||||
OBJS += app/common.o
|
||||
OBJS += app/dtmf.o
|
||||
ifeq ($(ENABLE_FMRADIO),1)
|
||||
OBJS += app/fm.o
|
||||
endif
|
||||
OBJS += app/generic.o
|
||||
OBJS += app/common.o
|
||||
OBJS += app/main.o
|
||||
OBJS += app/menu.o
|
||||
ifeq ($(ENABLE_SPECTRUM), 1)
|
||||
@@ -282,7 +283,7 @@ endif
|
||||
ifeq ($(ENABLE_REVERSE_BAT_SYMBOL),1)
|
||||
CFLAGS += -DENABLE_REVERSE_BAT_SYMBOL
|
||||
endif
|
||||
ifeq ($(ENABLE_CODE_SCAN_TIMEOUT),1)
|
||||
ifeq ($(ENABLE_NO_CODE_SCAN_TIMEOUT),1)
|
||||
CFLAGS += -DENABLE_CODE_SCAN_TIMEOUT
|
||||
endif
|
||||
ifeq ($(ENABLE_AM_FIX),1)
|
||||
@@ -324,6 +325,9 @@ endif
|
||||
ifeq ($(ENABLE_BYP_RAW_DEMODULATORS),1)
|
||||
CFLAGS += -DENABLE_BYP_RAW_DEMODULATORS
|
||||
endif
|
||||
ifeq ($(ENABLE_BLMIN_TMP_OFF),1)
|
||||
CFLAGS += -DENABLE_BLMIN_TMP_OFF
|
||||
endif
|
||||
|
||||
LDFLAGS =
|
||||
ifeq ($(ENABLE_CLANG),0)
|
||||
|
||||
67
README.md
67
README.md
@@ -1,7 +1,32 @@
|
||||
# Main features:
|
||||
- many of OneOfEleven mods, including AM fix
|
||||
- fagci spectrum analyzer (**F+5** to turn on)
|
||||
- some other mods introduced by me
|
||||
* many of OneOfEleven mods:
|
||||
* AM fix, huge improvement in reception quality
|
||||
* longpress buttons functions replicating F+ action
|
||||
* fast scanning
|
||||
* channel name editing in the menu
|
||||
* channel name + frequency display option
|
||||
* shortcut for scannlist assignment (longpress `5 NOAA`)
|
||||
* scannlist toggle (longpress `* Scan` while scanning)
|
||||
* configurable button function selectable from menu
|
||||
* battery percentage/voltage on status bar, selectable from menu
|
||||
* longer backlight times
|
||||
* mic bar
|
||||
* RSSI s-meter
|
||||
* more frequency steps
|
||||
* squelch more sensitive
|
||||
* fagci spectrum analyzer (**F+5** to turn on)
|
||||
* some other mods introduced by me:
|
||||
* SSB demodulation (adopted from fagci)
|
||||
* backlight dimming
|
||||
* battery voltage callibration from menu
|
||||
* better battery percentage calculation, selectable for 1600mAh or 2200mAh
|
||||
* more configurable button functions
|
||||
* longpress MENU as another cofigurable button
|
||||
* better DCS/CTCSS scanning in the menu (`* SCAN` while in RX DCS/CTCSS menu item)
|
||||
* Piotr022 s-meter style
|
||||
* restore initial freq/channel when scanning stopped with EXIT, remember last found transmission with MENU button
|
||||
* reordered and renamed menu entries
|
||||
* LCD interference crash fix
|
||||
|
||||
# Manual
|
||||
|
||||
@@ -73,45 +98,25 @@ ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq
|
||||
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
|
||||
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-end/PA not designed for full range)
|
||||
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
|
||||
ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu
|
||||
ENABLE_F_CAL_MENU := 0 enable 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_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
||||
ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan)
|
||||
ENABLE_NO_CODE_SCAN_TIMEOUT := 1 disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan)
|
||||
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 0 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy
|
||||
ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
|
||||
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M')
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
|
||||
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
||||
ENABLE_AUDIO_BAR := 0 experimental, display an audio bar level when TX'ing
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press `1 BAND` when in channel mode
|
||||
ENABLE_SPECTRUM := 1 fagci spectrum analizer, activated with `F` + `5 NOAA`
|
||||
ENABLE_REDUCE_LOW_MID_TX_POWER:= 0 makes medium and low power settings even lower
|
||||
ENABLE_BYP_RAW_DEMODULATORS := 0 additional BYP (bypass?) and RAW demodulation options, prooved not to be very usefull, but it is there if you want to experiment
|
||||
ENABLE_BLMIN_TMP_OFF := 0 additional function for configurable buttons that toggles `BLMin` on and off wihout saving it to the EEPROM
|
||||
```
|
||||
|
||||
# New/modified function keys
|
||||
|
||||
* Long-press 'M' .. Copy selected channel into same VFO, then switch VFO to frequency mode
|
||||
*
|
||||
* Long-press '7' .. Toggle selected channel scanlist setting .. if VOX is disabled in Makefile
|
||||
* or
|
||||
* Long-press '5' .. Toggle selected channel scanlist setting .. if NOAA is disabled in Makefile
|
||||
*
|
||||
* Long-press '*' .. Start scanning, then toggles the scanning between scanlists 1, 2 or ALL channels
|
||||
|
||||
# Some changes made from the Quansheng firmware
|
||||
|
||||
* Various Quansheng firmware bugs fixed
|
||||
* Added new bugs
|
||||
* Mic menu includes max gain possible
|
||||
* AM RX everywhere (left the TX as is)
|
||||
* An attempt to improve the AM RX audio (demodulator getting saturated/overloaded in Quansheng firmware)
|
||||
* keypad-5/NOAA button now toggles scanlist-1 on/off for current channel when held down - IF NOAA not used
|
||||
* Better backlight times (inc always on)
|
||||
* Live DTMF decoder option, though the decoder needs some coeff tuning changes to decode other radios it seems
|
||||
* Various menu re-wordings (trying to reduce 'WTH does that mean ?')
|
||||
* ..
|
||||
|
||||
# Compiler
|
||||
|
||||
|
||||
55
app/action.c
55
app/action.c
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "app/action.h"
|
||||
#include "app/app.h"
|
||||
#include "app/chFrScanner.h"
|
||||
#include "app/common.h"
|
||||
#include "app/dtmf.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -31,6 +32,7 @@
|
||||
#endif
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/backlight.h"
|
||||
#include "functions.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
@@ -116,6 +118,7 @@ void ACTION_Monitor(void)
|
||||
|
||||
void ACTION_Scan(bool bRestart)
|
||||
{
|
||||
(void)bRestart;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
{
|
||||
@@ -164,7 +167,7 @@ void ACTION_Scan(bool bRestart)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
if (!SCANNER_IsScanning())
|
||||
{ // not scanning
|
||||
|
||||
gMonitor = false;
|
||||
@@ -192,7 +195,7 @@ void ACTION_Scan(bool bRestart)
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
SCANNER_ScanChannels(false, gScanStateDir);
|
||||
CHFRSCANNER_Start(false, gScanStateDir);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
@@ -201,7 +204,7 @@ void ACTION_Scan(bool bRestart)
|
||||
else
|
||||
{ // stop scanning
|
||||
|
||||
SCANNER_Stop();
|
||||
CHFRSCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
@@ -211,7 +214,7 @@ void ACTION_Scan(bool bRestart)
|
||||
else
|
||||
{ // start scanning
|
||||
|
||||
SCANNER_ScanChannels(true, SCAN_FWD);
|
||||
CHFRSCANNER_Start(true, SCAN_FWD);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
@@ -227,31 +230,6 @@ void ACTION_Scan(bool bRestart)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
// if (!bRestart)
|
||||
if (!bRestart && IS_MR_CHANNEL(gNextMrChannel))
|
||||
{ // channel mode, keep scanning but toggle between scan lists
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
SCANNER_ScanChannels(false, gScanStateDir);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
else
|
||||
{ // stop scanning
|
||||
gMonitor = false;
|
||||
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
@@ -332,6 +310,20 @@ void ACTION_SwitchDemodul(void)
|
||||
gRequestSaveChannel = 1;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
void ACTION_BlminTmpOff(void)
|
||||
{
|
||||
if(++gEeprom.BACKLIGHT_MIN_STAT == BLMIN_STAT_UNKNOWN)
|
||||
{
|
||||
gEeprom.BACKLIGHT_MIN_STAT = BLMIN_STAT_ON;
|
||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MIN);
|
||||
} else
|
||||
{
|
||||
BACKLIGHT_SetBrightness(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gScreenToDisplay == DISPLAY_MAIN && gDTMF_InputMode) // entering DTMF code
|
||||
@@ -450,5 +442,10 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
case ACTION_OPT_SWITCH_DEMODUL:
|
||||
ACTION_SwitchDemodul();
|
||||
break;
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
case ACTION_OPT_BLMIN_TMP_OFF:
|
||||
ACTION_BlminTmpOff();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ void ACTION_Scan(bool bRestart);
|
||||
#endif
|
||||
void ACTION_SwitchDemodul(void);
|
||||
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
void ACTION_BlminTmpOff(void);
|
||||
#endif
|
||||
|
||||
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
|
||||
#endif
|
||||
|
||||
286
app/app.c
286
app/app.c
@@ -21,6 +21,7 @@
|
||||
#include "app/aircopy.h"
|
||||
#endif
|
||||
#include "app/app.h"
|
||||
#include "app/chFrScanner.h"
|
||||
#include "app/dtmf.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
@@ -92,15 +93,6 @@ static void CheckForIncoming(void)
|
||||
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
{ // not RF scanning
|
||||
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE)
|
||||
{ // CTCSS/DTS scanning
|
||||
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_DETECTED;
|
||||
}
|
||||
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
||||
{ // dual watch is disabled
|
||||
|
||||
@@ -219,7 +211,7 @@ static void HandleIncoming(void)
|
||||
if (!bFlag)
|
||||
return;
|
||||
|
||||
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
{ // not scanning
|
||||
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||
{ // DTMF DCD is enabled
|
||||
@@ -407,7 +399,7 @@ Skip:
|
||||
break;
|
||||
|
||||
case SCAN_RESUME_SE:
|
||||
SCANNER_Stop();
|
||||
CHFRSCANNER_Stop();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -483,7 +475,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
SCANNER_Found();
|
||||
CHFRSCANNER_Found();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gIsNoaaMode) {
|
||||
@@ -497,11 +489,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
gCssScanMode = CSS_SCAN_MODE_FOUND;
|
||||
|
||||
if (gScanStateDir == SCAN_OFF &&
|
||||
gCssScanMode == CSS_SCAN_MODE_OFF &&
|
||||
gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{ // not scanning, dual watch is enabled
|
||||
|
||||
@@ -633,7 +621,7 @@ static void DualwatchAlternate(void)
|
||||
|
||||
static void CheckRadioInterrupts(void)
|
||||
{
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||
if (SCANNER_IsScanning())
|
||||
return;
|
||||
|
||||
while (BK4819_ReadRegister(BK4819_REG_0C) & 1u)
|
||||
@@ -805,7 +793,7 @@ void APP_EndTransmission(void)
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
||||
return;
|
||||
|
||||
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
return;
|
||||
|
||||
if (gVOX_NoiseDetected)
|
||||
@@ -896,23 +884,12 @@ void APP_Update(void)
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0)
|
||||
if (!SCANNER_IsScanning() && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed)
|
||||
if (!SCANNER_IsScanning() && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed)
|
||||
#endif
|
||||
{ // scanning
|
||||
SCANNER_ContinueScanning();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gCssScanMode == CSS_SCAN_MODE_SCANNING && gScheduleScanListen && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gCssScanMode == CSS_SCAN_MODE_SCANNING && gScheduleScanListen)
|
||||
#endif
|
||||
{
|
||||
MENU_SelectNextCode();
|
||||
|
||||
gScheduleScanListen = false;
|
||||
CHFRSCANNER_ContinueScanning();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
@@ -931,7 +908,7 @@ void APP_Update(void)
|
||||
#endif
|
||||
|
||||
// toggle between the VFO's if dual watch is enabled
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
if (!SCANNER_IsScanning() && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gScheduleDualWatch && gVoiceWriteIndex == 0)
|
||||
@@ -939,7 +916,7 @@ void APP_Update(void)
|
||||
if (gScheduleDualWatch)
|
||||
#endif
|
||||
{
|
||||
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
{
|
||||
if (!gPttIsPressed &&
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -990,7 +967,7 @@ void APP_Update(void)
|
||||
gKeyBeingHeld ||
|
||||
gEeprom.BATTERY_SAVE == 0 ||
|
||||
gScanStateDir != SCAN_OFF ||
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||
gCssBackgroundScan ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
@@ -1014,7 +991,7 @@ void APP_Update(void)
|
||||
gKeyBeingHeld ||
|
||||
gEeprom.BATTERY_SAVE == 0 ||
|
||||
gScanStateDir != SCAN_OFF ||
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||
gCssBackgroundScan ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
@@ -1048,7 +1025,7 @@ void APP_Update(void)
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF &&
|
||||
gScanStateDir == SCAN_OFF &&
|
||||
gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
!gCssBackgroundScan)
|
||||
{ // dual watch mode, toggle between the two VFO's
|
||||
DualwatchAlternate();
|
||||
|
||||
@@ -1061,7 +1038,7 @@ void APP_Update(void)
|
||||
gRxIdleMode = false; // RX is awake
|
||||
}
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gUpdateRSSI)
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanStateDir != SCAN_OFF || gCssBackgroundScan || gUpdateRSSI)
|
||||
{ // dual watch mode off or scanning or rssi update request
|
||||
|
||||
UpdateRSSI(gEeprom.RX_VFO);
|
||||
@@ -1330,153 +1307,33 @@ void APP_TimeSlice10ms(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode && gFM_RestoreCountdown_10ms > 0)
|
||||
{
|
||||
if (--gFM_RestoreCountdown_10ms == 0)
|
||||
{ // switch back to FM radio mode
|
||||
FM_Start();
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode && gFM_RestoreCountdown_10ms > 0)
|
||||
{
|
||||
uint32_t Result;
|
||||
int32_t Delta;
|
||||
BK4819_CssScanResult_t ScanResult;
|
||||
uint16_t CtcssFreq;
|
||||
|
||||
if (gScanDelay_10ms > 0)
|
||||
{
|
||||
if (--gScanDelay_10ms > 0)
|
||||
{
|
||||
CheckKeys();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gScannerEditState != 0)
|
||||
{
|
||||
CheckKeys();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (gScanCssState)
|
||||
{
|
||||
case SCAN_CSS_STATE_OFF:
|
||||
|
||||
// must be RF frequency scanning if we're here ?
|
||||
|
||||
if (!BK4819_GetFrequencyScanResult(&Result))
|
||||
break;
|
||||
|
||||
Delta = Result - gScanFrequency;
|
||||
gScanFrequency = Result;
|
||||
|
||||
if (Delta < 0)
|
||||
Delta = -Delta;
|
||||
if (Delta < 100)
|
||||
gScanHitCount++;
|
||||
else
|
||||
gScanHitCount = 0;
|
||||
|
||||
BK4819_DisableFrequencyScan();
|
||||
|
||||
if (gScanHitCount < 3)
|
||||
{
|
||||
BK4819_EnableFrequencyScan();
|
||||
}
|
||||
else
|
||||
{
|
||||
BK4819_SetScanFrequency(gScanFrequency);
|
||||
gScanCssResultCode = 0xFF;
|
||||
gScanCssResultType = 0xFF;
|
||||
gScanHitCount = 0;
|
||||
gScanUseCssResult = false;
|
||||
gScanProgressIndicator = 0;
|
||||
gScanCssState = SCAN_CSS_STATE_SCANNING;
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_SCANNER);
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
gScanDelay_10ms = scan_delay_10ms;
|
||||
//gScanDelay_10ms = 1; // 10ms
|
||||
break;
|
||||
|
||||
case SCAN_CSS_STATE_SCANNING:
|
||||
ScanResult = BK4819_GetCxCSSScanResult(&Result, &CtcssFreq);
|
||||
if (ScanResult == BK4819_CSS_RESULT_NOT_FOUND)
|
||||
break;
|
||||
|
||||
BK4819_Disable();
|
||||
|
||||
if (ScanResult == BK4819_CSS_RESULT_CDCSS)
|
||||
{
|
||||
const uint8_t Code = DCS_GetCdcssCode(Result);
|
||||
if (Code != 0xFF)
|
||||
{
|
||||
gScanCssResultCode = Code;
|
||||
gScanCssResultType = CODE_TYPE_DIGITAL;
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
gScanUseCssResult = true;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (ScanResult == BK4819_CSS_RESULT_CTCSS)
|
||||
{
|
||||
const uint8_t Code = DCS_GetCtcssCode(CtcssFreq);
|
||||
if (Code != 0xFF)
|
||||
{
|
||||
if (Code == gScanCssResultCode && gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE)
|
||||
{
|
||||
if (++gScanHitCount >= 2)
|
||||
{
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
gScanUseCssResult = true;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
gScanHitCount = 0;
|
||||
|
||||
gScanCssResultType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
gScanCssResultCode = Code;
|
||||
}
|
||||
}
|
||||
|
||||
if (gScanCssState < SCAN_CSS_STATE_FOUND)
|
||||
{
|
||||
BK4819_SetScanFrequency(gScanFrequency);
|
||||
gScanDelay_10ms = scan_delay_10ms;
|
||||
break;
|
||||
}
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_SCANNER);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
if (--gFM_RestoreCountdown_10ms == 0)
|
||||
{ // switch back to FM radio mode
|
||||
FM_Start();
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1)
|
||||
|
||||
SCANNER_TimeSlice10ms();
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1)
|
||||
{
|
||||
if (gAircopySendCountdown > 0)
|
||||
{
|
||||
if (gAircopySendCountdown > 0)
|
||||
if (--gAircopySendCountdown == 0)
|
||||
{
|
||||
if (--gAircopySendCountdown == 0)
|
||||
{
|
||||
AIRCOPY_SendMessage();
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
AIRCOPY_SendMessage();
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
CheckKeys();
|
||||
}
|
||||
@@ -1566,9 +1423,9 @@ void APP_TimeSlice500ms(void)
|
||||
|
||||
if (gBacklightCountdown > 0 &&
|
||||
!gAskToSave &&
|
||||
gCssScanMode == CSS_SCAN_MODE_OFF &&
|
||||
!gCssBackgroundScan &&
|
||||
// don't turn off backlight if user is in backlight menu option
|
||||
!(gScreenToDisplay == DISPLAY_MENU && (GetCurrentMenuId() == MENU_ABR || GetCurrentMenuId() == MENU_ABR_MAX))
|
||||
!(gScreenToDisplay == DISPLAY_MENU && (UI_MENU_GetCurrentMenuId() == MENU_ABR || UI_MENU_GetCurrentMenuId() == MENU_ABR_MAX))
|
||||
)
|
||||
{ if (--gBacklightCountdown == 0)
|
||||
if (gEeprom.BACKLIGHT_TIME < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) // backlight is not set to be always on
|
||||
@@ -1623,15 +1480,15 @@ void APP_TimeSlice500ms(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && !gCssBackgroundScan)
|
||||
#else
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
if (!gCssBackgroundScan)
|
||||
#endif
|
||||
{
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gScanStateDir == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
||||
if (gScanStateDir == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && !SCANNER_IsScanning())
|
||||
#else
|
||||
if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
||||
if (gScanStateDir == SCAN_OFF && !SCANNER_IsScanning())
|
||||
#endif
|
||||
{
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode && gScreenToDisplay != DISPLAY_MENU)
|
||||
@@ -1653,7 +1510,7 @@ void APP_TimeSlice500ms(void)
|
||||
if (gInputBoxIndex > 0 || gDTMF_InputMode)
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
/*
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||
if (SCANNER_IsScanning())
|
||||
{
|
||||
BK4819_StopScan();
|
||||
|
||||
@@ -1689,10 +1546,10 @@ void APP_TimeSlice500ms(void)
|
||||
|
||||
if (disp == DISPLAY_INVALID)
|
||||
{
|
||||
#ifndef ENABLE_CODE_SCAN_TIMEOUT
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
#endif
|
||||
disp = DISPLAY_MAIN;
|
||||
#ifndef ENABLE_NO_CODE_SCAN_TIMEOUT
|
||||
if (!SCANNER_IsScanning())
|
||||
#endif
|
||||
disp = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
if (disp != DISPLAY_INVALID)
|
||||
@@ -1723,27 +1580,8 @@ void APP_TimeSlice500ms(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BATTERY_TimeSlice500ms();
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER && gScannerEditState == 0 && gScanCssState < SCAN_CSS_STATE_FOUND)
|
||||
{
|
||||
gScanProgressIndicator++;
|
||||
|
||||
#ifdef ENABLE_CODE_SCAN_TIMEOUT
|
||||
if (gScanProgressIndicator > 32)
|
||||
{
|
||||
if (gScanCssState == SCAN_CSS_STATE_SCANNING && !gScanSingleFrequency)
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
else
|
||||
gScanCssState = SCAN_CSS_STATE_FAILED;
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
SCANNER_TimeSlice500ms();
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
@@ -1865,7 +1703,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
else // key pressed or held
|
||||
{
|
||||
const uint8_t s = gSetting_backlight_on_tx_rx;
|
||||
const int m = GetCurrentMenuId();
|
||||
const int m = UI_MENU_GetCurrentMenuId();
|
||||
if ( //not when PTT and the backlight shouldn't turn on on TX
|
||||
!(Key == KEY_PTT && s != BACKLIGHT_ON_TR_TX && s != BACKLIGHT_ON_TR_TXRX)
|
||||
// not in the backlight menu
|
||||
@@ -1954,7 +1792,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (Key <= KEY_9 || Key == KEY_F)
|
||||
{
|
||||
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
if (gScanStateDir != SCAN_OFF || gCssBackgroundScan)
|
||||
{ // FREQ/CTCSS/DCS scanning
|
||||
if (bKeyPressed && !bKeyHeld)
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
@@ -2110,9 +1948,9 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
else
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScreenToDisplay != DISPLAY_AIRCOPY)
|
||||
if (!SCANNER_IsScanning() && gScreenToDisplay != DISPLAY_AIRCOPY)
|
||||
#else
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
if (!SCANNER_IsScanning())
|
||||
#endif
|
||||
{
|
||||
ACTION_Handle(Key, bKeyPressed, bKeyHeld);
|
||||
@@ -2138,12 +1976,6 @@ Skip:
|
||||
gFlagAcceptSetting = false;
|
||||
}
|
||||
|
||||
if (gFlagStopScan)
|
||||
{
|
||||
BK4819_StopScan();
|
||||
gFlagStopScan = false;
|
||||
}
|
||||
|
||||
if (gRequestSaveSettings)
|
||||
{
|
||||
if (!bKeyHeld)
|
||||
@@ -2180,7 +2012,7 @@ Skip:
|
||||
{
|
||||
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_VFO, gTxVfo, gRequestSaveChannel);
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
if (!SCANNER_IsScanning())
|
||||
if (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
}
|
||||
@@ -2245,22 +2077,6 @@ Skip:
|
||||
MENU_ShowCurrentSetting();
|
||||
}
|
||||
|
||||
if (gFlagStartScan)
|
||||
{
|
||||
gFlagStartScan = false;
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
AUDIO_PlaySingleVoice(true);
|
||||
#endif
|
||||
|
||||
SCANNER_Start();
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
}
|
||||
|
||||
if (gFlagPrepareTX)
|
||||
{
|
||||
RADIO_PrepareTX();
|
||||
|
||||
262
app/chFrScanner.c
Normal file
262
app/chFrScanner.c
Normal file
@@ -0,0 +1,262 @@
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/chFrScanner.h"
|
||||
#include "functions.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
|
||||
int8_t gScanStateDir;
|
||||
bool gScanKeepResult;
|
||||
bool gScanPauseMode;
|
||||
|
||||
typedef enum {
|
||||
SCAN_NEXT_CHAN_SCANLIST1 = 0,
|
||||
SCAN_NEXT_CHAN_SCANLIST2,
|
||||
SCAN_NEXT_CHAN_DUAL_WATCH,
|
||||
SCAN_NEXT_CHAN_MR,
|
||||
SCAN_NEXT_NUM
|
||||
} scan_next_chan_t;
|
||||
|
||||
scan_next_chan_t currentScanList;
|
||||
uint32_t initialFrqOrChan;
|
||||
uint8_t initialCROSS_BAND_RX_TX;
|
||||
uint32_t lastFoundFrqOrChan;
|
||||
|
||||
static void NextFreqChannel(void);
|
||||
static void NextMemChannel(void);
|
||||
|
||||
void CHFRSCANNER_Start(const bool storeBackupSettings, const int8_t scan_direction)
|
||||
{
|
||||
if (storeBackupSettings) {
|
||||
initialCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gScanKeepResult = false;
|
||||
}
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gScanStateDir = scan_direction;
|
||||
|
||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||
{ // channel mode
|
||||
if (storeBackupSettings) {
|
||||
initialFrqOrChan = gRxVfo->CHANNEL_SAVE;
|
||||
lastFoundFrqOrChan = initialFrqOrChan;
|
||||
}
|
||||
NextMemChannel();
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
if (storeBackupSettings) {
|
||||
initialFrqOrChan = gRxVfo->freq_config_RX.Frequency;
|
||||
lastFoundFrqOrChan = initialFrqOrChan;
|
||||
}
|
||||
NextFreqChannel();
|
||||
}
|
||||
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScanPauseMode = false;
|
||||
}
|
||||
|
||||
void CHFRSCANNER_ContinueScanning(void)
|
||||
{
|
||||
if (IS_FREQ_CHANNEL(gNextMrChannel))
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
NextFreqChannel(); // switch to next frequency
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
NextMemChannel(); // switch to next channel
|
||||
}
|
||||
|
||||
gScanPauseMode = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
|
||||
void CHFRSCANNER_Found(void)
|
||||
{
|
||||
switch (gEeprom.SCAN_RESUME_MODE)
|
||||
{
|
||||
case SCAN_RESUME_TO:
|
||||
if (!gScanPauseMode)
|
||||
{
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gScanPauseMode = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCAN_RESUME_CO:
|
||||
case SCAN_RESUME_SE:
|
||||
gScanPauseDelayIn_10ms = 0;
|
||||
gScheduleScanListen = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) { //memory scan
|
||||
lastFoundFrqOrChan = gRxVfo->CHANNEL_SAVE;
|
||||
}
|
||||
else { // frequency scan
|
||||
lastFoundFrqOrChan = gRxVfo->freq_config_RX.Frequency;
|
||||
}
|
||||
|
||||
|
||||
gScanKeepResult = true;
|
||||
}
|
||||
|
||||
void CHFRSCANNER_Stop(void)
|
||||
{
|
||||
if(initialCROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
gEeprom.CROSS_BAND_RX_TX = initialCROSS_BAND_RX_TX;
|
||||
initialCROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
}
|
||||
|
||||
gScanStateDir = SCAN_OFF;
|
||||
|
||||
const uint32_t chFr = gScanKeepResult ? lastFoundFrqOrChan : initialFrqOrChan;
|
||||
const bool channelChanged = chFr != initialFrqOrChan;
|
||||
if (IS_MR_CHANNEL(gNextMrChannel)) {
|
||||
gEeprom.MrChannel[gEeprom.RX_VFO] = chFr;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = chFr;
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
if(channelChanged) {
|
||||
SETTINGS_SaveVfoIndices();
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gRxVfo->freq_config_RX.Frequency = chFr;
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
if(channelChanged) {
|
||||
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_VFO, gRxVfo, 1);
|
||||
}
|
||||
}
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void NextFreqChannel(void)
|
||||
{
|
||||
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
|
||||
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||
#endif
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void NextMemChannel(void)
|
||||
{
|
||||
static unsigned int prev_mr_chan = 0;
|
||||
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
|
||||
const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const unsigned int prev_chan = gNextMrChannel;
|
||||
unsigned int chan = 0;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
switch (currentScanList)
|
||||
{
|
||||
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||
prev_mr_chan = gNextMrChannel;
|
||||
|
||||
if (chan1 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||
{
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gNextMrChannel = chan1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[[fallthrough]];
|
||||
case SCAN_NEXT_CHAN_SCANLIST2:
|
||||
if (chan2 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||
{
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||
gNextMrChannel = chan2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[[fallthrough]];
|
||||
|
||||
// this bit doesn't yet work if the other VFO is a frequency
|
||||
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||
// dual watch is enabled - include the other VFO in the scan
|
||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
// {
|
||||
// chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||
// chan = gEeprom.ScreenChannel[chan];
|
||||
// if (IS_MR_CHANNEL(chan))
|
||||
// {
|
||||
// currentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||
// gNextMrChannel = chan;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
default:
|
||||
case SCAN_NEXT_CHAN_MR:
|
||||
currentScanList = SCAN_NEXT_CHAN_MR;
|
||||
gNextMrChannel = prev_mr_chan;
|
||||
chan = 0xff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!enabled || chan == 0xff)
|
||||
{
|
||||
chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (chan == 0xFF)
|
||||
{ // no valid channel found
|
||||
chan = MR_CHANNEL_FIRST;
|
||||
}
|
||||
|
||||
gNextMrChannel = chan;
|
||||
}
|
||||
|
||||
if (gNextMrChannel != prev_chan)
|
||||
{
|
||||
gEeprom.MrChannel[ gEeprom.RX_VFO] = gNextMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gNextMrChannel;
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
#endif
|
||||
|
||||
if (enabled)
|
||||
if (++currentScanList >= SCAN_NEXT_NUM)
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
|
||||
}
|
||||
18
app/chFrScanner.h
Normal file
18
app/chFrScanner.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef APP_CHFRSCANNER_H
|
||||
#define APP_CHFRSCANNER_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// scan direction, if not equal SCAN_OFF indicates
|
||||
// that we are in a process of scanning channels/frequencies
|
||||
extern int8_t gScanStateDir;
|
||||
extern bool gScanKeepResult;
|
||||
extern bool gScanPauseMode;
|
||||
|
||||
void CHFRSCANNER_Found(void);
|
||||
void CHFRSCANNER_Stop(void);
|
||||
void CHFRSCANNER_Start(const bool storeBackupSettings, const int8_t scan_direction);
|
||||
void CHFRSCANNER_ContinueScanning(void);
|
||||
|
||||
#endif
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h> // NULL
|
||||
|
||||
#include "app/chFrScanner.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
@@ -209,7 +210,7 @@ void DTMF_HandleRequest(void)
|
||||
if (!gDTMF_RX_pending)
|
||||
return; // nothing new received
|
||||
|
||||
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
if (gScanStateDir != SCAN_OFF || gCssBackgroundScan)
|
||||
{ // we're busy scanning
|
||||
DTMF_clear_RX();
|
||||
return;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/chFrScanner.h"
|
||||
#include "app/common.h"
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -142,36 +143,21 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
|
||||
// PTT pressed
|
||||
|
||||
if (gScanStateDir != SCAN_OFF || // frequency/channel scanning
|
||||
gScreenToDisplay == DISPLAY_SCANNER || // CTCSS/CDCSS scanning
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF) // " "
|
||||
{ // we're scanning .. stop
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||
{ // CTCSS/CDCSS scanning .. stop
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||
gFlagStopScan = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gFlagResetVfos = true;
|
||||
}
|
||||
else
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
{ // frequency/channel scanning . .stop
|
||||
SCANNER_Stop();
|
||||
}
|
||||
else
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
{ // CTCSS/CDCSS scanning .. stop
|
||||
MENU_StopCssScan();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (SCANNER_IsScanning())
|
||||
{ // CTCSS/CDCSS scanning .. stop
|
||||
SCANNER_Stop();
|
||||
goto cancel_tx;
|
||||
}
|
||||
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
{ // frequency/channel scanning . .stop
|
||||
CHFRSCANNER_Stop();
|
||||
goto cancel_tx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState != FM_SCAN_OFF)
|
||||
{ // FM radio is scanning .. stop
|
||||
|
||||
34
app/main.c
34
app/main.c
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "app/action.h"
|
||||
#include "app/app.h"
|
||||
#include "app/chFrScanner.h"
|
||||
#include "app/common.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
@@ -45,7 +46,7 @@
|
||||
void toggle_chan_scanlist(void)
|
||||
{ // toggle the selected channels scanlist setting
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER || !IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if ( SCANNER_IsScanning() || !IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
return;
|
||||
|
||||
if (gTxVfo->SCANLIST1_PARTICIPATION)
|
||||
@@ -105,7 +106,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||
if (gEeprom.VFO_OPEN && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
if (gEeprom.VFO_OPEN && !gCssBackgroundScan)
|
||||
{
|
||||
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
@@ -192,15 +193,15 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
case KEY_4:
|
||||
gWasFKeyPressed = false;
|
||||
gFlagStartScan = true;
|
||||
gScanSingleFrequency = false;
|
||||
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gUpdateStatus = true;
|
||||
|
||||
if (beep)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
SCANNER_Start(false);
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
break;
|
||||
|
||||
case KEY_5:
|
||||
@@ -506,7 +507,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
else
|
||||
{
|
||||
gScanKeepResult = false;
|
||||
SCANNER_Stop();
|
||||
CHFRSCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
@@ -579,7 +580,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
if (bFlag)
|
||||
{
|
||||
if (gScanStateDir != SCAN_OFF) {
|
||||
SCANNER_Stop();
|
||||
CHFRSCANNER_Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -651,19 +652,18 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
{ // with the F-key
|
||||
gWasFKeyPressed = false;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// scan the CTCSS/DCS code
|
||||
gFlagStartScan = true;
|
||||
gScanSingleFrequency = true;
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
SCANNER_Start(true);
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
}
|
||||
|
||||
gPttWasReleased = true;
|
||||
@@ -764,7 +764,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
}
|
||||
|
||||
// jump to the next channel
|
||||
SCANNER_ScanChannels(false, Direction);
|
||||
CHFRSCANNER_Start(false, Direction);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
|
||||
236
app/menu.c
236
app/menu.c
@@ -47,6 +47,8 @@
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
uint8_t gUnlockAllTxConfCnt;
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom)
|
||||
{
|
||||
@@ -75,27 +77,39 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
void MENU_StartCssScan(int8_t Direction)
|
||||
void MENU_StartCssScan(void)
|
||||
{
|
||||
gCssScanMode = CSS_SCAN_MODE_SCANNING;
|
||||
SCANNER_Start(true);
|
||||
gUpdateStatus = true;
|
||||
gCssBackgroundScan = true;
|
||||
|
||||
gMenuScrollDirection = Direction;
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
}
|
||||
|
||||
RADIO_SelectVfos();
|
||||
void MENU_CssScanFound(void)
|
||||
{
|
||||
if(gScanCssResultType == CODE_TYPE_DIGITAL || gScanCssResultType == CODE_TYPE_REVERSE_DIGITAL) {
|
||||
gMenuCursor = UI_MENU_GetMenuIdx(MENU_R_DCS);
|
||||
}
|
||||
else if(gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
gMenuCursor = UI_MENU_GetMenuIdx(MENU_R_CTCS);
|
||||
}
|
||||
|
||||
MENU_SelectNextCode();
|
||||
MENU_ShowCurrentSetting();
|
||||
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gUpdateStatus = true;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
void MENU_StopCssScan(void)
|
||||
{
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
gUpdateStatus = true;
|
||||
gCssBackgroundScan = false;
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
gUpdateDisplay = true;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||
@@ -240,7 +254,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||
case MENU_500TX:
|
||||
case MENU_350EN:
|
||||
case MENU_SCREN:
|
||||
case MENU_TX_EN:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
|
||||
break;
|
||||
@@ -367,14 +380,14 @@ void MENU_AcceptSetting(void)
|
||||
uint8_t Code;
|
||||
FREQ_Config_t *pConfig = &gTxVfo->freq_config_RX;
|
||||
|
||||
if (!MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||
if (!MENU_GetLimits(UI_MENU_GetCurrentMenuId(), &Min, &Max))
|
||||
{
|
||||
if (gSubMenuSelection < Min) gSubMenuSelection = Min;
|
||||
else
|
||||
if (gSubMenuSelection > Max) gSubMenuSelection = Max;
|
||||
}
|
||||
|
||||
switch (GetCurrentMenuId())
|
||||
switch (UI_MENU_GetCurrentMenuId())
|
||||
{
|
||||
default:
|
||||
return;
|
||||
@@ -747,10 +760,18 @@ void MENU_AcceptSetting(void)
|
||||
gSetting_350TX = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_F_LOCK:
|
||||
case MENU_F_LOCK: {
|
||||
if(gSubMenuSelection == F_LOCK_NONE) { // select 10 times to enable
|
||||
gUnlockAllTxConfCnt++;
|
||||
if(gUnlockAllTxConfCnt < 10)
|
||||
return;
|
||||
}
|
||||
else
|
||||
gUnlockAllTxConfCnt = 0;
|
||||
|
||||
gSetting_F_LOCK = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
}
|
||||
case MENU_200TX:
|
||||
gSetting_200TX = gSubMenuSelection;
|
||||
break;
|
||||
@@ -770,10 +791,6 @@ void MENU_AcceptSetting(void)
|
||||
gFlagReconfigureVfos = true;
|
||||
break;
|
||||
|
||||
case MENU_TX_EN:
|
||||
gSetting_TX_EN = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
writeXtalFreqCal(gSubMenuSelection, true);
|
||||
@@ -808,7 +825,7 @@ void MENU_AcceptSetting(void)
|
||||
&gEeprom.KEY_2_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_LONG_PRESS_ACTION,
|
||||
&gEeprom.KEY_M_LONG_PRESS_ACTION};
|
||||
*fun[GetCurrentMenuId()-MENU_F1SHRT] = gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].id;
|
||||
*fun[UI_MENU_GetCurrentMenuId()-MENU_F1SHRT] = gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].id;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -817,53 +834,12 @@ void MENU_AcceptSetting(void)
|
||||
gRequestSaveSettings = true;
|
||||
}
|
||||
|
||||
void MENU_SelectNextCode(void)
|
||||
{
|
||||
int32_t UpperLimit;
|
||||
|
||||
if (GetCurrentMenuId() == MENU_R_DCS)
|
||||
UpperLimit = 208;
|
||||
//UpperLimit = ARRAY_SIZE(DCS_Options);
|
||||
else if (GetCurrentMenuId() == MENU_R_CTCS)
|
||||
UpperLimit = ARRAY_SIZE(CTCSS_Options) - 1;
|
||||
else
|
||||
return;
|
||||
|
||||
gSubMenuSelection = NUMBER_AddWithWraparound(gSubMenuSelection, gMenuScrollDirection, 1, UpperLimit);
|
||||
|
||||
if (GetCurrentMenuId() == MENU_R_DCS)
|
||||
{
|
||||
if (gSubMenuSelection > 104)
|
||||
{
|
||||
gSelectedCodeType = CODE_TYPE_REVERSE_DIGITAL;
|
||||
gSelectedCode = gSubMenuSelection - 105;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSelectedCodeType = CODE_TYPE_DIGITAL;
|
||||
gSelectedCode = gSubMenuSelection - 1;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
gSelectedCodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
gSelectedCode = gSubMenuSelection - 1;
|
||||
}
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void MENU_ClampSelection(int8_t Direction)
|
||||
{
|
||||
int32_t Min;
|
||||
int32_t Max;
|
||||
|
||||
if (!MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||
if (!MENU_GetLimits(UI_MENU_GetCurrentMenuId(), &Min, &Max))
|
||||
{
|
||||
int32_t Selection = gSubMenuSelection;
|
||||
if (Selection < Min) Selection = Min;
|
||||
@@ -875,7 +851,7 @@ static void MENU_ClampSelection(int8_t Direction)
|
||||
|
||||
void MENU_ShowCurrentSetting(void)
|
||||
{
|
||||
switch (GetCurrentMenuId())
|
||||
switch (UI_MENU_GetCurrentMenuId())
|
||||
{
|
||||
case MENU_SQL:
|
||||
gSubMenuSelection = gEeprom.SQUELCH_LEVEL;
|
||||
@@ -889,28 +865,41 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gTxVfo->OUTPUT_POWER;
|
||||
break;
|
||||
|
||||
case MENU_RESET:
|
||||
gSubMenuSelection = 0;
|
||||
break;
|
||||
|
||||
case MENU_R_DCS:
|
||||
switch (gTxVfo->freq_config_RX.CodeType)
|
||||
{
|
||||
case MENU_R_CTCS:
|
||||
{
|
||||
DCS_CodeType_t type = gTxVfo->freq_config_RX.CodeType;
|
||||
uint8_t code = gTxVfo->freq_config_RX.Code;
|
||||
int menuid = UI_MENU_GetCurrentMenuId();
|
||||
|
||||
if(gScanUseCssResult) {
|
||||
gScanUseCssResult = false;
|
||||
type = gScanCssResultType;
|
||||
code = gScanCssResultCode;
|
||||
}
|
||||
if((menuid==MENU_R_CTCS) ^ (type==CODE_TYPE_CONTINUOUS_TONE)) { //not the same type
|
||||
gSubMenuSelection = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case CODE_TYPE_CONTINUOUS_TONE:
|
||||
case CODE_TYPE_DIGITAL:
|
||||
gSubMenuSelection = gTxVfo->freq_config_RX.Code + 1;
|
||||
gSubMenuSelection = code + 1;
|
||||
break;
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
gSubMenuSelection = gTxVfo->freq_config_RX.Code + 105;
|
||||
gSubMenuSelection = code + 105;
|
||||
break;
|
||||
default:
|
||||
gSubMenuSelection = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_RESET:
|
||||
gSubMenuSelection = 0;
|
||||
break;
|
||||
|
||||
case MENU_R_CTCS:
|
||||
gSubMenuSelection = (gTxVfo->freq_config_RX.CodeType == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->freq_config_RX.Code + 1 : 0;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_T_DCS:
|
||||
switch (gTxVfo->freq_config_TX.CodeType)
|
||||
@@ -1169,10 +1158,6 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gSetting_ScrambleEnable;
|
||||
break;
|
||||
|
||||
case MENU_TX_EN:
|
||||
gSubMenuSelection = gSetting_TX_EN;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
@@ -1199,7 +1184,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
&gEeprom.KEY_2_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_LONG_PRESS_ACTION,
|
||||
&gEeprom.KEY_M_LONG_PRESS_ACTION};
|
||||
uint8_t id = *fun[GetCurrentMenuId()-MENU_F1SHRT];
|
||||
uint8_t id = *fun[UI_MENU_GetCurrentMenuId()-MENU_F1SHRT];
|
||||
|
||||
for(int i = 0; i < gSubMenu_SIDEFUNCTIONS_size; i++) {
|
||||
if(gSubMenu_SIDEFUNCTIONS[i].id==id) {
|
||||
@@ -1228,7 +1213,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
{ // currently editing the channel name
|
||||
|
||||
if (edit_index < 10)
|
||||
@@ -1293,7 +1278,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetCurrentMenuId() == MENU_OFFSET)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_OFFSET)
|
||||
{
|
||||
uint32_t Frequency;
|
||||
|
||||
@@ -1316,10 +1301,10 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
GetCurrentMenuId() == MENU_1_CALL ||
|
||||
GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_1_CALL ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
{ // enter 3-digit channel number
|
||||
|
||||
if (gInputBoxIndex < 3)
|
||||
@@ -1348,7 +1333,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||
if (MENU_GetLimits(UI_MENU_GetCurrentMenuId(), &Min, &Max))
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
@@ -1389,11 +1374,11 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
if (!gCssBackgroundScan)
|
||||
{
|
||||
if (gIsInSubMenu)
|
||||
{
|
||||
if (gInputBoxIndex == 0 || GetCurrentMenuId() != MENU_OFFSET)
|
||||
if (gInputBoxIndex == 0 || UI_MENU_GetCurrentMenuId() != MENU_OFFSET)
|
||||
{
|
||||
gAskForConfirmation = 0;
|
||||
gIsInSubMenu = false;
|
||||
@@ -1449,12 +1434,12 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
if (!gIsInSubMenu)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
if (GetCurrentMenuId() != MENU_SCR)
|
||||
if (UI_MENU_GetCurrentMenuId() != MENU_SCR)
|
||||
gAnotherVoiceID = MenuList[gMenuCursor].voice_id;
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
if (GetCurrentMenuId() == MENU_DEL_CH || GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_DEL_CH || UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
if (!RADIO_CheckValidChannel(gSubMenuSelection, false, 0))
|
||||
return; // invalid channel
|
||||
#endif
|
||||
@@ -1462,7 +1447,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
gAskForConfirmation = 0;
|
||||
gIsInSubMenu = true;
|
||||
|
||||
// if (GetCurrentMenuId() != MENU_D_LIST)
|
||||
// if (UI_MENU_GetCurrentMenuId() != MENU_D_LIST)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
edit_index = -1;
|
||||
@@ -1471,7 +1456,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
{
|
||||
if (edit_index < 0)
|
||||
{ // enter channel name edit mode
|
||||
@@ -1518,10 +1503,10 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
if (gIsInSubMenu)
|
||||
{
|
||||
if (GetCurrentMenuId() == MENU_RESET ||
|
||||
GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_RESET ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
{
|
||||
switch (gAskForConfirmation)
|
||||
{
|
||||
@@ -1534,7 +1519,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
UI_DisplayMenu();
|
||||
|
||||
if (GetCurrentMenuId() == MENU_RESET)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_RESET)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM);
|
||||
@@ -1562,14 +1547,10 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
}
|
||||
}
|
||||
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
{
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (GetCurrentMenuId() == MENU_SCR)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_SCR)
|
||||
gAnotherVoiceID = (gSubMenuSelection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON;
|
||||
else
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
@@ -1585,7 +1566,7 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
{ // currently editing the channel name
|
||||
|
||||
if (edit_index < 10)
|
||||
@@ -1612,26 +1593,12 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
||||
if (gRxVfo->Modulation == MODULATION_FM)
|
||||
#endif
|
||||
{
|
||||
if (GetCurrentMenuId() == MENU_R_CTCS || GetCurrentMenuId() == MENU_R_DCS)
|
||||
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gIsInSubMenu)
|
||||
{ // scan CTCSS or DCS to find the tone/code of the incoming signal
|
||||
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{
|
||||
MENU_StartCssScan(1);
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
AUDIO_PlaySingleVoice(1);
|
||||
#endif
|
||||
}
|
||||
if (!SCANNER_IsScanning())
|
||||
MENU_StartCssScan();
|
||||
else
|
||||
{
|
||||
MENU_StopCssScan();
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
gPttWasReleased = true;
|
||||
@@ -1647,7 +1614,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
uint8_t Channel;
|
||||
bool bCheckScanList;
|
||||
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0)
|
||||
{ // change the character
|
||||
if (bKeyPressed && edit_index < 10 && Direction != 0)
|
||||
{
|
||||
@@ -1682,12 +1649,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
{
|
||||
MENU_StartCssScan(Direction);
|
||||
|
||||
gPttWasReleased = true;
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
if (SCANNER_IsScanning()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1699,7 +1661,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
|
||||
if (GetCurrentMenuId() != MENU_ABR && gEeprom.BACKLIGHT_TIME == 0) // backlight always off and not in the backlight menu
|
||||
if (UI_MENU_GetCurrentMenuId() != MENU_ABR && gEeprom.BACKLIGHT_TIME == 0) // backlight always off and not in the backlight menu
|
||||
{
|
||||
BACKLIGHT_TurnOff();
|
||||
}
|
||||
@@ -1707,7 +1669,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetCurrentMenuId() == MENU_OFFSET)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_OFFSET)
|
||||
{
|
||||
int32_t Offset = (Direction * gTxVfo->StepFrequency) + gSubMenuSelection;
|
||||
if (Offset < 99999990)
|
||||
@@ -1725,7 +1687,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
|
||||
VFO = 0;
|
||||
|
||||
switch (GetCurrentMenuId())
|
||||
switch (UI_MENU_GetCurrentMenuId())
|
||||
{
|
||||
case MENU_DEL_CH:
|
||||
case MENU_1_CALL:
|
||||
@@ -1785,7 +1747,7 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
MENU_Key_STAR(bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
case KEY_F:
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
{ // currently editing the channel name
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
@@ -1817,11 +1779,11 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MENU)
|
||||
{
|
||||
if (GetCurrentMenuId() == MENU_VOL ||
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_VOL ||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
GetCurrentMenuId() == MENU_F_CALI ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_F_CALI ||
|
||||
#endif
|
||||
GetCurrentMenuId() == MENU_BATCAL)
|
||||
UI_MENU_GetCurrentMenuId() == MENU_BATCAL)
|
||||
{
|
||||
gMenuCountdown = menu_timeout_long_500ms;
|
||||
}
|
||||
|
||||
@@ -23,11 +23,13 @@
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom);
|
||||
#endif
|
||||
|
||||
extern uint8_t gUnlockAllTxConfCnt;
|
||||
|
||||
int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax);
|
||||
void MENU_AcceptSetting(void);
|
||||
void MENU_SelectNextCode(void);
|
||||
void MENU_ShowCurrentSetting(void);
|
||||
void MENU_StartCssScan(int8_t Direction);
|
||||
void MENU_StartCssScan(void);
|
||||
void MENU_CssScanFound(void);
|
||||
void MENU_StopCssScan(void);
|
||||
|
||||
void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
|
||||
601
app/scanner.c
601
app/scanner.c
@@ -17,6 +17,7 @@
|
||||
#include "app/app.h"
|
||||
#include "app/dtmf.h"
|
||||
#include "app/generic.h"
|
||||
#include "app/menu.h"
|
||||
#include "app/scanner.h"
|
||||
#include "audio.h"
|
||||
#include "driver/bk4819.h"
|
||||
@@ -29,68 +30,45 @@
|
||||
|
||||
DCS_CodeType_t gScanCssResultType;
|
||||
uint8_t gScanCssResultCode;
|
||||
bool gFlagStartScan;
|
||||
bool gFlagStopScan;
|
||||
bool gScanSingleFrequency;
|
||||
uint8_t gScannerEditState;
|
||||
bool gScanSingleFrequency; // scan CTCSS/DCS codes for current frequency
|
||||
SCAN_SaveState_t gScannerSaveState;
|
||||
uint8_t gScanChannel;
|
||||
uint32_t gScanFrequency;
|
||||
bool gScanPauseMode;
|
||||
SCAN_CssState_t gScanCssState;
|
||||
volatile bool gScheduleScanListen = true;
|
||||
volatile uint16_t gScanPauseDelayIn_10ms;
|
||||
uint8_t gScanProgressIndicator;
|
||||
uint8_t gScanHitCount;
|
||||
bool gScanUseCssResult;
|
||||
int8_t gScanStateDir;
|
||||
bool gScanKeepResult;
|
||||
|
||||
typedef enum {
|
||||
SCAN_NEXT_CHAN_SCANLIST1 = 0,
|
||||
SCAN_NEXT_CHAN_SCANLIST2,
|
||||
SCAN_NEXT_CHAN_DUAL_WATCH,
|
||||
SCAN_NEXT_CHAN_MR,
|
||||
SCAN_NEXT_NUM
|
||||
} scan_next_chan_t;
|
||||
STEP_Setting_t stepSetting;
|
||||
uint8_t scanHitCount;
|
||||
|
||||
|
||||
scan_next_chan_t currentScanList;
|
||||
uint32_t initialFrqOrChan;
|
||||
uint8_t initialCROSS_BAND_RX_TX;
|
||||
uint32_t lastFoundFrqOrChan;
|
||||
|
||||
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
if (gScannerEditState == 1)
|
||||
{
|
||||
uint16_t Channel;
|
||||
|
||||
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
INPUTBOX_Append(Key);
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
|
||||
if (gInputBoxIndex < 3)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
if (gInputBoxIndex < 3) {
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
gShowChPrefix = RADIO_CheckValidChannel(Channel, false, 0);
|
||||
gScanChannel = (uint8_t)Channel;
|
||||
uint16_t chan = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
if (IS_MR_CHANNEL(chan)) {
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
gShowChPrefix = RADIO_CheckValidChannel(chan, false, 0);
|
||||
gScanChannel = (uint8_t)chan;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -101,28 +79,17 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed) { // short pressed
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
switch (gScannerEditState)
|
||||
{
|
||||
case 0:
|
||||
switch (gScannerSaveState) {
|
||||
case SCAN_SAVE_NO_PROMPT:
|
||||
SCANNER_Stop();
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||
gUpdateStatus = true;
|
||||
gFlagStopScan = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gFlagResetVfos = true;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (gInputBoxIndex > 0)
|
||||
{
|
||||
case SCAN_SAVE_CHAN_SEL:
|
||||
if (gInputBoxIndex > 0) {
|
||||
gInputBox[--gInputBoxIndex] = 10;
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
break;
|
||||
@@ -130,11 +97,11 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
// Fallthrough
|
||||
|
||||
case 2:
|
||||
gScannerEditState = 0;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
case SCAN_SAVE_CHANNEL:
|
||||
gScannerSaveState = SCAN_SAVE_NO_PROMPT;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
break;
|
||||
}
|
||||
@@ -143,40 +110,28 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
uint8_t Channel;
|
||||
|
||||
if (bKeyHeld)
|
||||
if (bKeyHeld || !bKeyPressed) // ignore long press or release button events
|
||||
return;
|
||||
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
|
||||
if (gScanCssState == SCAN_CSS_STATE_OFF && !gScanSingleFrequency)
|
||||
{
|
||||
if (gScanCssState == SCAN_CSS_STATE_OFF && !gScanSingleFrequency) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gScanCssState == SCAN_CSS_STATE_SCANNING)
|
||||
{
|
||||
if (gScanSingleFrequency)
|
||||
{
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
if (gScanCssState == SCAN_CSS_STATE_SCANNING && gScanSingleFrequency) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gScanCssState == SCAN_CSS_STATE_FAILED)
|
||||
{
|
||||
if (gScanCssState == SCAN_CSS_STATE_FAILED) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
switch (gScannerEditState)
|
||||
{
|
||||
case 0:
|
||||
switch (gScannerSaveState) {
|
||||
case SCAN_SAVE_NO_PROMPT:
|
||||
if (!gScanSingleFrequency)
|
||||
{
|
||||
uint32_t freq250 = FREQUENCY_RoundToStep(gScanFrequency, 250);
|
||||
@@ -186,60 +141,54 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
uint32_t diff625 = gScanFrequency > freq625 ? gScanFrequency - freq625 : freq625 - gScanFrequency;
|
||||
|
||||
if(diff250 > diff625) {
|
||||
gStepSetting = STEP_6_25kHz;
|
||||
stepSetting = STEP_6_25kHz;
|
||||
gScanFrequency = freq625;
|
||||
}
|
||||
else {
|
||||
gStepSetting = STEP_2_5kHz;
|
||||
stepSetting = STEP_2_5kHz;
|
||||
gScanFrequency = freq250;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gScannerEditState = 1;
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gScannerSaveState = SCAN_SAVE_CHAN_SEL;
|
||||
gScanChannel = gTxVfo->CHANNEL_SAVE;
|
||||
gShowChPrefix = RADIO_CheckValidChannel(gTxVfo->CHANNEL_SAVE, false, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gScannerEditState = 2;
|
||||
else {
|
||||
gScannerSaveState = SCAN_SAVE_CHANNEL;
|
||||
}
|
||||
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_MEMORY_CHANNEL;
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_MEMORY_CHANNEL;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (gInputBoxIndex == 0)
|
||||
{
|
||||
case SCAN_SAVE_CHAN_SEL:
|
||||
if (gInputBoxIndex == 0) {
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
gScannerEditState = 2;
|
||||
gScannerSaveState = SCAN_SAVE_CHANNEL;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (!gScanSingleFrequency)
|
||||
{
|
||||
case SCAN_SAVE_CHANNEL:
|
||||
if (!gScanSingleFrequency) {
|
||||
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, gScanFrequency);
|
||||
|
||||
if (gScanUseCssResult)
|
||||
{
|
||||
if (gScanUseCssResult) {
|
||||
gTxVfo->freq_config_RX.CodeType = gScanCssResultType;
|
||||
gTxVfo->freq_config_RX.Code = gScanCssResultCode;
|
||||
}
|
||||
|
||||
gTxVfo->freq_config_TX = gTxVfo->freq_config_RX;
|
||||
gTxVfo->STEP_SETTING = gStepSetting;
|
||||
gTxVfo->STEP_SETTING = stepSetting;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
@@ -249,25 +198,24 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
gTxVfo->freq_config_TX.Code = gScanCssResultCode;
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
Channel = gScanChannel;
|
||||
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
|
||||
uint8_t chan;
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
chan = gScanChannel;
|
||||
gEeprom.MrChannel[gEeprom.TX_VFO] = chan;
|
||||
}
|
||||
else
|
||||
{
|
||||
Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[gEeprom.TX_VFO] = Channel;
|
||||
else {
|
||||
chan = gTxVfo->Band + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[gEeprom.TX_VFO] = chan;
|
||||
}
|
||||
|
||||
gTxVfo->CHANNEL_SAVE = Channel;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
gRequestSaveChannel = 2;
|
||||
gScannerEditState = 0;
|
||||
gTxVfo->CHANNEL_SAVE = chan;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = chan;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
gRequestSaveChannel = 2;
|
||||
gScannerSaveState = SCAN_SAVE_NO_PROMPT;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -278,23 +226,20 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
static void SCANNER_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed) {
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
gFlagStartScan = true;
|
||||
SCANNER_Start(gScanSingleFrequency);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void SCANNER_Key_UP_DOWN(bool bKeyPressed, bool pKeyHeld, int8_t Direction)
|
||||
{
|
||||
if (pKeyHeld)
|
||||
{
|
||||
if (pKeyHeld) {
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
|
||||
@@ -302,8 +247,7 @@ static void SCANNER_Key_UP_DOWN(bool bKeyPressed, bool pKeyHeld, int8_t Directio
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
}
|
||||
|
||||
if (gScannerEditState == 1)
|
||||
{
|
||||
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
|
||||
gScanChannel = NUMBER_AddWithWraparound(gScanChannel, Direction, 0, MR_CHANNEL_LAST);
|
||||
gShowChPrefix = RADIO_CheckValidChannel(gScanChannel, false, 0);
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
@@ -314,8 +258,7 @@ static void SCANNER_Key_UP_DOWN(bool bKeyPressed, bool pKeyHeld, int8_t Directio
|
||||
|
||||
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
switch (Key)
|
||||
{
|
||||
switch (Key) {
|
||||
case KEY_0:
|
||||
case KEY_1:
|
||||
case KEY_2:
|
||||
@@ -353,13 +296,16 @@ void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
}
|
||||
|
||||
void SCANNER_Start(void)
|
||||
void SCANNER_Start(bool singleFreq)
|
||||
{
|
||||
uint8_t BackupStep;
|
||||
uint16_t BackupFrequency;
|
||||
gScanSingleFrequency = singleFreq;
|
||||
gMonitor = false;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_BEGIN;
|
||||
#endif
|
||||
|
||||
BK4819_StopScan();
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
@@ -367,13 +313,13 @@ void SCANNER_Start(void)
|
||||
gRxVfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||
#endif
|
||||
|
||||
BackupStep = gRxVfo->STEP_SETTING;
|
||||
BackupFrequency = gRxVfo->StepFrequency;
|
||||
uint8_t backupStep = gRxVfo->STEP_SETTING;
|
||||
uint16_t backupFrequency = gRxVfo->StepFrequency;
|
||||
|
||||
RADIO_InitInfo(gRxVfo, gRxVfo->CHANNEL_SAVE, gRxVfo->pRX->Frequency);
|
||||
|
||||
gRxVfo->STEP_SETTING = BackupStep;
|
||||
gRxVfo->StepFrequency = BackupFrequency;
|
||||
gRxVfo->STEP_SETTING = backupStep;
|
||||
gRxVfo->StepFrequency = backupFrequency;
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
@@ -381,23 +327,21 @@ void SCANNER_Start(void)
|
||||
gIsNoaaMode = false;
|
||||
#endif
|
||||
|
||||
if (gScanSingleFrequency)
|
||||
{
|
||||
if (gScanSingleFrequency) {
|
||||
gScanCssState = SCAN_CSS_STATE_SCANNING;
|
||||
gScanFrequency = gRxVfo->pRX->Frequency;
|
||||
gStepSetting = gRxVfo->STEP_SETTING;
|
||||
stepSetting = gRxVfo->STEP_SETTING;
|
||||
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(gScanFrequency);
|
||||
BK4819_SetScanFrequency(gScanFrequency);
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
gScanCssState = SCAN_CSS_STATE_OFF;
|
||||
gScanFrequency = 0xFFFFFFFF;
|
||||
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(0xFFFFFFFF);
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(gScanFrequency);
|
||||
BK4819_EnableFrequencyScan();
|
||||
|
||||
gUpdateStatus = true;
|
||||
@@ -408,7 +352,7 @@ void SCANNER_Start(void)
|
||||
gScanDelay_10ms = scan_delay_10ms;
|
||||
gScanCssResultCode = 0xFF;
|
||||
gScanCssResultType = 0xFF;
|
||||
gScanHitCount = 0;
|
||||
scanHitCount = 0;
|
||||
gScanUseCssResult = false;
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
g_CDCSS_Lost = false;
|
||||
@@ -418,242 +362,165 @@ void SCANNER_Start(void)
|
||||
g_VOX_Lost = false;
|
||||
#endif
|
||||
g_SquelchLost = false;
|
||||
gScannerEditState = 0;
|
||||
gScannerSaveState = SCAN_SAVE_NO_PROMPT;
|
||||
gScanProgressIndicator = 0;
|
||||
}
|
||||
|
||||
void SCANNER_Found()
|
||||
{
|
||||
switch (gEeprom.SCAN_RESUME_MODE)
|
||||
{
|
||||
case SCAN_RESUME_TO:
|
||||
if (!gScanPauseMode)
|
||||
{
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gScanPauseMode = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCAN_RESUME_CO:
|
||||
case SCAN_RESUME_SE:
|
||||
gScanPauseDelayIn_10ms = 0;
|
||||
gScheduleScanListen = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) { //memory scan
|
||||
lastFoundFrqOrChan = gRxVfo->CHANNEL_SAVE;
|
||||
}
|
||||
else { // frequency scan
|
||||
lastFoundFrqOrChan = gRxVfo->freq_config_RX.Frequency;
|
||||
}
|
||||
|
||||
|
||||
gScanKeepResult = true;
|
||||
}
|
||||
|
||||
void SCANNER_Stop(void)
|
||||
{
|
||||
if(initialCROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
gEeprom.CROSS_BAND_RX_TX = initialCROSS_BAND_RX_TX;
|
||||
initialCROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
if(SCANNER_IsScanning()) {
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gFlagResetVfos = true;
|
||||
gUpdateStatus = true;
|
||||
gCssBackgroundScan = false;
|
||||
gScanUseCssResult = false;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
BK4819_StopScan();
|
||||
}
|
||||
}
|
||||
|
||||
void SCANNER_TimeSlice10ms(void)
|
||||
{
|
||||
if (!SCANNER_IsScanning())
|
||||
return;
|
||||
|
||||
if (gScanDelay_10ms > 0) {
|
||||
gScanDelay_10ms--;
|
||||
return;
|
||||
}
|
||||
|
||||
gScanStateDir = SCAN_OFF;
|
||||
if (gScannerSaveState != SCAN_SAVE_NO_PROMPT) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t chFr = gScanKeepResult ? lastFoundFrqOrChan : initialFrqOrChan;
|
||||
const bool channelChanged = chFr != initialFrqOrChan;
|
||||
if (IS_MR_CHANNEL(gNextMrChannel)) {
|
||||
gEeprom.MrChannel[gEeprom.RX_VFO] = chFr;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = chFr;
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
switch (gScanCssState) {
|
||||
case SCAN_CSS_STATE_OFF: {
|
||||
// must be RF frequency scanning if we're here ?
|
||||
uint32_t result;
|
||||
if (!BK4819_GetFrequencyScanResult(&result))
|
||||
break;
|
||||
|
||||
int32_t delta = result - gScanFrequency;
|
||||
gScanFrequency = result;
|
||||
|
||||
if (delta < 0)
|
||||
delta = -delta;
|
||||
if (delta < 100)
|
||||
scanHitCount++;
|
||||
else
|
||||
scanHitCount = 0;
|
||||
|
||||
BK4819_DisableFrequencyScan();
|
||||
|
||||
if (scanHitCount < 3) {
|
||||
BK4819_EnableFrequencyScan();
|
||||
}
|
||||
else {
|
||||
BK4819_SetScanFrequency(gScanFrequency);
|
||||
gScanCssResultCode = 0xFF;
|
||||
gScanCssResultType = 0xFF;
|
||||
scanHitCount = 0;
|
||||
gScanUseCssResult = false;
|
||||
gScanProgressIndicator = 0;
|
||||
gScanCssState = SCAN_CSS_STATE_SCANNING;
|
||||
|
||||
if(!gCssBackgroundScan)
|
||||
GUI_SelectNextDisplay(DISPLAY_SCANNER);
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
gScanDelay_10ms = scan_delay_10ms;
|
||||
//gScanDelay_10ms = 1; // 10ms
|
||||
break;
|
||||
}
|
||||
case SCAN_CSS_STATE_SCANNING: {
|
||||
uint32_t cdcssFreq;
|
||||
uint16_t ctcssFreq;
|
||||
BK4819_CssScanResult_t scanResult = BK4819_GetCxCSSScanResult(&cdcssFreq, &ctcssFreq);
|
||||
if (scanResult == BK4819_CSS_RESULT_NOT_FOUND)
|
||||
break;
|
||||
|
||||
BK4819_Disable();
|
||||
|
||||
if (scanResult == BK4819_CSS_RESULT_CDCSS) {
|
||||
const uint8_t Code = DCS_GetCdcssCode(cdcssFreq);
|
||||
if (Code != 0xFF)
|
||||
{
|
||||
gScanCssResultCode = Code;
|
||||
gScanCssResultType = CODE_TYPE_DIGITAL;
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
gScanUseCssResult = true;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else if (scanResult == BK4819_CSS_RESULT_CTCSS) {
|
||||
const uint8_t Code = DCS_GetCtcssCode(ctcssFreq);
|
||||
if (Code != 0xFF) {
|
||||
if (Code == gScanCssResultCode && gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
if (++scanHitCount >= 2) {
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
gScanUseCssResult = true;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
scanHitCount = 0;
|
||||
|
||||
gScanCssResultType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
gScanCssResultCode = Code;
|
||||
}
|
||||
}
|
||||
|
||||
if (gScanCssState < SCAN_CSS_STATE_FOUND) { // scanning or off
|
||||
BK4819_SetScanFrequency(gScanFrequency);
|
||||
gScanDelay_10ms = scan_delay_10ms;
|
||||
break;
|
||||
}
|
||||
|
||||
if(gCssBackgroundScan) {
|
||||
gCssBackgroundScan = false;
|
||||
if(gScanUseCssResult)
|
||||
MENU_CssScanFound();
|
||||
}
|
||||
else
|
||||
GUI_SelectNextDisplay(DISPLAY_SCANNER);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
gCssBackgroundScan = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SCANNER_TimeSlice500ms(void)
|
||||
{
|
||||
if (SCANNER_IsScanning() && gScannerSaveState == SCAN_SAVE_NO_PROMPT && gScanCssState < SCAN_CSS_STATE_FOUND) {
|
||||
gScanProgressIndicator++;
|
||||
#ifdef ENABLE_NO_CODE_SCAN_TIMEOUT
|
||||
if (gScanProgressIndicator > 32) {
|
||||
if (gScanCssState == SCAN_CSS_STATE_SCANNING && !gScanSingleFrequency)
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
else
|
||||
gScanCssState = SCAN_CSS_STATE_FAILED;
|
||||
|
||||
if(channelChanged) {
|
||||
SETTINGS_SaveVfoIndices();
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gRxVfo->freq_config_RX.Frequency = chFr;
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
if(channelChanged) {
|
||||
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_VFO, gRxVfo, 1);
|
||||
}
|
||||
}
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void NextFreqChannel(void)
|
||||
{
|
||||
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
|
||||
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||
#endif
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void NextMemChannel(void)
|
||||
{
|
||||
static unsigned int prev_mr_chan = 0;
|
||||
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
|
||||
const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const unsigned int prev_chan = gNextMrChannel;
|
||||
unsigned int chan = 0;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
switch (currentScanList)
|
||||
{
|
||||
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||
prev_mr_chan = gNextMrChannel;
|
||||
|
||||
if (chan1 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||
{
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gNextMrChannel = chan1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[[fallthrough]];
|
||||
case SCAN_NEXT_CHAN_SCANLIST2:
|
||||
if (chan2 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||
{
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||
gNextMrChannel = chan2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[[fallthrough]];
|
||||
|
||||
// this bit doesn't yet work if the other VFO is a frequency
|
||||
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||
// dual watch is enabled - include the other VFO in the scan
|
||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
// {
|
||||
// chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||
// chan = gEeprom.ScreenChannel[chan];
|
||||
// if (IS_MR_CHANNEL(chan))
|
||||
// {
|
||||
// currentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||
// gNextMrChannel = chan;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
default:
|
||||
case SCAN_NEXT_CHAN_MR:
|
||||
currentScanList = SCAN_NEXT_CHAN_MR;
|
||||
gNextMrChannel = prev_mr_chan;
|
||||
chan = 0xff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!enabled || chan == 0xff)
|
||||
{
|
||||
chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (chan == 0xFF)
|
||||
{ // no valid channel found
|
||||
chan = MR_CHANNEL_FIRST;
|
||||
}
|
||||
|
||||
gNextMrChannel = chan;
|
||||
}
|
||||
|
||||
if (gNextMrChannel != prev_chan)
|
||||
{
|
||||
gEeprom.MrChannel[ gEeprom.RX_VFO] = gNextMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gNextMrChannel;
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
#endif
|
||||
|
||||
if (enabled)
|
||||
if (++currentScanList >= SCAN_NEXT_NUM)
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
|
||||
else if(gCssBackgroundScan) {
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
void SCANNER_ScanChannels(const bool storeBackupSettings, const int8_t scan_direction)
|
||||
bool SCANNER_IsScanning(void)
|
||||
{
|
||||
if (storeBackupSettings) {
|
||||
initialCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gScanKeepResult = false;
|
||||
}
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gScanStateDir = scan_direction;
|
||||
|
||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||
{ // channel mode
|
||||
if (storeBackupSettings) {
|
||||
initialFrqOrChan = gRxVfo->CHANNEL_SAVE;
|
||||
lastFoundFrqOrChan = initialFrqOrChan;
|
||||
}
|
||||
NextMemChannel();
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
if (storeBackupSettings) {
|
||||
initialFrqOrChan = gRxVfo->freq_config_RX.Frequency;
|
||||
lastFoundFrqOrChan = initialFrqOrChan;
|
||||
}
|
||||
NextFreqChannel();
|
||||
}
|
||||
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScanPauseMode = false;
|
||||
}
|
||||
|
||||
void SCANNER_ContinueScanning()
|
||||
{
|
||||
if (IS_FREQ_CHANNEL(gNextMrChannel))
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
NextFreqChannel(); // switch to next frequency
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
NextMemChannel(); // switch to next channel
|
||||
}
|
||||
|
||||
gScanPauseMode = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScheduleScanListen = false;
|
||||
return gCssBackgroundScan || (gScreenToDisplay == DISPLAY_SCANNER);
|
||||
}
|
||||
@@ -20,50 +20,38 @@
|
||||
#include "dcs.h"
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
enum SCAN_CssState_t
|
||||
typedef enum
|
||||
{
|
||||
SCAN_CSS_STATE_OFF = 0,
|
||||
SCAN_CSS_STATE_OFF,
|
||||
SCAN_CSS_STATE_SCANNING,
|
||||
SCAN_CSS_STATE_FOUND,
|
||||
SCAN_CSS_STATE_FAILED
|
||||
};
|
||||
} SCAN_CssState_t;
|
||||
|
||||
typedef enum SCAN_CssState_t SCAN_CssState_t;
|
||||
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SCAN_REV = -1,
|
||||
SCAN_OFF = 0,
|
||||
SCAN_FWD = +1
|
||||
};
|
||||
SCAN_SAVE_NO_PROMPT, // saving process not initiated
|
||||
SCAN_SAVE_CHAN_SEL, // "SAVE: ", channel select prompt, actives only in channel mode
|
||||
SCAN_SAVE_CHANNEL, // "SAVE?" prompt, waits for confirmation to save settings to channel, or current VFO
|
||||
} SCAN_SaveState_t;
|
||||
|
||||
|
||||
extern DCS_CodeType_t gScanCssResultType;
|
||||
extern uint8_t gScanCssResultCode;
|
||||
extern bool gFlagStartScan;
|
||||
extern bool gFlagStopScan;
|
||||
extern bool gScanSingleFrequency;
|
||||
extern uint8_t gScannerEditState;
|
||||
extern SCAN_SaveState_t gScannerSaveState;
|
||||
extern uint8_t gScanChannel;
|
||||
extern uint32_t gScanFrequency;
|
||||
extern bool gScanPauseMode;
|
||||
extern SCAN_CssState_t gScanCssState;
|
||||
extern volatile bool gScheduleScanListen;
|
||||
extern volatile uint16_t gScanPauseDelayIn_10ms;
|
||||
extern uint8_t gScanProgressIndicator;
|
||||
extern uint8_t gScanHitCount;
|
||||
extern bool gScanUseCssResult;
|
||||
|
||||
// scan direction, if not equal SCAN_OFF indicates
|
||||
// that we are in a process of scanning channels/frequencies
|
||||
extern int8_t gScanStateDir;
|
||||
extern bool gScanKeepResult;
|
||||
|
||||
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void SCANNER_Start(void);
|
||||
void SCANNER_Found();
|
||||
void SCANNER_Start(bool singleFreq);
|
||||
void SCANNER_Stop(void);
|
||||
void SCANNER_ScanChannels(const bool storeBackupSettings, const int8_t scan_direction);
|
||||
void SCANNER_ContinueScanning();
|
||||
void SCANNER_TimeSlice10ms(void);
|
||||
void SCANNER_TimeSlice500ms(void);
|
||||
bool SCANNER_IsScanning(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
7
board.c
7
board.c
@@ -537,6 +537,9 @@ void BOARD_EEPROM_Init(void)
|
||||
EEPROM_ReadBuffer(0x0E78, Data, 8);
|
||||
gEeprom.BACKLIGHT_MAX = (Data[0] & 0xF) <= 10 ? (Data[0] & 0xF) : 10;
|
||||
gEeprom.BACKLIGHT_MIN = (Data[0] >> 4) < gEeprom.BACKLIGHT_MAX ? (Data[0] >> 4) : 0;
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
gEeprom.BACKLIGHT_MIN_STAT = BLMIN_STAT_ON;
|
||||
#endif
|
||||
gEeprom.CHANNEL_DISPLAY_MODE = (Data[1] < 4) ? Data[1] : MDF_FREQUENCY; // 4 instead of 3 - extra display mode
|
||||
gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF;
|
||||
gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4;
|
||||
@@ -698,14 +701,14 @@ void BOARD_EEPROM_Init(void)
|
||||
|
||||
// 0F40..0F47
|
||||
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
||||
gSetting_F_LOCK = (Data[0] < 6) ? Data[0] : F_LOCK_OFF;
|
||||
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
|
||||
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
|
||||
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
|
||||
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
|
||||
gSetting_500TX = (Data[4] < 2) ? Data[4] : false;
|
||||
gSetting_350EN = (Data[5] < 2) ? Data[5] : 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_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2;
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
|
||||
@@ -94,7 +94,18 @@ void BACKLIGHT_TurnOn(void)
|
||||
|
||||
void BACKLIGHT_TurnOff()
|
||||
{
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
register uint8_t tmp;
|
||||
|
||||
if (gEeprom.BACKLIGHT_MIN_STAT == BLMIN_STAT_ON)
|
||||
tmp = gEeprom.BACKLIGHT_MIN;
|
||||
else
|
||||
tmp = 0;
|
||||
|
||||
BACKLIGHT_SetBrightness(tmp);
|
||||
#else
|
||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MIN);
|
||||
#endif
|
||||
gBacklightCountdown = 0;
|
||||
backlightOn = false;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
extern uint16_t gBacklightCountdown;
|
||||
extern uint8_t gBacklightBrightness;
|
||||
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
typedef enum {
|
||||
BLMIN_STAT_ON,
|
||||
BLMIN_STAT_OFF,
|
||||
BLMIN_STAT_UNKNOWN
|
||||
} BLMIN_STAT_t;
|
||||
#endif
|
||||
|
||||
void BACKLIGHT_InitHardware();
|
||||
void BACKLIGHT_TurnOn();
|
||||
void BACKLIGHT_TurnOff();
|
||||
|
||||
@@ -1035,6 +1035,7 @@ void BK4819_PlaySingleTone(const unsigned int tone_Hz, const unsigned int delay,
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0x0000);
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0xC1FE);
|
||||
BK4819_ExitTxMute();
|
||||
}
|
||||
|
||||
void BK4819_EnterTxMute(void)
|
||||
|
||||
@@ -147,7 +147,7 @@ int TX_freq_check(const uint32_t Frequency)
|
||||
|
||||
switch (gSetting_F_LOCK)
|
||||
{
|
||||
case F_LOCK_OFF:
|
||||
case F_LOCK_DEF:
|
||||
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < frequencyBandTable[BAND3_137MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower && Frequency < frequencyBandTable[BAND4_174MHz].upper)
|
||||
@@ -197,6 +197,15 @@ int TX_freq_check(const uint32_t Frequency)
|
||||
if (Frequency >= 40000000 && Frequency < 43800000)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case F_LOCK_ALL:
|
||||
break;
|
||||
|
||||
case F_LOCK_NONE:
|
||||
for (uint8_t i = 0; i < ARRAY_SIZE(frequencyBandTable); i++)
|
||||
if (Frequency >= frequencyBandTable[i].lower && Frequency < frequencyBandTable[i].upper)
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// dis-allowed TX frequency
|
||||
|
||||
18
functions.c
18
functions.c
@@ -44,18 +44,16 @@ FUNCTION_Type_t gCurrentFunction;
|
||||
|
||||
void FUNCTION_Init(void)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#endif
|
||||
{
|
||||
gCurrentCodeType = gSelectedCodeType;
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
gCurrentCodeType = (gRxVfo->Modulation != MODULATION_FM) ? CODE_TYPE_OFF : gRxVfo->pRX->CodeType;
|
||||
gCurrentCodeType = (gRxVfo->Modulation != MODULATION_FM) ? CODE_TYPE_OFF : gRxVfo->pRX->CodeType;
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
gCurrentCodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
gCurrentCodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
#endif
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
|
||||
}
|
||||
|
||||
|
||||
if ((gScreenToDisplay == DISPLAY_MENU) && GetCurrentMenuId() == MENU_VOL)
|
||||
if ((gScreenToDisplay == DISPLAY_MENU) && UI_MENU_GetCurrentMenuId() == MENU_VOL)
|
||||
gUpdateDisplay = true;
|
||||
|
||||
if (gBatteryCurrent < 501)
|
||||
|
||||
7
misc.c
7
misc.c
@@ -82,7 +82,6 @@ bool gSetting_KILLED;
|
||||
bool gSetting_200TX;
|
||||
bool gSetting_500TX;
|
||||
bool gSetting_350EN;
|
||||
bool gSetting_TX_EN;
|
||||
uint8_t gSetting_F_LOCK;
|
||||
bool gSetting_ScrambleEnable;
|
||||
|
||||
@@ -154,7 +153,11 @@ uint8_t gVFO_RSSI_bar_level[2];
|
||||
|
||||
uint8_t gReducedService;
|
||||
uint8_t gBatteryVoltageIndex;
|
||||
CssScanMode_t gCssScanMode;
|
||||
bool gCssBackgroundScan;
|
||||
|
||||
volatile bool gScheduleScanListen = true;
|
||||
volatile uint16_t gScanPauseDelayIn_10ms;
|
||||
|
||||
bool gUpdateRSSI;
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
AlarmState_t gAlarmState;
|
||||
|
||||
26
misc.h
26
misc.h
@@ -75,14 +75,6 @@ enum ReceptionMode_t {
|
||||
};
|
||||
typedef enum ReceptionMode_t ReceptionMode_t;
|
||||
|
||||
enum CssScanMode_t
|
||||
{
|
||||
CSS_SCAN_MODE_OFF = 0,
|
||||
CSS_SCAN_MODE_SCANNING,
|
||||
CSS_SCAN_MODE_FOUND,
|
||||
};
|
||||
typedef enum CssScanMode_t CssScanMode_t;
|
||||
|
||||
enum BacklightOnRxTx_t {
|
||||
BACKLIGHT_ON_TR_OFF,
|
||||
BACKLIGHT_ON_TR_TX,
|
||||
@@ -154,7 +146,6 @@ extern bool gSetting_KILLED;
|
||||
extern bool gSetting_200TX;
|
||||
extern bool gSetting_500TX;
|
||||
extern bool gSetting_350EN;
|
||||
extern bool gSetting_TX_EN;
|
||||
extern uint8_t gSetting_F_LOCK;
|
||||
extern bool gSetting_ScrambleEnable;
|
||||
|
||||
@@ -229,9 +220,20 @@ extern uint8_t gVFO_RSSI_bar_level[2];
|
||||
extern uint8_t gReducedService;
|
||||
extern uint8_t gBatteryVoltageIndex;
|
||||
|
||||
// if not equal CSS_SCAN_MODE_OFF we are scanning CTCSS/DCS
|
||||
// this is a scanning inside RX ctcss/dcs menu
|
||||
extern CssScanMode_t gCssScanMode;
|
||||
// we are searching CTCSS/DCS inside RX ctcss/dcs menu
|
||||
extern bool gCssBackgroundScan;
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
SCAN_REV = -1,
|
||||
SCAN_OFF = 0,
|
||||
SCAN_FWD = +1
|
||||
};
|
||||
|
||||
extern volatile bool gScheduleScanListen;
|
||||
extern volatile uint16_t gScanPauseDelayIn_10ms;
|
||||
|
||||
extern bool gUpdateRSSI;
|
||||
extern AlarmState_t gAlarmState;
|
||||
extern uint16_t gMenuCountdown;
|
||||
|
||||
14
radio.c
14
radio.c
@@ -38,10 +38,7 @@
|
||||
VFO_Info_t *gTxVfo;
|
||||
VFO_Info_t *gRxVfo;
|
||||
VFO_Info_t *gCurrentVfo;
|
||||
DCS_CodeType_t gSelectedCodeType;
|
||||
DCS_CodeType_t gCurrentCodeType;
|
||||
uint8_t gSelectedCode;
|
||||
STEP_Setting_t gStepSetting;
|
||||
VfoState_t VfoState[2];
|
||||
|
||||
const char gModulationStr[][4] =
|
||||
@@ -682,13 +679,8 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
{
|
||||
if (gRxVfo->Modulation == MODULATION_FM)
|
||||
{ // FM
|
||||
uint8_t CodeType = gSelectedCodeType;
|
||||
uint8_t Code = gSelectedCode;
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{
|
||||
CodeType = gRxVfo->pRX->CodeType;
|
||||
Code = gRxVfo->pRX->Code;
|
||||
}
|
||||
uint8_t CodeType = gRxVfo->pRX->CodeType;
|
||||
uint8_t Code = gRxVfo->pRX->Code;
|
||||
|
||||
switch (CodeType)
|
||||
{
|
||||
@@ -1019,7 +1011,7 @@ void RADIO_PrepareTX(void)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!gSetting_TX_EN || gSerialConfigCountDown_500ms > 0)
|
||||
if (gSerialConfigCountDown_500ms > 0)
|
||||
{ // TX is disabled or config upload/download in progress
|
||||
State = VFO_STATE_TX_DISABLE;
|
||||
}
|
||||
|
||||
4
radio.h
4
radio.h
@@ -149,11 +149,7 @@ extern VFO_Info_t *gRxVfo;
|
||||
// Equal to gTxVfo unless dual watch changes it on incomming transmition (this can only happen when XB off and DW on)
|
||||
extern VFO_Info_t *gCurrentVfo;
|
||||
|
||||
extern DCS_CodeType_t gSelectedCodeType;
|
||||
extern DCS_CodeType_t gCurrentCodeType;
|
||||
extern uint8_t gSelectedCode;
|
||||
|
||||
extern STEP_Setting_t gStepSetting;
|
||||
|
||||
extern VfoState_t VfoState[2];
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app/chFrScanner.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
@@ -77,18 +78,18 @@ void SystickHandler(void)
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
DECREMENT_AND_TRIGGER(gPowerSave_10ms, gPowerSaveCountdownExpired);
|
||||
|
||||
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
if (gScanStateDir == SCAN_OFF && !gCssBackgroundScan && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
|
||||
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch);
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
||||
if (gScanStateDir == SCAN_OFF && !gCssBackgroundScan && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
||||
if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE)
|
||||
DECREMENT_AND_TRIGGER(gNOAA_Countdown_10ms, gScheduleNOAA);
|
||||
#endif
|
||||
|
||||
if (gScanStateDir != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING)
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
DECREMENT_AND_TRIGGER(gScanPauseDelayIn_10ms, gScheduleScanListen);
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ void SETTINGS_SaveSettings(void)
|
||||
State[4] = gSetting_500TX;
|
||||
State[5] = gSetting_350EN;
|
||||
State[6] = gSetting_ScrambleEnable;
|
||||
if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
|
||||
//if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
|
||||
if (!gSetting_live_DTMF_decoder) State[7] &= ~(1u << 1);
|
||||
State[7] = (State[7] & ~(3u << 2)) | ((gSetting_battery_text & 3u) << 2);
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
|
||||
14
settings.h
14
settings.h
@@ -23,6 +23,7 @@
|
||||
#include "frequencies.h"
|
||||
#include <helper/battery.h>
|
||||
#include "radio.h"
|
||||
#include <driver/backlight.h>
|
||||
|
||||
enum POWER_OnDisplayMode_t {
|
||||
POWER_ON_DISPLAY_MODE_FULL_SCREEN = 0,
|
||||
@@ -33,12 +34,15 @@ enum POWER_OnDisplayMode_t {
|
||||
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
|
||||
|
||||
enum {
|
||||
F_LOCK_OFF = 0,
|
||||
F_LOCK_DEF, //all default frequencies + configurable
|
||||
F_LOCK_FCC,
|
||||
F_LOCK_CE,
|
||||
F_LOCK_GB,
|
||||
F_LOCK_430,
|
||||
F_LOCK_438
|
||||
F_LOCK_438,
|
||||
F_LOCK_ALL, // disable TX on all frequencies
|
||||
F_LOCK_NONE, // enable TX on all frequencies
|
||||
F_LOCK_LEN
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -85,6 +89,9 @@ enum {
|
||||
ACTION_OPT_A_B,
|
||||
ACTION_OPT_VFO_MR,
|
||||
ACTION_OPT_SWITCH_DEMODUL,
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
ACTION_OPT_BLMIN_TMP_OFF, //BackLight Minimum Temporay OFF
|
||||
#endif
|
||||
ACTION_OPT_LEN
|
||||
};
|
||||
|
||||
@@ -231,6 +238,9 @@ typedef struct {
|
||||
|
||||
uint8_t KEY_M_LONG_PRESS_ACTION;
|
||||
uint8_t BACKLIGHT_MIN;
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
BLMIN_STAT_t BACKLIGHT_MIN_STAT;
|
||||
#endif
|
||||
uint8_t BACKLIGHT_MAX;
|
||||
BATTERY_Type_t BATTERY_TYPE;
|
||||
} EEPROM_Config_t;
|
||||
|
||||
57
ui/main.c
57
ui/main.c
@@ -52,6 +52,31 @@ static void DrawSmallAntennaAndBars(uint8_t *p, unsigned int level)
|
||||
memset(p + 2 + i*3, bar, 2);
|
||||
}
|
||||
}
|
||||
#if defined ENABLE_AUDIO_BAR || defined ENABLE_RSSI_BAR
|
||||
|
||||
static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level)
|
||||
{
|
||||
const char hollowBar[] = {
|
||||
0b01111111,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b01111111
|
||||
};
|
||||
|
||||
uint8_t *p_line = gFrameBuffer[line];
|
||||
level = MIN(level, 13);
|
||||
|
||||
for(uint8_t i = 0; i < level; i++) {
|
||||
if(i < 9) {
|
||||
for(uint8_t j = 0; j < 4; j++)
|
||||
p_line[xpos + i * 5 + j] = (~(0x7F >> (i+1))) & 0x7F;
|
||||
}
|
||||
else {
|
||||
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
|
||||
@@ -76,10 +101,10 @@ void UI_DisplayAudioBar(void)
|
||||
{
|
||||
if (gSetting_mic_bar)
|
||||
{
|
||||
if(gLowBattery && !gLowBatteryConfirmed)
|
||||
return;
|
||||
|
||||
const unsigned int line = 3;
|
||||
const unsigned int bar_x = 2;
|
||||
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
|
||||
unsigned int i;
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
@@ -95,16 +120,14 @@ void UI_DisplayAudioBar(void)
|
||||
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
|
||||
|
||||
// make non-linear to make more sensitive at low values
|
||||
const unsigned int level = voice_amp * 8;
|
||||
const unsigned int sqrt_level = sqrt16((level < 65535) ? level : 65535);
|
||||
const unsigned int len = (sqrt_level <= bar_width) ? sqrt_level : bar_width;
|
||||
const unsigned int level = MIN(voice_amp * 8, 65535u);
|
||||
const unsigned int sqrt_level = MIN(sqrt16(level), 124u);
|
||||
uint8_t bars = 13 * sqrt_level / 124;
|
||||
|
||||
uint8_t *p_line = gFrameBuffer[line];
|
||||
|
||||
memset(p_line, 0, LCD_WIDTH);
|
||||
|
||||
for (i = 0; i < bar_width; i++)
|
||||
p_line[bar_x + i] = (i > len) ? ((i & 1) == 0) ? 0x41 : 0x00 : ((i & 1) == 0) ? 0x7f : 0x3e;
|
||||
DrawLevelBar(62, line, bars);
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
ST7565_BlitFullScreen();
|
||||
@@ -112,6 +135,7 @@ void UI_DisplayAudioBar(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void DisplayRSSIBar(const int16_t rssi, const bool now)
|
||||
{
|
||||
#if defined(ENABLE_RSSI_BAR)
|
||||
@@ -134,13 +158,6 @@ static void DisplayRSSIBar(const int16_t rssi, const bool now)
|
||||
0b00011000,
|
||||
};
|
||||
|
||||
const char hollowBar[] = {
|
||||
0b01111111,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b01111111
|
||||
};
|
||||
|
||||
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
||||
return; // display is in use
|
||||
|
||||
@@ -169,13 +186,7 @@ static void DisplayRSSIBar(const int16_t rssi, const bool now)
|
||||
|
||||
UI_PrintStringSmall(str, 2, 0, line);
|
||||
|
||||
for(uint8_t i = 0; i < s_level; i++) { // S bars
|
||||
for(uint8_t j = 0; j < 4; j++)
|
||||
p_line[bar_x + i * 5 + j] = (~(0x7F >> (i+1))) & 0x7F;
|
||||
}
|
||||
for(uint8_t i = 0; i < overS9Bars; i++) { // +10 hollow bars
|
||||
memcpy(p_line + (bar_x + (i + 9) * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
||||
}
|
||||
DrawLevelBar(bar_x, line, s_level + overS9Bars);
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
129
ui/menu.c
129
ui/menu.c
@@ -129,7 +129,6 @@ const t_menu_item MenuList[] =
|
||||
{"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||
{"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||
{"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||
{"TxEnab", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
{"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
#endif
|
||||
@@ -142,33 +141,33 @@ const t_menu_item MenuList[] =
|
||||
|
||||
const uint8_t FIRST_HIDDEN_MENU_ITEM = MENU_F_LOCK;
|
||||
|
||||
const char gSubMenu_TXP[3][5] =
|
||||
const char gSubMenu_TXP[][5] =
|
||||
{
|
||||
"LOW",
|
||||
"MID",
|
||||
"HIGH"
|
||||
};
|
||||
|
||||
const char gSubMenu_SFT_D[3][4] =
|
||||
const char gSubMenu_SFT_D[][4] =
|
||||
{
|
||||
"OFF",
|
||||
"+",
|
||||
"-"
|
||||
};
|
||||
|
||||
const char gSubMenu_W_N[2][7] =
|
||||
const char gSubMenu_W_N[][7] =
|
||||
{
|
||||
"WIDE",
|
||||
"NARROW"
|
||||
};
|
||||
|
||||
const char gSubMenu_OFF_ON[2][4] =
|
||||
const char gSubMenu_OFF_ON[][4] =
|
||||
{
|
||||
"OFF",
|
||||
"ON"
|
||||
};
|
||||
|
||||
const char gSubMenu_SAVE[5][4] =
|
||||
const char gSubMenu_SAVE[][4] =
|
||||
{
|
||||
"OFF",
|
||||
"1:1",
|
||||
@@ -177,7 +176,7 @@ const char gSubMenu_SAVE[5][4] =
|
||||
"1:4"
|
||||
};
|
||||
|
||||
const char gSubMenu_TOT[11][7] =
|
||||
const char gSubMenu_TOT[][7] =
|
||||
{
|
||||
"30 sec",
|
||||
"1 min",
|
||||
@@ -192,7 +191,7 @@ const char gSubMenu_TOT[11][7] =
|
||||
"15 min"
|
||||
};
|
||||
|
||||
const char* gSubMenu_RXMode[4] =
|
||||
const char* gSubMenu_RXMode[] =
|
||||
{
|
||||
"MAIN\nONLY", // TX and RX on main only
|
||||
"DUAL RX\nRESPOND", // Watch both and respond
|
||||
@@ -201,7 +200,7 @@ const char* gSubMenu_RXMode[4] =
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
const char gSubMenu_VOICE[3][4] =
|
||||
const char gSubMenu_VOICE[][4] =
|
||||
{
|
||||
"OFF",
|
||||
"CHI",
|
||||
@@ -209,14 +208,14 @@ const char* gSubMenu_RXMode[4] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_SC_REV[3][8] =
|
||||
const char gSubMenu_SC_REV[][8] =
|
||||
{
|
||||
"TIMEOUT",
|
||||
"CARRIER",
|
||||
"STOP"
|
||||
};
|
||||
|
||||
const char* gSubMenu_MDF[4] =
|
||||
const char* gSubMenu_MDF[] =
|
||||
{
|
||||
"FREQ",
|
||||
"CHANNEL\nNUMBER",
|
||||
@@ -225,14 +224,14 @@ const char* gSubMenu_MDF[4] =
|
||||
};
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
const char gSubMenu_AL_MOD[2][5] =
|
||||
const char gSubMenu_AL_MOD[][5] =
|
||||
{
|
||||
"SITE",
|
||||
"TONE"
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_D_RSP[4][11] =
|
||||
const char gSubMenu_D_RSP[][11] =
|
||||
{
|
||||
"DO\nNOTHING",
|
||||
"RING",
|
||||
@@ -240,16 +239,16 @@ const char gSubMenu_D_RSP[4][11] =
|
||||
"BOTH"
|
||||
};
|
||||
|
||||
const char* gSubMenu_PTT_ID[5] =
|
||||
const char* gSubMenu_PTT_ID[] =
|
||||
{
|
||||
"OFF",
|
||||
"KEY\nUP",
|
||||
"KEY\nDOWN",
|
||||
"KEY\nUP+DOWN",
|
||||
"UP CODE",
|
||||
"DOWN CODE",
|
||||
"UP+DOWN\nCODE",
|
||||
"APOLLO\nQUINDAR"
|
||||
};
|
||||
|
||||
const char gSubMenu_PONMSG[4][8] =
|
||||
const char gSubMenu_PONMSG[][8] =
|
||||
{
|
||||
"FULL",
|
||||
"MESSAGE",
|
||||
@@ -257,30 +256,32 @@ const char gSubMenu_PONMSG[4][8] =
|
||||
"NONE"
|
||||
};
|
||||
|
||||
const char* gSubMenu_ROGER[3] =
|
||||
const char gSubMenu_ROGER[][6] =
|
||||
{
|
||||
"OFF",
|
||||
"ROGER",
|
||||
"MDC\n1200"
|
||||
"MDC"
|
||||
};
|
||||
|
||||
const char gSubMenu_RESET[2][4] =
|
||||
const char gSubMenu_RESET[][4] =
|
||||
{
|
||||
"VFO",
|
||||
"ALL"
|
||||
};
|
||||
|
||||
const char gSubMenu_F_LOCK[6][4] =
|
||||
const char * gSubMenu_F_LOCK[] =
|
||||
{
|
||||
"OFF",
|
||||
"FCC",
|
||||
"CE",
|
||||
"GB",
|
||||
"430",
|
||||
"438"
|
||||
"DEFAULT+\n137-174\n400-470",
|
||||
"FCC HAM\n144-148\n420-450",
|
||||
"CE HAM\n144-146\n430-440",
|
||||
"GB HAM\n144-148\n430-440",
|
||||
"137-174\n400-430",
|
||||
"137-174\n400-438",
|
||||
"DISABLE\nALL",
|
||||
"UNLOCK\nALL",
|
||||
};
|
||||
|
||||
const char gSubMenu_BACKLIGHT[8][7] =
|
||||
const char gSubMenu_BACKLIGHT[][7] =
|
||||
{
|
||||
"OFF",
|
||||
"5 sec",
|
||||
@@ -292,7 +293,7 @@ const char gSubMenu_BACKLIGHT[8][7] =
|
||||
"ON"
|
||||
};
|
||||
|
||||
const char gSubMenu_RX_TX[4][6] =
|
||||
const char gSubMenu_RX_TX[][6] =
|
||||
{
|
||||
"OFF",
|
||||
"TX",
|
||||
@@ -301,7 +302,7 @@ const char gSubMenu_RX_TX[4][6] =
|
||||
};
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
const char gSubMenu_AM_fix_test1[4][8] =
|
||||
const char gSubMenu_AM_fix_test1[][8] =
|
||||
{
|
||||
"LNA-S 0",
|
||||
"LNA-S 1",
|
||||
@@ -310,20 +311,20 @@ const char gSubMenu_RX_TX[4][6] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_BAT_TXT[3][8] =
|
||||
const char gSubMenu_BAT_TXT[][8] =
|
||||
{
|
||||
"NONE",
|
||||
"VOLTAGE",
|
||||
"PERCENT"
|
||||
};
|
||||
|
||||
const char gSubMenu_BATTYP[2][9] =
|
||||
const char gSubMenu_BATTYP[][9] =
|
||||
{
|
||||
"1600mAh",
|
||||
"2200mAh"
|
||||
};
|
||||
|
||||
const char gSubMenu_SCRAMBLER[11][7] =
|
||||
const char gSubMenu_SCRAMBLER[][7] =
|
||||
{
|
||||
"OFF",
|
||||
"2600Hz",
|
||||
@@ -361,19 +362,30 @@ const t_sidefunction SIDEFUNCTIONS[] =
|
||||
{"SWITCH\nVFO", ACTION_OPT_A_B},
|
||||
{"VFO/MR", ACTION_OPT_VFO_MR},
|
||||
{"SWITCH\nDEMODUL", ACTION_OPT_SWITCH_DEMODUL},
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
{"BLMIN\nTMP OFF", ACTION_OPT_BLMIN_TMP_OFF}, //BackLight Minimum Temporay OFF
|
||||
#endif
|
||||
};
|
||||
const t_sidefunction* gSubMenu_SIDEFUNCTIONS = SIDEFUNCTIONS;
|
||||
const uint8_t gSubMenu_SIDEFUNCTIONS_size = ARRAY_SIZE(SIDEFUNCTIONS);
|
||||
|
||||
bool gIsInSubMenu;
|
||||
uint8_t gMenuCursor;
|
||||
int GetCurrentMenuId() {
|
||||
int UI_MENU_GetCurrentMenuId() {
|
||||
if(gMenuCursor < ARRAY_SIZE(MenuList))
|
||||
return MenuList[gMenuCursor].menu_id;
|
||||
else
|
||||
return MenuList[ARRAY_SIZE(MenuList)-1].menu_id;
|
||||
}
|
||||
int8_t gMenuScrollDirection;
|
||||
|
||||
uint8_t UI_MENU_GetMenuIdx(uint8_t id)
|
||||
{
|
||||
for(uint8_t i = 0; i < ARRAY_SIZE(MenuList); i++)
|
||||
if(MenuList[i].menu_id == id)
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t gSubMenuSelection;
|
||||
|
||||
// edit box
|
||||
@@ -476,7 +488,7 @@ void UI_DisplayMenu(void)
|
||||
|
||||
bool already_printed = false;
|
||||
|
||||
switch (GetCurrentMenuId())
|
||||
switch (UI_MENU_GetCurrentMenuId())
|
||||
{
|
||||
case MENU_SQL:
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
@@ -623,7 +635,6 @@ void UI_DisplayMenu(void)
|
||||
case MENU_500TX:
|
||||
case MENU_350EN:
|
||||
case MENU_SCREN:
|
||||
case MENU_TX_EN:
|
||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
@@ -791,7 +802,10 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_F_LOCK:
|
||||
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
||||
if(!gIsInSubMenu && gUnlockAllTxConfCnt>0 && gUnlockAllTxConfCnt<10)
|
||||
strcpy(String, "READ\nMANUAL");
|
||||
else
|
||||
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
@@ -884,9 +898,9 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (GetCurrentMenuId() == MENU_SLIST1 || GetCurrentMenuId() == MENU_SLIST2)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_SLIST1 || UI_MENU_GetCurrentMenuId() == MENU_SLIST2)
|
||||
{
|
||||
i = (GetCurrentMenuId() == MENU_SLIST1) ? 0 : 1;
|
||||
i = (UI_MENU_GetCurrentMenuId() == MENU_SLIST1) ? 0 : 1;
|
||||
|
||||
// if (gSubMenuSelection == 0xFF)
|
||||
if (gSubMenuSelection < 0)
|
||||
@@ -931,9 +945,9 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
GetCurrentMenuId() == MENU_1_CALL)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_1_CALL)
|
||||
{ // display the channel name
|
||||
char s[11];
|
||||
BOARD_fetchChannelName(s, gSubMenuSelection);
|
||||
@@ -942,18 +956,19 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(s, menu_item_x1, menu_item_x2, 2, 8);
|
||||
}
|
||||
|
||||
if ((GetCurrentMenuId() == MENU_R_CTCS || GetCurrentMenuId() == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
|
||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (GetCurrentMenuId() == MENU_UPCODE)
|
||||
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_UPCODE)
|
||||
if (strlen(gEeprom.DTMF_UP_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_UP_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (GetCurrentMenuId() == MENU_DWCODE)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_DWCODE)
|
||||
if (strlen(gEeprom.DTMF_DOWN_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid)
|
||||
{
|
||||
Contact[11] = 0;
|
||||
memmove(&gDTMF_ID, Contact + 8, 4);
|
||||
@@ -961,20 +976,20 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
}
|
||||
|
||||
if (GetCurrentMenuId() == MENU_R_CTCS ||
|
||||
GetCurrentMenuId() == MENU_T_CTCS ||
|
||||
GetCurrentMenuId() == MENU_R_DCS ||
|
||||
GetCurrentMenuId() == MENU_T_DCS ||
|
||||
GetCurrentMenuId() == MENU_D_LIST)
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_R_CTCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_T_CTCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_R_DCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_T_DCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_D_LIST)
|
||||
{
|
||||
sprintf(String, "%2d", gSubMenuSelection);
|
||||
UI_PrintStringSmall(String, 105, 0, 0);
|
||||
}
|
||||
|
||||
if ((GetCurrentMenuId() == MENU_RESET ||
|
||||
GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_MEM_NAME ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation)
|
||||
if ((UI_MENU_GetCurrentMenuId() == MENU_RESET ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation)
|
||||
{ // display confirmation
|
||||
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
|
||||
12
ui/menu.h
12
ui/menu.h
@@ -21,6 +21,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "audio.h" // VOICE_ID_t
|
||||
#include "settings.h"
|
||||
|
||||
typedef struct {
|
||||
const char name[7]; // menu display area only has room for 6 characters
|
||||
@@ -110,8 +111,6 @@ enum
|
||||
MENU_500TX,
|
||||
MENU_350EN,
|
||||
MENU_SCREN,
|
||||
|
||||
MENU_TX_EN, // enable TX
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
MENU_F_CALI, // reference xtal calibration
|
||||
#endif
|
||||
@@ -146,9 +145,9 @@ extern const char* gSubMenu_MDF[4];
|
||||
extern const char gSubMenu_D_RSP[4][11];
|
||||
extern const char* gSubMenu_PTT_ID[5];
|
||||
extern const char gSubMenu_PONMSG[4][8];
|
||||
extern const char* gSubMenu_ROGER[3];
|
||||
extern const char gSubMenu_ROGER[3][6];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char gSubMenu_F_LOCK[6][4];
|
||||
extern const char* gSubMenu_F_LOCK[F_LOCK_LEN];
|
||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||
extern const char gSubMenu_RX_TX[4][6];
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
@@ -165,8 +164,7 @@ extern const t_sidefunction* gSubMenu_SIDEFUNCTIONS;
|
||||
extern bool gIsInSubMenu;
|
||||
|
||||
extern uint8_t gMenuCursor;
|
||||
int GetCurrentMenuId();
|
||||
extern int8_t gMenuScrollDirection;
|
||||
|
||||
extern int32_t gSubMenuSelection;
|
||||
|
||||
extern char edit_original[17];
|
||||
@@ -174,5 +172,7 @@ extern char edit[17];
|
||||
extern int edit_index;
|
||||
|
||||
void UI_DisplayMenu(void);
|
||||
int UI_MENU_GetCurrentMenuId();
|
||||
uint8_t UI_MENU_GetMenuIdx(uint8_t id);
|
||||
|
||||
#endif
|
||||
|
||||
12
ui/scanner.c
12
ui/scanner.c
@@ -50,7 +50,7 @@ void UI_DisplayScanner(void)
|
||||
UI_PrintString(String, 2, 0, 3, 8);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gScannerEditState == 2)
|
||||
if (gScannerSaveState == SCAN_SAVE_CHANNEL)
|
||||
{
|
||||
strcpy(String, "SAVE?");
|
||||
|
||||
@@ -59,19 +59,15 @@ void UI_DisplayScanner(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gScannerEditState == 1)
|
||||
{
|
||||
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
|
||||
strcpy(String, "SAVE:");
|
||||
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
|
||||
}
|
||||
else
|
||||
if (gScanCssState < SCAN_CSS_STATE_FOUND)
|
||||
{
|
||||
else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
||||
strcpy(String, "SCAN");
|
||||
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
|
||||
}
|
||||
else
|
||||
if (gScanCssState == SCAN_CSS_STATE_FOUND)
|
||||
else if (gScanCssState == SCAN_CSS_STATE_FOUND)
|
||||
strcpy(String, "SCAN CMP.");
|
||||
else
|
||||
strcpy(String, "SCAN FAIL.");
|
||||
|
||||
@@ -16,10 +16,11 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/scanner.h"
|
||||
#include "app/chFrScanner.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
#include "app/scanner.h"
|
||||
#include "bitmaps.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/st7565.h"
|
||||
@@ -86,10 +87,10 @@ void UI_DisplayStatus()
|
||||
}
|
||||
else
|
||||
// SCAN indicator
|
||||
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER)
|
||||
if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning())
|
||||
{
|
||||
char * s = "";
|
||||
if (IS_MR_CHANNEL(gNextMrChannel) && gScreenToDisplay != DISPLAY_SCANNER)
|
||||
if (IS_MR_CHANNEL(gNextMrChannel) && !SCANNER_IsScanning())
|
||||
{ // channel mode
|
||||
switch(gEeprom.SCAN_LIST_DEFAULT) {
|
||||
case 0: s = "1"; break;
|
||||
@@ -119,7 +120,7 @@ void UI_DisplayStatus()
|
||||
#endif
|
||||
|
||||
x++;
|
||||
if(gScreenToDisplay != DISPLAY_SCANNER) {
|
||||
if(!SCANNER_IsScanning()) {
|
||||
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
|
||||
if(dw == 1 || dw == 3) { // DWR - dual watch + respond
|
||||
if(gDualWatchActive)
|
||||
|
||||
4
ui/ui.c
4
ui/ui.c
@@ -16,11 +16,11 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/chFrScanner.h"
|
||||
#include "app/dtmf.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
#include "app/scanner.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "misc.h"
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
@@ -86,7 +86,7 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
gIsInSubMenu = false;
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
gCssBackgroundScan = false;
|
||||
gScanStateDir = SCAN_OFF;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
|
||||
Reference in New Issue
Block a user