Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
5416c3a041
|
|||
|
b54e5ef8a5
|
|||
|
1ec2e15de8
|
|||
|
23dbad1a53
|
|||
|
6d98e23202
|
|||
|
8e48a5f4c5
|
|||
|
bbeb1d8fab
|
|||
|
c0d3ba51a2
|
|||
| 7b1d31fdef | |||
|
0ea8767a8b
|
|||
|
f1904e03fe
|
|||
| 101bde7463 | |||
|
85fb527020
|
|||
|
4fe99744e1
|
|||
|
8dd68d74a6
|
18
Makefile
18
Makefile
@@ -9,11 +9,10 @@ ENABLE_UART ?= 1
|
|||||||
ENABLE_AIRCOPY ?= 0
|
ENABLE_AIRCOPY ?= 0
|
||||||
ENABLE_NOAA ?= 0
|
ENABLE_NOAA ?= 0
|
||||||
ENABLE_VOICE ?= 0
|
ENABLE_VOICE ?= 0
|
||||||
ENABLE_VOX ?= 1
|
ENABLE_VOX ?= 0
|
||||||
ENABLE_ALARM ?= 0
|
ENABLE_ALARM ?= 0
|
||||||
ENABLE_TX1750 ?= 1
|
ENABLE_TX1750 ?= 0
|
||||||
ENABLE_PWRON_PASSWORD ?= 0
|
ENABLE_PWRON_PASSWORD ?= 0
|
||||||
ENABLE_DTMF_CALLING ?= 0
|
|
||||||
ENABLE_FLASHLIGHT ?= 1
|
ENABLE_FLASHLIGHT ?= 1
|
||||||
|
|
||||||
# ---- CUSTOM MODS ----
|
# ---- CUSTOM MODS ----
|
||||||
@@ -38,16 +37,15 @@ ENABLE_AUDIO_BAR ?= 1
|
|||||||
ENABLE_COPY_CHAN_TO_VFO ?= 1
|
ENABLE_COPY_CHAN_TO_VFO ?= 1
|
||||||
ENABLE_REDUCE_LOW_MID_TX_POWER ?= 1
|
ENABLE_REDUCE_LOW_MID_TX_POWER ?= 1
|
||||||
ENABLE_BYP_RAW_DEMODULATORS ?= 1
|
ENABLE_BYP_RAW_DEMODULATORS ?= 1
|
||||||
ENABLE_BLMIN_TMP_OFF ?= 1
|
ENABLE_BLMIN_TMP_OFF ?= 0
|
||||||
ENABLE_SCAN_RANGES ?= 1
|
ENABLE_SCAN_RANGES ?= 1
|
||||||
ENABLE_FEAT_F4HWN ?= 1
|
ENABLE_FEAT_F4HWN ?= 1
|
||||||
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
|
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
|
||||||
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
|
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
|
||||||
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 0
|
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 0
|
||||||
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
|
ENABLE_FEAT_F4HWN_CHARGING_C ?= 0
|
||||||
ENABLE_FEAT_F4HWN_SLEEP ?= 1
|
ENABLE_FEAT_F4HWN_SLEEP ?= 1
|
||||||
ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1
|
ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1
|
||||||
ENABLE_FEAT_F4HWN_NARROWER ?= 1
|
|
||||||
ENABLE_FEAT_F4HWN_INV ?= 1
|
ENABLE_FEAT_F4HWN_INV ?= 1
|
||||||
ENABLE_FEAT_F4HWN_CTR ?= 0
|
ENABLE_FEAT_F4HWN_CTR ?= 0
|
||||||
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
|
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
|
||||||
@@ -139,6 +137,7 @@ OBJS += app/chFrScanner.o
|
|||||||
OBJS += app/common.o
|
OBJS += app/common.o
|
||||||
OBJS += app/dtmf.o
|
OBJS += app/dtmf.o
|
||||||
OBJS += app/fskmodem.o
|
OBJS += app/fskmodem.o
|
||||||
|
OBJS += app/messages.o
|
||||||
ifeq ($(ENABLE_REGA),1)
|
ifeq ($(ENABLE_REGA),1)
|
||||||
OBJS += app/rega.o
|
OBJS += app/rega.o
|
||||||
endif
|
endif
|
||||||
@@ -177,6 +176,7 @@ OBJS += settings.o
|
|||||||
ifeq ($(ENABLE_AIRCOPY),1)
|
ifeq ($(ENABLE_AIRCOPY),1)
|
||||||
OBJS += ui/aircopy.o
|
OBJS += ui/aircopy.o
|
||||||
endif
|
endif
|
||||||
|
OBJS += ui/messages.o
|
||||||
OBJS += ui/battery.o
|
OBJS += ui/battery.o
|
||||||
ifeq ($(ENABLE_FMRADIO),1)
|
ifeq ($(ENABLE_FMRADIO),1)
|
||||||
OBJS += ui/fmradio.o
|
OBJS += ui/fmradio.o
|
||||||
@@ -403,9 +403,6 @@ endif
|
|||||||
ifeq ($(ENABLE_SCAN_RANGES),1)
|
ifeq ($(ENABLE_SCAN_RANGES),1)
|
||||||
CFLAGS += -DENABLE_SCAN_RANGES
|
CFLAGS += -DENABLE_SCAN_RANGES
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_DTMF_CALLING),1)
|
|
||||||
CFLAGS += -DENABLE_DTMF_CALLING
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_REGA),1)
|
ifeq ($(ENABLE_REGA),1)
|
||||||
CFLAGS += -DENABLE_REGA
|
CFLAGS += -DENABLE_REGA
|
||||||
endif
|
endif
|
||||||
@@ -449,9 +446,6 @@ endif
|
|||||||
ifeq ($(ENABLE_FEAT_F4HWN_RESUME_STATE),1)
|
ifeq ($(ENABLE_FEAT_F4HWN_RESUME_STATE),1)
|
||||||
CFLAGS += -DENABLE_FEAT_F4HWN_RESUME_STATE
|
CFLAGS += -DENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_FEAT_F4HWN_NARROWER),1)
|
|
||||||
CFLAGS += -DENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_FEAT_F4HWN_INV),1)
|
ifeq ($(ENABLE_FEAT_F4HWN_INV),1)
|
||||||
CFLAGS += -DENABLE_FEAT_F4HWN_INV
|
CFLAGS += -DENABLE_FEAT_F4HWN_INV
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ Special thanks to Jean-Cyrille F6IWW (2 times), Fabrice 14RC123, David F4BPP, Ol
|
|||||||
* no more PWM noise,
|
* no more PWM noise,
|
||||||
* and more...
|
* and more...
|
||||||
* enabled AIR COPY
|
* enabled AIR COPY
|
||||||
* disabled ENABLE_DTMF_CALLING,
|
|
||||||
* disabled SCRAMBLER,
|
* disabled SCRAMBLER,
|
||||||
* remove 200Tx, 350Tx and 500Tx,
|
* remove 200Tx, 350Tx and 500Tx,
|
||||||
* unlock TX on all bands needs only to be repeat 3 times,
|
* unlock TX on all bands needs only to be repeat 3 times,
|
||||||
|
|||||||
72
app/action.c
72
app/action.c
@@ -42,6 +42,9 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#include "driver/st7565.h"
|
||||||
|
#include "ui/menu.h"
|
||||||
|
|
||||||
#ifdef ENABLE_REGA
|
#ifdef ENABLE_REGA
|
||||||
#include "app/rega.h"
|
#include "app/rega.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -110,7 +113,6 @@ void (*action_opt_table[])(void) = {
|
|||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
[ACTION_OPT_RXMODE] = &ACTION_RxMode,
|
[ACTION_OPT_RXMODE] = &ACTION_RxMode,
|
||||||
[ACTION_OPT_MAINONLY] = &ACTION_MainOnly,
|
|
||||||
[ACTION_OPT_PTT] = &ACTION_Ptt,
|
[ACTION_OPT_PTT] = &ACTION_Ptt,
|
||||||
[ACTION_OPT_WN] = &ACTION_Wn,
|
[ACTION_OPT_WN] = &ACTION_Wn,
|
||||||
[ACTION_OPT_BACKLIGHT] = &ACTION_BackLight,
|
[ACTION_OPT_BACKLIGHT] = &ACTION_BackLight,
|
||||||
@@ -119,10 +121,6 @@ void (*action_opt_table[])(void) = {
|
|||||||
#else
|
#else
|
||||||
[ACTION_OPT_MUTE] = &FUNCTION_NOP,
|
[ACTION_OPT_MUTE] = &FUNCTION_NOP,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
[ACTION_OPT_POWER_HIGH] = &ACTION_Power_High,
|
|
||||||
[ACTION_OPT_REMOVE_OFFSET] = &ACTION_Remove_Offset,
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
[ACTION_OPT_RXMODE] = &FUNCTION_NOP,
|
[ACTION_OPT_RXMODE] = &FUNCTION_NOP,
|
||||||
#endif
|
#endif
|
||||||
@@ -136,8 +134,9 @@ static_assert(ARRAY_SIZE(action_opt_table) == ACTION_OPT_LEN);
|
|||||||
|
|
||||||
void ACTION_Power(void)
|
void ACTION_Power(void)
|
||||||
{
|
{
|
||||||
if (++gTxVfo->OUTPUT_POWER > OUTPUT_POWER_HIGH)
|
gTxVfo->OUTPUT_POWER++;
|
||||||
gTxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
|
if (gTxVfo->OUTPUT_POWER >= ARRAY_SIZE(gSubMenu_TXP))
|
||||||
|
gTxVfo->OUTPUT_POWER = 0;
|
||||||
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
|
|
||||||
@@ -207,9 +206,6 @@ void ACTION_Scan(bool bRestart)
|
|||||||
// not scanning
|
// not scanning
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
|
||||||
@@ -440,7 +436,7 @@ static void ACTION_Scan_FM(bool bRestart)
|
|||||||
static void ACTION_AlarmOr1750(const bool b1750)
|
static void ACTION_AlarmOr1750(const bool b1750)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(gEeprom.KEY_LOCK && gEeprom.KEY_LOCK_PTT)
|
if(gEeprom.KEY_LOCK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM)
|
#if defined(ENABLE_ALARM)
|
||||||
@@ -552,40 +548,12 @@ void ACTION_Ptt(void)
|
|||||||
|
|
||||||
void ACTION_Wn(void)
|
void ACTION_Wn(void)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
bool narrower = 0;
|
|
||||||
if (FUNCTION_IsRx())
|
if (FUNCTION_IsRx())
|
||||||
{
|
{
|
||||||
gRxVfo->CHANNEL_BANDWIDTH = (gRxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0;
|
gRxVfo->CHANNEL_BANDWIDTH++;
|
||||||
if(gRxVfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1)
|
if (gRxVfo->CHANNEL_BANDWIDTH > BK4819_FILTER_BW_NARROWER) {
|
||||||
{
|
gRxVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_WIDE;
|
||||||
narrower = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
|
||||||
BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH + narrower, true);
|
|
||||||
#else
|
|
||||||
BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH + narrower, false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gTxVfo->CHANNEL_BANDWIDTH = (gTxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0;
|
|
||||||
if(gTxVfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1)
|
|
||||||
{
|
|
||||||
narrower = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
|
||||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true);
|
|
||||||
#else
|
|
||||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (FUNCTION_IsRx())
|
|
||||||
{
|
|
||||||
gRxVfo->CHANNEL_BANDWIDTH = (gRxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0;
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH, true);
|
BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH, true);
|
||||||
#else
|
#else
|
||||||
@@ -594,14 +562,16 @@ void ACTION_Wn(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gTxVfo->CHANNEL_BANDWIDTH = (gTxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0;
|
gRxVfo->CHANNEL_BANDWIDTH++;
|
||||||
|
if (gRxVfo->CHANNEL_BANDWIDTH > BK4819_FILTER_BW_NARROWER) {
|
||||||
|
gRxVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_WIDE;
|
||||||
|
}
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true);
|
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true);
|
||||||
#else
|
#else
|
||||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false);
|
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACTION_BackLight(void)
|
void ACTION_BackLight(void)
|
||||||
@@ -657,18 +627,4 @@ void ACTION_BackLightOnDemand(void)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
void ACTION_Power_High(void)
|
|
||||||
{
|
|
||||||
gPowerHigh = !gPowerHigh;
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ACTION_Remove_Offset(void)
|
|
||||||
{
|
|
||||||
gRemoveOffset = !gRemoveOffset;
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
@@ -45,10 +45,6 @@ void ACTION_SwitchDemodul(void);
|
|||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
void ACTION_Mute(void);
|
void ACTION_Mute(void);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
void ACTION_Power_High(void);
|
|
||||||
void ACTION_Remove_Offset(void);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||||
|
|||||||
212
app/app.c
212
app/app.c
@@ -29,10 +29,10 @@
|
|||||||
#include "app/chFrScanner.h"
|
#include "app/chFrScanner.h"
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
|
|
||||||
|
#include "../ui/fmradio.h"
|
||||||
#ifdef ENABLE_FLASHLIGHT
|
#ifdef ENABLE_FLASHLIGHT
|
||||||
|
|
||||||
#include "app/flashlight.h"
|
#include "app/flashlight.h"
|
||||||
#include "../ui/fmradio.h"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -91,6 +91,7 @@
|
|||||||
#include "ui/menu.h"
|
#include "ui/menu.h"
|
||||||
#include "ui/status.h"
|
#include "ui/status.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#include "messages.h"
|
||||||
|
|
||||||
static bool flagSaveVfo;
|
static bool flagSaveVfo;
|
||||||
static bool flagSaveSettings;
|
static bool flagSaveSettings;
|
||||||
@@ -103,6 +104,7 @@ void (*ProcessKeysFunctions[])(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
[DISPLAY_MAIN] = &MAIN_ProcessKeys,
|
[DISPLAY_MAIN] = &MAIN_ProcessKeys,
|
||||||
[DISPLAY_MENU] = &MENU_ProcessKeys,
|
[DISPLAY_MENU] = &MENU_ProcessKeys,
|
||||||
[DISPLAY_SCANNER] = &SCANNER_ProcessKeys,
|
[DISPLAY_SCANNER] = &SCANNER_ProcessKeys,
|
||||||
|
[DISPLAY_MESSAGES] = &MESSAGES_ProcessKeys,
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
[DISPLAY_FM] = &FM_ProcessKeys,
|
[DISPLAY_FM] = &FM_ProcessKeys,
|
||||||
@@ -184,10 +186,6 @@ static void CheckForIncoming(void) {
|
|||||||
|
|
||||||
static void HandleIncoming(void) {
|
static void HandleIncoming(void) {
|
||||||
if (!g_SquelchLost) { // squelch is closed
|
if (!g_SquelchLost) { // squelch is closed
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_RX_index > 0)
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
if (gCurrentFunction != FUNCTION_FOREGROUND) {
|
if (gCurrentFunction != FUNCTION_FOREGROUND) {
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
@@ -215,30 +213,6 @@ static void HandleIncoming(void) {
|
|||||||
} else if (!bFlag)
|
} else if (!bFlag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gScanStateDir == SCAN_OFF && (gRxVfo->DTMF_DECODING_ENABLE)) {
|
|
||||||
|
|
||||||
// DTMF DCD is enabled
|
|
||||||
DTMF_HandleRequest();
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE) {
|
|
||||||
if (gRxReceptionMode != RX_MODE_DETECTED) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gDualWatchCountdown_10ms = dual_watch_count_after_1_10ms;
|
|
||||||
gScheduleDualWatch = false;
|
|
||||||
|
|
||||||
gRxReceptionMode = RX_MODE_LISTENING;
|
|
||||||
|
|
||||||
// let the user see DW is not active
|
|
||||||
gDualWatchActive = false;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE);
|
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,7 +527,7 @@ uint32_t APP_SetFreqByStepAndLimits(VFO_Info_t *pInfo, int8_t direction, uint32_
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if (Frequency > upper)
|
if (Frequency > upper)
|
||||||
#else
|
#else
|
||||||
if (Frequency >= upper)
|
if (Frequency >= upper)
|
||||||
#endif
|
#endif
|
||||||
Frequency = lower;
|
Frequency = lower;
|
||||||
|
|
||||||
@@ -668,21 +642,6 @@ static void CheckRadioInterrupts(void) {
|
|||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gRxVfo->DTMF_DECODING_ENABLE) {
|
|
||||||
if (gDTMF_RX_index >= sizeof(gDTMF_RX) - 1) { // make room
|
|
||||||
memmove(&gDTMF_RX[0], &gDTMF_RX[1], sizeof(gDTMF_RX) - 1);
|
|
||||||
gDTMF_RX_index--;
|
|
||||||
}
|
|
||||||
gDTMF_RX[gDTMF_RX_index++] = c;
|
|
||||||
gDTMF_RX[gDTMF_RX_index] = 0;
|
|
||||||
gDTMF_RX_timeout = DTMF_RX_timeout_500ms; // time till we delete it
|
|
||||||
gDTMF_RX_pending = true;
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(3);//fix DTMF not reply@Yurisu
|
|
||||||
DTMF_HandleRequest();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -759,6 +718,7 @@ static void CheckRadioInterrupts(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
FSK_HANDLE_IRQ(interrupts.__raw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -831,9 +791,6 @@ static void HandleVox(void) {
|
|||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT && !SerialConfigInProgress()) {
|
if (gCurrentFunction != FUNCTION_TRANSMIT && !SerialConfigInProgress()) {
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
#endif
|
|
||||||
RADIO_PrepareTX();
|
RADIO_PrepareTX();
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
@@ -850,43 +807,6 @@ void APP_Update(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT && (gTxTimeoutReachedAlert || SerialConfigInProgress())) {
|
|
||||||
if (gSetting_set_tot >= 2) {
|
|
||||||
if (gEeprom.BACKLIGHT_TIME == 0) {
|
|
||||||
if (gBlinkCounter == 0 || gBlinkCounter == 250) {
|
|
||||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (gBlinkCounter == 0) {
|
|
||||||
//BACKLIGHT_TurnOn();
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
|
||||||
} else if (gBlinkCounter == 15000) {
|
|
||||||
//BACKLIGHT_TurnOff();
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gBlinkCounter++;
|
|
||||||
|
|
||||||
if (
|
|
||||||
(gSetting_set_tot == 3 && gEeprom.BACKLIGHT_TIME != 0 && gBlinkCounter > 74000) ||
|
|
||||||
(gSetting_set_tot == 3 && gEeprom.BACKLIGHT_TIME == 0 && gBlinkCounter > 79000) ||
|
|
||||||
(gSetting_set_tot != 3 && gBlinkCounter > 76000)
|
|
||||||
) // try to calibrate 10 times
|
|
||||||
{
|
|
||||||
gBlinkCounter = 0;
|
|
||||||
|
|
||||||
if (gSetting_set_tot == 1 || gSetting_set_tot == 3) {
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
BK4819_PlaySingleTone(gTxTimeoutToneAlert, 30, 1, true);
|
|
||||||
gTxTimeoutToneAlert += 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT &&
|
if (gCurrentFunction == FUNCTION_TRANSMIT &&
|
||||||
(gTxTimeoutReached || SerialConfigInProgress())) { // transmitter timed out or must de-key
|
(gTxTimeoutReached || SerialConfigInProgress())) { // transmitter timed out or must de-key
|
||||||
gTxTimeoutReached = false;
|
gTxTimeoutReached = false;
|
||||||
@@ -970,14 +890,11 @@ void APP_Update(void) {
|
|||||||
&& gScanStateDir == SCAN_OFF
|
&& gScanStateDir == SCAN_OFF
|
||||||
&& !gPttIsPressed
|
&& !gPttIsPressed
|
||||||
&& gCurrentFunction != FUNCTION_POWER_SAVE
|
&& gCurrentFunction != FUNCTION_POWER_SAVE
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
&& gVoiceWriteIndex == 0
|
&& gVoiceWriteIndex == 0
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
&& !gFmRadioMode
|
&& !gFmRadioMode
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
&& gDTMF_CallState == DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
DualwatchAlternate(); // toggle between the two VFO's
|
DualwatchAlternate(); // toggle between the two VFO's
|
||||||
@@ -1012,11 +929,8 @@ void APP_Update(void) {
|
|||||||
|| gScanStateDir != SCAN_OFF
|
|| gScanStateDir != SCAN_OFF
|
||||||
|| gCssBackgroundScan
|
|| gCssBackgroundScan
|
||||||
|| gScreenToDisplay != DISPLAY_MAIN
|
|| gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
|| gFmRadioMode
|
|| gFmRadioMode
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
|| (gIsNoaaMode && (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1])))
|
|| (gIsNoaaMode && (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1])))
|
||||||
@@ -1169,10 +1083,9 @@ static void CheckKeys(void) {
|
|||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (gPttIsPressed)
|
if (gPttIsPressed) {
|
||||||
{
|
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress())
|
SerialConfigInProgress()) { // PTT released or serial comms config in progress
|
||||||
{ // PTT released or serial comms config in progress
|
|
||||||
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
|
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
|
||||||
{ // stop transmitting
|
{ // stop transmitting
|
||||||
ProcessKey(KEY_PTT, false, false);
|
ProcessKey(KEY_PTT, false, false);
|
||||||
@@ -1180,21 +1093,17 @@ static void CheckKeys(void) {
|
|||||||
if (gKeyReading1 != KEY_INVALID)
|
if (gKeyReading1 != KEY_INVALID)
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
}
|
} else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress()) { // PTT pressed
|
||||||
else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress())
|
|
||||||
{ // PTT pressed
|
|
||||||
if (++gPttDebounceCounter >= 3) // 30ms
|
if (++gPttDebounceCounter >= 3) // 30ms
|
||||||
{ // start transmitting
|
{ // start transmitting
|
||||||
boot_counter_10ms = 0;
|
boot_counter_10ms = 0;
|
||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
gPttIsPressed = true;
|
gPttIsPressed = true;
|
||||||
ProcessKey(KEY_PTT, true, false);
|
ProcessKey(KEY_PTT, true, false);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1310,11 +1219,9 @@ void APP_TimeSlice10ms(void) {
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
|
|
||||||
#ifdef ENABLE_FLASHLIGHT
|
#ifdef ENABLE_FLASHLIGHT
|
||||||
FlashlightTimeSlice();
|
FlashlightTimeSlice();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
if (gVoxResumeCountdown > 0)
|
if (gVoxResumeCountdown > 0)
|
||||||
@@ -1395,6 +1302,10 @@ void APP_TimeSlice10ms(void) {
|
|||||||
|
|
||||||
SCANNER_TimeSlice10ms();
|
SCANNER_TimeSlice10ms();
|
||||||
|
|
||||||
|
// if (gEnteringSMS == SMS_NOT_ENTERING) {
|
||||||
|
// MSG_FSKReceiveData();
|
||||||
|
// }
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1) {
|
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1) {
|
||||||
if (!AIRCOPY_SendMessage()) {
|
if (!AIRCOPY_SendMessage()) {
|
||||||
@@ -1471,11 +1382,6 @@ void APP_TimeSlice500ms(void) {
|
|||||||
if (--gMenuCountdown == 0)
|
if (--gMenuCountdown == 0)
|
||||||
exit_menu = (gScreenToDisplay == DISPLAY_MENU); // exit menu mode
|
exit_menu = (gScreenToDisplay == DISPLAY_MENU); // exit menu mode
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_RX_timeout > 0)
|
|
||||||
if (--gDTMF_RX_timeout == 0)
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Skipped authentic device check
|
// Skipped authentic device check
|
||||||
|
|
||||||
@@ -1632,7 +1538,7 @@ void APP_TimeSlice500ms(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (disp == DISPLAY_INVALID
|
if (disp == DISPLAY_INVALID
|
||||||
#ifdef ENABLE_NO_CODE_SCAN_TIMEOUT
|
#ifdef ENABLE_NO_CODE_SCAN_TIMEOUT
|
||||||
&& !SCANNER_IsScanning()
|
&& !SCANNER_IsScanning()
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
@@ -1658,35 +1564,10 @@ void APP_TimeSlice500ms(void) {
|
|||||||
|
|
||||||
BATTERY_TimeSlice500ms();
|
BATTERY_TimeSlice500ms();
|
||||||
SCANNER_TimeSlice500ms();
|
SCANNER_TimeSlice500ms();
|
||||||
|
MESSAGES_TimeSlice500ms();
|
||||||
|
FSKModem_TimeSlice500ms();
|
||||||
UI_MAIN_TimeSlice500ms();
|
UI_MAIN_TimeSlice500ms();
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT) {
|
|
||||||
if (gDTMF_DecodeRingCountdown_500ms > 0) {
|
|
||||||
// make "ring-ring" sound
|
|
||||||
gDTMF_DecodeRingCountdown_500ms--;
|
|
||||||
AUDIO_PlayBeep(BEEP_880HZ_200MS);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT
|
|
||||||
&& gCurrentFunction != FUNCTION_RECEIVE && gDTMF_auto_reset_time_500ms > 0
|
|
||||||
&& --gDTMF_auto_reset_time_500ms == 0) {
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED && gEeprom.DTMF_auto_reset_time >= DTMF_HOLD_MAX) {
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED_STAY; // keep message on-screen till a key is pressed
|
|
||||||
} else {
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_IsTx && gDTMF_TxStopCountdown_500ms > 0 && --gDTMF_TxStopCountdown_500ms == 0) {
|
|
||||||
gDTMF_IsTx = false;
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
@@ -1802,24 +1683,12 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
||||||
gMenuCountdown = menu_timeout_500ms;
|
gMenuCountdown = menu_timeout_500ms;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_DecodeRingCountdown_500ms > 0) { // cancel the ringing
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
|
||||||
|
|
||||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
|
||||||
|
|
||||||
if (Key != KEY_PTT) {
|
|
||||||
gPttWasReleased = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN;
|
bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN;
|
||||||
|
|
||||||
if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT)
|
if ((gEeprom.KEY_LOCK || lowBatPopup) &&
|
||||||
{ // keyboard is locked or low battery popup
|
gCurrentFunction != FUNCTION_TRANSMIT) { // keyboard is locked or low battery popup
|
||||||
|
|
||||||
// close low battery popup
|
// close low battery popup
|
||||||
if (Key == KEY_EXIT && bKeyPressed && lowBatPopup) {
|
if (Key == KEY_EXIT && bKeyPressed && lowBatPopup) {
|
||||||
@@ -1888,7 +1757,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
|
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
|
||||||
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT)) {
|
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT)) {
|
||||||
#else
|
#else
|
||||||
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
|
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
|
||||||
#endif
|
#endif
|
||||||
// cancel the F-key
|
// cancel the F-key
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
@@ -1928,10 +1797,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
|
|
||||||
BK4819_ExitDTMF_TX(false);
|
BK4819_ExitDTMF_TX(false);
|
||||||
|
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE == 0)
|
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
|
||||||
BK4819_DisableScramble();
|
|
||||||
else
|
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1940,7 +1806,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BK4819_DisableScramble();
|
BK4819_SetScramble(0);
|
||||||
|
|
||||||
if (Code == 0xFE)
|
if (Code == 0xFE)
|
||||||
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
|
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
|
||||||
@@ -1965,15 +1831,15 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
|
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
|
||||||
else if (gWasFKeyPressed && (Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
|
else if (gWasFKeyPressed && (Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
|
||||||
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
||||||
} else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
|
} else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
|
||||||
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
|
|
||||||
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
|
||||||
|
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (!SCANNER_IsScanning()
|
else if (!SCANNER_IsScanning()
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
@@ -2068,12 +1934,6 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gDTMF_auto_reset_time_500ms = 0;
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
gDTMF_TxStopCountdown_500ms = 0;
|
|
||||||
gDTMF_IsTx = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gVFO_RSSI_bar_level[0] = 0;
|
gVFO_RSSI_bar_level[0] = 0;
|
||||||
gVFO_RSSI_bar_level[1] = 0;
|
gVFO_RSSI_bar_level[1] = 0;
|
||||||
|
|||||||
301
app/dtmf.c
301
app/dtmf.c
@@ -44,40 +44,8 @@ uint8_t gDTMF_PreviousIndex = 0;
|
|||||||
char gDTMF_RX_live[20];
|
char gDTMF_RX_live[20];
|
||||||
uint8_t gDTMF_RX_live_timeout = 0;
|
uint8_t gDTMF_RX_live_timeout = 0;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char gDTMF_RX[17];
|
|
||||||
uint8_t gDTMF_RX_index = 0;
|
|
||||||
uint8_t gDTMF_RX_timeout = 0;
|
|
||||||
bool gDTMF_RX_pending = false;
|
|
||||||
|
|
||||||
bool gIsDtmfContactValid;
|
|
||||||
char gDTMF_ID[4];
|
|
||||||
char gDTMF_Caller[4];
|
|
||||||
char gDTMF_Callee[4];
|
|
||||||
DTMF_State_t gDTMF_State;
|
|
||||||
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
|
||||||
uint8_t gDTMF_chosen_contact;
|
|
||||||
uint8_t gDTMF_auto_reset_time_500ms;
|
|
||||||
DTMF_CallState_t gDTMF_CallState;
|
|
||||||
DTMF_CallMode_t gDTMF_CallMode;
|
|
||||||
|
|
||||||
bool gDTMF_IsTx;
|
|
||||||
|
|
||||||
uint8_t gDTMF_TxStopCountdown_500ms;
|
|
||||||
bool gDTMF_IsGroupCall;
|
|
||||||
#endif
|
|
||||||
DTMF_ReplyState_t gDTMF_ReplyState;
|
DTMF_ReplyState_t gDTMF_ReplyState;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
void DTMF_clear_RX(void)
|
|
||||||
{
|
|
||||||
gDTMF_RX_timeout = 0;
|
|
||||||
gDTMF_RX_index = 0;
|
|
||||||
gDTMF_RX_pending = false;
|
|
||||||
memset(gDTMF_RX, 0, sizeof(gDTMF_RX));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DTMF_SendEndOfTransmission(void)
|
void DTMF_SendEndOfTransmission(void)
|
||||||
{
|
{
|
||||||
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO) {
|
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO) {
|
||||||
@@ -85,9 +53,6 @@ void DTMF_SendEndOfTransmission(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH)
|
if ((gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH)
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
&& gDTMF_CallState == DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
) { // end-of-tx
|
) { // end-of-tx
|
||||||
if (gEeprom.DTMF_SIDE_TONE) {
|
if (gEeprom.DTMF_SIDE_TONE) {
|
||||||
AUDIO_AudioPathOn();
|
AUDIO_AudioPathOn();
|
||||||
@@ -134,41 +99,6 @@ bool DTMF_ValidateCodes(char *pCode, const unsigned int size)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
bool DTMF_GetContact(const int Index, char *pContact)
|
|
||||||
{
|
|
||||||
if (Index < 0 || Index >= MAX_DTMF_CONTACTS || pContact == NULL) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1C00 + (Index * 16), pContact, 16);
|
|
||||||
|
|
||||||
// check whether the first character is printable or not
|
|
||||||
return (pContact[0] >= ' ' && pContact[0] < 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DTMF_FindContact(const char *pContact, char *pResult)
|
|
||||||
{
|
|
||||||
pResult[0] = 0;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < MAX_DTMF_CONTACTS; i++) {
|
|
||||||
char Contact[16];
|
|
||||||
if (!DTMF_GetContact(i, Contact)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memcmp(pContact, Contact + 8, 3) == 0) {
|
|
||||||
memcpy(pResult, Contact, 8);
|
|
||||||
pResult[8] = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char DTMF_GetCharacter(const unsigned int code)
|
char DTMF_GetCharacter(const unsigned int code)
|
||||||
{
|
{
|
||||||
if (code <= KEY_9)
|
if (code <= KEY_9)
|
||||||
@@ -185,33 +115,6 @@ char DTMF_GetCharacter(const unsigned int code)
|
|||||||
default: return 0xff;
|
default: return 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
static bool CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
for (i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
if (pMsg[i] != pTemplate[i])
|
|
||||||
{
|
|
||||||
if (!bCheckGroup || pMsg[i] != gEeprom.DTMF_GROUP_CALL_CODE)
|
|
||||||
return false;
|
|
||||||
gDTMF_IsGroupCall = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
|
||||||
{
|
|
||||||
for (unsigned int i = 0; i < size; i++)
|
|
||||||
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE) {
|
|
||||||
return DTMF_CALL_MODE_GROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DTMF_CALL_MODE_NOT_GROUP;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DTMF_clear_input_box(void)
|
void DTMF_clear_input_box(void)
|
||||||
{
|
{
|
||||||
@@ -232,227 +135,23 @@ void DTMF_Append(const char code)
|
|||||||
gDTMF_InputBox[gDTMF_InputBox_Index++] = code;
|
gDTMF_InputBox[gDTMF_InputBox_Index++] = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
void DTMF_HandleRequest(void)
|
|
||||||
{ // proccess the RX'ed DTMF characters
|
|
||||||
|
|
||||||
char String[21];
|
|
||||||
unsigned int Offset;
|
|
||||||
|
|
||||||
if (!gDTMF_RX_pending)
|
|
||||||
return; // nothing new received
|
|
||||||
|
|
||||||
if (gScanStateDir != SCAN_OFF || gCssBackgroundScan)
|
|
||||||
{ // we're busy scanning
|
|
||||||
DTMF_clear_RX();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gRxVfo->DTMF_DECODING_ENABLE)
|
|
||||||
{ // D-DCD is disabled or we're alive
|
|
||||||
DTMF_clear_RX();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gDTMF_RX_pending = false;
|
|
||||||
|
|
||||||
if (gDTMF_RX_index >= 9)
|
|
||||||
{ // look for the KILL code
|
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.KILL_CODE);
|
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
|
||||||
|
|
||||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
|
||||||
{ // bugger
|
|
||||||
|
|
||||||
// if (gEeprom.PERMIT_REMOTE_KILL)
|
|
||||||
// {
|
|
||||||
// gSetting_KILLED = true; // oooerr !
|
|
||||||
//
|
|
||||||
// DTMF_clear_RX();
|
|
||||||
//
|
|
||||||
// SETTINGS_SaveSettings();
|
|
||||||
//
|
|
||||||
// gDTMF_ReplyState = DTMF_REPLY_AB;
|
|
||||||
//
|
|
||||||
// #ifdef ENABLE_FMRADIO
|
|
||||||
// if (gFmRadioMode)
|
|
||||||
// {
|
|
||||||
// FM_TurnOff();
|
|
||||||
// GUI_SelectNextDisplay(DISPLAY_MAIN);
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
// }
|
|
||||||
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (gDTMF_RX_index >= 9)
|
|
||||||
// { // look for the REVIVE code
|
|
||||||
//
|
|
||||||
// sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
|
||||||
//
|
|
||||||
// Offset = gDTMF_RX_index - strlen(String);
|
|
||||||
//
|
|
||||||
// if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
|
||||||
// { // shit, we're back !
|
|
||||||
//
|
|
||||||
// gSetting_KILLED = false;
|
|
||||||
//
|
|
||||||
// DTMF_clear_RX();
|
|
||||||
//
|
|
||||||
// SETTINGS_SaveSettings();
|
|
||||||
//
|
|
||||||
// gDTMF_ReplyState = DTMF_REPLY_AB;
|
|
||||||
// gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
//
|
|
||||||
// gUpdateDisplay = true;
|
|
||||||
// gUpdateStatus = true;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (gDTMF_RX_index >= 2)
|
|
||||||
{ // look for ACK reply
|
|
||||||
char *pPrintStr = "AB";
|
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(pPrintStr);
|
|
||||||
|
|
||||||
if (CompareMessage(gDTMF_RX + Offset, pPrintStr, strlen(pPrintStr), true)) {
|
|
||||||
// ends with "AB"
|
|
||||||
|
|
||||||
if (gDTMF_ReplyState != DTMF_REPLY_NONE) // 1of11
|
|
||||||
// if (gDTMF_CallState != DTMF_CALL_STATE_NONE) // 1of11
|
|
||||||
// if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) // 1of11
|
|
||||||
{
|
|
||||||
gDTMF_State = DTMF_STATE_TX_SUCC;
|
|
||||||
DTMF_clear_RX();
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT &&
|
|
||||||
gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP &&
|
|
||||||
gDTMF_RX_index >= 9)
|
|
||||||
{ // waiting for a reply
|
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
|
||||||
|
|
||||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), false))
|
|
||||||
{ // we got a response
|
|
||||||
gDTMF_State = DTMF_STATE_CALL_OUT_RSP;
|
|
||||||
DTMF_clear_RX();
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
|
||||||
{ // we've been killed or expecting a reply
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_RX_index >= 7)
|
|
||||||
{ // see if we're being called
|
|
||||||
|
|
||||||
gDTMF_IsGroupCall = false;
|
|
||||||
|
|
||||||
sprintf(String, "%s%c", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE);
|
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String) - 3;
|
|
||||||
|
|
||||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
|
||||||
{ // it's for us !
|
|
||||||
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED;
|
|
||||||
|
|
||||||
memset(gDTMF_Callee, 0, sizeof(gDTMF_Callee));
|
|
||||||
memset(gDTMF_Caller, 0, sizeof(gDTMF_Caller));
|
|
||||||
memcpy(gDTMF_Callee, gDTMF_RX + Offset + 0, 3);
|
|
||||||
memcpy(gDTMF_Caller, gDTMF_RX + Offset + 4, 3);
|
|
||||||
|
|
||||||
DTMF_clear_RX();
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
|
|
||||||
switch (gEeprom.DTMF_DECODE_RESPONSE)
|
|
||||||
{
|
|
||||||
case DTMF_DEC_RESPONSE_BOTH:
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
|
||||||
[[fallthrough]];
|
|
||||||
case DTMF_DEC_RESPONSE_REPLY:
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
|
|
||||||
break;
|
|
||||||
case DTMF_DEC_RESPONSE_RING:
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case DTMF_DEC_RESPONSE_NONE:
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_IsGroupCall)
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DTMF_Reply(void)
|
void DTMF_Reply(void)
|
||||||
{
|
{
|
||||||
uint16_t Delay;
|
uint16_t Delay;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char String[23];
|
|
||||||
#endif
|
|
||||||
const char *pString = NULL;
|
const char *pString = NULL;
|
||||||
|
|
||||||
switch (gDTMF_ReplyState)
|
switch (gDTMF_ReplyState)
|
||||||
{
|
{
|
||||||
case DTMF_REPLY_ANI:
|
case DTMF_REPLY_ANI:
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_CallMode != DTMF_CALL_MODE_DTMF)
|
|
||||||
{ // append our ID code onto the end of the DTMF code to send
|
|
||||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, gEeprom.ANI_DTMF_ID);
|
|
||||||
pString = String;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
pString = gDTMF_String;
|
pString = gDTMF_String;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case DTMF_REPLY_AB:
|
|
||||||
pString = "AB";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DTMF_REPLY_AAAAA:
|
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
|
||||||
pString = String;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
case DTMF_REPLY_NONE:
|
case DTMF_REPLY_NONE:
|
||||||
if (
|
if (
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
|
||||||
#endif
|
|
||||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO ||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO ||
|
||||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
||||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
||||||
|
|||||||
29
app/dtmf.h
29
app/dtmf.h
@@ -87,33 +87,4 @@ void DTMF_Append(const char code);
|
|||||||
void DTMF_Reply(void);
|
void DTMF_Reply(void);
|
||||||
void DTMF_SendEndOfTransmission(void);
|
void DTMF_SendEndOfTransmission(void);
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|
|
||||||
extern char gDTMF_RX[17];
|
|
||||||
extern uint8_t gDTMF_RX_index;
|
|
||||||
extern uint8_t gDTMF_RX_timeout;
|
|
||||||
extern bool gDTMF_RX_pending;
|
|
||||||
|
|
||||||
extern bool gIsDtmfContactValid;
|
|
||||||
extern char gDTMF_ID[4];
|
|
||||||
extern char gDTMF_Caller[4];
|
|
||||||
extern char gDTMF_Callee[4];
|
|
||||||
extern DTMF_State_t gDTMF_State;
|
|
||||||
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
|
||||||
extern uint8_t gDTMF_chosen_contact;
|
|
||||||
extern uint8_t gDTMF_auto_reset_time_500ms;
|
|
||||||
extern DTMF_CallState_t gDTMF_CallState;
|
|
||||||
|
|
||||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
|
||||||
extern bool gDTMF_IsTx;
|
|
||||||
extern uint8_t gDTMF_TxStopCountdown_500ms;
|
|
||||||
|
|
||||||
void DTMF_clear_RX(void);
|
|
||||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
|
|
||||||
bool DTMF_GetContact(const int Index, char *pContact);
|
|
||||||
bool DTMF_FindContact(const char *pContact, char *pResult);
|
|
||||||
void DTMF_HandleRequest(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
113
app/flashlight.c
113
app/flashlight.c
@@ -5,79 +5,60 @@
|
|||||||
|
|
||||||
#include "flashlight.h"
|
#include "flashlight.h"
|
||||||
|
|
||||||
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
|
enum FlashlightMode_t gFlashLightState;
|
||||||
enum FlashlightMode_t gFlashLightState;
|
|
||||||
|
|
||||||
void FlashlightTimeSlice()
|
void FlashlightTimeSlice() {
|
||||||
{
|
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) {
|
||||||
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) {
|
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gFlashLightState == FLASHLIGHT_SOS) {
|
||||||
|
const uint16_t u = 15;
|
||||||
|
static uint8_t c;
|
||||||
|
static uint16_t next;
|
||||||
|
|
||||||
|
if (gFlashLightBlinkCounter - next > 7 * u) {
|
||||||
|
c = 0;
|
||||||
|
next = gFlashLightBlinkCounter + 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gFlashLightState == FLASHLIGHT_SOS) {
|
if (gFlashLightBlinkCounter == next) {
|
||||||
const uint16_t u = 15;
|
if (c == 0) {
|
||||||
static uint8_t c;
|
|
||||||
static uint16_t next;
|
|
||||||
|
|
||||||
if (gFlashLightBlinkCounter - next > 7 * u) {
|
|
||||||
c = 0;
|
|
||||||
next = gFlashLightBlinkCounter + 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gFlashLightBlinkCounter == next) {
|
|
||||||
if (c==0) {
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
||||||
} else {
|
|
||||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c >= 18) {
|
|
||||||
next = gFlashLightBlinkCounter + 7 * u;
|
|
||||||
c = 0;
|
|
||||||
} else if(c==7 || c==9 || c==11) {
|
|
||||||
next = gFlashLightBlinkCounter + 3 * u;
|
|
||||||
} else {
|
|
||||||
next = gFlashLightBlinkCounter + u;
|
|
||||||
}
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ACTION_FlashLight(void)
|
|
||||||
{
|
|
||||||
switch (gFlashLightState) {
|
|
||||||
case FLASHLIGHT_OFF:
|
|
||||||
gFlashLightState++;
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
||||||
break;
|
|
||||||
case FLASHLIGHT_ON:
|
|
||||||
case FLASHLIGHT_BLINK:
|
|
||||||
gFlashLightState++;
|
|
||||||
break;
|
|
||||||
case FLASHLIGHT_SOS:
|
|
||||||
default:
|
|
||||||
gFlashLightState = 0;
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
|
} else {
|
||||||
|
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c >= 18) {
|
||||||
|
next = gFlashLightBlinkCounter + 7 * u;
|
||||||
|
c = 0;
|
||||||
|
} else if (c == 7 || c == 9 || c == 11) {
|
||||||
|
next = gFlashLightBlinkCounter + 3 * u;
|
||||||
|
} else {
|
||||||
|
next = gFlashLightBlinkCounter + u;
|
||||||
|
}
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
void ACTION_FlashLight(void)
|
|
||||||
{
|
|
||||||
static bool gFlashLightState = false;
|
|
||||||
|
|
||||||
if(gFlashLightState)
|
void ACTION_FlashLight(void) {
|
||||||
{
|
switch (gFlashLightState) {
|
||||||
|
case FLASHLIGHT_OFF:
|
||||||
|
gFlashLightState++;
|
||||||
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
|
break;
|
||||||
|
case FLASHLIGHT_ON:
|
||||||
|
case FLASHLIGHT_BLINK:
|
||||||
|
gFlashLightState++;
|
||||||
|
break;
|
||||||
|
case FLASHLIGHT_SOS:
|
||||||
|
default:
|
||||||
|
gFlashLightState = 0;
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
gFlashLightState = (gFlashLightState) ? false : true;
|
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
|
|
||||||
enum FlashlightMode_t {
|
enum FlashlightMode_t {
|
||||||
FLASHLIGHT_OFF = 0,
|
FLASHLIGHT_OFF = 0,
|
||||||
FLASHLIGHT_ON,
|
FLASHLIGHT_ON,
|
||||||
@@ -17,7 +16,6 @@
|
|||||||
extern volatile uint16_t gFlashLightBlinkCounter;
|
extern volatile uint16_t gFlashLightBlinkCounter;
|
||||||
|
|
||||||
void FlashlightTimeSlice(void);
|
void FlashlightTimeSlice(void);
|
||||||
#endif
|
|
||||||
void ACTION_FlashLight(void);
|
void ACTION_FlashLight(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
236
app/fm.c
236
app/fm.c
@@ -31,22 +31,22 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#include "driver/systick.h"
|
||||||
|
|
||||||
#ifndef ARRAY_SIZE
|
#ifndef ARRAY_SIZE
|
||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t gFM_Channels[20];
|
uint16_t gFM_Channels[20];
|
||||||
bool gFmRadioMode;
|
bool gFmRadioMode;
|
||||||
uint8_t gFmRadioCountdown_500ms;
|
uint8_t gFmRadioCountdown_500ms;
|
||||||
volatile uint16_t gFmPlayCountdown_10ms;
|
volatile uint16_t gFmPlayCountdown_10ms;
|
||||||
volatile int8_t gFM_ScanState;
|
volatile int8_t gFM_ScanState;
|
||||||
bool gFM_AutoScan;
|
bool gFM_AutoScan;
|
||||||
uint8_t gFM_ChannelPosition;
|
uint8_t gFM_ChannelPosition;
|
||||||
bool gFM_FoundFrequency;
|
bool gFM_FoundFrequency;
|
||||||
bool gFM_AutoScan;
|
bool gFM_AutoScan;
|
||||||
uint16_t gFM_RestoreCountdown_10ms;
|
uint16_t gFM_RestoreCountdown_10ms;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t BUTTON_STATE_PRESSED = 1 << 0;
|
const uint8_t BUTTON_STATE_PRESSED = 1 << 0;
|
||||||
@@ -54,21 +54,19 @@ const uint8_t BUTTON_STATE_HELD = 1 << 1;
|
|||||||
|
|
||||||
const uint8_t BUTTON_EVENT_PRESSED = BUTTON_STATE_PRESSED;
|
const uint8_t BUTTON_EVENT_PRESSED = BUTTON_STATE_PRESSED;
|
||||||
const uint8_t BUTTON_EVENT_HELD = BUTTON_STATE_PRESSED | BUTTON_STATE_HELD;
|
const uint8_t BUTTON_EVENT_HELD = BUTTON_STATE_PRESSED | BUTTON_STATE_HELD;
|
||||||
const uint8_t BUTTON_EVENT_SHORT = 0;
|
const uint8_t BUTTON_EVENT_SHORT = 0;
|
||||||
const uint8_t BUTTON_EVENT_LONG = BUTTON_STATE_HELD;
|
const uint8_t BUTTON_EVENT_LONG = BUTTON_STATE_HELD;
|
||||||
|
|
||||||
|
|
||||||
static void Key_FUNC(KEY_Code_t Key, uint8_t state);
|
static void Key_FUNC(KEY_Code_t Key, uint8_t state);
|
||||||
|
|
||||||
bool FM_CheckValidChannel(uint8_t Channel)
|
bool FM_CheckValidChannel(uint8_t Channel) {
|
||||||
{
|
return Channel < ARRAY_SIZE(gFM_Channels) &&
|
||||||
return Channel < ARRAY_SIZE(gFM_Channels) &&
|
gFM_Channels[Channel] >= BK1080_GetFreqLoLimit(gEeprom.FM_Band) &&
|
||||||
gFM_Channels[Channel] >= BK1080_GetFreqLoLimit(gEeprom.FM_Band) &&
|
gFM_Channels[Channel] < BK1080_GetFreqHiLimit(gEeprom.FM_Band);
|
||||||
gFM_Channels[Channel] < BK1080_GetFreqHiLimit(gEeprom.FM_Band);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction)
|
uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction) {
|
||||||
{
|
|
||||||
for (unsigned i = 0; i < ARRAY_SIZE(gFM_Channels); i++) {
|
for (unsigned i = 0; i < ARRAY_SIZE(gFM_Channels); i++) {
|
||||||
if (Channel == 0xFF)
|
if (Channel == 0xFF)
|
||||||
Channel = ARRAY_SIZE(gFM_Channels) - 1;
|
Channel = ARRAY_SIZE(gFM_Channels) - 1;
|
||||||
@@ -82,8 +80,7 @@ uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction)
|
|||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FM_ConfigureChannelState(void)
|
int FM_ConfigureChannelState(void) {
|
||||||
{
|
|
||||||
gEeprom.FM_FrequencyPlaying = gEeprom.FM_SelectedFrequency;
|
gEeprom.FM_FrequencyPlaying = gEeprom.FM_SelectedFrequency;
|
||||||
|
|
||||||
if (gEeprom.FM_IsMrMode) {
|
if (gEeprom.FM_IsMrMode) {
|
||||||
@@ -92,17 +89,16 @@ int FM_ConfigureChannelState(void)
|
|||||||
gEeprom.FM_IsMrMode = false;
|
gEeprom.FM_IsMrMode = false;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
gEeprom.FM_SelectedChannel = Channel;
|
gEeprom.FM_SelectedChannel = Channel;
|
||||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_TurnOff(void)
|
void FM_TurnOff(void) {
|
||||||
{
|
gFmRadioMode = false;
|
||||||
gFmRadioMode = false;
|
gFM_ScanState = FM_SCAN_OFF;
|
||||||
gFM_ScanState = FM_SCAN_OFF;
|
|
||||||
gFM_RestoreCountdown_10ms = 0;
|
gFM_RestoreCountdown_10ms = 0;
|
||||||
|
|
||||||
AUDIO_AudioPathOff();
|
AUDIO_AudioPathOff();
|
||||||
@@ -110,17 +106,16 @@ void FM_TurnOff(void)
|
|||||||
|
|
||||||
BK1080_Init0();
|
BK1080_Init0();
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
gEeprom.CURRENT_STATE = 0;
|
gEeprom.CURRENT_STATE = 0;
|
||||||
SETTINGS_WriteCurrentState();
|
SETTINGS_WriteCurrentState();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_EraseChannels(void)
|
void FM_EraseChannels(void) {
|
||||||
{
|
uint8_t Template[8];
|
||||||
uint8_t Template[8];
|
|
||||||
memset(Template, 0xFF, sizeof(Template));
|
memset(Template, 0xFF, sizeof(Template));
|
||||||
|
|
||||||
for (unsigned i = 0; i < 5; i++)
|
for (unsigned i = 0; i < 5; i++)
|
||||||
@@ -129,18 +124,18 @@ void FM_EraseChannels(void)
|
|||||||
memset(gFM_Channels, 0xFF, sizeof(gFM_Channels));
|
memset(gFM_Channels, 0xFF, sizeof(gFM_Channels));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag)
|
void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag) {
|
||||||
{
|
|
||||||
AUDIO_AudioPathOff();
|
AUDIO_AudioPathOff();
|
||||||
|
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
|
|
||||||
gFmPlayCountdown_10ms = (gFM_ScanState == FM_SCAN_OFF) ? fm_play_countdown_noscan_10ms : fm_play_countdown_scan_10ms;
|
gFmPlayCountdown_10ms = (gFM_ScanState == FM_SCAN_OFF) ? fm_play_countdown_noscan_10ms
|
||||||
|
: fm_play_countdown_scan_10ms;
|
||||||
|
|
||||||
gScheduleFM = false;
|
gScheduleFM = false;
|
||||||
gFM_FoundFrequency = false;
|
gFM_FoundFrequency = false;
|
||||||
gAskToSave = false;
|
gAskToSave = false;
|
||||||
gAskToDelete = false;
|
gAskToDelete = false;
|
||||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||||
|
|
||||||
if (!bFlag) {
|
if (!bFlag) {
|
||||||
@@ -158,12 +153,11 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag)
|
|||||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_PlayAndUpdate(void)
|
void FM_PlayAndUpdate(void) {
|
||||||
{
|
|
||||||
gFM_ScanState = FM_SCAN_OFF;
|
gFM_ScanState = FM_SCAN_OFF;
|
||||||
|
|
||||||
if (gFM_AutoScan) {
|
if (gFM_AutoScan) {
|
||||||
gEeprom.FM_IsMrMode = true;
|
gEeprom.FM_IsMrMode = true;
|
||||||
gEeprom.FM_SelectedChannel = 0;
|
gEeprom.FM_SelectedChannel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,16 +166,15 @@ void FM_PlayAndUpdate(void)
|
|||||||
SETTINGS_SaveFM();
|
SETTINGS_SaveFM();
|
||||||
|
|
||||||
gFmPlayCountdown_10ms = 0;
|
gFmPlayCountdown_10ms = 0;
|
||||||
gScheduleFM = false;
|
gScheduleFM = false;
|
||||||
gAskToSave = false;
|
gAskToSave = false;
|
||||||
|
|
||||||
AUDIO_AudioPathOn();
|
AUDIO_AudioPathOn();
|
||||||
|
|
||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit) {
|
||||||
{
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
const uint16_t Test2 = BK1080_ReadRegister(BK1080_REG_07_TEST1);
|
const uint16_t Test2 = BK1080_ReadRegister(BK1080_REG_07_TEST1);
|
||||||
@@ -191,7 +184,7 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
|||||||
|
|
||||||
if (BK1080_REG_07_GET_SNR(Test2) <= 2) {
|
if (BK1080_REG_07_GET_SNR(Test2) <= 2) {
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -200,7 +193,7 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
|||||||
|
|
||||||
if ((Status & BK1080_REG_10_MASK_AFCRL) != BK1080_REG_10_AFCRL_NOT_RAILED || BK1080_REG_10_GET_RSSI(Status) < 10) {
|
if ((Status & BK1080_REG_10_MASK_AFCRL) != BK1080_REG_10_AFCRL_NOT_RAILED || BK1080_REG_10_GET_RSSI(Status) < 10) {
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -208,17 +201,16 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
|||||||
//if (Deviation > -281 && Deviation < 280)
|
//if (Deviation > -281 && Deviation < 280)
|
||||||
if (Deviation >= 280 && Deviation <= 3815) {
|
if (Deviation >= 280 && Deviation <= 3815) {
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not BLE(less than or equal)
|
// not BLE(less than or equal)
|
||||||
if (Frequency > LowerLimit && (Frequency - BK1080_BaseFrequency) == 1) {
|
if (Frequency > LowerLimit && (Frequency - BK1080_BaseFrequency) == 1) {
|
||||||
if (BK1080_FrequencyDeviation & 0x800 || (BK1080_FrequencyDeviation < 20))
|
if (BK1080_FrequencyDeviation & 0x800 || (BK1080_FrequencyDeviation < 20)) {
|
||||||
{
|
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -227,10 +219,9 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
|||||||
// not BLT(less than)
|
// not BLT(less than)
|
||||||
|
|
||||||
if (Frequency >= LowerLimit && (BK1080_BaseFrequency - Frequency) == 1) {
|
if (Frequency >= LowerLimit && (BK1080_BaseFrequency - Frequency) == 1) {
|
||||||
if ((BK1080_FrequencyDeviation & 0x800) == 0 || (BK1080_FrequencyDeviation > 4075))
|
if ((BK1080_FrequencyDeviation & 0x800) == 0 || (BK1080_FrequencyDeviation > 4075)) {
|
||||||
{
|
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -238,14 +229,15 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
static void Key_DIGITS(KEY_Code_t Key, uint8_t state) {
|
||||||
{
|
enum {
|
||||||
enum { STATE_FREQ_MODE, STATE_MR_MODE, STATE_SAVE };
|
STATE_FREQ_MODE, STATE_MR_MODE, STATE_SAVE
|
||||||
|
};
|
||||||
|
|
||||||
if (state == BUTTON_EVENT_SHORT && !gWasFKeyPressed) {
|
if (state == BUTTON_EVENT_SHORT && !gWasFKeyPressed) {
|
||||||
uint8_t State;
|
uint8_t State;
|
||||||
@@ -257,8 +249,7 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
|
|
||||||
if (gAskToSave) {
|
if (gAskToSave) {
|
||||||
State = STATE_SAVE;
|
State = STATE_SAVE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (gFM_ScanState != FM_SCAN_OFF) {
|
if (gFM_ScanState != FM_SCAN_OFF) {
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
@@ -278,20 +269,20 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
gInputBox[0] = 0;
|
gInputBox[0] = 0;
|
||||||
gInputBoxIndex = 2;
|
gInputBoxIndex = 2;
|
||||||
}
|
}
|
||||||
}
|
} else if (gInputBoxIndex > 3) {
|
||||||
else if (gInputBoxIndex > 3) {
|
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
Frequency = StrToUL(INPUTBOX_GetAscii());
|
Frequency = StrToUL(INPUTBOX_GetAscii());
|
||||||
|
|
||||||
if (Frequency < BK1080_GetFreqLoLimit(gEeprom.FM_Band) || BK1080_GetFreqHiLimit(gEeprom.FM_Band) < Frequency) {
|
if (Frequency < BK1080_GetFreqLoLimit(gEeprom.FM_Band) ||
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
BK1080_GetFreqHiLimit(gEeprom.FM_Band) < Frequency) {
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gEeprom.FM_SelectedFrequency = (uint16_t)Frequency;
|
gEeprom.FM_SelectedFrequency = (uint16_t) Frequency;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
#endif
|
#endif
|
||||||
@@ -300,8 +291,7 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else if (gInputBoxIndex == 2) {
|
||||||
else if (gInputBoxIndex == 2) {
|
|
||||||
uint8_t Channel;
|
uint8_t Channel;
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
@@ -318,8 +308,7 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else if (Channel < 20) {
|
||||||
else if (Channel < 20) {
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
#endif
|
#endif
|
||||||
@@ -336,19 +325,17 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
#endif
|
#endif
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
Key_FUNC(Key, state);
|
Key_FUNC(Key, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
static void Key_FUNC(KEY_Code_t Key, uint8_t state) {
|
||||||
{
|
|
||||||
if (state == BUTTON_EVENT_SHORT || state == BUTTON_EVENT_HELD) {
|
if (state == BUTTON_EVENT_SHORT || state == BUTTON_EVENT_HELD) {
|
||||||
bool autoScan = gWasFKeyPressed || (state == BUTTON_EVENT_HELD);
|
bool autoScan = gWasFKeyPressed || (state == BUTTON_EVENT_HELD);
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
|
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
@@ -361,10 +348,10 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
|||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// case KEY_2:
|
// case KEY_2:
|
||||||
// gEeprom.FM_Space = (gEeprom.FM_Space + 1) % 3;
|
// gEeprom.FM_Space = (gEeprom.FM_Space + 1) % 3;
|
||||||
// gRequestSaveFM = true;
|
// gRequestSaveFM = true;
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
case KEY_3:
|
case KEY_3:
|
||||||
gEeprom.FM_IsMrMode = !gEeprom.FM_IsMrMode;
|
gEeprom.FM_IsMrMode = !gEeprom.FM_IsMrMode;
|
||||||
@@ -372,32 +359,30 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
|||||||
if (!FM_ConfigureChannelState()) {
|
if (!FM_ConfigureChannelState()) {
|
||||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_4:
|
case KEY_4:
|
||||||
gEeprom.BK1080_AGC_ENABLED = !gEeprom.BK1080_AGC_ENABLED;
|
gEeprom.BK1080_AGC_ENABLED = !gEeprom.BK1080_AGC_ENABLED;
|
||||||
BK1080_UpdateSysconf();
|
BK1080_UpdateSysconf();
|
||||||
gRequestSaveSettings = true;
|
gRequestSaveSettings = true;
|
||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_5:
|
case KEY_5:
|
||||||
gEeprom.BK1080_DEEMPHASIS_CONFIG++;
|
gEeprom.BK1080_DEEMPHASIS_CONFIG++;
|
||||||
BK1080_UpdateSysconf();
|
BK1080_UpdateSysconf();
|
||||||
gRequestSaveSettings = true;
|
gRequestSaveSettings = true;
|
||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_6:
|
case KEY_6:
|
||||||
gEeprom.BK1080_BLEND_CONFIG++;
|
gEeprom.BK1080_BLEND_CONFIG++;
|
||||||
BK1080_UpdateSysconf();
|
BK1080_UpdateSysconf();
|
||||||
gRequestSaveSettings = true;
|
gRequestSaveSettings = true;
|
||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_STAR:
|
case KEY_STAR:
|
||||||
ACTION_Scan(autoScan);
|
ACTION_Scan(autoScan);
|
||||||
break;
|
break;
|
||||||
@@ -409,8 +394,7 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_EXIT(uint8_t state)
|
static void Key_EXIT(uint8_t state) {
|
||||||
{
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (state == BUTTON_EVENT_SHORT) {
|
if (state == BUTTON_EVENT_SHORT) {
|
||||||
@@ -424,10 +408,9 @@ static void Key_EXIT(uint8_t state)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gAskToSave = false;
|
gAskToSave = false;
|
||||||
gAskToDelete = false;
|
gAskToDelete = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gInputBox[--gInputBoxIndex] = 10;
|
gInputBox[--gInputBoxIndex] = 10;
|
||||||
|
|
||||||
if (gInputBoxIndex) {
|
if (gInputBoxIndex) {
|
||||||
@@ -447,8 +430,7 @@ static void Key_EXIT(uint8_t state)
|
|||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
FM_PlayAndUpdate();
|
FM_PlayAndUpdate();
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
@@ -458,14 +440,13 @@ static void Key_EXIT(uint8_t state)
|
|||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_MENU(uint8_t state)
|
static void Key_MENU(uint8_t state) {
|
||||||
{
|
|
||||||
if (state != BUTTON_EVENT_SHORT)
|
if (state != BUTTON_EVENT_SHORT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (gFM_ScanState == FM_SCAN_OFF) {
|
if (gFM_ScanState == FM_SCAN_OFF) {
|
||||||
if (!gEeprom.FM_IsMrMode) {
|
if (!gEeprom.FM_IsMrMode) {
|
||||||
@@ -474,8 +455,7 @@ static void Key_MENU(uint8_t state)
|
|||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
}
|
}
|
||||||
gAskToSave = !gAskToSave;
|
gAskToSave = !gAskToSave;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (gAskToDelete) {
|
if (gAskToDelete) {
|
||||||
gFM_Channels[gEeprom.FM_SelectedChannel] = 0xFFFF;
|
gFM_Channels[gEeprom.FM_SelectedChannel] = 0xFFFF;
|
||||||
|
|
||||||
@@ -486,10 +466,9 @@ static void Key_MENU(uint8_t state)
|
|||||||
}
|
}
|
||||||
gAskToDelete = !gAskToDelete;
|
gAskToDelete = !gAskToDelete;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (gFM_AutoScan || !gFM_FoundFrequency) {
|
if (gFM_AutoScan || !gFM_FoundFrequency) {
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -502,8 +481,7 @@ static void Key_MENU(uint8_t state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_UP_DOWN(uint8_t state, int8_t Step)
|
static void Key_UP_DOWN(uint8_t state, int8_t Step) {
|
||||||
{
|
|
||||||
if (state == BUTTON_EVENT_PRESSED) {
|
if (state == BUTTON_EVENT_PRESSED) {
|
||||||
if (gInputBoxIndex) {
|
if (gInputBoxIndex) {
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
@@ -511,13 +489,13 @@ static void Key_UP_DOWN(uint8_t state, int8_t Step)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
} else if (gInputBoxIndex || state!=BUTTON_EVENT_HELD) {
|
} else if (gInputBoxIndex || state != BUTTON_EVENT_HELD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gAskToSave) {
|
if (gAskToSave) {
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
gFM_ChannelPosition = NUMBER_AddWithWraparound(gFM_ChannelPosition, Step, 0, 19);
|
gFM_ChannelPosition = NUMBER_AddWithWraparound(gFM_ChannelPosition, Step, 0, 19);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,10 +515,9 @@ static void Key_UP_DOWN(uint8_t state, int8_t Step)
|
|||||||
if (Channel == 0xFF || gEeprom.FM_SelectedChannel == Channel)
|
if (Channel == 0xFF || gEeprom.FM_SelectedChannel == Channel)
|
||||||
goto Bail;
|
goto Bail;
|
||||||
|
|
||||||
gEeprom.FM_SelectedChannel = Channel;
|
gEeprom.FM_SelectedChannel = Channel;
|
||||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
uint16_t Frequency = gEeprom.FM_SelectedFrequency + Step;
|
uint16_t Frequency = gEeprom.FM_SelectedFrequency + Step;
|
||||||
|
|
||||||
if (Frequency < BK1080_GetFreqLoLimit(gEeprom.FM_Band))
|
if (Frequency < BK1080_GetFreqLoLimit(gEeprom.FM_Band))
|
||||||
@@ -548,20 +525,19 @@ static void Key_UP_DOWN(uint8_t state, int8_t Step)
|
|||||||
else if (Frequency > BK1080_GetFreqHiLimit(gEeprom.FM_Band))
|
else if (Frequency > BK1080_GetFreqHiLimit(gEeprom.FM_Band))
|
||||||
Frequency = BK1080_GetFreqLoLimit(gEeprom.FM_Band);
|
Frequency = BK1080_GetFreqLoLimit(gEeprom.FM_Band);
|
||||||
|
|
||||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||||
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
|
|
||||||
Bail:
|
Bail:
|
||||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||||
{
|
|
||||||
uint8_t state = bKeyPressed + 2 * bKeyHeld;
|
uint8_t state = bKeyPressed + 2 * bKeyHeld;
|
||||||
|
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
@@ -597,12 +573,11 @@ void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
GUI_DisplayScreen();
|
GUI_DisplayScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_Play(void)
|
void FM_Play(void) {
|
||||||
{
|
|
||||||
if (!FM_CheckFrequencyLock(gEeprom.FM_FrequencyPlaying, BK1080_GetFreqLoLimit(gEeprom.FM_Band))) {
|
if (!FM_CheckFrequencyLock(gEeprom.FM_FrequencyPlaying, BK1080_GetFreqLoLimit(gEeprom.FM_Band))) {
|
||||||
if (!gFM_AutoScan) {
|
if (!gFM_AutoScan) {
|
||||||
gFmPlayCountdown_10ms = 0;
|
gFmPlayCountdown_10ms = 0;
|
||||||
gFM_FoundFrequency = true;
|
gFM_FoundFrequency = true;
|
||||||
|
|
||||||
if (!gEeprom.FM_IsMrMode)
|
if (!gEeprom.FM_IsMrMode)
|
||||||
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
||||||
@@ -632,24 +607,23 @@ void FM_Play(void)
|
|||||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_Start(void)
|
void FM_Start(void) {
|
||||||
{
|
gDualWatchActive = false;
|
||||||
gDualWatchActive = false;
|
gFmRadioMode = true;
|
||||||
gFmRadioMode = true;
|
gFM_ScanState = FM_SCAN_OFF;
|
||||||
gFM_ScanState = FM_SCAN_OFF;
|
|
||||||
gFM_RestoreCountdown_10ms = 0;
|
gFM_RestoreCountdown_10ms = 0;
|
||||||
|
|
||||||
BK1080_Init(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
BK1080_Init(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
||||||
|
|
||||||
AUDIO_AudioPathOn();
|
AUDIO_AudioPathOn();
|
||||||
|
|
||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
gEeprom.CURRENT_STATE = 3;
|
gEeprom.CURRENT_STATE = 3;
|
||||||
SETTINGS_WriteCurrentState();
|
SETTINGS_WriteCurrentState();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
599
app/fskmodem.c
599
app/fskmodem.c
@@ -3,10 +3,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "fskmodem.h"
|
#include "fskmodem.h"
|
||||||
|
//#include "messages.h"
|
||||||
|
#include "driver/uart.h"
|
||||||
|
#include "../ui/messages.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
|
||||||
uint16_t TONE2_FREQ;
|
uint16_t TONE2_FREQ;
|
||||||
|
|
||||||
uint8_t seq = 0;
|
|
||||||
DataPacket dataPacket;
|
DataPacket dataPacket;
|
||||||
|
|
||||||
DataPacket inBoundPacket;
|
DataPacket inBoundPacket;
|
||||||
@@ -15,57 +18,154 @@ uint8_t *dataPTR = dataPacket.data;
|
|||||||
|
|
||||||
SMSEnteringState gEnteringSMS = SMS_NOT_ENTERING;
|
SMSEnteringState gEnteringSMS = SMS_NOT_ENTERING;
|
||||||
|
|
||||||
void MSG_ConfigureFSK(bool rx) {
|
SMSResponseState gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
BK4819_WriteRegister(BK4819_REG_70, TONE2_ENABLE_BIT | (96U << 0));
|
|
||||||
|
|
||||||
switch (gEeprom.FSKMode) {
|
bool gGotACK = false;
|
||||||
case MOD_AFSK_2400:
|
|
||||||
TONE2_FREQ = 24779U; // Estimated
|
uint8_t SMSResponseCounter = 0;
|
||||||
break;
|
|
||||||
case MOD_AFSK_1200:
|
typedef enum {
|
||||||
TONE2_FREQ = 12389U;
|
Receiving,
|
||||||
break;
|
Ready
|
||||||
case MOD_FSK_700:
|
} RXState;
|
||||||
TONE2_FREQ = 7227U;
|
|
||||||
break;
|
RXState rxState = Ready;
|
||||||
case MOD_FSK_450:
|
|
||||||
TONE2_FREQ = 4646U;
|
uint8_t SMSResponseCounterTarget = 6;
|
||||||
break;
|
|
||||||
case MOD_FSK_1200_2400:
|
void FSKModem_TimeSlice500ms(void) {
|
||||||
TONE2_FREQ = 12389U; // Default to 1200Hz, dynamic switching may be required
|
if (SMSResponseCounter && FUNCTION_IsRx() && SMSResponseCounter++ > SMSResponseCounterTarget) {
|
||||||
break;
|
switch (gSMSResponseState) {
|
||||||
case MOD_NOAA_SAME:
|
case SMS_RESPONSE_ACK:
|
||||||
TONE2_FREQ = 2083U; // NOAA SAME uses 2083.3 Hz for mark and 1562.5 Hz for space
|
MSG_FSKSendData(&inBoundPacket);
|
||||||
break;
|
gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
|
SMSResponseCounter = 0;
|
||||||
|
break;
|
||||||
|
case SMS_RESPONSE_RETRANSMIT:
|
||||||
|
MSG_FSKSendData(&inBoundPacket);
|
||||||
|
gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
|
SMSResponseCounter = 0;
|
||||||
|
break;
|
||||||
|
case SMS_RESPONSE_RESEND:
|
||||||
|
MSG_FSKSendData(&dataPacket);
|
||||||
|
gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
|
SMSResponseCounter = 0;
|
||||||
|
break;
|
||||||
|
case SMS_RESPONSE_ACK_LIGHT:
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||||
|
gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
|
SMSResponseCounter = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MSG_ConfigureFSK(bool rx) {
|
||||||
|
|
||||||
|
// quick helper
|
||||||
|
bool isAFSK = (gEeprom.FSKMode == MOD_AFSK_1200 ||
|
||||||
|
gEeprom.FSKMode == MOD_AFSK_2400 ||
|
||||||
|
gEeprom.FSKMode == MOD_NOAA_SAME);
|
||||||
|
|
||||||
|
|
||||||
|
// Base tone config
|
||||||
|
uint16_t tone1 = 0, tone2 = 0;
|
||||||
|
#define BK4819_FREQ_WORD(freq_hz) ((uint16_t)((freq_hz) * 10.32444f))
|
||||||
|
|
||||||
|
if (isAFSK) {
|
||||||
|
// Bell-202 style tones for AFSK/NOAA
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_AFSK_1200:
|
||||||
|
tone1 = BK4819_FREQ_WORD(1200.0f); // mark
|
||||||
|
tone2 = BK4819_FREQ_WORD(2200.0f); // space
|
||||||
|
break;
|
||||||
|
case MOD_AFSK_2400:
|
||||||
|
tone1 = BK4819_FREQ_WORD(1200.0f);
|
||||||
|
tone2 = BK4819_FREQ_WORD(2400.0f);
|
||||||
|
break;
|
||||||
|
case MOD_NOAA_SAME:
|
||||||
|
tone1 = BK4819_FREQ_WORD(1562.5f); // typical mark
|
||||||
|
tone2 = BK4819_FREQ_WORD(2083.3f); // typical space
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tone1 = BK4819_FREQ_WORD(1200.0f);
|
||||||
|
tone2 = BK4819_FREQ_WORD(2200.0f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
BK4819_WriteRegister(BK4819_REG_71, tone1);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_72, tone2);
|
||||||
|
// enable both tones
|
||||||
|
BK4819_WriteRegister(BK4819_REG_70,
|
||||||
|
TONE1_ENABLE_BIT | TONE2_ENABLE_BIT |
|
||||||
|
(96U << 8) | (96U << 0));
|
||||||
|
} else {
|
||||||
|
// plain FSK path: only TONE2 used (frequency for binary shift display/debug)
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_FSK_450:
|
||||||
|
tone2 = BK4819_FREQ_WORD(450.0f);
|
||||||
|
break;
|
||||||
|
case MOD_FSK_700:
|
||||||
|
tone2 = BK4819_FREQ_WORD(700.0f);
|
||||||
|
break;
|
||||||
|
case MOD_FSK_1200:
|
||||||
|
tone2 = BK4819_FREQ_WORD(1200.0f);
|
||||||
|
break;
|
||||||
|
case MOD_FSK_2400:
|
||||||
|
tone2 = BK4819_FREQ_WORD(2400.0f);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tone2 = BK4819_FREQ_WORD(1200.0f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BK4819_WriteRegister(BK4819_REG_72, tone2);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_70, TONE2_ENABLE_BIT | (96U << 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Base FSK config
|
||||||
BK4819_WriteRegister(BK4819_REG_72, TONE2_FREQ);
|
|
||||||
|
|
||||||
// uint16_t fskConfig = FSK_ENABLE_BIT | FSK_RX_BW_1_2K | FSK_RX_GAIN_DEFAULT | FSK_PREAMBLE_TYPE_AA;
|
|
||||||
// if (gEeprom.FSKMode == MOD_AFSK_1200) {
|
|
||||||
// fskConfig = FSK_ENABLE_BIT | FSK_TX_MODE_FSK_1_2K_2_4K | FSK_RX_MODE_FSK_1_2K_2_4K_NOAA;
|
|
||||||
// }
|
|
||||||
|
|
||||||
uint16_t fskConfig = FSK_ENABLE_BIT | FSK_PREAMBLE_TYPE_AA;
|
uint16_t fskConfig = FSK_ENABLE_BIT | FSK_PREAMBLE_TYPE_AA;
|
||||||
|
|
||||||
|
// Compose the correct fields into REG_58:
|
||||||
|
// - TX mode bits are at <15:13> (use your FSK_TX_MODE_* macros which are <<13)
|
||||||
|
// - RX mode bits are at <12:10> (use your FSK_RX_MODE_* macros which are <<10)
|
||||||
|
// - RX BW bits are at <3:1> (use your FSK_RX_BW_* macros which are <<1)
|
||||||
switch (gEeprom.FSKMode) {
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_AFSK_1200:
|
||||||
|
fskConfig |= FSK_TX_MODE_FFSK_1200_1800 /*<<13 in macro*/
|
||||||
|
| FSK_RX_MODE_FFSK_1200_1800 /*<<10 in macro*/
|
||||||
|
| FSK_RX_BW_FFSK_1200_1800; /*<<1 in macro*/
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_AFSK_2400:
|
||||||
|
fskConfig |= FSK_TX_MODE_FFSK_1200_2400
|
||||||
|
| FSK_RX_MODE_FFSK_1200_2400
|
||||||
|
| FSK_RX_BW_2_4K_FFSK_1200_2400;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_NOAA_SAME:
|
||||||
|
fskConfig |= FSK_TX_MODE_NOAA_SAME
|
||||||
|
| FSK_RX_MODE_FSK_1_2K_2_4K_NOAA
|
||||||
|
| FSK_RX_BW_NOAA_SAME;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_2400:
|
||||||
|
// binary FSK 1.2k/2.4k - use default FSK TX/RX modes and 1.2k BW
|
||||||
|
fskConfig |= FSK_TX_MODE_FSK_1_2K_2_4K
|
||||||
|
| FSK_RX_MODE_FSK_1_2K_2_4K_NOAA
|
||||||
|
| FSK_RX_BW_2_4K_FFSK_1200_2400;
|
||||||
|
break;
|
||||||
|
|
||||||
case MOD_FSK_700:
|
case MOD_FSK_700:
|
||||||
case MOD_FSK_450:
|
case MOD_FSK_450:
|
||||||
case MOD_FSK_1200_2400:
|
case MOD_FSK_1200:
|
||||||
fskConfig |= FSK_TX_MODE_FSK_1_2K_2_4K | FSK_RX_MODE_FSK_1_2K_2_4K_NOAA | FSK_RX_BW_1_2K;
|
|
||||||
break;
|
|
||||||
case MOD_AFSK_1200:
|
|
||||||
fskConfig |= FSK_TX_MODE_FFSK_1200_1800 | FSK_RX_MODE_FFSK_1200_1800 | FSK_RX_BW_FFSK_1200_1800;
|
|
||||||
break;
|
|
||||||
case MOD_AFSK_2400:
|
|
||||||
fskConfig |= FSK_TX_MODE_FFSK_1200_2400 | FSK_RX_MODE_FFSK_1200_2400 | FSK_RX_BW_2_4K_FFSK_1200_2400;
|
|
||||||
break;
|
|
||||||
case MOD_NOAA_SAME:
|
|
||||||
fskConfig |= FSK_TX_MODE_NOAA_SAME | FSK_RX_MODE_FSK_1_2K_2_4K_NOAA | FSK_RX_BW_NOAA_SAME;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
// Unsupported mode; keep previous setting
|
// binary FSK 1.2k/2.4k - use default FSK TX/RX modes and 1.2k BW
|
||||||
|
fskConfig |= FSK_TX_MODE_FSK_1_2K_2_4K
|
||||||
|
| FSK_RX_MODE_FSK_1_2K_2_4K_NOAA
|
||||||
|
| FSK_RX_BW_1_2K;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,27 +177,165 @@ void MSG_ConfigureFSK(bool rx) {
|
|||||||
BK4819_WriteRegister(BK4819_REG_5C, FSK_CRC_ON);
|
BK4819_WriteRegister(BK4819_REG_5C, FSK_CRC_ON);
|
||||||
|
|
||||||
if (rx) {
|
if (rx) {
|
||||||
BK4819_WriteRegister(BK4819_REG_5E, (64U << 3) | (1U << 0));
|
uint8_t threshold;
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_AFSK_1200:
|
||||||
|
case MOD_NOAA_SAME:
|
||||||
|
threshold = 1U;
|
||||||
|
break;
|
||||||
|
case MOD_AFSK_2400:
|
||||||
|
threshold = 2U; // Slightly higher; 2400 baud can fill FIFO faster
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
threshold = 4U; // FSK modes
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5E, (64U << 3) | threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Data length (REG_5D<15:8>)
|
||||||
size_t size = sizeof(dataPacket);
|
size_t size = sizeof(dataPacket);
|
||||||
if (rx) {
|
if (rx) size = (((size + 1) / 2) * 2) + 2;
|
||||||
size = (((size + 1) / 2) * 2) + 2;
|
|
||||||
}
|
|
||||||
BK4819_WriteRegister(BK4819_REG_5D, (size << 8));
|
BK4819_WriteRegister(BK4819_REG_5D, (size << 8));
|
||||||
|
|
||||||
BK4819_FskClearFifo();
|
BK4819_FskClearFifo();
|
||||||
|
|
||||||
uint16_t fskParams = FSK_SYNC_LEN_BIT | ((rx ? 0U : 15U) << 4);
|
// REG_59: clear flags, preamble len, sync len etc.
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0) {
|
//uint16_t fskParams = FSK_SYNC_LEN_BIT | ((rx ? 0U : 15U) << 4);
|
||||||
fskParams |= FSK_SCRAMBLE_ENABLE;
|
uint16_t preamble_len = (gEeprom.FSKMode == MOD_AFSK_1200 || gEeprom.FSKMode == MOD_AFSK_2400 || gEeprom.FSKMode == MOD_NOAA_SAME) ? 10U : (rx ? 0U
|
||||||
}
|
: 15U);
|
||||||
|
uint16_t fskParams = FSK_SYNC_LEN_BIT | (preamble_len << 4);
|
||||||
|
if (gCurrentVfo->SCRAMBLING_TYPE > 0) fskParams |= FSK_SCRAMBLE_ENABLE;
|
||||||
BK4819_WriteRegister(BK4819_REG_59, fskParams);
|
BK4819_WriteRegister(BK4819_REG_59, fskParams);
|
||||||
|
|
||||||
|
|
||||||
|
// Clear interrupt flags
|
||||||
BK4819_WriteRegister(BK4819_REG_02, 0);
|
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||||
|
|
||||||
|
// Enable AF path filters for tone demodulation in AFSK/NOAA modes
|
||||||
|
if (gEeprom.FSKMode == MOD_AFSK_1200 ||
|
||||||
|
gEeprom.FSKMode == MOD_AFSK_2400 ||
|
||||||
|
gEeprom.FSKMode == MOD_NOAA_SAME) {
|
||||||
|
|
||||||
|
// Keep DC cancel, disable only deemphasis
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B,
|
||||||
|
(1U << 15) | (1U << 14) | (1U << 8));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B, (1u << 2) | (1u << 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the FM deviation level
|
||||||
|
const uint16_t dev_val = BK4819_ReadRegister(BK4819_REG_40);
|
||||||
|
|
||||||
|
uint16_t deviation;
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_AFSK_1200:
|
||||||
|
case MOD_AFSK_2400:
|
||||||
|
case MOD_NOAA_SAME:
|
||||||
|
deviation = 650; // 0.65 kHz for audio-based tones (linear region)
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_450:
|
||||||
|
deviation = 225; // ≈ half of 450 Hz separation
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_700:
|
||||||
|
deviation = 350; // ≈ half of 700 Hz separation
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_1200:
|
||||||
|
deviation = 600; // halfway between 1200 and 2400 = 1.8 kHz spacing → ±900 Hz dev
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_2400:
|
||||||
|
deviation = 1200; // halfway between 1200 and 2400 = 1.8 kHz spacing → ±900 Hz dev
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
deviation = 750; // safe fallback
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BK4819_WriteRegister(BK4819_REG_40, (dev_val & 0xf000) | (deviation & 0x0fff));
|
||||||
|
// restore FM deviation level
|
||||||
|
//BK4819_WriteRegister(BK4819_REG_40, dev_val);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t calculateCRC(uint8_t *data, size_t length) {
|
||||||
|
uint16_t crc = 0xFFFF; // Example CRC-16 initialization
|
||||||
|
for (size_t i = 0; i < length; i++) {
|
||||||
|
crc ^= data[i];
|
||||||
|
for (uint8_t j = 0; j < 8; j++) {
|
||||||
|
if (crc & 1) {
|
||||||
|
crc = (crc >> 1) ^ 0xA001; // Example polynomial (CRC-16-IBM)
|
||||||
|
} else {
|
||||||
|
crc >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void processReceivedPacket(DataPacket *packet) {
|
||||||
|
char String[18];
|
||||||
|
char numBuf[11]; // Enough for any 64-bit unsigned integer
|
||||||
|
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||||
|
: gEeprom.TX_VFO;
|
||||||
|
|
||||||
|
UART_Send(packet, sizeof(DataPacket));
|
||||||
|
if (packet->dest == gEeprom.FSKSRCAddress) {
|
||||||
|
if ((packet->flags & 0x80)) {
|
||||||
|
if (packet->flags & 0x40) {
|
||||||
|
uint16_t crcSent = calculateCRC(dataPacket.data, 20);
|
||||||
|
uint16_t crcGot = inBoundPacket.data[0] | (inBoundPacket.data[1] << 8);
|
||||||
|
if (crcSent == crcGot) {
|
||||||
|
gGotACK = true;
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true);
|
||||||
|
SMSResponseCounter = 1;
|
||||||
|
gSMSResponseState = SMS_RESPONSE_ACK_LIGHT;
|
||||||
|
} else {
|
||||||
|
if (--dataPacket.ttl) {
|
||||||
|
gSMSResponseState = SMS_RESPONSE_RESEND;
|
||||||
|
SMSResponseCounter = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP);
|
||||||
|
BK4819_PlaySingleTone(1000, 250, 127, true);
|
||||||
|
strcpy(String, "SMS by ");
|
||||||
|
itoa(packet->src, numBuf); // Convert number to string
|
||||||
|
strcat(String, numBuf);
|
||||||
|
MESSAGES_SAVE();
|
||||||
|
gRequestDisplayScreen = DISPLAY_MESSAGES;
|
||||||
|
GUI_SelectNextDisplay(gRequestDisplayScreen);
|
||||||
|
gActiveMessageBank = MESSAGES_COUNT / 3 - 1;
|
||||||
|
UI_DisplayPopup(String);
|
||||||
|
inBoundPacket.flags |= 0x40;
|
||||||
|
inBoundPacket.dest = inBoundPacket.src;
|
||||||
|
inBoundPacket.src = gEeprom.FSKSRCAddress;
|
||||||
|
uint16_t crcTest = calculateCRC(inBoundPacket.data, 20);
|
||||||
|
memset(inBoundPacket.data, 0, DataPacketDataSize);
|
||||||
|
inBoundPacket.data[0] = crcTest & 0xFF;
|
||||||
|
inBoundPacket.data[1] = (crcTest >> 8) & 0xFF;
|
||||||
|
gSMSResponseState = SMS_RESPONSE_ACK;
|
||||||
|
SMSResponseCounter = 1;
|
||||||
|
UI_PrintStringSmallNormal(String, 2, 0, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||||
|
if (packet->ttl--) {
|
||||||
|
SMSResponseCounter = 1;
|
||||||
|
gSMSResponseState = SMS_RESPONSE_RETRANSMIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MSG_EnableRX(const bool enable) {
|
void MSG_EnableRX(const bool enable) {
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
@@ -111,109 +349,190 @@ void MSG_EnableRX(const bool enable) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSG_FSKSendData() {
|
void MSG_FSKSendData(DataPacket *dataPacketIn) {
|
||||||
|
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||||
|
: gEeprom.TX_VFO;
|
||||||
|
if (VfoState[vfo] == VFO_STATE_NORMAL &&
|
||||||
|
!TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||||
|
|
||||||
// turn off CTCSS/CDCSS during FFSK
|
RADIO_PrepareTX();
|
||||||
const uint16_t css_val = BK4819_ReadRegister(BK4819_REG_51);
|
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
|
||||||
BK4819_WriteRegister(BK4819_REG_51, 0);
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
|
|
||||||
// set the FM deviation level
|
bool isAudioOn = gEnableSpeaker;
|
||||||
const uint16_t dev_val = BK4819_ReadRegister(BK4819_REG_40);
|
if (gEnableSpeaker) {
|
||||||
|
AUDIO_AudioPathOff();
|
||||||
|
BK4819_EnterTxMute();
|
||||||
|
gEnableSpeaker = false;
|
||||||
|
}
|
||||||
|
// turn off CTCSS/CDCSS during FFSK
|
||||||
|
const uint16_t css_val = BK4819_ReadRegister(BK4819_REG_51);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_51, 0);
|
||||||
|
|
||||||
{
|
|
||||||
uint16_t deviation;
|
|
||||||
switch (gEeprom.VfoInfo[gEeprom.TX_VFO].CHANNEL_BANDWIDTH) {
|
// REG_2B 0
|
||||||
case BK4819_FILTER_BW_WIDE:
|
//
|
||||||
deviation = 1300;
|
// <15> 1 Enable CTCSS/CDCSS DC cancellation after FM Demodulation 1 = enable 0 = disable
|
||||||
break; // 20k // measurements by kamilsss655
|
// <14> 1 Enable AF DC cancellation after FM Demodulation 1 = enable 0 = disable
|
||||||
case BK4819_FILTER_BW_NARROW:
|
// <10> 0 AF RX HPF 300Hz filter 0 = enable 1 = disable
|
||||||
deviation = 1200;
|
// <9> 0 AF RX LPF 3kHz filter 0 = enable 1 = disable
|
||||||
break; // 10k
|
// <8> 0 AF RX de-emphasis filter 0 = enable 1 = disable
|
||||||
// case BK4819_FILTER_BW_NARROWAVIATION: deviation = 850; break; // 5k
|
// <2> 0 AF TX HPF 300Hz filter 0 = enable 1 = disable
|
||||||
// case BK4819_FILTER_BW_NARROWER: deviation = 850; break; // 5k
|
// <1> 0 AF TX LPF filter 0 = enable 1 = disable
|
||||||
// case BK4819_FILTER_BW_NARROWEST: deviation = 850; break; // 5k
|
// <0> 0 AF TX pre-emphasis filter 0 = enable 1 = disable
|
||||||
default:
|
//
|
||||||
deviation = 850;
|
// disable the 300Hz HPF and FM pre-emphasis filter
|
||||||
break; // 5k
|
//
|
||||||
|
|
||||||
|
const uint16_t filt_val = BK4819_ReadRegister(BK4819_REG_2B);
|
||||||
|
// Enable AF path filters for tone demodulation in AFSK/NOAA modes
|
||||||
|
if (gEeprom.FSKMode == MOD_AFSK_1200 ||
|
||||||
|
gEeprom.FSKMode == MOD_AFSK_2400 ||
|
||||||
|
gEeprom.FSKMode == MOD_NOAA_SAME) {
|
||||||
|
|
||||||
|
// Keep DC cancel, disable only deemphasis
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B,
|
||||||
|
(1U << 15) | (1U << 14) | (1U << 8));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B, (1u << 2) | (1u << 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
//BK4819_WriteRegister(0x40, (3u << 12) | (deviation & 0xfff));
|
MSG_ConfigureFSK(false);
|
||||||
BK4819_WriteRegister(BK4819_REG_40, (dev_val & 0xf000) | (deviation & 0xfff));
|
|
||||||
}
|
|
||||||
|
|
||||||
// REG_2B 0
|
|
||||||
//
|
|
||||||
// <15> 1 Enable CTCSS/CDCSS DC cancellation after FM Demodulation 1 = enable 0 = disable
|
|
||||||
// <14> 1 Enable AF DC cancellation after FM Demodulation 1 = enable 0 = disable
|
|
||||||
// <10> 0 AF RX HPF 300Hz filter 0 = enable 1 = disable
|
|
||||||
// <9> 0 AF RX LPF 3kHz filter 0 = enable 1 = disable
|
|
||||||
// <8> 0 AF RX de-emphasis filter 0 = enable 1 = disable
|
|
||||||
// <2> 0 AF TX HPF 300Hz filter 0 = enable 1 = disable
|
|
||||||
// <1> 0 AF TX LPF filter 0 = enable 1 = disable
|
|
||||||
// <0> 0 AF TX pre-emphasis filter 0 = enable 1 = disable
|
|
||||||
//
|
|
||||||
// disable the 300Hz HPF and FM pre-emphasis filter
|
|
||||||
//
|
|
||||||
const uint16_t filt_val = BK4819_ReadRegister(BK4819_REG_2B);
|
|
||||||
BK4819_WriteRegister(BK4819_REG_2B, (1u << 2) | (1u << 0));
|
|
||||||
|
|
||||||
MSG_ConfigureFSK(false);
|
|
||||||
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(100);
|
SYSTEM_DelayMs(100);
|
||||||
|
|
||||||
{ // load the entire packet data into the TX FIFO buffer
|
{ // load the entire packet data into the TX FIFO buffer
|
||||||
uint16_t *ptr = (uint16_t *) &dataPacket;
|
uint16_t *ptr = (uint16_t *) dataPacketIn;
|
||||||
size_t wordCount = sizeof(dataPacket) / sizeof(uint16_t);
|
size_t wordCount = sizeof(*dataPacketIn) / sizeof(uint16_t);
|
||||||
|
|
||||||
for (size_t i = 0; i < wordCount; i++) {
|
for (size_t i = 0; i < wordCount; i++) {
|
||||||
BK4819_WriteRegister(BK4819_REG_5F, ptr[i]);
|
BK4819_WriteRegister(BK4819_REG_5F, ptr[i]);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// enable FSK TX
|
|
||||||
BK4819_FskEnableTx();
|
|
||||||
|
|
||||||
{
|
|
||||||
// allow up to 310ms for the TX to complete
|
|
||||||
// if it takes any longer then somethings gone wrong, we shut the TX down
|
|
||||||
unsigned int timeout = 1000 / 5;
|
|
||||||
|
|
||||||
while (timeout-- > 0) {
|
|
||||||
SYSTEM_DelayMs(5);
|
|
||||||
if (BK4819_ReadRegister(BK4819_REG_0C) & (1u << 0)) { // we have interrupt flags
|
|
||||||
BK4819_WriteRegister(BK4819_REG_02, 0);
|
|
||||||
if (BK4819_ReadRegister(BK4819_REG_02) & BK4819_REG_02_FSK_TX_FINISHED)
|
|
||||||
timeout = 0; // TX is complete
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// enable FSK TX
|
||||||
|
BK4819_FskEnableTx();
|
||||||
|
|
||||||
|
{
|
||||||
|
// allow up to 310ms for the TX to complete
|
||||||
|
// if it takes any longer then somethings gone wrong, we shut the TX down
|
||||||
|
unsigned int timeout = 1000 / 5;
|
||||||
|
|
||||||
|
while (timeout-- > 0) {
|
||||||
|
SYSTEM_DelayMs(5);
|
||||||
|
if (BK4819_ReadRegister(BK4819_REG_0C) & (1u << 0)) { // we have interrupt flags
|
||||||
|
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||||
|
if (BK4819_ReadRegister(BK4819_REG_02) & BK4819_REG_02_FSK_TX_FINISHED)
|
||||||
|
timeout = 0; // TX is complete
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(100);
|
||||||
|
|
||||||
|
// disable TX
|
||||||
|
MSG_ConfigureFSK(true);
|
||||||
|
|
||||||
|
// restore TX/RX filtering
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B, filt_val);
|
||||||
|
|
||||||
|
// restore the CTCSS/CDCSS setting
|
||||||
|
BK4819_WriteRegister(BK4819_REG_51, css_val);
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(50);
|
||||||
|
APP_EndTransmission();
|
||||||
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
gFlagEndTransmission = false;
|
||||||
|
|
||||||
|
if (isAudioOn) {
|
||||||
|
AUDIO_AudioPathOn();
|
||||||
|
gEnableSpeaker = true;
|
||||||
|
BK4819_ExitTxMute();
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (!(dataPacketIn->flags & 0x64)) {
|
||||||
|
if (!(dataPacketIn->flags & 0x40)) {
|
||||||
|
gGotACK = false;
|
||||||
|
}
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||||
|
MSG_EnableRX(true);
|
||||||
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
|
dataPTR = dataPacket.data;
|
||||||
|
|
||||||
}
|
}
|
||||||
//BK4819_WriteRegister(BK4819_REG_02, 0);
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(100);
|
|
||||||
|
|
||||||
// disable TX
|
|
||||||
MSG_ConfigureFSK(true);
|
|
||||||
|
|
||||||
// restore FM deviation level
|
|
||||||
BK4819_WriteRegister(BK4819_REG_40, dev_val);
|
|
||||||
|
|
||||||
// restore TX/RX filtering
|
|
||||||
BK4819_WriteRegister(BK4819_REG_2B, filt_val);
|
|
||||||
|
|
||||||
// restore the CTCSS/CDCSS setting
|
|
||||||
BK4819_WriteRegister(BK4819_REG_51, css_val);
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(50);
|
|
||||||
APP_EndTransmission();
|
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
|
||||||
gUpdateStatus = true;
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
gFlagEndTransmission = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepareDataPacket() {
|
void prepareDataPacket() {
|
||||||
dataPacket.src = gEeprom.FSKSRCAddress;
|
dataPacket.src = gEeprom.FSKSRCAddress;
|
||||||
dataPacket.seq = seq++;
|
uint8_t Data[8];
|
||||||
|
EEPROM_ReadBuffer(SEQParameterEEPROM, Data, 8);
|
||||||
|
dataPacket.seq = Data[0];
|
||||||
|
Data[0]++;
|
||||||
|
EEPROM_WriteBuffer(SEQParameterEEPROM, Data);
|
||||||
|
dataPacket.ttl = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FSK_HANDLE_IRQ(unsigned short irq) {
|
||||||
|
//const uint16_t rx_sync_flags = BK4819_ReadRegister(BK4819_REG_0B);
|
||||||
|
|
||||||
|
const bool rx_sync = (irq & BK4819_REG_02_FSK_RX_SYNC) != 0;
|
||||||
|
const bool rx_fifo_almost_full = (irq & BK4819_REG_02_FSK_FIFO_ALMOST_FULL) != 0;
|
||||||
|
const bool rx_finished = (irq & BK4819_REG_02_FSK_RX_FINISHED) != 0;
|
||||||
|
|
||||||
|
//UART_printf("\nMSG : S%i, F%i, E%i | %i", rx_sync, rx_fifo_almost_full, rx_finished, irq);
|
||||||
|
|
||||||
|
if (rx_sync) {
|
||||||
|
// prevent listening to fsk data and squelch (kamilsss655)
|
||||||
|
// CTCSS codes seem to false trigger the rx_sync
|
||||||
|
if (gCurrentCodeType == CODE_TYPE_OFF)
|
||||||
|
AUDIO_AudioPathOff();
|
||||||
|
gFSKWriteIndex = 0;
|
||||||
|
memset(&inBoundPacket, 0, sizeof(DataPacket));
|
||||||
|
rxState = Receiving;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rx_fifo_almost_full && rxState == Receiving) {
|
||||||
|
const uint16_t count = BK4819_ReadRegister(BK4819_REG_5E) & (7u << 0); // Almost full threshold
|
||||||
|
uint16_t *ptr = (uint16_t *) &inBoundPacket;
|
||||||
|
size_t wordCount = sizeof(inBoundPacket) / sizeof(uint16_t);
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < count && gFSKWriteIndex < wordCount; i++) {
|
||||||
|
ptr[gFSKWriteIndex++] = BK4819_ReadRegister(BK4819_REG_5F);
|
||||||
|
UART_Send((const void *) &ptr[gFSKWriteIndex - 1], 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rx_finished) {
|
||||||
|
// Turn off green LED
|
||||||
|
BK4819_FskClearFifo();
|
||||||
|
|
||||||
|
rxState = Ready;
|
||||||
|
|
||||||
|
if (gFSKWriteIndex > 2) {
|
||||||
|
// Validate checksum (assuming last 2 bytes are CRC-16)
|
||||||
|
//size_t dataLength = sizeof(inBoundPacket.data) - 2;
|
||||||
|
//uint16_t receivedCRC = (inBoundPacket.data[dataLength] << 8) | inBoundPacket.data[dataLength + 1];
|
||||||
|
//uint16_t calculatedCRC = calculateCRC(inBoundPacket.data, dataLength);
|
||||||
|
|
||||||
|
//if (receivedCRC == calculatedCRC) {
|
||||||
|
processReceivedPacket(&inBoundPacket);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
APP_EndTransmission();
|
||||||
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
gFlagEndTransmission = false;
|
||||||
|
|
||||||
|
gFSKWriteIndex = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,11 @@
|
|||||||
#include "../driver/system.h"
|
#include "../driver/system.h"
|
||||||
#include "../misc.h"
|
#include "../misc.h"
|
||||||
#include "../app/app.h"
|
#include "../app/app.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include "../audio.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "../ui/helper.h"
|
||||||
|
#include "../ui/main.h"
|
||||||
|
|
||||||
// REG_70 bit definitions
|
// REG_70 bit definitions
|
||||||
#define TONE1_ENABLE_BIT (1U << 15)
|
#define TONE1_ENABLE_BIT (1U << 15)
|
||||||
@@ -73,34 +78,58 @@
|
|||||||
#define FSK_CRC_ON (1U << 6)
|
#define FSK_CRC_ON (1U << 6)
|
||||||
#define FSK_CRC_OFF (0U << 6)
|
#define FSK_CRC_OFF (0U << 6)
|
||||||
|
|
||||||
#define DataPacketDataSize (36)
|
#define DataPacketDataSize (21)
|
||||||
|
|
||||||
|
#define SEQParameterEEPROM 0x1C00
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t dest;
|
uint32_t dest; //4bytes
|
||||||
uint32_t src;
|
uint32_t src; //4bytes
|
||||||
uint8_t seq;
|
uint8_t seq; //1bytes
|
||||||
uint8_t flags;
|
uint8_t ttl; //1bytes
|
||||||
|
uint8_t flags; //1bytes
|
||||||
uint8_t data[DataPacketDataSize];
|
uint8_t data[DataPacketDataSize];
|
||||||
} DataPacket;
|
} DataPacket;
|
||||||
|
|
||||||
void prepareDataPacket();
|
void prepareDataPacket();
|
||||||
|
|
||||||
void MSG_FSKSendData();
|
void MSG_FSKSendData(DataPacket *dataPacketIn);
|
||||||
|
|
||||||
void MSG_EnableRX(bool enable);
|
void MSG_EnableRX(bool enable);
|
||||||
|
|
||||||
|
void processReceivedPacket(DataPacket *packet);
|
||||||
|
|
||||||
|
uint16_t calculateCRC(uint8_t *data, size_t length);
|
||||||
|
|
||||||
extern DataPacket dataPacket;
|
extern DataPacket dataPacket;
|
||||||
|
|
||||||
extern DataPacket inBoundPacket;
|
extern DataPacket inBoundPacket;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SMS_NOT_ENTERING,
|
SMS_NOT_ENTERING = 0,
|
||||||
SMS_ENTERING_DEST,
|
SMS_ENTERING_DEST,
|
||||||
SMS_ENTERING_MESSAGE
|
SMS_ENTERING_MESSAGE
|
||||||
} SMSEnteringState;
|
} SMSEnteringState;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SMS_RESPONSE_IDLE,
|
||||||
|
SMS_RESPONSE_ACK,
|
||||||
|
SMS_RESPONSE_ACK_LIGHT,
|
||||||
|
SMS_RESPONSE_RETRANSMIT,
|
||||||
|
SMS_RESPONSE_RESEND
|
||||||
|
} SMSResponseState;
|
||||||
|
|
||||||
extern SMSEnteringState gEnteringSMS;
|
extern SMSEnteringState gEnteringSMS;
|
||||||
|
extern SMSResponseState gSMSResponseState;
|
||||||
|
|
||||||
extern uint8_t *dataPTR;
|
extern uint8_t *dataPTR;
|
||||||
|
|
||||||
|
extern bool gGotACK;
|
||||||
|
|
||||||
|
extern uint8_t SMSResponseCounter;
|
||||||
|
|
||||||
|
void FSK_HANDLE_IRQ(unsigned short irq);
|
||||||
|
|
||||||
|
void FSKModem_TimeSlice500ms(void);
|
||||||
|
|
||||||
#endif //UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
|
#endif //UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
|
||||||
|
|||||||
@@ -198,16 +198,6 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
if (gDTMF_InputBox_Index < sizeof(gDTMF_InputBox))
|
if (gDTMF_InputBox_Index < sizeof(gDTMF_InputBox))
|
||||||
gDTMF_InputBox[gDTMF_InputBox_Index] = 0; // NULL term the string
|
gDTMF_InputBox[gDTMF_InputBox_Index] = 0; // NULL term the string
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
// append our DTMF ID to the inputted DTMF code -
|
|
||||||
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
|
||||||
if (gDTMF_InputBox_Index == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
|
||||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
|
||||||
else
|
|
||||||
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
|
||||||
|
|
||||||
gDTMF_State = DTMF_STATE_0;
|
|
||||||
#endif
|
|
||||||
// remember the DTMF string
|
// remember the DTMF string
|
||||||
gDTMF_PreviousIndex = gDTMF_InputBox_Index;
|
gDTMF_PreviousIndex = gDTMF_InputBox_Index;
|
||||||
strcpy(gDTMF_String, gDTMF_InputBox);
|
strcpy(gDTMF_String, gDTMF_InputBox);
|
||||||
|
|||||||
146
app/main.c
146
app/main.c
@@ -47,23 +47,9 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#include "messages.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define T9Count 9
|
|
||||||
|
|
||||||
const char T9Table[10][T9Count] = {
|
|
||||||
{'#', '(', ')', ';', ':', '<', '>', '/', '0'},
|
|
||||||
{',', '.', '?', '&', '!', ' ', '-', '_', '1'},
|
|
||||||
{'a', 'b', 'c', 'A', 'B', 'C', '[', ']', '2'},
|
|
||||||
{'d', 'e', 'f', 'D', 'E', 'F', '@', '%', '3'},
|
|
||||||
{'g', 'h', 'i', 'G', 'H', 'I', '~', '$', '4'},
|
|
||||||
{'j', 'k', 'l', 'J', 'K', 'L', '|', '*', '5'},
|
|
||||||
{'m', 'n', 'o', 'M', 'N', 'O', '{', '}', '6'},
|
|
||||||
{'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S', '7'},
|
|
||||||
{'t', 'u', 'v', 'T', 'U', 'V', '"', '\'', '8'},
|
|
||||||
{'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z', '9'}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void toggle_chan_scanlist(void) { // toggle the selected channels scanlist setting
|
static void toggle_chan_scanlist(void) { // toggle the selected channels scanlist setting
|
||||||
|
|
||||||
if (SCANNER_IsScanning())
|
if (SCANNER_IsScanning())
|
||||||
@@ -270,7 +256,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_8:
|
case KEY_8:
|
||||||
gTxVfo->FrequencyReverse = gTxVfo->FrequencyReverse == false;
|
gTxVfo->FrequencyReverse = !gTxVfo->FrequencyReverse;
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -360,10 +346,8 @@ void channelMove(uint16_t Channel) {
|
|||||||
//gRequestSaveVFO = true;
|
//gRequestSaveVFO = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
gRemoveOffset = false;
|
gRemoveOffset = false;
|
||||||
gPowerHigh = false;
|
gPowerHigh = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
|
RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
|
||||||
|
|
||||||
@@ -594,14 +578,6 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) {
|
|||||||
if (!bKeyHeld && bKeyPressed) { // exit key pressed
|
if (!bKeyHeld && bKeyPressed) { // exit key pressed
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT)
|
|
||||||
{ // clear CALL mode being displayed
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (!gFmRadioMode)
|
if (!gFmRadioMode)
|
||||||
@@ -660,7 +636,7 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) {
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
// Exclude work with list 1, 2, 3 or all list
|
// Exclude work with list 1, 2, 3 or all list
|
||||||
if (gScanStateDir != SCAN_OFF) {
|
if (gScanStateDir != SCAN_OFF) {
|
||||||
if (FUNCTION_IsRx()) {
|
if (FUNCTION_IsRx() || gScanPauseDelayIn_10ms > 9) {
|
||||||
gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = true;
|
gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = true;
|
||||||
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE;
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
@@ -693,6 +669,13 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gWasFKeyPressed && bKeyPressed) {
|
||||||
|
MESSAGES_GET();
|
||||||
|
gRequestDisplayScreen = DISPLAY_MESSAGES;
|
||||||
|
gActiveMessageBank = MESSAGES_COUNT / 3 - 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!bKeyPressed && !gDTMF_InputMode) { // menu key released
|
if (!bKeyPressed && !gDTMF_InputMode) { // menu key released
|
||||||
const bool bFlag = !gInputBoxIndex;
|
const bool bFlag = !gInputBoxIndex;
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
@@ -825,10 +808,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
gRemoveOffset = false;
|
gRemoveOffset = false;
|
||||||
gPowerHigh = false;
|
gPowerHigh = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
||||||
|
|
||||||
@@ -910,11 +891,6 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatePrevChar(KEY_Code_t Key) {
|
|
||||||
if (Key != prevKey) {
|
|
||||||
prevKey = Key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -943,108 +919,6 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
// Key = KEY_SIDE2; // what's this doing ???
|
// Key = KEY_SIDE2; // what's this doing ???
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (Key == KEY_9 && bKeyHeld) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
if (gEnteringSMS == SMS_NOT_ENTERING) {
|
|
||||||
gEnteringSMS = SMS_ENTERING_DEST;
|
|
||||||
updatePrevChar(Key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Key == KEY_MENU) {
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
|
||||||
prepareDataPacket();
|
|
||||||
dataPacket.flags = 126;
|
|
||||||
gEnteringSMS = SMS_ENTERING_MESSAGE;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
if (strlen((char *) dataPacket.data)) {
|
|
||||||
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
|
||||||
: gEeprom.TX_VFO;
|
|
||||||
if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
|
||||||
AUDIO_AudioPathOff();
|
|
||||||
gEnableSpeaker = false;
|
|
||||||
RADIO_PrepareTX();
|
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
|
||||||
else
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
|
||||||
MSG_FSKSendData();
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
|
||||||
AUDIO_AudioPathOn();
|
|
||||||
gEnableSpeaker = true;
|
|
||||||
BK4819_ExitTxMute();
|
|
||||||
MSG_EnableRX(true);
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE;
|
|
||||||
dataPTR = dataPacket.data;
|
|
||||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
|
||||||
}
|
|
||||||
gEnteringSMS = SMS_NOT_ENTERING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Key == KEY_EXIT && gEnteringSMS != SMS_NOT_ENTERING) {
|
|
||||||
if (bKeyHeld) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
gEnteringSMS = SMS_NOT_ENTERING;
|
|
||||||
dataPTR = dataPacket.data;
|
|
||||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
|
||||||
if (dataPacket.data <= dataPTR) {
|
|
||||||
*dataPTR = '\0';
|
|
||||||
if (dataPacket.data < dataPTR) {
|
|
||||||
dataPTR--;
|
|
||||||
}
|
|
||||||
*dataPTR = '\0';
|
|
||||||
}
|
|
||||||
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
|
||||||
dataPacket.dest /= 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updatePrevChar(Key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gEnteringSMS != SMS_NOT_ENTERING && !bKeyHeld) {
|
|
||||||
if (!dataPTR) {
|
|
||||||
dataPTR = dataPacket.data;
|
|
||||||
}
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
if (prevKey != Key) {
|
|
||||||
dataPTR++;
|
|
||||||
if (dataPTR - dataPacket.data >= DataPacketDataSize) {
|
|
||||||
dataPTR = dataPacket.data;
|
|
||||||
}
|
|
||||||
prevLetter = 0;
|
|
||||||
}
|
|
||||||
*(dataPTR - 1) = T9Table[Key][(prevLetter++) % T9Count];
|
|
||||||
updatePrevChar(Key);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
dataPacket.dest *= 10;
|
|
||||||
dataPacket.dest += Key;
|
|
||||||
prevLetter = 0;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case KEY_SIDE1:
|
case KEY_SIDE1:
|
||||||
|
|||||||
190
app/menu.c
190
app/menu.c
@@ -121,6 +121,11 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
*pMax = 9;
|
*pMax = 9;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_TOT:
|
||||||
|
*pMin = 0;
|
||||||
|
*pMax = 179;
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_STEP:
|
case MENU_STEP:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = STEP_N_ELEM - 1;
|
*pMax = STEP_N_ELEM - 1;
|
||||||
@@ -239,9 +244,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
case MENU_S_ADD3:
|
case MENU_S_ADD3:
|
||||||
case MENU_STE:
|
case MENU_STE:
|
||||||
case MENU_D_ST:
|
case MENU_D_ST:
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_DCD:
|
|
||||||
#endif
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
case MENU_NOAA_S:
|
case MENU_NOAA_S:
|
||||||
@@ -259,7 +262,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = 10;
|
*pMax = 65535;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_AUTOLK:
|
case MENU_AUTOLK:
|
||||||
@@ -271,11 +274,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMin = 5;
|
|
||||||
*pMax = 179;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
case MENU_VOX:
|
case MENU_VOX:
|
||||||
@@ -315,12 +313,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
*pMax = 5;
|
*pMax = 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_RSP:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_D_RSP) - 1;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_PTT_ID:
|
case MENU_PTT_ID:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
||||||
@@ -331,23 +324,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_HOLD:
|
|
||||||
*pMin = 5;
|
|
||||||
*pMax = 60;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
*pMin = 3;
|
*pMin = 3;
|
||||||
*pMax = 99;
|
*pMax = 99;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_LIST:
|
|
||||||
*pMin = 1;
|
|
||||||
*pMax = 16;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
case MENU_F_CALI:
|
case MENU_F_CALI:
|
||||||
*pMin = -50;
|
*pMin = -50;
|
||||||
@@ -385,41 +367,18 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_TOT:
|
|
||||||
case MENU_SET_EOT:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
*pMin = 1;
|
|
||||||
*pMax = 15;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_INV
|
#ifdef ENABLE_FEAT_F4HWN_INV
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
case MENU_SET_NFM:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_NFM) - 1;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
case MENU_SET_VOL:
|
case MENU_SET_VOL:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = 63;
|
*pMax = 63;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
case MENU_SET_KEY:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = 4;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -518,10 +477,7 @@ void MENU_AcceptSetting(void) {
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
||||||
if (gSubMenuSelection > 0)
|
BK4819_SetScramble(gSubMenuSelection);
|
||||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
|
||||||
else
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -530,6 +486,10 @@ void MENU_AcceptSetting(void) {
|
|||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case MENU_TOT:
|
||||||
|
gEeprom.TX_TIMEOUT_TIMER = gSubMenuSelection;
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_MEM_CH:
|
case MENU_MEM_CH:
|
||||||
gTxVfo->CHANNEL_SAVE = gSubMenuSelection;
|
gTxVfo->CHANNEL_SAVE = gSubMenuSelection;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -606,10 +566,6 @@ void MENU_AcceptSetting(void) {
|
|||||||
gEeprom.BEEP_CONTROL = gSubMenuSelection;
|
gEeprom.BEEP_CONTROL = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
|
||||||
gEeprom.TX_TIMEOUT_TIMER = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
case MENU_VOICE:
|
case MENU_VOICE:
|
||||||
gEeprom.VOICE_PROMPT = gSubMenuSelection;
|
gEeprom.VOICE_PROMPT = gSubMenuSelection;
|
||||||
@@ -697,15 +653,6 @@ void MENU_AcceptSetting(void) {
|
|||||||
gEeprom.DTMF_SIDE_TONE = gSubMenuSelection;
|
gEeprom.DTMF_SIDE_TONE = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_RSP:
|
|
||||||
gEeprom.DTMF_DECODE_RESPONSE = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
|
||||||
gEeprom.DTMF_auto_reset_time = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
gEeprom.DTMF_PRELOAD_TIME = gSubMenuSelection * 10;
|
gEeprom.DTMF_PRELOAD_TIME = gSubMenuSelection * 10;
|
||||||
break;
|
break;
|
||||||
@@ -719,13 +666,6 @@ void MENU_AcceptSetting(void) {
|
|||||||
gSetting_battery_text = gSubMenuSelection;
|
gSetting_battery_text = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_DCD:
|
|
||||||
gTxVfo->DTMF_DECODING_ENABLE = gSubMenuSelection;
|
|
||||||
DTMF_clear_RX();
|
|
||||||
gRequestSaveChannel = 1;
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
gSetting_live_DTMF_decoder = gSubMenuSelection;
|
gSetting_live_DTMF_decoder = gSubMenuSelection;
|
||||||
@@ -737,18 +677,6 @@ void MENU_AcceptSetting(void) {
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_LIST:
|
|
||||||
gDTMF_chosen_contact = gSubMenuSelection - 1;
|
|
||||||
if (gIsDtmfContactValid) {
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
|
||||||
gDTMF_InputMode = true;
|
|
||||||
gDTMF_InputBox_Index = 3;
|
|
||||||
memcpy(gDTMF_InputBox, gDTMF_ID, 4);
|
|
||||||
gRequestDisplayScreen = DISPLAY_INVALID;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
case MENU_FSKMOD:
|
case MENU_FSKMOD:
|
||||||
gEeprom.FSKMode = gSubMenuSelection;
|
gEeprom.FSKMode = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
@@ -849,39 +777,13 @@ void MENU_AcceptSetting(void) {
|
|||||||
gSetting_set_ptt = gSubMenuSelection;
|
gSetting_set_ptt = gSubMenuSelection;
|
||||||
gSetting_set_ptt_session = gSetting_set_ptt; // Special for action
|
gSetting_set_ptt_session = gSetting_set_ptt; // Special for action
|
||||||
break;
|
break;
|
||||||
case MENU_SET_TOT:
|
|
||||||
gSetting_set_tot = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
case MENU_SET_EOT:
|
|
||||||
gSetting_set_eot = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
gSetting_set_ctr = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
gSetting_set_inv = gSubMenuSelection;
|
gSetting_set_inv = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_LCK:
|
|
||||||
gSetting_set_lck = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
case MENU_SET_NFM:
|
|
||||||
gSetting_set_nfm = gSubMenuSelection;
|
|
||||||
RADIO_SetTxParameters();
|
|
||||||
RADIO_SetupRegisters(true);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
case MENU_SET_VOL:
|
case MENU_SET_VOL:
|
||||||
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
case MENU_SET_KEY:
|
|
||||||
gEeprom.SET_KEY = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case MENU_SET_TMR:
|
case MENU_SET_TMR:
|
||||||
gSetting_set_tmr = gSubMenuSelection;
|
gSetting_set_tmr = gSubMenuSelection;
|
||||||
@@ -992,6 +894,10 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
gSubMenuSelection = gTxVfo->BUSY_CHANNEL_LOCK;
|
gSubMenuSelection = gTxVfo->BUSY_CHANNEL_LOCK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_TOT:
|
||||||
|
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_MEM_CH:
|
case MENU_MEM_CH:
|
||||||
#if 0
|
#if 0
|
||||||
gSubMenuSelection = gEeprom.MrChannel[0];
|
gSubMenuSelection = gEeprom.MrChannel[0];
|
||||||
@@ -1046,11 +952,6 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
case MENU_BEEP:
|
case MENU_BEEP:
|
||||||
gSubMenuSelection = gEeprom.BEEP_CONTROL;
|
gSubMenuSelection = gEeprom.BEEP_CONTROL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
|
||||||
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
case MENU_VOICE:
|
case MENU_VOICE:
|
||||||
gSubMenuSelection = gEeprom.VOICE_PROMPT;
|
gSubMenuSelection = gEeprom.VOICE_PROMPT;
|
||||||
@@ -1127,15 +1028,6 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
gSubMenuSelection = gEeprom.DTMF_SIDE_TONE;
|
gSubMenuSelection = gEeprom.DTMF_SIDE_TONE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_RSP:
|
|
||||||
gSubMenuSelection = gEeprom.DTMF_DECODE_RESPONSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
|
||||||
gSubMenuSelection = gEeprom.DTMF_auto_reset_time;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
gSubMenuSelection = gEeprom.DTMF_PRELOAD_TIME / 10;
|
gSubMenuSelection = gEeprom.DTMF_PRELOAD_TIME / 10;
|
||||||
break;
|
break;
|
||||||
@@ -1148,15 +1040,6 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
gSubMenuSelection = gSetting_battery_text;
|
gSubMenuSelection = gSetting_battery_text;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_DCD:
|
|
||||||
gSubMenuSelection = gTxVfo->DTMF_DECODING_ENABLE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_D_LIST:
|
|
||||||
gSubMenuSelection = gDTMF_chosen_contact + 1;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
gSubMenuSelection = gSetting_live_DTMF_decoder;
|
gSubMenuSelection = gSetting_live_DTMF_decoder;
|
||||||
break;
|
break;
|
||||||
@@ -1256,37 +1139,13 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
case MENU_SET_PTT:
|
case MENU_SET_PTT:
|
||||||
gSubMenuSelection = gSetting_set_ptt_session;
|
gSubMenuSelection = gSetting_set_ptt_session;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_TOT:
|
|
||||||
gSubMenuSelection = gSetting_set_tot;
|
|
||||||
break;
|
|
||||||
case MENU_SET_EOT:
|
|
||||||
gSubMenuSelection = gSetting_set_eot;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
gSubMenuSelection = gSetting_set_ctr;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
gSubMenuSelection = gSetting_set_inv;
|
gSubMenuSelection = gSetting_set_inv;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_LCK:
|
|
||||||
gSubMenuSelection = gSetting_set_lck;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
case MENU_SET_NFM:
|
|
||||||
gSubMenuSelection = gSetting_set_nfm;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
case MENU_SET_VOL:
|
case MENU_SET_VOL:
|
||||||
gSubMenuSelection = gEeprom.VOLUME_GAIN;
|
gSubMenuSelection = gEeprom.VOLUME_GAIN;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
case MENU_SET_KEY:
|
|
||||||
gSubMenuSelection = gEeprom.SET_KEY;
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case MENU_SET_TMR:
|
case MENU_SET_TMR:
|
||||||
gSubMenuSelection = gSetting_set_tmr;
|
gSubMenuSelection = gSetting_set_tmr;
|
||||||
@@ -1422,7 +1281,15 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset = (Max >= 100) ? 3 : (Max >= 10) ? 2 : 1;
|
Offset = (Max >= 1000000000) ? 10 :
|
||||||
|
(Max >= 100000000) ? 9 :
|
||||||
|
(Max >= 10000000) ? 8 :
|
||||||
|
(Max >= 1000000) ? 7 :
|
||||||
|
(Max >= 100000) ? 6 :
|
||||||
|
(Max >= 10000) ? 5 :
|
||||||
|
(Max >= 1000) ? 4 :
|
||||||
|
(Max >= 100) ? 3 :
|
||||||
|
(Max >= 10) ? 2 : 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
switch (gInputBoxIndex)
|
switch (gInputBoxIndex)
|
||||||
@@ -1521,9 +1388,6 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) {
|
|||||||
#endif
|
#endif
|
||||||
if (UI_MENU_GetCurrentMenuId() == MENU_UPCODE
|
if (UI_MENU_GetCurrentMenuId() == MENU_UPCODE
|
||||||
|| UI_MENU_GetCurrentMenuId() == MENU_DWCODE
|
|| UI_MENU_GetCurrentMenuId() == MENU_DWCODE
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| UI_MENU_GetCurrentMenuId() == MENU_ANI_ID
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
#if 1
|
#if 1
|
||||||
|
|||||||
298
app/messages.c
Normal file
298
app/messages.c
Normal file
@@ -0,0 +1,298 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "messages.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
#include "driver/uart.h"
|
||||||
|
#include "driver/systick.h"
|
||||||
|
|
||||||
|
#define T9Count 9
|
||||||
|
|
||||||
|
const char T9Table[10][T9Count] = {
|
||||||
|
{'#', '(', ')', ';', ':', '<', '>', '/', '0'},
|
||||||
|
{',', '.', '?', '&', '!', ' ', '-', '_', '1'},
|
||||||
|
{'a', 'b', 'c', 'A', 'B', 'C', '[', ']', '2'},
|
||||||
|
{'d', 'e', 'f', 'D', 'E', 'F', '@', '%', '3'},
|
||||||
|
{'g', 'h', 'i', 'G', 'H', 'I', '~', '$', '4'},
|
||||||
|
{'j', 'k', 'l', 'J', 'K', 'L', '|', '*', '5'},
|
||||||
|
{'m', 'n', 'o', 'M', 'N', 'O', '{', '}', '6'},
|
||||||
|
{'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S', '7'},
|
||||||
|
{'t', 'u', 'v', 'T', 'U', 'V', '"', '\'', '8'},
|
||||||
|
{'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z', '9'}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t gActiveMessage = 0;
|
||||||
|
uint8_t gActiveMessageBank = 0;
|
||||||
|
|
||||||
|
StoredPacket loadedPacket;
|
||||||
|
|
||||||
|
uint8_t gKeyTimeout = 0;
|
||||||
|
|
||||||
|
void MESSAGES_SAVE() {
|
||||||
|
uint8_t Data[8];
|
||||||
|
EEPROM_ReadBuffer(SEQParameterEEPROM, Data, 8);
|
||||||
|
uint8_t msgIndex = Data[1];
|
||||||
|
if (msgIndex >= MESSAGES_COUNT) {
|
||||||
|
msgIndex = 0;
|
||||||
|
}
|
||||||
|
msgIndex++;
|
||||||
|
Data[1] = msgIndex;
|
||||||
|
EEPROM_WriteBuffer(SEQParameterEEPROM, Data);
|
||||||
|
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 0,
|
||||||
|
(uint8_t *) &inBoundPacket + 4); // metadata
|
||||||
|
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 8,
|
||||||
|
(uint8_t *) &inBoundPacket + 12); // message part 1
|
||||||
|
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 16,
|
||||||
|
(uint8_t *) &inBoundPacket + 20); // message part 2
|
||||||
|
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 24,
|
||||||
|
(uint8_t *) &inBoundPacket + 28); // message part 3
|
||||||
|
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 32,
|
||||||
|
(uint8_t *) &inBoundPacket + 36); // message part 4
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_GET() {
|
||||||
|
if (gActiveMessage == MESSAGES_COUNT) {
|
||||||
|
memcpy(&loadedPacket, (uint8_t *) &dataPacket + (sizeof(DataPacket) - sizeof(StoredPacket)),
|
||||||
|
sizeof(StoredPacket));
|
||||||
|
} else {
|
||||||
|
EEPROM_ReadBuffer(MESSAGES_START + (gActiveMessage * sizeof(StoredPacket)), &loadedPacket,
|
||||||
|
sizeof(StoredPacket));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_DELETE() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void updatePrevChar(KEY_Code_t Key) {
|
||||||
|
if (Key != prevKey) {
|
||||||
|
prevKey = Key;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_TimeSlice500ms(void) {
|
||||||
|
if (gKeyTimeout && gKeyTimeout++ > 2) {
|
||||||
|
gKeyTimeout = 0;
|
||||||
|
prevKey = KEY_EXIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||||
|
gKeyTimeout = 1;
|
||||||
|
if (gEnteringSMS != SMS_NOT_ENTERING && Key <= KEY_9) {
|
||||||
|
if (!bKeyHeld) {
|
||||||
|
if (!dataPTR || dataPTR < dataPacket.data) {
|
||||||
|
dataPTR = dataPacket.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
if (prevKey != Key) {
|
||||||
|
dataPTR++;
|
||||||
|
//if (dataPTR - dataPacket.data >= DataPacketDataSize) {
|
||||||
|
if (dataPTR - dataPacket.data >= 19) {
|
||||||
|
dataPTR = dataPacket.data;
|
||||||
|
}
|
||||||
|
prevLetter = 0;
|
||||||
|
}
|
||||||
|
*(dataPTR - 1) = T9Table[Key][prevLetter];
|
||||||
|
if (!bKeyHeld) {
|
||||||
|
prevLetter++;
|
||||||
|
} else {
|
||||||
|
prevLetter--;
|
||||||
|
}
|
||||||
|
prevLetter = (prevLetter) % T9Count;
|
||||||
|
updatePrevChar(Key);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||||
|
if (!bKeyHeld) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
dataPacket.dest *= 10;
|
||||||
|
dataPacket.dest += Key;
|
||||||
|
prevLetter = 0;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch (Key) {
|
||||||
|
case KEY_PTT:
|
||||||
|
case KEY_MENU:
|
||||||
|
if (gEnteringSMS == SMS_NOT_ENTERING) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
gEnteringSMS = SMS_ENTERING_DEST;
|
||||||
|
updatePrevChar(Key);
|
||||||
|
}
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||||
|
prepareDataPacket();
|
||||||
|
dataPacket.flags = 0x80 | (gCurrentVfo->OUTPUT_POWER & 0x07);
|
||||||
|
if (dataPacket.src == 665 || dataPacket.src == 664) {
|
||||||
|
|
||||||
|
uint8_t out[5];
|
||||||
|
if (dataPacket.src == 665) {
|
||||||
|
const uint32_t id24 = 0xFFFFFF & (dataPacket.dest >> 4);
|
||||||
|
const uint8_t btn = 0x0F & (dataPacket.dest);
|
||||||
|
// mask just in case
|
||||||
|
// uint32_t id24 = 0x00A38C;
|
||||||
|
// uint8_t btn = 0x04;
|
||||||
|
|
||||||
|
// 3-byte big-endian ID
|
||||||
|
out[0] = (id24 >> 16) & 0xFF;
|
||||||
|
out[1] = (id24 >> 8) & 0xFF;
|
||||||
|
out[2] = (id24 >> 0) & 0xFF;
|
||||||
|
|
||||||
|
// first nibble redundancy copy: 0xBB if btn=0xB
|
||||||
|
out[3] = (btn << 4) | 0x04;
|
||||||
|
|
||||||
|
// second copy with MSB flipped (btn ^ 0x8) in the high nibble
|
||||||
|
out[4] = ((btn ^ 0x8) << 4);
|
||||||
|
} else {
|
||||||
|
out[0] = (dataPacket.dest >> 8) & 0xFF;
|
||||||
|
out[1] = dataPacket.dest & 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
BK4819_EnterTxMute();
|
||||||
|
RADIO_SetTxParameters();
|
||||||
|
|
||||||
|
uint16_t datX = BK4819_REG_30_ENABLE_VCO_CALIB |
|
||||||
|
BK4819_REG_30_ENABLE_UNKNOWN |
|
||||||
|
BK4819_REG_30_DISABLE_RX_LINK |
|
||||||
|
BK4819_REG_30_DISABLE_AF_DAC |
|
||||||
|
BK4819_REG_30_ENABLE_DISC_MODE |
|
||||||
|
BK4819_REG_30_ENABLE_PLL_VCO |
|
||||||
|
BK4819_REG_30_ENABLE_PA_GAIN |
|
||||||
|
BK4819_REG_30_DISABLE_MIC_ADC |
|
||||||
|
BK4819_REG_30_ENABLE_TX_DSP |
|
||||||
|
BK4819_REG_30_DISABLE_RX_DSP;
|
||||||
|
BK4819_WriteRegister(BK4819_REG_30,
|
||||||
|
datX);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
SYSTEM_DelayMs(20);
|
||||||
|
|
||||||
|
for (unsigned int x = 0; x < 15; x++) {
|
||||||
|
for (unsigned int y = 0; y < (dataPacket.src == 665 ? 5 : 2); y++) {
|
||||||
|
for (unsigned char i = 7; i < 8; i--) {
|
||||||
|
if ((out[y] >> i) & 1) {
|
||||||
|
// datX |= BK4819_REG_30_ENABLE_PA_GAIN;
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
|
||||||
|
SYSTICK_DelayUs(400 * (dataPacket.src == 665 ? 3 : 2) - 325);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
// datX &= ~BK4819_REG_30_ENABLE_PA_GAIN;
|
||||||
|
SYSTICK_DelayUs(400 * 1 - 325);
|
||||||
|
} else {
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
|
||||||
|
// datX |= BK4819_REG_30_ENABLE_PA_GAIN;
|
||||||
|
SYSTICK_DelayUs(400 * 1 - 325);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
// datX &= ~BK4819_REG_30_ENABLE_PA_GAIN;
|
||||||
|
SYSTICK_DelayUs(400 * (dataPacket.src == 665 ? 3 : 2) - 325);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
SYSTEM_DelayMs((dataPacket.src == 665 ? 3 : 15));
|
||||||
|
}
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
SYSTEM_DelayMs(100);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_30, 0xC1FE);
|
||||||
|
gEnteringSMS = SMS_NOT_ENTERING;
|
||||||
|
} else {
|
||||||
|
gEnteringSMS = SMS_ENTERING_MESSAGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
if (strlen((char *) dataPacket.data)) {
|
||||||
|
MSG_FSKSendData(&dataPacket);
|
||||||
|
gEnteringSMS = SMS_NOT_ENTERING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case KEY_UP:
|
||||||
|
if (gEnteringSMS != SMS_NOT_ENTERING) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
gActiveMessageBank++;
|
||||||
|
gActiveMessage = gActiveMessageBank * 3;
|
||||||
|
if (gActiveMessage > MESSAGES_COUNT) {
|
||||||
|
gActiveMessage = 0;
|
||||||
|
}
|
||||||
|
if (gActiveMessageBank >= MESSAGES_COUNT / 3) {
|
||||||
|
gActiveMessageBank = 0;
|
||||||
|
}
|
||||||
|
MESSAGES_GET();
|
||||||
|
}
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
dataPTR++;
|
||||||
|
//if (dataPTR - dataPacket.data >= DataPacketDataSize) {
|
||||||
|
if (dataPTR - dataPacket.data >= 19) {
|
||||||
|
dataPTR = dataPacket.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case KEY_DOWN:
|
||||||
|
if (gEnteringSMS != SMS_NOT_ENTERING) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
gActiveMessageBank--;
|
||||||
|
gActiveMessage = gActiveMessageBank * 3;
|
||||||
|
if (gActiveMessage >= MESSAGES_COUNT) {
|
||||||
|
gActiveMessage = MESSAGES_COUNT - 1;
|
||||||
|
}
|
||||||
|
if (gActiveMessageBank > MESSAGES_COUNT / 3) {
|
||||||
|
gActiveMessageBank = MESSAGES_COUNT / 3 - 1;
|
||||||
|
}
|
||||||
|
MESSAGES_GET();
|
||||||
|
}
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
if (dataPacket.data < dataPTR) {
|
||||||
|
dataPTR--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case KEY_EXIT:
|
||||||
|
if (gEnteringSMS != SMS_NOT_ENTERING) {
|
||||||
|
if (bKeyHeld) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
gEnteringSMS = SMS_NOT_ENTERING;
|
||||||
|
dataPTR = dataPacket.data;
|
||||||
|
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
if (dataPacket.data <= dataPTR) {
|
||||||
|
*dataPTR = '\0';
|
||||||
|
if (dataPacket.data < dataPTR) {
|
||||||
|
dataPTR--;
|
||||||
|
}
|
||||||
|
*dataPTR = '\0';
|
||||||
|
}
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||||
|
dataPacket.dest /= 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updatePrevChar(Key);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (!bKeyHeld && bKeyPressed)
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
app/messages.h
Normal file
35
app/messages.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
//#ifndef BRNQUANFW_MESSAGES_H
|
||||||
|
//#define BRNQUANFW_MESSAGES_H
|
||||||
|
#include "fskmodem.h"
|
||||||
|
#include "../driver/keyboard.h"
|
||||||
|
#include "../driver/eeprom.h"
|
||||||
|
|
||||||
|
#define MESSAGES_START (0x1C08)
|
||||||
|
#define MESSAGES_COUNT (12)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t src;
|
||||||
|
uint8_t seq;
|
||||||
|
uint8_t ttl;
|
||||||
|
uint8_t flags;
|
||||||
|
uint8_t data[DataPacketDataSize];
|
||||||
|
} StoredPacket;
|
||||||
|
|
||||||
|
extern uint8_t gActiveMessage;
|
||||||
|
extern uint8_t gActiveMessageBank;
|
||||||
|
|
||||||
|
extern StoredPacket loadedPacket;
|
||||||
|
|
||||||
|
extern uint8_t gKeyTimeout;
|
||||||
|
|
||||||
|
void MESSAGES_GET();
|
||||||
|
void MESSAGES_DELETE();
|
||||||
|
void MESSAGES_SAVE();
|
||||||
|
void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||||
|
void MESSAGES_TimeSlice500ms(void);
|
||||||
|
|
||||||
|
//#endif //BRNQUANFW_MESSAGES_H
|
||||||
@@ -347,9 +347,6 @@ void SCANNER_Start(bool singleFreq)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gScanDelay_10ms = scan_delay_10ms;
|
gScanDelay_10ms = scan_delay_10ms;
|
||||||
gScanCssResultCode = 0xFF;
|
gScanCssResultCode = 0xFF;
|
||||||
|
|||||||
@@ -856,7 +856,7 @@ static void ShowChannelName(uint32_t f) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void DrawF(uint32_t f) {
|
static void DrawF(uint32_t f) {
|
||||||
sprintf(String, "%u.%05u", f / 100000, f % 100000);
|
sprintf(String, "%lu.%05lu", f / 100000, f % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 8, 127, 0);
|
UI_PrintStringSmallNormal(String, 8, 127, 0);
|
||||||
|
|
||||||
sprintf(String, "%3s", gModulationStr[settings.modulationType]);
|
sprintf(String, "%3s", gModulationStr[settings.modulationType]);
|
||||||
@@ -879,19 +879,19 @@ static void DrawNums() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsCenterMode()) {
|
if (IsCenterMode()) {
|
||||||
sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000,
|
sprintf(String, "%lu.%05lu \x7F%lu.%02luk", currentFreq / 100000,
|
||||||
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
||||||
settings.frequencyChangeStep % 100);
|
settings.frequencyChangeStep % 100);
|
||||||
GUI_DisplaySmallest(String, 36, 39, false, true);
|
GUI_DisplaySmallest(String, 36, 39, false, true);
|
||||||
} else {
|
} else {
|
||||||
sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000);
|
sprintf(String, "%lu.%05lu", GetFStart() / 100000, GetFStart() % 100000);
|
||||||
GUI_DisplaySmallest(String, 0, 49, false, true);
|
GUI_DisplaySmallest(String, 0, 49, false, true);
|
||||||
|
|
||||||
sprintf(String, "\x7F%u.%02uk", settings.frequencyChangeStep / 100,
|
sprintf(String, "\x7F%lu.%02luk", settings.frequencyChangeStep / 100,
|
||||||
settings.frequencyChangeStep % 100);
|
settings.frequencyChangeStep % 100);
|
||||||
GUI_DisplaySmallest(String, 48, 10, false, true);
|
GUI_DisplaySmallest(String, 48, 10, false, true);
|
||||||
|
|
||||||
sprintf(String, "%u.%05u", GetFEnd() / 100000, GetFEnd() % 100000);
|
sprintf(String, "%lu.%05lu", GetFEnd() / 100000, GetFEnd() % 100000);
|
||||||
GUI_DisplaySmallest(String, 93, 49, false, true);
|
GUI_DisplaySmallest(String, 93, 49, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,8 +180,9 @@ typedef struct PeakInfo
|
|||||||
uint16_t i;
|
uint16_t i;
|
||||||
} PeakInfo;
|
} PeakInfo;
|
||||||
|
|
||||||
|
#ifdef ENABLE_SPECTRUM
|
||||||
void APP_RunSpectrum(void);
|
void APP_RunSpectrum(void);
|
||||||
|
#endif
|
||||||
#endif /* ifndef SPECTRUM_H */
|
#endif /* ifndef SPECTRUM_H */
|
||||||
|
|
||||||
// vim: ft=c
|
// vim: ft=c
|
||||||
|
|||||||
@@ -418,9 +418,6 @@ static void CMD_052F(const uint8_t *pBuffer)
|
|||||||
gEeprom.VfoInfo[0].pTX = &gEeprom.VfoInfo[0].freq_config_TX;
|
gEeprom.VfoInfo[0].pTX = &gEeprom.VfoInfo[0].freq_config_TX;
|
||||||
gEeprom.VfoInfo[0].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
gEeprom.VfoInfo[0].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
||||||
gEeprom.VfoInfo[0].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
gEeprom.VfoInfo[0].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gEeprom.VfoInfo[0].DTMF_DECODING_ENABLE = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
gIsNoaaMode = false;
|
gIsNoaaMode = false;
|
||||||
|
|||||||
5
audio.c
5
audio.c
@@ -40,10 +40,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
if (Beep != BEEP_880HZ_60MS_DOUBLE_BEEP &&
|
if (Beep != BEEP_880HZ_60MS_DOUBLE_BEEP &&
|
||||||
Beep != BEEP_500HZ_60MS_DOUBLE_BEEP &&
|
Beep != BEEP_500HZ_60MS_DOUBLE_BEEP &&
|
||||||
Beep != BEEP_440HZ_500MS &&
|
Beep != BEEP_440HZ_500MS &&
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
Beep != BEEP_880HZ_200MS &&
|
|
||||||
Beep != BEEP_880HZ_500MS &&
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
Beep != BEEP_400HZ_30MS &&
|
Beep != BEEP_400HZ_30MS &&
|
||||||
Beep != BEEP_500HZ_30MS &&
|
Beep != BEEP_500HZ_30MS &&
|
||||||
|
|||||||
4
audio.h
4
audio.h
@@ -29,10 +29,6 @@ enum BEEP_Type_t
|
|||||||
BEEP_1KHZ_60MS_OPTIONAL,
|
BEEP_1KHZ_60MS_OPTIONAL,
|
||||||
BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL,
|
BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL,
|
||||||
BEEP_440HZ_500MS,
|
BEEP_440HZ_500MS,
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
BEEP_880HZ_200MS,
|
|
||||||
BEEP_880HZ_500MS,
|
|
||||||
#endif
|
|
||||||
BEEP_500HZ_60MS_DOUBLE_BEEP,
|
BEEP_500HZ_60MS_DOUBLE_BEEP,
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
BEEP_400HZ_30MS,
|
BEEP_400HZ_30MS,
|
||||||
|
|||||||
23
bitmaps.c
23
bitmaps.c
@@ -44,19 +44,6 @@ const uint8_t gFontKeyLock[9] =
|
|||||||
0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c
|
0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t gFontLight[9] =
|
|
||||||
{
|
|
||||||
0b00001100,
|
|
||||||
0b00010010,
|
|
||||||
0b00100001,
|
|
||||||
0b01101101,
|
|
||||||
0b01111001,
|
|
||||||
0b01101101,
|
|
||||||
0b00100001,
|
|
||||||
0b00010010,
|
|
||||||
0b00001100,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t gFontMute[12] =
|
const uint8_t gFontMute[12] =
|
||||||
{
|
{
|
||||||
0b00011100,
|
0b00011100,
|
||||||
@@ -291,16 +278,6 @@ const uint8_t BITMAP_ScanListAll[19] =
|
|||||||
0b01111111
|
0b01111111
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_compand[6] =
|
|
||||||
{
|
|
||||||
0b00000000,
|
|
||||||
0b00111100,
|
|
||||||
0b01000010,
|
|
||||||
0b01000010,
|
|
||||||
0b01000010,
|
|
||||||
0b00100100
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const uint8_t BITMAP_Ready[7] =
|
const uint8_t BITMAP_Ready[7] =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ extern const uint8_t gFontF[8];
|
|||||||
extern const uint8_t gFontS[6];
|
extern const uint8_t gFontS[6];
|
||||||
|
|
||||||
extern const uint8_t gFontKeyLock[9];
|
extern const uint8_t gFontKeyLock[9];
|
||||||
extern const uint8_t gFontLight[9];
|
|
||||||
extern const uint8_t gFontMute[12];
|
extern const uint8_t gFontMute[12];
|
||||||
|
|
||||||
extern const uint8_t gFontXB[2][6];
|
extern const uint8_t gFontXB[2][6];
|
||||||
@@ -46,8 +45,6 @@ extern const uint8_t BITMAP_ScanList123[19];
|
|||||||
extern const uint8_t BITMAP_ScanListAll[19];
|
extern const uint8_t BITMAP_ScanListAll[19];
|
||||||
extern const uint8_t BITMAP_ScanListE[7];
|
extern const uint8_t BITMAP_ScanListE[7];
|
||||||
extern const uint8_t BITMAP_PowerUser[3];
|
extern const uint8_t BITMAP_PowerUser[3];
|
||||||
extern const uint8_t BITMAP_compand[6];
|
|
||||||
|
|
||||||
extern const uint8_t BITMAP_NOAA[12];
|
extern const uint8_t BITMAP_NOAA[12];
|
||||||
|
|
||||||
#ifndef ENABLE_CUSTOM_MENU_LAYOUT
|
#ifndef ENABLE_CUSTOM_MENU_LAYOUT
|
||||||
|
|||||||
@@ -66,12 +66,6 @@ void BACKLIGHT_InitHardware()
|
|||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BACKLIGHT_Sound(void)
|
|
||||||
{
|
|
||||||
gK5startup = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BACKLIGHT_TurnOn(void)
|
void BACKLIGHT_TurnOn(void)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
@@ -84,38 +78,11 @@ void BACKLIGHT_TurnOn(void)
|
|||||||
|
|
||||||
if (gEeprom.BACKLIGHT_TIME == 0) {
|
if (gEeprom.BACKLIGHT_TIME == 0) {
|
||||||
BACKLIGHT_TurnOff();
|
BACKLIGHT_TurnOff();
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
|
||||||
if(gK5startup == true)
|
|
||||||
{
|
|
||||||
BACKLIGHT_Sound();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
backlightOn = true;
|
backlightOn = true;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
|
||||||
if(gK5startup == true) {
|
|
||||||
#if defined(ENABLE_FMRADIO) && defined(ENABLE_SPECTRUM)
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
|
||||||
#else
|
|
||||||
for(uint8_t i = 0; i <= gEeprom.BACKLIGHT_MAX; i++)
|
|
||||||
{
|
|
||||||
BACKLIGHT_SetBrightness(i);
|
|
||||||
SYSTEM_DelayMs(50);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BACKLIGHT_Sound();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
||||||
}
|
|
||||||
#else
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (gEeprom.BACKLIGHT_TIME) {
|
switch (gEeprom.BACKLIGHT_TIME) {
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -42,12 +42,18 @@ static uint16_t gBK4819_GpioOutState;
|
|||||||
|
|
||||||
bool gRxIdleMode;
|
bool gRxIdleMode;
|
||||||
|
|
||||||
__inline uint16_t scale_freq(const uint16_t freq)
|
__inline uint16_t scale_freq(uint16_t freq)
|
||||||
{
|
{
|
||||||
// return (((uint32_t)freq * 1032444u) + 50000u) / 100000u; // with rounding
|
// return (((uint32_t)freq * 1032444u) + 50000u) / 100000u; // with rounding
|
||||||
return (((uint32_t)freq * 1353245u) + (1u << 16)) >> 17; // with rounding
|
return (((uint32_t)freq * 1353245u) + (1u << 16)) >> 17; // with rounding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__inline uint16_t inverse_scale_freq(uint16_t scaled_freq)
|
||||||
|
{
|
||||||
|
return (((uint32_t)scaled_freq << 17) - (1u << 16)) / 1353245u;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BK4819_FskEnableTx(void){
|
void BK4819_FskEnableTx(void){
|
||||||
const uint16_t fsk_reg59 = BK4819_ReadRegister(BK4819_REG_59);
|
const uint16_t fsk_reg59 = BK4819_ReadRegister(BK4819_REG_59);
|
||||||
BK4819_WriteRegister(BK4819_REG_59, (1u << 11) | fsk_reg59);
|
BK4819_WriteRegister(BK4819_REG_59, (1u << 11) | fsk_reg59);
|
||||||
@@ -854,18 +860,18 @@ void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BK4819_DisableScramble(void)
|
void BK4819_SetScramble(uint16_t Freq)
|
||||||
{
|
{
|
||||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
||||||
BK4819_WriteRegister(BK4819_REG_31, Value & ~(1u << 1));
|
if (Freq) {
|
||||||
}
|
Value |= (1u << 1);
|
||||||
|
} else {
|
||||||
|
Value &= ~(1u << 1);
|
||||||
|
}
|
||||||
|
BK4819_WriteRegister(BK4819_REG_31, Value);
|
||||||
|
|
||||||
void BK4819_EnableScramble(uint8_t Type)
|
//BK4819_WriteRegister(BK4819_REG_71, 0x68DC + (Freq * 1032)); // 0110 1000 1101 1100
|
||||||
{
|
BK4819_WriteRegister(BK4819_REG_71, Freq);
|
||||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
|
||||||
BK4819_WriteRegister(BK4819_REG_31, Value | (1u << 1));
|
|
||||||
|
|
||||||
BK4819_WriteRegister(BK4819_REG_71, 0x68DC + (Type * 1032)); // 0110 1000 1101 1100
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BK4819_CompanderEnabled(void)
|
bool BK4819_CompanderEnabled(void)
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
|
|||||||
// radio is asleep, not listening
|
// radio is asleep, not listening
|
||||||
extern bool gRxIdleMode;
|
extern bool gRxIdleMode;
|
||||||
|
|
||||||
|
uint16_t inverse_scale_freq(uint16_t scaled_freq);
|
||||||
|
uint16_t scale_freq(uint16_t freq);
|
||||||
|
|
||||||
void BK4819_Init(void);
|
void BK4819_Init(void);
|
||||||
uint16_t BK4819_ReadRegister(BK4819_REGISTER_t Register);
|
uint16_t BK4819_ReadRegister(BK4819_REGISTER_t Register);
|
||||||
void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data);
|
void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data);
|
||||||
@@ -100,8 +103,7 @@ void BK4819_SetupSquelch(
|
|||||||
void BK4819_SetAF(BK4819_AF_Type_t AF);
|
void BK4819_SetAF(BK4819_AF_Type_t AF);
|
||||||
void BK4819_RX_TurnOn(void);
|
void BK4819_RX_TurnOn(void);
|
||||||
void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency);
|
void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency);
|
||||||
void BK4819_DisableScramble(void);
|
void BK4819_SetScramble(uint16_t Freq);
|
||||||
void BK4819_EnableScramble(uint8_t Type);
|
|
||||||
|
|
||||||
bool BK4819_CompanderEnabled(void);
|
bool BK4819_CompanderEnabled(void);
|
||||||
void BK4819_SetCompander(const unsigned int mode);
|
void BK4819_SetCompander(const unsigned int mode);
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ uint8_t cmds[] = {
|
|||||||
ST7565_WriteByte(ST7565_CMD_INVERSE_DISPLAY | gSetting_set_inv);
|
ST7565_WriteByte(ST7565_CMD_INVERSE_DISPLAY | gSetting_set_inv);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
ST7565_WriteByte(21 + gSetting_set_ctr);
|
ST7565_WriteByte(21 + ST7565_CTR_SETTING_VAL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ST7565_WriteByte(cmds[i]);
|
ST7565_WriteByte(cmds[i]);
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
extern uint8_t gStatusLine[LCD_WIDTH];
|
extern uint8_t gStatusLine[LCD_WIDTH];
|
||||||
extern uint8_t gFrameBuffer[FRAME_LINES][LCD_WIDTH];
|
extern uint8_t gFrameBuffer[FRAME_LINES][LCD_WIDTH];
|
||||||
|
|
||||||
|
#define ST7565_CTR_SETTING_VAL (15)
|
||||||
|
|
||||||
void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const uint8_t *pBitmap, const unsigned int Size);
|
void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const uint8_t *pBitmap, const unsigned int Size);
|
||||||
void ST7565_BlitFullScreen(void);
|
void ST7565_BlitFullScreen(void);
|
||||||
void ST7565_BlitLine(unsigned line);
|
void ST7565_BlitLine(unsigned line);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
#include "bsp/dp32g030/dma.h"
|
#include "bsp/dp32g030/dma.h"
|
||||||
#include "bsp/dp32g030/syscon.h"
|
#include "bsp/dp32g030/syscon.h"
|
||||||
#include "bsp/dp32g030/uart.h"
|
#include "bsp/dp32g030/uart.h"
|
||||||
@@ -23,8 +24,7 @@
|
|||||||
static bool UART_IsLogEnabled;
|
static bool UART_IsLogEnabled;
|
||||||
uint8_t UART_DMA_Buffer[256];
|
uint8_t UART_DMA_Buffer[256];
|
||||||
|
|
||||||
void UART_Init(void)
|
void UART_Init(void) {
|
||||||
{
|
|
||||||
uint32_t Delta;
|
uint32_t Delta;
|
||||||
uint32_t Positive;
|
uint32_t Positive;
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
@@ -48,35 +48,32 @@ void UART_Init(void)
|
|||||||
|
|
||||||
DMA_CTR = (DMA_CTR & ~DMA_CTR_DMAEN_MASK) | DMA_CTR_DMAEN_BITS_DISABLE;
|
DMA_CTR = (DMA_CTR & ~DMA_CTR_DMAEN_MASK) | DMA_CTR_DMAEN_BITS_DISABLE;
|
||||||
|
|
||||||
DMA_CH0->MSADDR = (uint32_t)(uintptr_t)&UART1->RDR;
|
DMA_CH0->MSADDR = (uint32_t) (uintptr_t) &UART1->RDR;
|
||||||
DMA_CH0->MDADDR = (uint32_t)(uintptr_t)UART_DMA_Buffer;
|
DMA_CH0->MDADDR = (uint32_t) (uintptr_t) UART_DMA_Buffer;
|
||||||
DMA_CH0->MOD = 0
|
DMA_CH0->MOD = 0
|
||||||
// Source
|
// Source
|
||||||
| DMA_CH_MOD_MS_ADDMOD_BITS_NONE
|
| DMA_CH_MOD_MS_ADDMOD_BITS_NONE
|
||||||
| DMA_CH_MOD_MS_SIZE_BITS_8BIT
|
| DMA_CH_MOD_MS_SIZE_BITS_8BIT
|
||||||
| DMA_CH_MOD_MS_SEL_BITS_HSREQ_MS1
|
| DMA_CH_MOD_MS_SEL_BITS_HSREQ_MS1
|
||||||
// Destination
|
// Destination
|
||||||
| DMA_CH_MOD_MD_ADDMOD_BITS_INCREMENT
|
| DMA_CH_MOD_MD_ADDMOD_BITS_INCREMENT
|
||||||
| DMA_CH_MOD_MD_SIZE_BITS_8BIT
|
| DMA_CH_MOD_MD_SIZE_BITS_8BIT
|
||||||
| DMA_CH_MOD_MD_SEL_BITS_SRAM
|
| DMA_CH_MOD_MD_SEL_BITS_SRAM;
|
||||||
;
|
|
||||||
DMA_INTEN = 0;
|
DMA_INTEN = 0;
|
||||||
DMA_INTST = 0
|
DMA_INTST = 0
|
||||||
| DMA_INTST_CH0_TC_INTST_BITS_SET
|
| DMA_INTST_CH0_TC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH1_TC_INTST_BITS_SET
|
| DMA_INTST_CH1_TC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH2_TC_INTST_BITS_SET
|
| DMA_INTST_CH2_TC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH3_TC_INTST_BITS_SET
|
| DMA_INTST_CH3_TC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH0_THC_INTST_BITS_SET
|
| DMA_INTST_CH0_THC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH1_THC_INTST_BITS_SET
|
| DMA_INTST_CH1_THC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH2_THC_INTST_BITS_SET
|
| DMA_INTST_CH2_THC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH3_THC_INTST_BITS_SET
|
| DMA_INTST_CH3_THC_INTST_BITS_SET;
|
||||||
;
|
|
||||||
DMA_CH0->CTR = 0
|
DMA_CH0->CTR = 0
|
||||||
| DMA_CH_CTR_CH_EN_BITS_ENABLE
|
| DMA_CH_CTR_CH_EN_BITS_ENABLE
|
||||||
| ((0xFF << DMA_CH_CTR_LENGTH_SHIFT) & DMA_CH_CTR_LENGTH_MASK)
|
| ((0xFF << DMA_CH_CTR_LENGTH_SHIFT) & DMA_CH_CTR_LENGTH_MASK)
|
||||||
| DMA_CH_CTR_LOOP_BITS_ENABLE
|
| DMA_CH_CTR_LOOP_BITS_ENABLE
|
||||||
| DMA_CH_CTR_PRI_BITS_MEDIUM
|
| DMA_CH_CTR_PRI_BITS_MEDIUM;
|
||||||
;
|
|
||||||
UART1->IF = UART_IF_RXTO_BITS_SET;
|
UART1->IF = UART_IF_RXTO_BITS_SET;
|
||||||
|
|
||||||
DMA_CTR = (DMA_CTR & ~DMA_CTR_DMAEN_MASK) | DMA_CTR_DMAEN_BITS_ENABLE;
|
DMA_CTR = (DMA_CTR & ~DMA_CTR_DMAEN_MASK) | DMA_CTR_DMAEN_BITS_ENABLE;
|
||||||
@@ -84,9 +81,8 @@ void UART_Init(void)
|
|||||||
UART1->CTRL |= UART_CTRL_UARTEN_BITS_ENABLE;
|
UART1->CTRL |= UART_CTRL_UARTEN_BITS_ENABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UART_Send(const void *pBuffer, uint32_t Size)
|
void UART_Send(const void *pBuffer, uint32_t Size) {
|
||||||
{
|
const uint8_t *pData = (const uint8_t *) pBuffer;
|
||||||
const uint8_t *pData = (const uint8_t *)pBuffer;
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = 0; i < Size; i++) {
|
for (i = 0; i < Size; i++) {
|
||||||
@@ -96,8 +92,11 @@ void UART_Send(const void *pBuffer, uint32_t Size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UART_LogSend(const void *pBuffer, uint32_t Size)
|
void UART_String(const char *str) {
|
||||||
{
|
UART_Send(str, strlen(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UART_LogSend(const void *pBuffer, uint32_t Size) {
|
||||||
if (UART_IsLogEnabled) {
|
if (UART_IsLogEnabled) {
|
||||||
UART_Send(pBuffer, Size);
|
UART_Send(pBuffer, Size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ extern uint8_t UART_DMA_Buffer[256];
|
|||||||
void UART_Init(void);
|
void UART_Init(void);
|
||||||
void UART_Send(const void *pBuffer, uint32_t Size);
|
void UART_Send(const void *pBuffer, uint32_t Size);
|
||||||
void UART_LogSend(const void *pBuffer, uint32_t Size);
|
void UART_LogSend(const void *pBuffer, uint32_t Size);
|
||||||
|
void UART_String(const char *str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
24
functions.c
24
functions.c
@@ -48,6 +48,7 @@
|
|||||||
#include "ui/status.h"
|
#include "ui/status.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
#include "driver/systick.h"
|
||||||
|
|
||||||
|
|
||||||
FUNCTION_Type_t gCurrentFunction;
|
FUNCTION_Type_t gCurrentFunction;
|
||||||
@@ -79,9 +80,6 @@ void FUNCTION_Init(void) {
|
|||||||
g_VOX_Lost = false;
|
g_VOX_Lost = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
gNOAACountdown_10ms = 0;
|
gNOAACountdown_10ms = 0;
|
||||||
@@ -95,10 +93,6 @@ void FUNCTION_Init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction) {
|
void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction) {
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_ReplyState != DTMF_REPLY_NONE)
|
|
||||||
RADIO_PrepareCssTX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (PreviousFunction == FUNCTION_TRANSMIT) {
|
if (PreviousFunction == FUNCTION_TRANSMIT) {
|
||||||
ST7565_FixInterfGlitch();
|
ST7565_FixInterfGlitch();
|
||||||
@@ -113,13 +107,6 @@ void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction) {
|
|||||||
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT ||
|
|
||||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
|
||||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) {
|
|
||||||
gDTMF_auto_reset_time_500ms = gEeprom.DTMF_auto_reset_time * 2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,10 +144,6 @@ void FUNCTION_Transmit() {
|
|||||||
|
|
||||||
BK4819_DisableDTMF();
|
BK4819_DisableDTMF();
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
// clear the DTMF RX buffer
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// clear the DTMF RX live decoder buffer
|
// clear the DTMF RX live decoder buffer
|
||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
@@ -204,6 +187,7 @@ void FUNCTION_Transmit() {
|
|||||||
|
|
||||||
DTMF_Reply();
|
DTMF_Reply();
|
||||||
|
|
||||||
|
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
|
||||||
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
||||||
BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE);
|
BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|
||||||
@@ -234,10 +218,6 @@ void FUNCTION_Transmit() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
|
||||||
else
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
|
|
||||||
if (gSetting_backlight_on_tx_rx & BACKLIGHT_ON_TR_TX) {
|
if (gSetting_backlight_on_tx_rx & BACKLIGHT_ON_TR_TX) {
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|||||||
@@ -44,13 +44,6 @@ BOOT_Mode_t BOOT_GetMode(void) {
|
|||||||
SYSTEM_DelayMs(20);
|
SYSTEM_DelayMs(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
if (Keys[0] == (10 + gEeprom.SET_KEY))
|
|
||||||
{
|
|
||||||
return BOOT_MODE_RESCUE_OPS; // Secret KEY pressed
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Keys[0] == Keys[1]) {
|
if (Keys[0] == Keys[1]) {
|
||||||
gKeyReading0 = Keys[0];
|
gKeyReading0 = Keys[0];
|
||||||
gKeyReading1 = Keys[0];
|
gKeyReading1 = Keys[0];
|
||||||
|
|||||||
14
misc.c
14
misc.c
@@ -30,11 +30,6 @@ const uint8_t menu_timeout_500ms = 20000 / 500; // 20 second
|
|||||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||||
|
|
||||||
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
|
||||||
const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
|
|
||||||
const uint8_t DTMF_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
|
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
|
||||||
|
|
||||||
@@ -111,14 +106,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
bool gSetting_set_ptt = 0;
|
bool gSetting_set_ptt = 0;
|
||||||
uint8_t gSetting_set_tot = 0;
|
|
||||||
uint8_t gSetting_set_ctr = 10;
|
|
||||||
bool gSetting_set_inv = false;
|
bool gSetting_set_inv = false;
|
||||||
uint8_t gSetting_set_eot = 0;
|
|
||||||
bool gSetting_set_lck = false;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
bool gSetting_set_nfm = 0;
|
|
||||||
#endif
|
|
||||||
bool gSetting_set_tmr = 0;
|
bool gSetting_set_tmr = 0;
|
||||||
bool gSetting_set_ptt_session;
|
bool gSetting_set_ptt_session;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_DEBUG
|
#ifdef ENABLE_FEAT_F4HWN_DEBUG
|
||||||
@@ -130,10 +118,8 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
uint8_t crc[15] = { 0 };
|
uint8_t crc[15] = { 0 };
|
||||||
uint8_t lErrorsDuringAirCopy = 0;
|
uint8_t lErrorsDuringAirCopy = 0;
|
||||||
uint8_t gAircopyStep = 0;
|
uint8_t gAircopyStep = 0;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
bool gPowerHigh = false;
|
bool gPowerHigh = false;
|
||||||
bool gRemoveOffset = false;
|
bool gRemoveOffset = false;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
|
|||||||
14
misc.h
14
misc.h
@@ -90,11 +90,6 @@ extern const uint8_t menu_timeout_500ms;
|
|||||||
extern const uint16_t menu_timeout_long_500ms;
|
extern const uint16_t menu_timeout_long_500ms;
|
||||||
|
|
||||||
extern const uint8_t DTMF_RX_live_timeout_500ms;
|
extern const uint8_t DTMF_RX_live_timeout_500ms;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
extern const uint8_t DTMF_RX_timeout_500ms;
|
|
||||||
extern const uint8_t DTMF_decode_ring_countdown_500ms;
|
|
||||||
extern const uint8_t DTMF_txstop_countdown_500ms;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern const uint8_t key_input_timeout_500ms;
|
extern const uint8_t key_input_timeout_500ms;
|
||||||
|
|
||||||
@@ -164,14 +159,7 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
extern bool gSetting_set_ptt;
|
extern bool gSetting_set_ptt;
|
||||||
extern uint8_t gSetting_set_tot;
|
|
||||||
extern uint8_t gSetting_set_ctr;
|
|
||||||
extern bool gSetting_set_inv;
|
extern bool gSetting_set_inv;
|
||||||
extern uint8_t gSetting_set_eot;
|
|
||||||
extern bool gSetting_set_lck;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
extern bool gSetting_set_nfm;
|
|
||||||
#endif
|
|
||||||
extern bool gSetting_set_tmr;
|
extern bool gSetting_set_tmr;
|
||||||
extern bool gSetting_set_ptt_session;
|
extern bool gSetting_set_ptt_session;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_DEBUG
|
#ifdef ENABLE_FEAT_F4HWN_DEBUG
|
||||||
@@ -183,10 +171,8 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
extern uint8_t crc[15];
|
extern uint8_t crc[15];
|
||||||
extern uint8_t lErrorsDuringAirCopy;
|
extern uint8_t lErrorsDuringAirCopy;
|
||||||
extern uint8_t gAircopyStep;
|
extern uint8_t gAircopyStep;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
extern bool gPowerHigh;
|
extern bool gPowerHigh;
|
||||||
extern bool gRemoveOffset;
|
extern bool gRemoveOffset;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
|
|||||||
130
radio.c
130
radio.c
@@ -229,9 +229,9 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
|
|
||||||
uint16_t base;
|
uint16_t base;
|
||||||
if (IS_MR_CHANNEL(channel))
|
if (IS_MR_CHANNEL(channel))
|
||||||
base = channel * 16;
|
base = channel * 24;
|
||||||
else
|
else
|
||||||
base = 0x0C80 + ((channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16);
|
base = 0x0C80 + ((channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 24);
|
||||||
|
|
||||||
if (configure == VFO_CONFIGURE_RELOAD || IS_FREQ_CHANNEL(channel)) {
|
if (configure == VFO_CONFIGURE_RELOAD || IS_FREQ_CHANNEL(channel)) {
|
||||||
uint8_t tmp;
|
uint8_t tmp;
|
||||||
@@ -256,12 +256,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
pVfo->STEP_SETTING = tmp;
|
pVfo->STEP_SETTING = tmp;
|
||||||
pVfo->StepFrequency = gStepFrequencyTable[tmp];
|
pVfo->StepFrequency = gStepFrequencyTable[tmp];
|
||||||
|
|
||||||
tmp = data[7];
|
|
||||||
if (tmp > 10)
|
|
||||||
tmp = 0;
|
|
||||||
pVfo->SCRAMBLING_TYPE = tmp;
|
|
||||||
//pVfo->SCRAMBLING_TYPE = 0;
|
|
||||||
|
|
||||||
pVfo->freq_config_RX.CodeType = (data[2] >> 0) & 0x0F;
|
pVfo->freq_config_RX.CodeType = (data[2] >> 0) & 0x0F;
|
||||||
pVfo->freq_config_TX.CodeType = (data[2] >> 4) & 0x0F;
|
pVfo->freq_config_TX.CodeType = (data[2] >> 4) & 0x0F;
|
||||||
|
|
||||||
@@ -314,27 +308,27 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
pVfo->BUSY_CHANNEL_LOCK = false;
|
pVfo->BUSY_CHANNEL_LOCK = false;
|
||||||
} else {
|
} else {
|
||||||
const uint8_t d4 = data[4];
|
const uint8_t d4 = data[4];
|
||||||
pVfo->FrequencyReverse = !!((d4 >> 0) & 1u);
|
pVfo->FrequencyReverse = ((d4 >> 0) & 1u) != 0;
|
||||||
pVfo->CHANNEL_BANDWIDTH = !!((d4 >> 1) & 1u);
|
pVfo->CHANNEL_BANDWIDTH = ((d4 >> 1) & 3u);
|
||||||
pVfo->OUTPUT_POWER = ((d4 >> 2) & 7u);
|
pVfo->OUTPUT_POWER = ((d4 >> 3) & 7u);
|
||||||
pVfo->BUSY_CHANNEL_LOCK = !!((d4 >> 5) & 1u);
|
pVfo->BUSY_CHANNEL_LOCK = ((d4 >> 6) & 1u) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data[5] == 0xFF) {
|
if (data[5] == 0xFF) {
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
pVfo->DTMF_DECODING_ENABLE = false;
|
|
||||||
#endif
|
|
||||||
pVfo->DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
pVfo->DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||||
} else {
|
} else {
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
pVfo->DTMF_DECODING_ENABLE = ((data[5] >> 0) & 1u) ? true : false;
|
|
||||||
#endif
|
|
||||||
uint8_t pttId = ((data[5] >> 1) & 7u);
|
uint8_t pttId = ((data[5] >> 1) & 7u);
|
||||||
pVfo->DTMF_PTT_ID_TX_MODE = pttId < ARRAY_SIZE(gSubMenu_PTT_ID) ? pttId : PTT_ID_OFF;
|
pVfo->DTMF_PTT_ID_TX_MODE = pttId < ARRAY_SIZE(gSubMenu_PTT_ID) ? pttId : PTT_ID_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************
|
// ***************
|
||||||
|
|
||||||
|
EEPROM_ReadBuffer(base + 16, data, sizeof(data));
|
||||||
|
|
||||||
|
uint16_t * data16 = (uint16_t *)data;
|
||||||
|
|
||||||
|
pVfo->SCRAMBLING_TYPE = data16[0];
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
uint32_t Offset;
|
uint32_t Offset;
|
||||||
@@ -388,7 +382,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
|
|
||||||
pVfo->Compander = att.compander;
|
pVfo->Compander = att.compander;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
if(gRemoveOffset)
|
if(gRemoveOffset)
|
||||||
{
|
{
|
||||||
pVfo->pTX = &pVfo->freq_config_RX;
|
pVfo->pTX = &pVfo->freq_config_RX;
|
||||||
@@ -398,7 +391,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
{
|
{
|
||||||
pVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH;
|
pVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(pVfo);
|
RADIO_ConfigureSquelchAndOutputPower(pVfo);
|
||||||
}
|
}
|
||||||
@@ -490,58 +482,10 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) {
|
|||||||
} else if (currentPower == OUTPUT_POWER_HIGH) {
|
} else if (currentPower == OUTPUT_POWER_HIGH) {
|
||||||
Op = 2; // High eeprom calibration data
|
Op = 2; // High eeprom calibration data
|
||||||
}
|
}
|
||||||
currentPower--;
|
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (Op * 3), Txp, 3);
|
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (Op * 3), Txp, 3);
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
// make low and mid even lower
|
|
||||||
// and use calibration values
|
|
||||||
// be aware with toxic fucking closed firmwares
|
|
||||||
|
|
||||||
/*
|
|
||||||
uint8_t shift[] = {0, 0, 0, 0, 0};
|
|
||||||
|
|
||||||
if(Band == 5) // UHF
|
|
||||||
{
|
|
||||||
shift[0] = 0;
|
|
||||||
shift[1] = 0;
|
|
||||||
shift[2] = 0;
|
|
||||||
shift[3] = 0;
|
|
||||||
shift[4] = 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
for(uint8_t p = 0; p < 3; p++)
|
|
||||||
{
|
|
||||||
switch (currentPower)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
Txp[p] = (Txp[p] * 4) / 25; //+ shift[pInfo->OUTPUT_POWER];
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
Txp[p] = (Txp[p] * 4) / 19; // + shift[pInfo->OUTPUT_POWER];
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
Txp[p] = (Txp[p] * 4) / 13; // + shift[pInfo->OUTPUT_POWER];
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
Txp[p] = (Txp[p] * 4) / 10; // + shift[pInfo->OUTPUT_POWER];
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
Txp[p] = (Txp[p] * 4) / 7; // + shift[pInfo->OUTPUT_POWER];
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
Txp[p] = (Txp[p] * 3) / 4;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
Txp[p] = Txp[p] + 30;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static const uint8_t dividers[6] = {25, 19, 13, 10, 7, 4};
|
static const uint8_t dividers[6] = {25, 19, 13, 10, 7, 4};
|
||||||
|
|
||||||
for (uint8_t p = 0; p < 3; p++) {
|
for (uint8_t p = 0; p < 3; p++) {
|
||||||
@@ -620,12 +564,6 @@ void RADIO_SelectVfos(void) {
|
|||||||
void RADIO_SetupRegisters(bool switchToForeground) {
|
void RADIO_SetupRegisters(bool switchToForeground) {
|
||||||
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
if (Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) {
|
|
||||||
Bandwidth = BK4819_FILTER_BW_NARROWER;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AUDIO_AudioPathOff();
|
AUDIO_AudioPathOff();
|
||||||
|
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
@@ -746,10 +684,9 @@ void RADIO_SetupRegisters(bool switchToForeground) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gRxVfo->SCRAMBLING_TYPE > 0)
|
BK4819_SetScramble(0);
|
||||||
BK4819_EnableScramble(gRxVfo->SCRAMBLING_TYPE - 1);
|
SYSTEM_DelayMs(10);
|
||||||
else
|
BK4819_SetScramble(gRxVfo->SCRAMBLING_TYPE);
|
||||||
BK4819_DisableScramble();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
@@ -789,6 +726,9 @@ void RADIO_SetupRegisters(bool switchToForeground) {
|
|||||||
|
|
||||||
RADIO_SetupAGC(gRxVfo->Modulation == MODULATION_AM, false);
|
RADIO_SetupAGC(gRxVfo->Modulation == MODULATION_AM, false);
|
||||||
|
|
||||||
|
MSG_EnableRX(true);
|
||||||
|
InterruptMask |= BK4819_REG_3F_FSK_RX_SYNC | BK4819_REG_3F_FSK_RX_FINISHED | BK4819_REG_3F_FSK_FIFO_ALMOST_FULL | BK4819_REG_3F_FSK_TX_FINISHED;
|
||||||
|
|
||||||
// enable/disable BK4819 selected interrupts
|
// enable/disable BK4819 selected interrupts
|
||||||
BK4819_WriteRegister(BK4819_REG_3F, InterruptMask);
|
BK4819_WriteRegister(BK4819_REG_3F, InterruptMask);
|
||||||
|
|
||||||
@@ -846,12 +786,6 @@ void RADIO_ConfigureNOAA(void)
|
|||||||
void RADIO_SetTxParameters(void) {
|
void RADIO_SetTxParameters(void) {
|
||||||
BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
if (Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) {
|
|
||||||
Bandwidth = BK4819_FILTER_BW_NARROWER;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AUDIO_AudioPathOff();
|
AUDIO_AudioPathOff();
|
||||||
|
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
@@ -1051,28 +985,12 @@ void RADIO_PrepareTX(void) {
|
|||||||
gAlarmState = ALARM_STATE_OFF;
|
gAlarmState = ALARM_STATE_OFF;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
#endif
|
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TX is allowed
|
// TX is allowed
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_ReplyState == DTMF_REPLY_ANI)
|
|
||||||
{
|
|
||||||
gDTMF_IsTx = gDTMF_CallMode == DTMF_CALL_MODE_DTMF;
|
|
||||||
|
|
||||||
if (gDTMF_IsTx) {
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
gDTMF_TxStopCountdown_500ms = DTMF_txstop_countdown_500ms;
|
|
||||||
} else {
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_CALL_OUT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FUNCTION_Select(FUNCTION_TRANSMIT);
|
FUNCTION_Select(FUNCTION_TRANSMIT);
|
||||||
|
|
||||||
@@ -1085,15 +1003,6 @@ void RADIO_PrepareTX(void) {
|
|||||||
|
|
||||||
gTxTimerCountdown_500ms = ((gEeprom.TX_TIMEOUT_TIMER + 1) * 5) * 2;
|
gTxTimerCountdown_500ms = ((gEeprom.TX_TIMEOUT_TIMER + 1) * 5) * 2;
|
||||||
|
|
||||||
/*
|
|
||||||
if (gEeprom.TX_TIMEOUT_TIMER == 0)
|
|
||||||
gTxTimerCountdown_500ms = 60; // 30 sec
|
|
||||||
else if (gEeprom.TX_TIMEOUT_TIMER < (ARRAY_SIZE(gSubMenu_TOT) - 1))
|
|
||||||
gTxTimerCountdown_500ms = 120 * gEeprom.TX_TIMEOUT_TIMER; // minutes
|
|
||||||
else
|
|
||||||
gTxTimerCountdown_500ms = 120 * 15; // 15 minutes
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
gTxTimerCountdownAlert_500ms = gTxTimerCountdown_500ms;
|
gTxTimerCountdownAlert_500ms = gTxTimerCountdown_500ms;
|
||||||
#endif
|
#endif
|
||||||
@@ -1108,9 +1017,6 @@ void RADIO_PrepareTX(void) {
|
|||||||
gFlagEndTransmission = false;
|
gFlagEndTransmission = false;
|
||||||
gRTTECountdown_10ms = 0;
|
gRTTECountdown_10ms = 0;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIO_SendCssTail(void) {
|
void RADIO_SendCssTail(void) {
|
||||||
|
|||||||
130
radio.h
130
radio.h
@@ -24,7 +24,7 @@
|
|||||||
#include "frequencies.h"
|
#include "frequencies.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
RADIO_CHANNEL_UP = 0x01u,
|
RADIO_CHANNEL_UP = 0x01u,
|
||||||
RADIO_CHANNEL_DOWN = 0xFFu,
|
RADIO_CHANNEL_DOWN = 0xFFu,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,8 +42,7 @@ enum PTT_ID_t {
|
|||||||
};
|
};
|
||||||
typedef enum PTT_ID_t PTT_ID_t;
|
typedef enum PTT_ID_t PTT_ID_t;
|
||||||
|
|
||||||
enum VfoState_t
|
enum VfoState_t {
|
||||||
{
|
|
||||||
VFO_STATE_NORMAL = 0,
|
VFO_STATE_NORMAL = 0,
|
||||||
VFO_STATE_BUSY,
|
VFO_STATE_BUSY,
|
||||||
VFO_STATE_BAT_LOW,
|
VFO_STATE_BAT_LOW,
|
||||||
@@ -70,18 +69,16 @@ typedef enum {
|
|||||||
|
|
||||||
extern const char gModulationStr[MODULATION_UKNOWN][4];
|
extern const char gModulationStr[MODULATION_UKNOWN][4];
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
uint32_t Frequency;
|
||||||
uint32_t Frequency;
|
|
||||||
DCS_CodeType_t CodeType;
|
DCS_CodeType_t CodeType;
|
||||||
uint8_t Code;
|
uint8_t Code;
|
||||||
uint8_t Padding[2];
|
uint8_t Padding[2];
|
||||||
} FREQ_Config_t;
|
} FREQ_Config_t;
|
||||||
|
|
||||||
typedef struct VFO_Info_t
|
typedef struct VFO_Info_t {
|
||||||
{
|
FREQ_Config_t freq_config_RX;
|
||||||
FREQ_Config_t freq_config_RX;
|
FREQ_Config_t freq_config_TX;
|
||||||
FREQ_Config_t freq_config_TX;
|
|
||||||
|
|
||||||
// this is for a purpose of the FrequencyReverse function
|
// this is for a purpose of the FrequencyReverse function
|
||||||
// it points to freq_config_RX normally and to freq_config_TX if reverse function is active
|
// it points to freq_config_RX normally and to freq_config_TX if reverse function is active
|
||||||
@@ -92,81 +89,94 @@ typedef struct VFO_Info_t
|
|||||||
// it points to freq_config_TX normally and to freq_config_RX if reverse function is active
|
// it points to freq_config_TX normally and to freq_config_RX if reverse function is active
|
||||||
FREQ_Config_t *pTX;
|
FREQ_Config_t *pTX;
|
||||||
|
|
||||||
uint32_t TX_OFFSET_FREQUENCY;
|
uint32_t TX_OFFSET_FREQUENCY;
|
||||||
uint16_t StepFrequency;
|
uint16_t StepFrequency;
|
||||||
|
|
||||||
uint8_t CHANNEL_SAVE;
|
uint8_t CHANNEL_SAVE;
|
||||||
|
|
||||||
uint8_t TX_OFFSET_FREQUENCY_DIRECTION;
|
uint8_t TX_OFFSET_FREQUENCY_DIRECTION;
|
||||||
|
|
||||||
uint8_t SquelchOpenRSSIThresh;
|
uint8_t SquelchOpenRSSIThresh;
|
||||||
uint8_t SquelchOpenNoiseThresh;
|
uint8_t SquelchOpenNoiseThresh;
|
||||||
uint8_t SquelchCloseGlitchThresh;
|
uint8_t SquelchCloseGlitchThresh;
|
||||||
uint8_t SquelchCloseRSSIThresh;
|
uint8_t SquelchCloseRSSIThresh;
|
||||||
uint8_t SquelchCloseNoiseThresh;
|
uint8_t SquelchCloseNoiseThresh;
|
||||||
uint8_t SquelchOpenGlitchThresh;
|
uint8_t SquelchOpenGlitchThresh;
|
||||||
|
|
||||||
STEP_Setting_t STEP_SETTING;
|
STEP_Setting_t STEP_SETTING;
|
||||||
uint8_t OUTPUT_POWER;
|
uint8_t OUTPUT_POWER;
|
||||||
uint8_t TXP_CalculatedSetting;
|
uint8_t TXP_CalculatedSetting;
|
||||||
bool FrequencyReverse;
|
bool FrequencyReverse;
|
||||||
|
|
||||||
uint8_t SCRAMBLING_TYPE;
|
uint16_t SCRAMBLING_TYPE;
|
||||||
uint8_t CHANNEL_BANDWIDTH;
|
uint8_t CHANNEL_BANDWIDTH;
|
||||||
|
|
||||||
uint8_t SCANLIST1_PARTICIPATION;
|
uint8_t SCANLIST1_PARTICIPATION;
|
||||||
uint8_t SCANLIST2_PARTICIPATION;
|
uint8_t SCANLIST2_PARTICIPATION;
|
||||||
uint8_t SCANLIST3_PARTICIPATION;
|
uint8_t SCANLIST3_PARTICIPATION;
|
||||||
|
|
||||||
uint8_t Band;
|
uint8_t Band;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
PTT_ID_t DTMF_PTT_ID_TX_MODE;
|
||||||
uint8_t DTMF_DECODING_ENABLE;
|
|
||||||
#endif
|
|
||||||
PTT_ID_t DTMF_PTT_ID_TX_MODE;
|
|
||||||
|
|
||||||
uint8_t BUSY_CHANNEL_LOCK;
|
uint8_t BUSY_CHANNEL_LOCK;
|
||||||
|
|
||||||
ModulationMode_t Modulation;
|
ModulationMode_t Modulation;
|
||||||
|
|
||||||
uint8_t Compander;
|
uint8_t Compander;
|
||||||
|
|
||||||
char Name[16];
|
char Name[16];
|
||||||
} VFO_Info_t;
|
} VFO_Info_t;
|
||||||
|
|
||||||
// Settings of the main VFO that is selected by the user
|
// Settings of the main VFO that is selected by the user
|
||||||
// The pointer follows gEeprom.TX_VFO index
|
// The pointer follows gEeprom.TX_VFO index
|
||||||
extern VFO_Info_t *gTxVfo;
|
extern VFO_Info_t *gTxVfo;
|
||||||
|
|
||||||
// Settings of the actual VFO that is now used for RX,
|
// Settings of the actual VFO that is now used for RX,
|
||||||
// It is being alternated by dual watch, and flipped by crossband
|
// It is being alternated by dual watch, and flipped by crossband
|
||||||
// The pointer follows gEeprom.RX_VFO
|
// The pointer follows gEeprom.RX_VFO
|
||||||
extern VFO_Info_t *gRxVfo;
|
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)
|
// 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 VFO_Info_t *gCurrentVfo;
|
||||||
|
|
||||||
extern DCS_CodeType_t gCurrentCodeType;
|
extern DCS_CodeType_t gCurrentCodeType;
|
||||||
|
|
||||||
extern VfoState_t VfoState[2];
|
extern VfoState_t VfoState[2];
|
||||||
|
|
||||||
|
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList);
|
||||||
|
|
||||||
|
uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum);
|
||||||
|
|
||||||
|
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency);
|
||||||
|
|
||||||
|
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure);
|
||||||
|
|
||||||
|
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
||||||
|
|
||||||
|
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
||||||
|
|
||||||
|
void RADIO_SelectVfos(void);
|
||||||
|
|
||||||
|
void RADIO_SetupRegisters(bool switchToForeground);
|
||||||
|
|
||||||
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList);
|
|
||||||
uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum);
|
|
||||||
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency);
|
|
||||||
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure);
|
|
||||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
|
||||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
|
||||||
void RADIO_SelectVfos(void);
|
|
||||||
void RADIO_SetupRegisters(bool switchToForeground);
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
void RADIO_ConfigureNOAA(void);
|
void RADIO_ConfigureNOAA(void);
|
||||||
#endif
|
#endif
|
||||||
void RADIO_SetTxParameters(void);
|
|
||||||
void RADIO_SetupAGC(bool listeningAM, bool disable);
|
void RADIO_SetTxParameters(void);
|
||||||
void RADIO_SetModulation(ModulationMode_t modulation);
|
|
||||||
void RADIO_SetVfoState(VfoState_t State);
|
void RADIO_SetupAGC(bool listeningAM, bool disable);
|
||||||
void RADIO_PrepareTX(void);
|
|
||||||
void RADIO_SendCssTail(void);
|
void RADIO_SetModulation(ModulationMode_t modulation);
|
||||||
void RADIO_PrepareCssTX(void);
|
|
||||||
void RADIO_SendEndOfTransmission(void);
|
void RADIO_SetVfoState(VfoState_t State);
|
||||||
|
|
||||||
|
void RADIO_PrepareTX(void);
|
||||||
|
|
||||||
|
void RADIO_SendCssTail(void);
|
||||||
|
|
||||||
|
void RADIO_PrepareCssTX(void);
|
||||||
|
|
||||||
|
void RADIO_SendEndOfTransmission(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -57,13 +57,14 @@ void SystickHandler(void)
|
|||||||
gNextTimeslice_500ms = true;
|
gNextTimeslice_500ms = true;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
DECREMENT_AND_TRIGGER(gTxTimerCountdownAlert_500ms - ALERT_TOT * 2, gTxTimeoutReachedAlert);
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
|
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
|
||||||
DECREMENT(gRxTimerCountdown_500ms);
|
DECREMENT(gRxTimerCountdown_500ms);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
if (gEeprom.TX_TIMEOUT_TIMER != 0) {
|
||||||
|
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
||||||
|
}
|
||||||
DECREMENT(gSerialConfigCountDown_500ms);
|
DECREMENT(gSerialConfigCountDown_500ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
138
settings.c
138
settings.c
@@ -28,6 +28,7 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/menu.h"
|
#include "ui/menu.h"
|
||||||
|
#include "app/messages.h"
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL
|
#ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL
|
||||||
static const uint32_t gDefaultFrequencyTable[] =
|
static const uint32_t gDefaultFrequencyTable[] =
|
||||||
@@ -43,6 +44,7 @@ static const uint32_t gDefaultFrequencyTable[] =
|
|||||||
EEPROM_Config_t gEeprom = {0};
|
EEPROM_Config_t gEeprom = {0};
|
||||||
|
|
||||||
void SETTINGS_InitEEPROM(void) {
|
void SETTINGS_InitEEPROM(void) {
|
||||||
|
MESSAGES_GET();
|
||||||
uint8_t Data[16] = {0};
|
uint8_t Data[16] = {0};
|
||||||
// 0E70..0E77
|
// 0E70..0E77
|
||||||
EEPROM_ReadBuffer(0x0E70, Data, 8);
|
EEPROM_ReadBuffer(0x0E70, Data, 8);
|
||||||
@@ -53,12 +55,9 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||||
gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0;
|
|
||||||
gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0;
|
gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0;
|
||||||
gEeprom.SET_KEY = ((Data[4] >> 2) & 0x0F) > 4 ? 0 : (Data[4] >> 2) & 0x0F;
|
|
||||||
#else
|
|
||||||
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
|
||||||
#endif
|
#endif
|
||||||
|
gEeprom.KEY_LOCK = (Data[4] < 2) != 0 && Data[4];
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
||||||
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
||||||
@@ -77,12 +76,8 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
gEeprom.BATTERY_SAVE = (Data[3] < 6) ? Data[3] : 4;
|
gEeprom.BATTERY_SAVE = (Data[3] < 6) ? Data[3] : 4;
|
||||||
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
||||||
gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12;
|
gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
gEeprom.TAIL_TONE_ELIMINATION = Data[6] & 0x01;
|
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) != 0 && Data[6];
|
||||||
gSetting_set_nfm = (Data[6] >> 1) & 0x01;
|
|
||||||
#else
|
|
||||||
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
gEeprom.VFO_OPEN = Data[7] & 0x01;
|
gEeprom.VFO_OPEN = Data[7] & 0x01;
|
||||||
@@ -178,12 +173,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
||||||
gEeprom.DTMF_SIDE_TONE = (Data[0] < 2) ? Data[0] : true;
|
gEeprom.DTMF_SIDE_TONE = (Data[0] < 2) ? Data[0] : true;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
|
|
||||||
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
|
|
||||||
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
|
|
||||||
gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 5) ? Data[4] : 10;
|
|
||||||
#endif
|
|
||||||
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
||||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
||||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
||||||
@@ -192,35 +181,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
EEPROM_ReadBuffer(0x0ED8, Data, 8);
|
EEPROM_ReadBuffer(0x0ED8, Data, 8);
|
||||||
gEeprom.DTMF_CODE_PERSIST_TIME = (Data[0] < 101) ? Data[0] * 10 : 100;
|
gEeprom.DTMF_CODE_PERSIST_TIME = (Data[0] < 101) ? Data[0] * 10 : 100;
|
||||||
gEeprom.DTMF_CODE_INTERVAL_TIME = (Data[1] < 101) ? Data[1] * 10 : 100;
|
gEeprom.DTMF_CODE_INTERVAL_TIME = (Data[1] < 101) ? Data[1] * 10 : 100;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gEeprom.PERMIT_REMOTE_KILL = (Data[2] < 2) ? Data[2] : true;
|
|
||||||
|
|
||||||
// 0EE0..0EE7
|
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x0EE0, Data, sizeof(gEeprom.ANI_DTMF_ID));
|
|
||||||
if (DTMF_ValidateCodes((char *)Data, sizeof(gEeprom.ANI_DTMF_ID))) {
|
|
||||||
memcpy(gEeprom.ANI_DTMF_ID, Data, sizeof(gEeprom.ANI_DTMF_ID));
|
|
||||||
} else {
|
|
||||||
strcpy(gEeprom.ANI_DTMF_ID, "123");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 0EE8..0EEF
|
|
||||||
EEPROM_ReadBuffer(0x0EE8, Data, sizeof(gEeprom.KILL_CODE));
|
|
||||||
if (DTMF_ValidateCodes((char *)Data, sizeof(gEeprom.KILL_CODE))) {
|
|
||||||
memcpy(gEeprom.KILL_CODE, Data, sizeof(gEeprom.KILL_CODE));
|
|
||||||
} else {
|
|
||||||
strcpy(gEeprom.KILL_CODE, "ABCD9");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 0EF0..0EF7
|
|
||||||
EEPROM_ReadBuffer(0x0EF0, Data, sizeof(gEeprom.REVIVE_CODE));
|
|
||||||
if (DTMF_ValidateCodes((char *)Data, sizeof(gEeprom.REVIVE_CODE))) {
|
|
||||||
memcpy(gEeprom.REVIVE_CODE, Data, sizeof(gEeprom.REVIVE_CODE));
|
|
||||||
} else {
|
|
||||||
strcpy(gEeprom.REVIVE_CODE, "9DCBA");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 0EF8..0F07
|
// 0EF8..0F07
|
||||||
EEPROM_ReadBuffer(0x0EF8, Data, sizeof(gEeprom.DTMF_UP_CODE));
|
EEPROM_ReadBuffer(0x0EF8, Data, sizeof(gEeprom.DTMF_UP_CODE));
|
||||||
@@ -274,10 +234,11 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
gEeprom.FSKSRCAddress |= Data[1] << 8;
|
gEeprom.FSKSRCAddress |= Data[1] << 8;
|
||||||
gEeprom.FSKSRCAddress |= Data[2] << 16;
|
gEeprom.FSKSRCAddress |= Data[2] << 16;
|
||||||
gEeprom.FSKSRCAddress |= Data[3] << 24;
|
gEeprom.FSKSRCAddress |= Data[3] << 24;
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
gEeprom.BK1080_AGC_ENABLED = Data[4] & 0x01;
|
gEeprom.BK1080_AGC_ENABLED = Data[4] & 0x01;
|
||||||
gEeprom.BK1080_BLEND_CONFIG = (Data[4] >> 1) & 0x03;
|
gEeprom.BK1080_BLEND_CONFIG = (Data[4] >> 1) & 0x03;
|
||||||
gEeprom.BK1080_DEEMPHASIS_CONFIG = (Data[4] >> 3) & 0x03;
|
gEeprom.BK1080_DEEMPHASIS_CONFIG = (Data[4] >> 3) & 0x03;
|
||||||
|
#endif
|
||||||
// 0F40..0F47
|
// 0F40..0F47
|
||||||
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
||||||
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
|
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
|
||||||
@@ -331,15 +292,10 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
EEPROM_ReadBuffer(0x1FF0, Data, 8);
|
EEPROM_ReadBuffer(0x1FF0, Data, 8);
|
||||||
gSetting_set_ptt = (((Data[7] & 0x0F)) < 2) ? ((Data[7] & 0x0F)) : 0;
|
gSetting_set_ptt = (((Data[7] & 0x0F)) < 2) ? ((Data[7] & 0x0F)) : 0;
|
||||||
|
|
||||||
gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0;
|
|
||||||
gSetting_set_eot = (((Data[6] & 0x0F)) < 4) ? ((Data[6] & 0x0F)) : 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int tmp = ((Data[5] & 0xF0) >> 4);
|
int tmp = ((Data[5] & 0xF0) >> 4);
|
||||||
|
|
||||||
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
|
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
|
||||||
gSetting_set_lck = (((tmp >> 1) & 0x01) < 2) ? ((tmp >> 1) & 0x01): 0;
|
|
||||||
gSetting_set_ctr = (((Data[5] & 0x0F)) > 00 && ((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 10;
|
|
||||||
|
|
||||||
gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
|
gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
|
||||||
*/
|
*/
|
||||||
@@ -351,14 +307,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
#else
|
#else
|
||||||
gSetting_set_inv = 0;
|
gSetting_set_inv = 0;
|
||||||
#endif
|
#endif
|
||||||
gSetting_set_lck = (tmp >> 1) & 0x01;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
int ctr_value = Data[5] & 0x0F;
|
|
||||||
gSetting_set_ctr = (ctr_value > 0 && ctr_value < 16) ? ctr_value : 10;
|
|
||||||
#else
|
|
||||||
gSetting_set_ctr = 10;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gSetting_set_tmr = Data[4] & 0x01;
|
gSetting_set_tmr = Data[4] & 0x01;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
@@ -371,7 +319,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
|
|
||||||
// And set special session settings for actions
|
// And set special session settings for actions
|
||||||
gSetting_set_ptt_session = gSetting_set_ptt;
|
gSetting_set_ptt_session = gSetting_set_ptt;
|
||||||
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,7 +385,7 @@ uint32_t SETTINGS_FetchChannelFrequency(const int channel) {
|
|||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
} __attribute__((packed)) info;
|
} __attribute__((packed)) info;
|
||||||
|
|
||||||
EEPROM_ReadBuffer(channel * 16, &info, sizeof(info));
|
EEPROM_ReadBuffer(channel * 20, &info, sizeof(info));
|
||||||
|
|
||||||
return info.frequency;
|
return info.frequency;
|
||||||
}
|
}
|
||||||
@@ -455,7 +402,7 @@ void SETTINGS_FetchChannelName(char *s, const int channel) {
|
|||||||
if (!RADIO_CheckValidChannel(channel, false, 0))
|
if (!RADIO_CheckValidChannel(channel, false, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x0F50 + (channel * 16), s, 10);
|
EEPROM_ReadBuffer(0x0F50 + (channel * 20), s, 10);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
@@ -479,8 +426,6 @@ void SETTINGS_FactoryReset(bool bIsAll) {
|
|||||||
if (
|
if (
|
||||||
!(i >= 0x0EE0 && i < 0x0F18) && // ANI ID + DTMF codes
|
!(i >= 0x0EE0 && i < 0x0F18) && // ANI ID + DTMF codes
|
||||||
!(i >= 0x0F30 && i < 0x0F50) && // AES KEY + F LOCK + Scramble Enable
|
!(i >= 0x0F30 && i < 0x0F50) && // AES KEY + F LOCK + Scramble Enable
|
||||||
!(i >= 0x1C00 && i < 0x1E00) && // DTMF contacts
|
|
||||||
!(i >= 0x0EB0 && i < 0x0ED0) && // Welcome strings
|
|
||||||
!(i >= 0x0EA0 && i < 0x0EA8) && // Voice Prompt
|
!(i >= 0x0EA0 && i < 0x0EA8) && // Voice Prompt
|
||||||
(bIsAll ||
|
(bIsAll ||
|
||||||
(
|
(
|
||||||
@@ -581,12 +526,7 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[3] = false;
|
State[3] = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0);
|
||||||
State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0) | (gEeprom.MENU_LOCK ? 0x02 :0) | ((gEeprom.SET_KEY & 0x0F) << 2);
|
|
||||||
#else
|
|
||||||
State[4] = gEeprom.KEY_LOCK;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
State[5] = gEeprom.VOX_SWITCH;
|
State[5] = gEeprom.VOX_SWITCH;
|
||||||
State[6] = gEeprom.VOX_LEVEL;
|
State[6] = gEeprom.VOX_LEVEL;
|
||||||
@@ -617,11 +557,7 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[5] = gEeprom.BACKLIGHT_TIME;
|
State[5] = gEeprom.BACKLIGHT_TIME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
State[6] = gEeprom.TAIL_TONE_ELIMINATION & 0x01;
|
||||||
State[6] = (gEeprom.TAIL_TONE_ELIMINATION & 0x01) | ((gSetting_set_nfm & 0x03) << 1);
|
|
||||||
#else
|
|
||||||
State[6] = gEeprom.TAIL_TONE_ELIMINATION;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) |
|
State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) |
|
||||||
@@ -671,12 +607,6 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
EEPROM_WriteBuffer(0x0EA8, State);
|
EEPROM_WriteBuffer(0x0EA8, State);
|
||||||
|
|
||||||
State[0] = gEeprom.DTMF_SIDE_TONE;
|
State[0] = gEeprom.DTMF_SIDE_TONE;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
|
||||||
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
|
||||||
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
|
|
||||||
State[4] = gEeprom.DTMF_auto_reset_time;
|
|
||||||
#endif
|
|
||||||
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
||||||
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
||||||
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
||||||
@@ -685,9 +615,6 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
memset(State, 0xFF, sizeof(State));
|
memset(State, 0xFF, sizeof(State));
|
||||||
State[0] = gEeprom.DTMF_CODE_PERSIST_TIME / 10U;
|
State[0] = gEeprom.DTMF_CODE_PERSIST_TIME / 10U;
|
||||||
State[1] = gEeprom.DTMF_CODE_INTERVAL_TIME / 10U;
|
State[1] = gEeprom.DTMF_CODE_INTERVAL_TIME / 10U;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
State[2] = gEeprom.PERMIT_REMOTE_KILL;
|
|
||||||
#endif
|
|
||||||
EEPROM_WriteBuffer(0x0ED8, State);
|
EEPROM_WriteBuffer(0x0ED8, State);
|
||||||
|
|
||||||
State[0] = gEeprom.SCAN_LIST_DEFAULT;
|
State[0] = gEeprom.SCAN_LIST_DEFAULT;
|
||||||
@@ -714,9 +641,11 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF;
|
State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF;
|
||||||
State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF;
|
State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF;
|
||||||
State[3] = (gEeprom.FSKSRCAddress >> 24) & 0xFF;
|
State[3] = (gEeprom.FSKSRCAddress >> 24) & 0xFF;
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
State[4] = ((gEeprom.BK1080_AGC_ENABLED & 0x01) |
|
State[4] = ((gEeprom.BK1080_AGC_ENABLED & 0x01) |
|
||||||
((gEeprom.BK1080_BLEND_CONFIG & 0x03) << 1) |
|
((gEeprom.BK1080_BLEND_CONFIG & 0x03) << 1) |
|
||||||
((gEeprom.BK1080_DEEMPHASIS_CONFIG & 0x03) << 3));
|
((gEeprom.BK1080_DEEMPHASIS_CONFIG & 0x03) << 3));
|
||||||
|
#endif
|
||||||
|
|
||||||
EEPROM_WriteBuffer(0x0F20, State);
|
EEPROM_WriteBuffer(0x0F20, State);
|
||||||
|
|
||||||
@@ -763,8 +692,6 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
|
|
||||||
if(gSetting_set_inv == 1)
|
if(gSetting_set_inv == 1)
|
||||||
tmp = tmp | (1 << 0);
|
tmp = tmp | (1 << 0);
|
||||||
if (gSetting_set_lck == 1)
|
|
||||||
tmp = tmp | (1 << 1);
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
@@ -773,17 +700,16 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
|
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tmp = (gSetting_set_inv << 0) |
|
tmp = (gSetting_set_inv << 0);
|
||||||
(gSetting_set_lck << 1);
|
|
||||||
|
|
||||||
State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F));
|
State[5] = (tmp << 4);
|
||||||
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
|
|
||||||
State[7] = gSetting_set_ptt & 0x0F;
|
State[7] = gSetting_set_ptt & 0x0F;
|
||||||
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
|
|
||||||
|
|
||||||
EEPROM_WriteBuffer(0x1FF0, State);
|
EEPROM_WriteBuffer(0x1FF0, State);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MSG_EnableRX(true);
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
SETTINGS_WriteCurrentVol();
|
SETTINGS_WriteCurrentVol();
|
||||||
#endif
|
#endif
|
||||||
@@ -795,10 +721,10 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t OffsetVFO = Channel * 16;
|
uint16_t OffsetVFO = Channel * 24;
|
||||||
|
|
||||||
if (IS_FREQ_CHANNEL(Channel)) { // it's a VFO, not a channel
|
if (IS_FREQ_CHANNEL(Channel)) { // it's a VFO, not a channel
|
||||||
OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90;
|
OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C98;
|
||||||
OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32;
|
OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -806,6 +732,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
union {
|
union {
|
||||||
uint8_t _8[8];
|
uint8_t _8[8];
|
||||||
uint32_t _32[2];
|
uint32_t _32[2];
|
||||||
|
uint16_t _16[4];
|
||||||
} State;
|
} State;
|
||||||
|
|
||||||
State._32[0] = pVFO->freq_config_RX.Frequency;
|
State._32[0] = pVFO->freq_config_RX.Frequency;
|
||||||
@@ -817,19 +744,18 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
State._8[2] = (pVFO->freq_config_TX.CodeType << 4) | pVFO->freq_config_RX.CodeType;
|
State._8[2] = (pVFO->freq_config_TX.CodeType << 4) | pVFO->freq_config_RX.CodeType;
|
||||||
State._8[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION;
|
State._8[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION;
|
||||||
State._8[4] = 0
|
State._8[4] = 0
|
||||||
| (pVFO->BUSY_CHANNEL_LOCK << 5)
|
| (pVFO->BUSY_CHANNEL_LOCK << 6)
|
||||||
| (pVFO->OUTPUT_POWER << 2)
|
| (pVFO->OUTPUT_POWER << 3)
|
||||||
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
||||||
| (pVFO->FrequencyReverse << 0);
|
| (pVFO->FrequencyReverse << 0);
|
||||||
State._8[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1)
|
State._8[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1)
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
| ((pVFO->DTMF_DECODING_ENABLE & 1u) << 0)
|
|
||||||
#endif
|
|
||||||
;
|
;
|
||||||
State._8[6] = pVFO->STEP_SETTING;
|
State._8[6] = pVFO->STEP_SETTING;
|
||||||
|
EEPROM_WriteBuffer(OffsetVFO + sizeof (State._32), State._8);
|
||||||
|
|
||||||
|
State._16[0] = pVFO->SCRAMBLING_TYPE;
|
||||||
|
EEPROM_WriteBuffer(OffsetVFO + sizeof (State._32) + sizeof (State._8), State._16);
|
||||||
|
|
||||||
State._8[7] = pVFO->SCRAMBLING_TYPE;
|
|
||||||
EEPROM_WriteBuffer(OffsetVFO + 8, State._8);
|
|
||||||
|
|
||||||
SETTINGS_UpdateChannel(Channel, pVFO, true, true, true);
|
SETTINGS_UpdateChannel(Channel, pVFO, true, true, true);
|
||||||
|
|
||||||
@@ -857,7 +783,7 @@ void SETTINGS_SaveBatteryCalibration(const uint16_t *batteryCalibration) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SETTINGS_SaveChannelName(uint8_t channel, const char *name) {
|
void SETTINGS_SaveChannelName(uint8_t channel, const char *name) {
|
||||||
uint16_t offset = channel * 16;
|
uint16_t offset = channel * 24;
|
||||||
uint8_t buf[16] = {0};
|
uint8_t buf[16] = {0};
|
||||||
memcpy(buf, name, MIN(strlen(name), 10u));
|
memcpy(buf, name, MIN(strlen(name), 10u));
|
||||||
EEPROM_WriteBuffer(0x0F50 + offset, buf);
|
EEPROM_WriteBuffer(0x0F50 + offset, buf);
|
||||||
@@ -940,9 +866,6 @@ void SETTINGS_WriteBuildOptions(void) {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_PWRON_PASSWORD
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
| (1 << 6)
|
| (1 << 6)
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
| (1 << 7)
|
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -965,10 +888,7 @@ void SETTINGS_WriteBuildOptions(void) {
|
|||||||
#ifdef ENABLE_SPECTRUM
|
#ifdef ENABLE_SPECTRUM
|
||||||
| (1 << 5)
|
| (1 << 5)
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
| (1 << 6);
|
||||||
| (1 << 6)
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
EEPROM_WriteBuffer(0x1FF0, State);
|
EEPROM_WriteBuffer(0x1FF0, State);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1001,7 +921,7 @@ void SETTINGS_WriteCurrentVol(void) {
|
|||||||
void SETTINGS_ResetTxLock(void) {
|
void SETTINGS_ResetTxLock(void) {
|
||||||
uint8_t State[8];
|
uint8_t State[8];
|
||||||
for (uint8_t channel = 0; channel < 200; channel++) {
|
for (uint8_t channel = 0; channel < 200; channel++) {
|
||||||
uint16_t OffsetVFO = channel * 16;
|
uint16_t OffsetVFO = channel * 24;
|
||||||
EEPROM_ReadBuffer(OffsetVFO + 8, State, sizeof(State));
|
EEPROM_ReadBuffer(OffsetVFO + 8, State, sizeof(State));
|
||||||
State[4] |= (1 << 6);
|
State[4] |= (1 << 6);
|
||||||
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
||||||
|
|||||||
28
settings.h
28
settings.h
@@ -31,9 +31,10 @@
|
|||||||
typedef enum ModemModulation {
|
typedef enum ModemModulation {
|
||||||
MOD_FSK_450, // for bad conditions
|
MOD_FSK_450, // for bad conditions
|
||||||
MOD_FSK_700, // for medium conditions
|
MOD_FSK_700, // for medium conditions
|
||||||
|
MOD_FSK_1200,
|
||||||
|
MOD_FSK_2400,
|
||||||
MOD_AFSK_1200, // for good conditions
|
MOD_AFSK_1200, // for good conditions
|
||||||
MOD_AFSK_2400,
|
MOD_AFSK_2400,
|
||||||
MOD_FSK_1200_2400,
|
|
||||||
MOD_NOAA_SAME
|
MOD_NOAA_SAME
|
||||||
} ModemModulation;
|
} ModemModulation;
|
||||||
|
|
||||||
@@ -98,8 +99,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
OUTPUT_POWER_USER = 0,
|
OUTPUT_POWER_LOW1 = 0,
|
||||||
OUTPUT_POWER_LOW1,
|
|
||||||
OUTPUT_POWER_LOW2,
|
OUTPUT_POWER_LOW2,
|
||||||
OUTPUT_POWER_LOW3,
|
OUTPUT_POWER_LOW3,
|
||||||
OUTPUT_POWER_LOW4,
|
OUTPUT_POWER_LOW4,
|
||||||
@@ -125,15 +125,10 @@ enum ACTION_OPT_t {
|
|||||||
ACTION_OPT_BLMIN_TMP_OFF, //BackLight Minimum Temporay OFF
|
ACTION_OPT_BLMIN_TMP_OFF, //BackLight Minimum Temporay OFF
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
ACTION_OPT_RXMODE,
|
ACTION_OPT_RXMODE,
|
||||||
ACTION_OPT_MAINONLY,
|
|
||||||
ACTION_OPT_PTT,
|
ACTION_OPT_PTT,
|
||||||
ACTION_OPT_WN,
|
ACTION_OPT_WN,
|
||||||
ACTION_OPT_BACKLIGHT,
|
ACTION_OPT_BACKLIGHT,
|
||||||
ACTION_OPT_MUTE,
|
ACTION_OPT_MUTE,
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
ACTION_OPT_POWER_HIGH,
|
|
||||||
ACTION_OPT_REMOVE_OFFSET,
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_REGA
|
#ifdef ENABLE_REGA
|
||||||
ACTION_OPT_REGA_ALARM,
|
ACTION_OPT_REGA_ALARM,
|
||||||
@@ -223,10 +218,7 @@ typedef struct {
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
bool KEY_LOCK_PTT;
|
bool KEY_LOCK_PTT;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
bool MENU_LOCK;
|
bool MENU_LOCK;
|
||||||
uint8_t SET_KEY;
|
|
||||||
#endif
|
|
||||||
bool VOX_SWITCH;
|
bool VOX_SWITCH;
|
||||||
uint8_t VOX_LEVEL;
|
uint8_t VOX_LEVEL;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -270,11 +262,6 @@ typedef struct {
|
|||||||
uint8_t MIC_SENSITIVITY;
|
uint8_t MIC_SENSITIVITY;
|
||||||
uint8_t MIC_SENSITIVITY_TUNING;
|
uint8_t MIC_SENSITIVITY_TUNING;
|
||||||
uint8_t CHAN_1_CALL;
|
uint8_t CHAN_1_CALL;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char ANI_DTMF_ID[8];
|
|
||||||
char KILL_CODE[8];
|
|
||||||
char REVIVE_CODE[8];
|
|
||||||
#endif
|
|
||||||
char DTMF_UP_CODE[16];
|
char DTMF_UP_CODE[16];
|
||||||
|
|
||||||
uint8_t field57_0x6c;
|
uint8_t field57_0x6c;
|
||||||
@@ -285,21 +272,12 @@ typedef struct {
|
|||||||
uint8_t field60_0x7e;
|
uint8_t field60_0x7e;
|
||||||
uint8_t field61_0x7f;
|
uint8_t field61_0x7f;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char DTMF_SEPARATE_CODE;
|
|
||||||
char DTMF_GROUP_CALL_CODE;
|
|
||||||
uint8_t DTMF_DECODE_RESPONSE;
|
|
||||||
uint8_t DTMF_auto_reset_time;
|
|
||||||
#endif
|
|
||||||
uint16_t DTMF_PRELOAD_TIME;
|
uint16_t DTMF_PRELOAD_TIME;
|
||||||
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
||||||
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
||||||
uint16_t DTMF_CODE_PERSIST_TIME;
|
uint16_t DTMF_CODE_PERSIST_TIME;
|
||||||
uint16_t DTMF_CODE_INTERVAL_TIME;
|
uint16_t DTMF_CODE_INTERVAL_TIME;
|
||||||
bool DTMF_SIDE_TONE;
|
bool DTMF_SIDE_TONE;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
bool PERMIT_REMOTE_KILL;
|
|
||||||
#endif
|
|
||||||
int16_t BK4819_XTAL_FREQ_LOW;
|
int16_t BK4819_XTAL_FREQ_LOW;
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
bool NOAA_AUTO_SCAN;
|
bool NOAA_AUTO_SCAN;
|
||||||
|
|||||||
25
ui/helper.c
25
ui/helper.c
@@ -110,6 +110,31 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
|||||||
UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font, inv);
|
UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font, inv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void itoa(unsigned long num, char *str) {
|
||||||
|
char buf[20]; // Enough to store any 32-bit or 64-bit unsigned number
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
// Handle 0 explicitly
|
||||||
|
if (num == 0) {
|
||||||
|
str[i++] = '0';
|
||||||
|
str[i] = '\0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert number to string in reverse order
|
||||||
|
while (num > 0) {
|
||||||
|
buf[i++] = (num % 10) + '0'; // Get last digit and convert to ASCII
|
||||||
|
num /= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reverse the string
|
||||||
|
int j = 0;
|
||||||
|
while (i > 0) {
|
||||||
|
str[j++] = buf[--i];
|
||||||
|
}
|
||||||
|
str[j] = '\0'; // Null-terminate the string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
||||||
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *) gFontSmall, false);
|
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *) gFontSmall, false);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black
|
|||||||
#endif
|
#endif
|
||||||
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
||||||
void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
||||||
|
void itoa(unsigned long num, char *str);
|
||||||
void UI_DisplayClear();
|
void UI_DisplayClear();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
187
ui/main.c
187
ui/main.c
@@ -45,6 +45,7 @@
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
|
|
||||||
#include "driver/system.h"
|
#include "driver/system.h"
|
||||||
|
#include "app/scanner.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ static uint32_t RxOnVfofrequency;
|
|||||||
|
|
||||||
bool isMainOnlyInputDTMF = false;
|
bool isMainOnlyInputDTMF = false;
|
||||||
|
|
||||||
static bool isMainOnly() {
|
bool isMainOnly() {
|
||||||
return (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) && (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF);
|
return (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) && (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +89,7 @@ const char *VfoStateStr[] = {
|
|||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
static void DrawSmallAntennaAndBars(uint8_t *p, unsigned int level) {
|
static void DrawSmallAntennaAndBars(uint8_t *p, unsigned int level) {
|
||||||
|
level++;
|
||||||
if (level > 6)
|
if (level > 6)
|
||||||
level = 6;
|
level = 6;
|
||||||
|
|
||||||
@@ -165,9 +167,7 @@ void UI_DisplayAudioBar(void) {
|
|||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||||
gScreenToDisplay != DISPLAY_MAIN
|
gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
) {
|
) {
|
||||||
return; // screen is in use
|
return; // screen is in use
|
||||||
}
|
}
|
||||||
@@ -267,9 +267,6 @@ void DisplayRSSIBar(const bool now) {
|
|||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
||||||
gScreenToDisplay != DISPLAY_MAIN
|
gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return; // display is in use
|
return; // display is in use
|
||||||
|
|
||||||
@@ -334,7 +331,7 @@ void DisplayRSSIBar(const bool now) {
|
|||||||
sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
|
sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf(str, "% 4d %2d", -rssi_dBm, overS9dBm);
|
sprintf(str, "% 4d %2ld", -rssi_dBm, overS9dBm);
|
||||||
memcpy(p_line + 2 + 7*5, &plus, ARRAY_SIZE(plus));
|
memcpy(p_line + 2 + 7*5, &plus, ARRAY_SIZE(plus));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +398,7 @@ void UI_MAIN_PrintAGC(bool now)
|
|||||||
int8_t pgaTab[] = {-33, -27, -21, -15, -9, -6, -3, 0};
|
int8_t pgaTab[] = {-33, -27, -21, -15, -9, -6, -3, 0};
|
||||||
int16_t agcGain = lnaShortTab[agcGainReg.lnaS] + lnaTab[agcGainReg.lna] + mixerTab[agcGainReg.mixer] + pgaTab[agcGainReg.pga];
|
int16_t agcGain = lnaShortTab[agcGainReg.lnaS] + lnaTab[agcGainReg.lna] + mixerTab[agcGainReg.mixer] + pgaTab[agcGainReg.pga];
|
||||||
|
|
||||||
sprintf(buf, "%d%2d %2d %2d %3d", reg7e.agcEnab, reg7e.gainIdx, -agcGain, reg7e.agcSigStrength, BK4819_GetRSSI());
|
sprintf(buf, "%d%2ld %2ld %2ld %3ld", reg7e.agcEnab, reg7e.gainIdx, -agcGain, reg7e.agcSigStrength, BK4819_GetRSSI());
|
||||||
UI_PrintStringSmallNormal(buf, 2, 0, 3);
|
UI_PrintStringSmallNormal(buf, 2, 0, 3);
|
||||||
if(now)
|
if(now)
|
||||||
ST7565_BlitLine(3);
|
ST7565_BlitLine(3);
|
||||||
@@ -418,44 +415,6 @@ void UI_MAIN_TimeSlice500ms(void) {
|
|||||||
if (FUNCTION_IsRx()) {
|
if (FUNCTION_IsRx()) {
|
||||||
DisplayRSSIBar(true);
|
DisplayRSSIBar(true);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_FEAT_F4HWN // Blink Green Led for white...
|
|
||||||
else if (gSetting_set_eot > 0 && RxBlinkLed == 2) {
|
|
||||||
if (RxBlinkLedCounter <= 8) {
|
|
||||||
if (RxBlinkLedCounter % 2 == 0) {
|
|
||||||
if (gSetting_set_eot > 1) {
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (gSetting_set_eot > 1) {
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gSetting_set_eot == 1 || gSetting_set_eot == 3) {
|
|
||||||
switch (RxBlinkLedCounter) {
|
|
||||||
case 1:
|
|
||||||
AUDIO_PlayBeep(BEEP_400HZ_30MS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
AUDIO_PlayBeep(BEEP_400HZ_30MS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_30MS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
AUDIO_PlayBeep(BEEP_600HZ_30MS);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RxBlinkLedCounter += 1;
|
|
||||||
} else {
|
|
||||||
RxBlinkLed = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,8 +428,9 @@ void UI_DisplayMain(void) {
|
|||||||
// clear the screen
|
// clear the screen
|
||||||
UI_DisplayClear();
|
UI_DisplayClear();
|
||||||
|
|
||||||
|
|
||||||
if (gLowBattery && !gLowBatteryConfirmed) {
|
if (gLowBattery && !gLowBatteryConfirmed) {
|
||||||
UI_DisplayPopup("LOW BATT");
|
UI_DisplayPopup("LOW BAT");
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -564,9 +524,9 @@ void UI_DisplayMain(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString("ScnRng", 5, 0, line + shift /*, 8 */);
|
UI_PrintString("ScnRng", 5, 0, line + shift /*, 8 */);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line + shift);
|
UI_PrintStringSmallNormal(String, 56, 0, line + shift);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1);
|
UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1);
|
||||||
|
|
||||||
if (!isMainOnly())
|
if (!isMainOnly())
|
||||||
@@ -576,66 +536,19 @@ void UI_DisplayMain(void) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UI_PrintString("ScnRng", 5, 0, line /*, 8 */);
|
UI_PrintString("ScnRng", 5, 0, line /*, 8 */);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line);
|
UI_PrintStringSmallNormal(String, 56, 0, line);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line + 1);
|
UI_PrintStringSmallNormal(String, 56, 0, line + 1);
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
|
||||||
UI_PrintString("SMS Dst", 0, 0, line - 1 /*, 8 */);
|
|
||||||
sprintf(String, "%d", dataPacket.dest);
|
|
||||||
UI_PrintStringSmallNormal(String, 0, 0, line);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
|
||||||
UI_PrintString("SMS Dat", 0, 0, line - 1 /*, 8 */);
|
|
||||||
sprintf(String, "%s", dataPacket.data);
|
|
||||||
UI_PrintStringSmallNormal(String, 0, 0, line);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_InputMode
|
if (gDTMF_InputMode
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx
|
|
||||||
#endif
|
|
||||||
) {
|
) {
|
||||||
char *pPrintStr = "";
|
char *pPrintStr = "";
|
||||||
// show DTMF stuff
|
// show DTMF stuff
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char Contact[16];
|
|
||||||
if (!gDTMF_InputMode) {
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) {
|
|
||||||
pPrintStr = DTMF_FindContact(gDTMF_String, Contact) ? Contact : gDTMF_String;
|
|
||||||
} else if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
|
||||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) {
|
|
||||||
pPrintStr = DTMF_FindContact(gDTMF_Callee, Contact) ? Contact : gDTMF_Callee;
|
|
||||||
} else if (gDTMF_IsTx) {
|
|
||||||
pPrintStr = gDTMF_String;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UI_PrintString(pPrintStr, 2, 0, 2 + (vfo_num * 3) /*, 8 */);
|
|
||||||
|
|
||||||
pPrintStr = "";
|
|
||||||
if (!gDTMF_InputMode) {
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) {
|
|
||||||
pPrintStr = (gDTMF_State == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT";
|
|
||||||
} else if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
|
||||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) {
|
|
||||||
sprintf(String, "CALL FRM:%s",
|
|
||||||
(DTMF_FindContact(gDTMF_Caller, Contact)) ? Contact : gDTMF_Caller);
|
|
||||||
pPrintStr = String;
|
|
||||||
} else if (gDTMF_IsTx) {
|
|
||||||
pPrintStr = (gDTMF_State == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX";
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
sprintf(String, ">%s", gDTMF_InputBox);
|
sprintf(String, ">%s", gDTMF_InputBox);
|
||||||
pPrintStr = String;
|
pPrintStr = String;
|
||||||
@@ -826,16 +739,14 @@ void UI_DisplayMain(void) {
|
|||||||
|
|
||||||
// compander symbol
|
// compander symbol
|
||||||
#ifndef ENABLE_BIG_FREQ
|
#ifndef ENABLE_BIG_FREQ
|
||||||
const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
//const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||||
if (att.compander)
|
|
||||||
memcpy(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
|
||||||
#else
|
#else
|
||||||
// TODO: // find somewhere else to put the symbol
|
// TODO: // find somewhere else to put the symbol
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (gEeprom.CHANNEL_DISPLAY_MODE) {
|
switch (gEeprom.CHANNEL_DISPLAY_MODE) {
|
||||||
case MDF_FREQUENCY: // show the channel frequency
|
case MDF_FREQUENCY: // show the channel frequency
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
#ifdef ENABLE_BIG_FREQ
|
#ifdef ENABLE_BIG_FREQ
|
||||||
if (frequency < _1GHz_in_KHz) {
|
if (frequency < _1GHz_in_KHz) {
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
@@ -884,7 +795,7 @@ void UI_DisplayMain(void) {
|
|||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if (isMainOnly()) {
|
if (isMainOnly()) {
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
if (frequency < _1GHz_in_KHz) {
|
if (frequency < _1GHz_in_KHz) {
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4);
|
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4);
|
||||||
@@ -897,11 +808,11 @@ void UI_DisplayMain(void) {
|
|||||||
UI_PrintString(String, 40, 0, line + 3 /*, 8 */);
|
UI_PrintString(String, 40, 0, line + 3 /*, 8 */);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%03lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintStringSmallBold(String, 40 + 4, 0, line + 1);
|
UI_PrintStringSmallBold(String, 40 + 4, 0, line + 1);
|
||||||
}
|
}
|
||||||
#else // show the channel frequency below the channel number/name
|
#else // show the channel frequency below the channel number/name
|
||||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%03u.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 20 + 4, 0, line + 1);
|
UI_PrintStringSmallNormal(String, 20 + 4, 0, line + 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -909,7 +820,7 @@ void UI_DisplayMain(void) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else { // frequency mode
|
} else { // frequency mode
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
|
|
||||||
#ifdef ENABLE_BIG_FREQ
|
#ifdef ENABLE_BIG_FREQ
|
||||||
if (frequency < _1GHz_in_KHz) {
|
if (frequency < _1GHz_in_KHz) {
|
||||||
@@ -926,13 +837,7 @@ void UI_DisplayMain(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// show the channel symbols
|
// show the channel symbols
|
||||||
const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
//const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||||
if (att.compander)
|
|
||||||
#ifdef ENABLE_BIG_FREQ
|
|
||||||
memcpy(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
|
|
||||||
#else
|
|
||||||
memcpy(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -962,7 +867,7 @@ void UI_DisplayMain(void) {
|
|||||||
Level = 2;
|
Level = 2;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
Level = gRxVfo->OUTPUT_POWER - 1;
|
Level = gRxVfo->OUTPUT_POWER;
|
||||||
} else if (mode == VFO_MODE_RX) { // RX signal level
|
} else if (mode == VFO_MODE_RX) { // RX signal level
|
||||||
#ifndef ENABLE_RSSI_BAR
|
#ifndef ENABLE_RSSI_BAR
|
||||||
// bar graph
|
// bar graph
|
||||||
@@ -1010,7 +915,6 @@ void UI_DisplayMain(void) {
|
|||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
const FREQ_Config_t *pConfig = (mode == VFO_MODE_TX) ? vfoInfo->pTX : vfoInfo->pRX;
|
const FREQ_Config_t *pConfig = (mode == VFO_MODE_TX) ? vfoInfo->pTX : vfoInfo->pRX;
|
||||||
int8_t shift = 0;
|
int8_t shift = 0;
|
||||||
|
|
||||||
switch ((int) pConfig->CodeType) {
|
switch ((int) pConfig->CodeType) {
|
||||||
case 1:
|
case 1:
|
||||||
sprintf(String, "%u.%u", CTCSS_Options[pConfig->Code] / 10, CTCSS_Options[pConfig->Code] % 10);
|
sprintf(String, "%u.%u", CTCSS_Options[pConfig->Code] / 10, CTCSS_Options[pConfig->Code] % 10);
|
||||||
@@ -1029,6 +933,8 @@ void UI_DisplayMain(void) {
|
|||||||
shift = -10;
|
shift = -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UI_PrintStringSmallNormal(s, 50, 0, line + 2);
|
UI_PrintStringSmallNormal(s, 50, 0, line + 2);
|
||||||
UI_PrintStringSmallNormal(t, 2, 0, line + 2);
|
UI_PrintStringSmallNormal(t, 2, 0, line + 2);
|
||||||
|
|
||||||
@@ -1047,25 +953,20 @@ void UI_DisplayMain(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) { // show the TX power
|
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) { // show the TX power
|
||||||
uint8_t currentPower = vfoInfo->OUTPUT_POWER % 8;
|
|
||||||
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "ME",
|
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "ME",
|
||||||
"HI"};
|
"HI"};
|
||||||
UI_PrintStringSmallNormal(pwr_short[currentPower], LCD_WIDTH + 25, 0, line + 1);
|
UI_PrintStringSmallNormal(pwr_short[vfoInfo->OUTPUT_POWER], LCD_WIDTH + 25, 0, line + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vfoInfo->freq_config_RX.Frequency != vfoInfo->freq_config_TX.Frequency) { // show the TX offset symbol
|
if (vfoInfo->freq_config_RX.Frequency != vfoInfo->freq_config_TX.Frequency) { // show the TX offset symbol
|
||||||
int i = vfoInfo->TX_OFFSET_FREQUENCY_DIRECTION % 3;
|
int i = vfoInfo->TX_OFFSET_FREQUENCY_DIRECTION % 3;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
const char dir_list[][2] = {"", "+", "-", "D"};
|
const char dir_list[][2] = {"", "+", "-", "D"};
|
||||||
|
|
||||||
if(gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION != 0 && gTxVfo->pTX == &gTxVfo->freq_config_RX && !vfoInfo->FrequencyReverse)
|
if(gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION != 0 && gTxVfo->pTX == &gTxVfo->freq_config_RX && !vfoInfo->FrequencyReverse)
|
||||||
{
|
{
|
||||||
i = 3;
|
i = 3;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
const char dir_list[][2] = {"", "+", "-"};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
|
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
|
||||||
@@ -1078,49 +979,28 @@ void UI_DisplayMain(void) {
|
|||||||
if (vfoInfo->FrequencyReverse)
|
if (vfoInfo->FrequencyReverse)
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
{
|
{
|
||||||
UI_PrintStringSmallNormal("R", LCD_WIDTH + 68, 0, line + 1);
|
UI_PrintStringSmallNormal("R", LCD_WIDTH + 110, 0, line + 1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1);
|
UI_PrintStringSmallNormal("R", LCD_WIDTH + 110, 0, line + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
bool narrower = 0;
|
|
||||||
|
|
||||||
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1) {
|
|
||||||
narrower = 1;
|
|
||||||
}
|
|
||||||
const char *bandWidthNames[] = {"WID", "NAR", "NR+"};
|
const char *bandWidthNames[] = {"WID", "NAR", "NR+"};
|
||||||
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 30, 0,
|
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], LCD_WIDTH + 30, 0,
|
||||||
line);
|
line);
|
||||||
#else
|
|
||||||
if (gSetting_set_gui)
|
|
||||||
{
|
|
||||||
const char *bandWidthNames[] = {"W", "N"};
|
|
||||||
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], LCD_WIDTH + 80, 0, line + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const char *bandWidthNames[] = {"WIDE", "NAR"};
|
|
||||||
GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], 91, line == 0 ? 17 : 49, false, true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
||||||
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
|
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
// show the DTMF decoding symbol
|
|
||||||
if (vfoInfo->DTMF_DECODING_ENABLE)
|
|
||||||
UI_PrintStringSmallNormal("DTMF", LCD_WIDTH + 78, 0, line + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// show the audio scramble symbol
|
// show the audio scramble symbol
|
||||||
if (vfoInfo->SCRAMBLING_TYPE > 0) {
|
if (vfoInfo->SCRAMBLING_TYPE > 0) {
|
||||||
sprintf(String, "S%d", vfoInfo->SCRAMBLING_TYPE + 25);
|
sprintf(String, "S%d", inverse_scale_freq(vfoInfo->SCRAMBLING_TYPE));
|
||||||
UI_PrintStringSmallNormal(String, 105, 0, line + 2);
|
UI_PrintStringSmallNormal(String, 90, 0, line + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
@@ -1156,9 +1036,6 @@ void UI_DisplayMain(void) {
|
|||||||
if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].Modulation == MODULATION_AM && gSetting_AM_fix)
|
if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].Modulation == MODULATION_AM && gSetting_AM_fix)
|
||||||
{
|
{
|
||||||
if (gScreenToDisplay != DISPLAY_MAIN
|
if (gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1182,9 +1059,6 @@ void UI_DisplayMain(void) {
|
|||||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MAIN
|
if (gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1223,9 +1097,6 @@ void UI_DisplayMain(void) {
|
|||||||
else if (gChargingWithTypeC)
|
else if (gChargingWithTypeC)
|
||||||
{ // charging .. show the battery state
|
{ // charging .. show the battery state
|
||||||
if (gScreenToDisplay != DISPLAY_MAIN
|
if (gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ extern const int8_t dBmCorrTable[7];
|
|||||||
void UI_DisplayAudioBar(void);
|
void UI_DisplayAudioBar(void);
|
||||||
void UI_MAIN_TimeSlice500ms(void);
|
void UI_MAIN_TimeSlice500ms(void);
|
||||||
void UI_DisplayMain(void);
|
void UI_DisplayMain(void);
|
||||||
|
bool isMainOnly();
|
||||||
|
|
||||||
#ifdef ENABLE_AGC_SHOW_DATA
|
#ifdef ENABLE_AGC_SHOW_DATA
|
||||||
void UI_MAIN_PrintAGC(bool force);
|
void UI_MAIN_PrintAGC(bool force);
|
||||||
|
|||||||
262
ui/menu.c
262
ui/menu.c
@@ -48,7 +48,7 @@ const t_menu_item MenuList[] =
|
|||||||
{"TCTCS", MENU_T_CTCS}, // was "T_CTCS"
|
{"TCTCS", MENU_T_CTCS}, // was "T_CTCS"
|
||||||
{"TxODir", MENU_SFT_D}, // was "SFT_D"
|
{"TxODir", MENU_SFT_D}, // was "SFT_D"
|
||||||
{"TxOffs", MENU_OFFSET}, // was "OFFSET"
|
{"TxOffs", MENU_OFFSET}, // was "OFFSET"
|
||||||
{"W/N", MENU_W_N},
|
{"WID", MENU_W_N},
|
||||||
{"SCR", MENU_SCR}, // was "SCR"
|
{"SCR", MENU_SCR}, // was "SCR"
|
||||||
{"BusyL", MENU_BCL}, // was "BCL"
|
{"BusyL", MENU_BCL}, // was "BCL"
|
||||||
{"COMP", MENU_COMPAND},
|
{"COMP", MENU_COMPAND},
|
||||||
@@ -79,7 +79,7 @@ const t_menu_item MenuList[] =
|
|||||||
{"ML", MENU_MLONG},
|
{"ML", MENU_MLONG},
|
||||||
|
|
||||||
{"KeyLck", MENU_AUTOLK}, // was "AUTOLk"
|
{"KeyLck", MENU_AUTOLK}, // was "AUTOLk"
|
||||||
{"TxTOut", MENU_TOT}, // was "TOT"
|
{"TXTime", MENU_TOT},
|
||||||
{"BatSav", MENU_SAVE}, // was "SAVE"
|
{"BatSav", MENU_SAVE}, // was "SAVE"
|
||||||
{"BatTxt", MENU_BAT_TXT},
|
{"BatTxt", MENU_BAT_TXT},
|
||||||
{"Mic", MENU_MIC},
|
{"Mic", MENU_MIC},
|
||||||
@@ -101,23 +101,13 @@ const t_menu_item MenuList[] =
|
|||||||
{"1 Call", MENU_1_CALL},
|
{"1 Call", MENU_1_CALL},
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
{"AlarmT", MENU_AL_MOD},
|
{"AlarmT", MENU_AL_MOD},
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
{"ANI ID", MENU_ANI_ID },
|
|
||||||
#endif
|
#endif
|
||||||
{"UPCode", MENU_UPCODE},
|
{"UPCode", MENU_UPCODE},
|
||||||
{"DNCode", MENU_DWCODE},
|
{"DNCode", MENU_DWCODE},
|
||||||
{"PTT ID", MENU_PTT_ID},
|
{"PTT ID", MENU_PTT_ID},
|
||||||
{"L DTMF", MENU_D_ST},
|
{"L DTMF", MENU_D_ST},
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
{"D Resp", MENU_D_RSP },
|
|
||||||
{"D Hold", MENU_D_HOLD },
|
|
||||||
#endif
|
|
||||||
{"D Prel", MENU_D_PRE},
|
{"D Prel", MENU_D_PRE},
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
{"D Decd", MENU_D_DCD },
|
|
||||||
{"D List", MENU_D_LIST },
|
|
||||||
#endif
|
|
||||||
{"D Live", MENU_D_LIVE_DEC}, // live DTMF decoder
|
{"D Live", MENU_D_LIVE_DEC}, // live DTMF decoder
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
#ifndef ENABLE_FEAT_F4HWN
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
@@ -131,24 +121,14 @@ const t_menu_item MenuList[] =
|
|||||||
{"Sql", MENU_SQL},
|
{"Sql", MENU_SQL},
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
{"SPTT", MENU_SET_PTT},
|
{"SPTT", MENU_SET_PTT},
|
||||||
{"STOT", MENU_SET_TOT},
|
|
||||||
{"SEOT", MENU_SET_EOT},
|
|
||||||
{"SCtr", MENU_SET_CTR},
|
|
||||||
{"SInv", MENU_SET_INV},
|
{"SInv", MENU_SET_INV},
|
||||||
{"SLck", MENU_SET_LCK},
|
|
||||||
{"STmr", MENU_SET_TMR},
|
{"STmr", MENU_SET_TMR},
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
{"SOff", MENU_SET_OFF},
|
{"SOff", MENU_SET_OFF},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
{"SNFM", MENU_SET_NFM},
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
{"SVol", MENU_SET_VOL},
|
{"SVol", MENU_SET_VOL},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
{"SKey", MENU_SET_KEY },
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
{"SNWR", MENU_NOAA_S },
|
{"SNWR", MENU_NOAA_S },
|
||||||
#endif
|
#endif
|
||||||
@@ -184,10 +164,11 @@ const char gSubMenu_SFT_D[][4] =
|
|||||||
"-"
|
"-"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_W_N[][7] =
|
const char gSubMenu_W_N[][5] =
|
||||||
{
|
{
|
||||||
"WIDE",
|
"WIDE",
|
||||||
"NARR"
|
"NARR",
|
||||||
|
"NAR+"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_OFF_ON[][4] =
|
const char gSubMenu_OFF_ON[][4] =
|
||||||
@@ -205,8 +186,8 @@ const char *const gSubMenu_RXMode[] =
|
|||||||
{
|
{
|
||||||
"MAIN", // TX and RX on main only
|
"MAIN", // TX and RX on main only
|
||||||
"RESP", // Watch both and respond
|
"RESP", // Watch both and respond
|
||||||
"XBAND ONLY", // TX on main, RX on secondary
|
"XBAND", // TX on main, RX on secondary
|
||||||
"DUALMON" // always TX on main, but RX on both
|
"DMON" // always TX on main, but RX on both
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -221,7 +202,7 @@ const char gSubMenu_VOICE[][4] =
|
|||||||
const char *const gSubMenu_MDF[] =
|
const char *const gSubMenu_MDF[] =
|
||||||
{
|
{
|
||||||
"FREQ",
|
"FREQ",
|
||||||
"CHNUMB",
|
"CHNUM",
|
||||||
"NAME",
|
"NAME",
|
||||||
"NAME\n+\nFREQ"
|
"NAME\n+\nFREQ"
|
||||||
};
|
};
|
||||||
@@ -234,16 +215,6 @@ const char gSubMenu_AL_MOD[][5] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
const char gSubMenu_D_RSP[][11] =
|
|
||||||
{
|
|
||||||
"DO\nNOTHING",
|
|
||||||
"RING",
|
|
||||||
"REPLY",
|
|
||||||
"BOTH"
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *const gSubMenu_PTT_ID[] =
|
const char *const gSubMenu_PTT_ID[] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"OFF",
|
||||||
@@ -253,13 +224,14 @@ const char *const gSubMenu_PTT_ID[] =
|
|||||||
"APOLLO"
|
"APOLLO"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_FSKMod[][8] =
|
const char gSubMenu_FSKMod[][6] =
|
||||||
{
|
{
|
||||||
"450",
|
"450",
|
||||||
"700",
|
"700",
|
||||||
|
"1200",
|
||||||
|
"2400",
|
||||||
"A1200",
|
"A1200",
|
||||||
"A2400",
|
"A2400",
|
||||||
"2400",
|
|
||||||
"NOAA"
|
"NOAA"
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -305,14 +277,14 @@ const char gSubMenu_RX_TX[][6] =
|
|||||||
"TX/RX"
|
"TX/RX"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_BAT_TXT[][8] =
|
const char gSubMenu_BAT_TXT[][5] =
|
||||||
{
|
{
|
||||||
"NONE",
|
"NONE",
|
||||||
"VLT",
|
"VLT",
|
||||||
"PRC"
|
"PRC"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_BATTYP[][9] =
|
const char gSubMenu_BATTYP[][3] =
|
||||||
{
|
{
|
||||||
"16",
|
"16",
|
||||||
"22",
|
"22",
|
||||||
@@ -321,38 +293,11 @@ const char gSubMenu_BATTYP[][9] =
|
|||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
|
|
||||||
const char gSubMenu_SET_PTT[][8] =
|
const char gSubMenu_SET_PTT[][4] =
|
||||||
{
|
{
|
||||||
"HOLD",
|
"HOL",
|
||||||
"TAP"
|
"TOG",
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_SET_TOT[][7] = // Use by SET_EOT too
|
|
||||||
{
|
|
||||||
"OFF",
|
|
||||||
"SND",
|
|
||||||
"VIS",
|
|
||||||
"ALL"
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
const char gSubMenu_SET_NFM[][9] =
|
|
||||||
{
|
|
||||||
"NRW",
|
|
||||||
"NRWER"
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
const char gSubMenu_SET_KEY[][9] =
|
|
||||||
{
|
|
||||||
"KEY_MENU",
|
|
||||||
"KEY_UP",
|
|
||||||
"KEY_DOWN",
|
|
||||||
"KEY_EXIT",
|
|
||||||
"KEY_STAR"
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
|
const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
|
||||||
@@ -389,16 +334,11 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
{"RX MOD", ACTION_OPT_RXMODE},
|
{"RX MOD", ACTION_OPT_RXMODE},
|
||||||
{"MAIN ONLY", ACTION_OPT_MAINONLY},
|
|
||||||
{"PTT", ACTION_OPT_PTT},
|
{"PTT", ACTION_OPT_PTT},
|
||||||
{"WIDE\nNAR", ACTION_OPT_WN},
|
{"WIDE\nNAR", ACTION_OPT_WN},
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
{"MUTE", ACTION_OPT_MUTE},
|
{"MUTE", ACTION_OPT_MUTE},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
{"POWER\nHIGH", ACTION_OPT_POWER_HIGH},
|
|
||||||
{"REMOVE\nOFFSET", ACTION_OPT_REMOVE_OFFSET},
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -435,9 +375,6 @@ void UI_DisplayMenu(void) {
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char Contact[16];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UI_DisplayClear();
|
UI_DisplayClear();
|
||||||
|
|
||||||
@@ -544,15 +481,9 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
uint8_t gaugeLine = 0;
|
|
||||||
uint8_t gaugeMin = 0;
|
|
||||||
uint8_t gaugeMax = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (UI_MENU_GetCurrentMenuId()) {
|
switch (UI_MENU_GetCurrentMenuId()) {
|
||||||
case MENU_SQL:
|
case MENU_SQL:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%ld", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_MIC: { // display the mic gain in actual dB rather than just an index number
|
case MENU_MIC: { // display the mic gain in actual dB rather than just an index number
|
||||||
@@ -605,7 +536,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_OFFSET:
|
case MENU_OFFSET:
|
||||||
if (!gIsInSubMenu || gInputBoxIndex == 0) {
|
if (!gIsInSubMenu || gInputBoxIndex == 0) {
|
||||||
sprintf(String, "%3d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
sprintf(String, "%3ld.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
|
||||||
} else {
|
} else {
|
||||||
const char *ascii = INPUTBOX_GetAscii();
|
const char *ascii = INPUTBOX_GetAscii();
|
||||||
@@ -624,17 +555,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
if (gSubMenuSelection > 0) {
|
if (gSubMenuSelection > 0) {
|
||||||
sprintf(String, "%d00", gSubMenuSelection + 25);
|
sprintf(String, "%huHz\n%ld", inverse_scale_freq(gSubMenuSelection), gSubMenuSelection);
|
||||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(String, "OFF");
|
strcpy(String, "OFF");
|
||||||
BK4819_DisableScramble();
|
|
||||||
}
|
}
|
||||||
|
BK4819_SetScramble(gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
case MENU_VOX:
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%u", gSubMenuSelection);
|
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%lu", gSubMenuSelection);
|
||||||
#else
|
#else
|
||||||
strcpy(String, gSubMenu_NA);
|
strcpy(String, gSubMenu_NA);
|
||||||
#endif
|
#endif
|
||||||
@@ -644,13 +574,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
} else if (gSubMenuSelection < 61) {
|
} else if (gSubMenuSelection < 61) {
|
||||||
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60));
|
sprintf(String, "%02ldm:%02lds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
//ST7565_Gauge(4, 1, 60, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 60;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(String, "ON");
|
strcpy(String, "ON");
|
||||||
}
|
}
|
||||||
@@ -662,7 +586,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_ABR_MIN:
|
case MENU_ABR_MIN:
|
||||||
case MENU_ABR_MAX:
|
case MENU_ABR_MAX:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%ld", gSubMenuSelection);
|
||||||
if (gIsInSubMenu)
|
if (gIsInSubMenu)
|
||||||
BACKLIGHT_SetBrightness(gSubMenuSelection);
|
BACKLIGHT_SetBrightness(gSubMenuSelection);
|
||||||
// Obsolete ???
|
// Obsolete ???
|
||||||
@@ -674,22 +598,24 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
strcpy(String, gModulationStr[gSubMenuSelection]);
|
strcpy(String, gModulationStr[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_TOT:
|
||||||
|
if (gSubMenuSelection == 0) {
|
||||||
|
strcpy(String, "OFF");
|
||||||
|
} else {
|
||||||
|
sprintf(String, "%02ldm:%02lds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_AUTOLK:
|
case MENU_AUTOLK:
|
||||||
if (gSubMenuSelection == 0)
|
if (gSubMenuSelection == 0)
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
else {
|
else {
|
||||||
sprintf(String, "%02dm:%02ds", ((gSubMenuSelection * 15) / 60), ((gSubMenuSelection * 15) % 60));
|
sprintf(String, "%02ldm:%02lds", ((gSubMenuSelection * 15) / 60), ((gSubMenuSelection * 15) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
//ST7565_Gauge(4, 1, 40, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 40;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_FSKSRC:
|
case MENU_FSKSRC:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%ld", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_COMPAND:
|
case MENU_COMPAND:
|
||||||
@@ -709,9 +635,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
case MENU_S_ADD3:
|
case MENU_S_ADD3:
|
||||||
case MENU_STE:
|
case MENU_STE:
|
||||||
case MENU_D_ST:
|
case MENU_D_ST:
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_DCD:
|
|
||||||
#endif
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
case MENU_NOAA_S:
|
case MENU_NOAA_S:
|
||||||
@@ -732,7 +655,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
||||||
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
||||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -767,7 +690,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
||||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0) /*, 8 */);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0) /*, 8 */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -777,23 +700,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MENU_SAVE:
|
case MENU_SAVE:
|
||||||
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "1:%u", gSubMenuSelection);
|
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "1:%ld", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
strcpy(String, gSubMenu_RXMode[gSubMenuSelection]);
|
strcpy(String, gSubMenu_RXMode[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
|
||||||
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60));
|
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
//ST7565_Gauge(4, 5, 179, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 5;
|
|
||||||
gaugeMax = 179;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
case MENU_VOICE:
|
case MENU_VOICE:
|
||||||
strcpy(String, gSubMenu_VOICE[gSubMenuSelection]);
|
strcpy(String, gSubMenu_VOICE[gSubMenuSelection]);
|
||||||
@@ -804,22 +717,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, "STOP");
|
strcpy(String, "STOP");
|
||||||
} else if (gSubMenuSelection < 81) {
|
} else if (gSubMenuSelection < 81) {
|
||||||
sprintf(String, "CARRIER\n%02ds:%03dms", ((gSubMenuSelection * 250) / 1000),
|
sprintf(String, "CARRIER\n%02lds:%03ldms", ((gSubMenuSelection * 250) / 1000),
|
||||||
((gSubMenuSelection * 250) % 1000));
|
((gSubMenuSelection * 250) % 1000));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(5, 1, 80, gSubMenuSelection);
|
//ST7565_Gauge(5, 1, 80, gSubMenuSelection);
|
||||||
gaugeLine = 5;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 80;
|
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
sprintf(String, "TIMEOUT\n%02dm:%02ds", (((gSubMenuSelection - 80) * 5) / 60),
|
sprintf(String, "TIMEOUT\n%02ldm:%02lds", (((gSubMenuSelection - 80) * 5) / 60),
|
||||||
(((gSubMenuSelection - 80) * 5) % 60));
|
(((gSubMenuSelection - 80) * 5) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(5, 80, 104, gSubMenuSelection);
|
//ST7565_Gauge(5, 80, 104, gSubMenuSelection);
|
||||||
gaugeLine = 5;
|
|
||||||
gaugeMin = 80;
|
|
||||||
gaugeMax = 104;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -829,14 +736,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_RP_STE:
|
case MENU_RP_STE:
|
||||||
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%u*100ms", gSubMenuSelection);
|
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%lu*100ms", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
if (gSubMenuSelection == 0)
|
if (gSubMenuSelection == 0)
|
||||||
strcpy(String, "LIST [0]\nNO LIST");
|
strcpy(String, "LIST [0]\nNO LIST");
|
||||||
else if (gSubMenuSelection < 4)
|
else if (gSubMenuSelection < 4)
|
||||||
sprintf(String, "LIST [%u]", gSubMenuSelection);
|
sprintf(String, "LIST [%lu]", gSubMenuSelection);
|
||||||
else if (gSubMenuSelection == 4)
|
else if (gSubMenuSelection == 4)
|
||||||
strcpy(String, "LISTS\n[1, 2, 3]");
|
strcpy(String, "LISTS\n[1, 2, 3]");
|
||||||
else if (gSubMenuSelection == 5)
|
else if (gSubMenuSelection == 5)
|
||||||
@@ -849,11 +756,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_ANI_ID:
|
|
||||||
strcpy(String, gEeprom.ANI_DTMF_ID);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_UPCODE:
|
case MENU_UPCODE:
|
||||||
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_UP_CODE, gEeprom.DTMF_UP_CODE + 8);
|
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_UP_CODE, gEeprom.DTMF_UP_CODE + 8);
|
||||||
break;
|
break;
|
||||||
@@ -862,17 +764,8 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_DOWN_CODE, gEeprom.DTMF_DOWN_CODE + 8);
|
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_DOWN_CODE, gEeprom.DTMF_DOWN_CODE + 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_RSP:
|
|
||||||
strcpy(String, gSubMenu_D_RSP[gSubMenuSelection]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
|
||||||
sprintf(String, "%ds", gSubMenuSelection);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
sprintf(String, "%d*10ms", gSubMenuSelection);
|
sprintf(String, "%ld*10ms", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_PTT_ID:
|
case MENU_PTT_ID:
|
||||||
@@ -883,15 +776,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
strcpy(String, gSubMenu_BAT_TXT[gSubMenuSelection]);
|
strcpy(String, gSubMenu_BAT_TXT[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_LIST:
|
|
||||||
gIsDtmfContactValid = DTMF_GetContact((int)gSubMenuSelection - 1, Contact);
|
|
||||||
if (!gIsDtmfContactValid)
|
|
||||||
strcpy(String, "NULL");
|
|
||||||
else
|
|
||||||
memcpy(String, Contact, 8);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case MENU_FSKMOD:
|
case MENU_FSKMOD:
|
||||||
strcpy(String, gSubMenu_FSKMod[gSubMenuSelection]);
|
strcpy(String, gSubMenu_FSKMod[gSubMenuSelection]);
|
||||||
@@ -916,7 +800,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
writeXtalFreqCal(gSubMenuSelection, false);
|
writeXtalFreqCal(gSubMenuSelection, false);
|
||||||
|
|
||||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
sprintf(String, "%ld\n%lu.%06lu\nMHz",
|
||||||
gSubMenuSelection,
|
gSubMenuSelection,
|
||||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||||
}
|
}
|
||||||
@@ -925,7 +809,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_BATCAL: {
|
case MENU_BATCAL: {
|
||||||
const uint16_t vol = (uint32_t) gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
const uint16_t vol = (uint32_t) gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
||||||
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, gSubMenuSelection);
|
sprintf(String, "%u.%02dV\n%lu", vol / 100, vol % 100, gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -946,13 +830,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
} else if (gSubMenuSelection < 121) {
|
} else if (gSubMenuSelection < 121) {
|
||||||
sprintf(String, "%dh:%02dm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
|
sprintf(String, "%ldh:%02ldm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
//ST7565_Gauge(4, 1, 120, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 120;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -962,21 +840,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
|
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_SET_TOT:
|
|
||||||
case MENU_SET_EOT:
|
|
||||||
strcpy(String, gSubMenu_SET_TOT[gSubMenuSelection]); // Same as SET_TOT
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
|
||||||
gSetting_set_ctr = gSubMenuSelection;
|
|
||||||
ST7565_ContrastAndInv();
|
|
||||||
#else
|
|
||||||
strcpy(String, gSubMenu_NA);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
#ifdef ENABLE_FEAT_F4HWN_INV
|
#ifdef ENABLE_FEAT_F4HWN_INV
|
||||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
||||||
@@ -986,23 +849,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
case MENU_SET_NFM:
|
|
||||||
strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
case MENU_SET_VOL:
|
case MENU_SET_VOL:
|
||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
} else if (gSubMenuSelection < 64) {
|
} else if (gSubMenuSelection < 64) {
|
||||||
sprintf(String, "%02u", gSubMenuSelection);
|
sprintf(String, "%02lu", gSubMenuSelection);
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(4, 1, 63, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 63;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
||||||
@@ -1013,12 +866,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
case MENU_SET_KEY:
|
|
||||||
strcpy(String, gSubMenu_SET_KEY[gSubMenuSelection]);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1108,12 +955,12 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
|
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
|
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
|
||||||
sprintf(String, "PRI%d:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
sprintf(String, "PRI%ld:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 3 , 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 3 , 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
|
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
|
||||||
sprintf(String, "PRI%d:%u", 2, gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
sprintf(String, "PRI%ld:%u", 2, gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -1135,24 +982,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
|
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 */);
|
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) {
|
|
||||||
Contact[11] = 0;
|
|
||||||
memcpy(&gDTMF_ID, Contact + 8, 4);
|
|
||||||
sprintf(String, "ID:%4s", gDTMF_ID);
|
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (UI_MENU_GetCurrentMenuId() == MENU_R_CTCS ||
|
if (UI_MENU_GetCurrentMenuId() == MENU_R_CTCS ||
|
||||||
UI_MENU_GetCurrentMenuId() == MENU_T_CTCS ||
|
UI_MENU_GetCurrentMenuId() == MENU_T_CTCS ||
|
||||||
UI_MENU_GetCurrentMenuId() == MENU_R_DCS ||
|
UI_MENU_GetCurrentMenuId() == MENU_R_DCS ||
|
||||||
UI_MENU_GetCurrentMenuId() == MENU_T_DCS
|
UI_MENU_GetCurrentMenuId() == MENU_T_DCS
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| UI_MENU_GetCurrentMenuId() == MENU_D_LIST
|
|
||||||
#endif
|
|
||||||
) {
|
) {
|
||||||
sprintf(String, "%2d", gSubMenuSelection);
|
sprintf(String, "%2ld", gSubMenuSelection);
|
||||||
UI_PrintStringSmallNormal(String, 105, 0, 0);
|
UI_PrintStringSmallNormal(String, 105, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
42
ui/menu.h
42
ui/menu.h
@@ -74,23 +74,12 @@ enum {
|
|||||||
MENU_SLIST3,
|
MENU_SLIST3,
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
MENU_AL_MOD,
|
MENU_AL_MOD,
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
MENU_ANI_ID,
|
|
||||||
#endif
|
#endif
|
||||||
MENU_UPCODE,
|
MENU_UPCODE,
|
||||||
MENU_DWCODE,
|
MENU_DWCODE,
|
||||||
MENU_PTT_ID,
|
MENU_PTT_ID,
|
||||||
MENU_D_ST,
|
MENU_D_ST,
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
MENU_D_RSP,
|
|
||||||
MENU_D_HOLD,
|
|
||||||
#endif
|
|
||||||
MENU_D_PRE,
|
MENU_D_PRE,
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
MENU_D_DCD,
|
|
||||||
MENU_D_LIST,
|
|
||||||
#endif
|
|
||||||
MENU_D_LIVE_DEC,
|
MENU_D_LIVE_DEC,
|
||||||
MENU_FSKSRC,
|
MENU_FSKSRC,
|
||||||
MENU_FSKMOD,
|
MENU_FSKMOD,
|
||||||
@@ -115,21 +104,11 @@ enum {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
MENU_SET_PTT,
|
MENU_SET_PTT,
|
||||||
MENU_SET_TOT,
|
|
||||||
MENU_SET_EOT,
|
|
||||||
MENU_SET_CTR,
|
|
||||||
MENU_SET_INV,
|
MENU_SET_INV,
|
||||||
MENU_SET_LCK,
|
|
||||||
MENU_SET_TMR,
|
MENU_SET_TMR,
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
MENU_SET_NFM,
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
MENU_SET_VOL,
|
MENU_SET_VOL,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
MENU_SET_KEY,
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
MENU_NOAA_S,
|
MENU_NOAA_S,
|
||||||
#endif
|
#endif
|
||||||
@@ -147,10 +126,9 @@ extern const t_menu_item MenuList[];
|
|||||||
|
|
||||||
extern const char gSubMenu_TXP[7][5];
|
extern const char gSubMenu_TXP[7][5];
|
||||||
extern const char gSubMenu_SFT_D[3][4];
|
extern const char gSubMenu_SFT_D[3][4];
|
||||||
extern const char gSubMenu_W_N[2][7];
|
extern const char gSubMenu_W_N[3][5];
|
||||||
extern const char gSubMenu_OFF_ON[2][4];
|
extern const char gSubMenu_OFF_ON[2][4];
|
||||||
extern const char gSubMenu_NA[4];
|
extern const char gSubMenu_NA[4];
|
||||||
extern const char gSubMenu_TOT[11][7];
|
|
||||||
extern const char *const gSubMenu_RXMode[4];
|
extern const char *const gSubMenu_RXMode[4];
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -160,29 +138,19 @@ extern const char *const gSubMenu_MDF[4];
|
|||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
extern const char gSubMenu_AL_MOD[2][5];
|
extern const char gSubMenu_AL_MOD[2][5];
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
extern const char gSubMenu_D_RSP[4][11];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
extern const char gSubMenu_SET_PTT[2][8];
|
extern const char gSubMenu_SET_PTT[2][4];
|
||||||
extern const char gSubMenu_SET_TOT[4][7];
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
extern const char gSubMenu_SET_NFM[2][9];
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
extern const char gSubMenu_SET_KEY[][9];
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const char *const gSubMenu_PTT_ID[5];
|
extern const char *const gSubMenu_PTT_ID[5];
|
||||||
extern const char gSubMenu_FSKMod[6][8];
|
extern const char gSubMenu_FSKMod[7][6];
|
||||||
extern const char gSubMenu_ROGER[3][6];
|
extern const char gSubMenu_ROGER[3][6];
|
||||||
extern const char gSubMenu_RESET[2][4];
|
extern const char gSubMenu_RESET[2][4];
|
||||||
extern const char *const gSubMenu_F_LOCK[F_LOCK_LEN];
|
extern const char *const gSubMenu_F_LOCK[F_LOCK_LEN];
|
||||||
extern const char gSubMenu_RX_TX[4][6];
|
extern const char gSubMenu_RX_TX[4][6];
|
||||||
extern const char gSubMenu_BAT_TXT[3][8];
|
extern const char gSubMenu_BAT_TXT[3][5];
|
||||||
extern const char gSubMenu_BATTYP[3][9];
|
extern const char gSubMenu_BATTYP[3][3];
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
|
|||||||
84
ui/messages.c
Normal file
84
ui/messages.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "messages.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Convert a 32-bit number to a string (10 digits, zero-padded)
|
||||||
|
void u32_to_str(uint32_t num, char *str) {
|
||||||
|
for (int i = 9; i >= 0; i--) {
|
||||||
|
str[i] = '0' + (num % 10);
|
||||||
|
num /= 10;
|
||||||
|
}
|
||||||
|
str[10] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert an 8-bit number to a 2-digit string (zero-padded)
|
||||||
|
void u8_to_str(uint8_t num, char *str) {
|
||||||
|
str[0] = '0' + (num / 100); // Hundreds place
|
||||||
|
str[1] = '0' + ((num / 10) % 10); // Tens place
|
||||||
|
str[2] = '0' + (num % 10); // Ones place
|
||||||
|
str[3] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_DisplayMessages(void) {
|
||||||
|
char String[19];
|
||||||
|
UI_DisplayClear();
|
||||||
|
if (gEnteringSMS != SMS_NOT_ENTERING) {
|
||||||
|
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||||
|
UI_PrintString("SMS dest", 0, 0, 0 /*, 8 */);
|
||||||
|
u32_to_str(dataPacket.dest, String);
|
||||||
|
UI_PrintStringSmallNormal(String, 0, 0, 2);
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
UI_PrintString("SMS data", 0, 0, 0 /*, 8 */);
|
||||||
|
UI_PrintStringSmallNormal((const char *) dataPacket.data, 1, 0, 1);
|
||||||
|
memset(gFrameBuffer[1] + 2 + (7 * strlen((const char *) dataPacket.data)), gKeyTimeout == 0 ? 0xFF : 0x80,
|
||||||
|
6);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uint8_t Data[8];
|
||||||
|
EEPROM_ReadBuffer(SEQParameterEEPROM, Data, 8);
|
||||||
|
uint8_t msgIndex = Data[1]; // index of latest written message
|
||||||
|
|
||||||
|
// Determine oldest message index (next to be overwritten)
|
||||||
|
uint8_t startIndex = (msgIndex + 1) % MESSAGES_COUNT;
|
||||||
|
|
||||||
|
// Each bank shows 3 messages
|
||||||
|
uint8_t messagesPerPage = 3;
|
||||||
|
|
||||||
|
// Compute offset for scrolling (0 = newest, higher = older)
|
||||||
|
uint8_t pageOffset = gActiveMessageBank * messagesPerPage;
|
||||||
|
|
||||||
|
for (uint8_t ixa = 0; ixa < messagesPerPage; ixa++) {
|
||||||
|
// Logical order from oldest to newest
|
||||||
|
uint8_t logicalIndex = (startIndex + pageOffset + ixa) % MESSAGES_COUNT;
|
||||||
|
|
||||||
|
// If out of stored range, stop
|
||||||
|
if (pageOffset + ixa >= MESSAGES_COUNT)
|
||||||
|
break;
|
||||||
|
|
||||||
|
gActiveMessage = logicalIndex;
|
||||||
|
MESSAGES_GET();
|
||||||
|
|
||||||
|
// Build the display string
|
||||||
|
u32_to_str(gActiveMessage == MESSAGES_COUNT ? dataPacket.dest : loadedPacket.src, &String[0]);
|
||||||
|
String[10] = '-';
|
||||||
|
u8_to_str(loadedPacket.seq, &String[11]);
|
||||||
|
String[14] = '-';
|
||||||
|
|
||||||
|
// Display a visual index (0,1,2,3... not EEPROM slot)
|
||||||
|
uint8_t visualIndex = ixa + (gActiveMessageBank * 3);
|
||||||
|
String[15] = (visualIndex < 10) ? ('0' + visualIndex) : ('A' + visualIndex - 10);
|
||||||
|
String[16] = '-';
|
||||||
|
String[17] = (gActiveMessage < 10) ? ('0' + gActiveMessage) : ('A' + gActiveMessage - 10);
|
||||||
|
String[18] = 0;
|
||||||
|
|
||||||
|
// Print both metadata and message
|
||||||
|
UI_PrintString(String, 2, 0, ixa * 2);
|
||||||
|
UI_PrintString((const char *) loadedPacket.data, 2, 0, ixa * 2 + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ST7565_BlitFullScreen();
|
||||||
|
}
|
||||||
18
ui/messages.h
Normal file
18
ui/messages.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BRNQUANFW_MESSAGES_H
|
||||||
|
#define BRNQUANFW_MESSAGES_H
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "helper.h"
|
||||||
|
#include "../driver/st7565.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "../app/messages.h"
|
||||||
|
#include "../app/fskmodem.h"
|
||||||
|
|
||||||
|
void UI_DisplayMessages(void);
|
||||||
|
void u8_to_str(uint8_t num, char *str);
|
||||||
|
void u32_to_str(uint32_t num, char *str);
|
||||||
|
|
||||||
|
#endif //BRNQUANFW_MESSAGES_H
|
||||||
22
ui/status.c
22
ui/status.c
@@ -54,6 +54,17 @@ static void convertTime(uint8_t *line, uint8_t type)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//static const char* const FunctionStrings[] = {
|
||||||
|
// [FUNCTION_FOREGROUND] = "FG",
|
||||||
|
// [FUNCTION_TRANSMIT] = "TX",
|
||||||
|
// [FUNCTION_MONITOR] = "MON",
|
||||||
|
// [FUNCTION_INCOMING] = "INC",
|
||||||
|
// [FUNCTION_RECEIVE] = "RX",
|
||||||
|
// [FUNCTION_POWER_SAVE] = "PWS",
|
||||||
|
// [FUNCTION_BAND_SCOPE] = "BS",
|
||||||
|
// [FUNCTION_N_ELEM] = "NE"
|
||||||
|
//};
|
||||||
|
|
||||||
void UI_DisplayStatus()
|
void UI_DisplayStatus()
|
||||||
{
|
{
|
||||||
char str[8] = "";
|
char str[8] = "";
|
||||||
@@ -227,10 +238,6 @@ void UI_DisplayStatus()
|
|||||||
size = sizeof(gFontMute);
|
size = sizeof(gFontMute);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (gBackLight) {
|
|
||||||
src = gFontLight;
|
|
||||||
size = sizeof(gFontLight);
|
|
||||||
}
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CHARGING_C
|
#ifdef ENABLE_FEAT_F4HWN_CHARGING_C
|
||||||
else if (gChargingWithTypeC) {
|
else if (gChargingWithTypeC) {
|
||||||
src = BITMAP_USB_C;
|
src = BITMAP_USB_C;
|
||||||
@@ -239,9 +246,7 @@ void UI_DisplayStatus()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Perform the memcpy if a source was selected
|
// Perform the memcpy if a source was selected
|
||||||
if (src) {
|
memcpy(line + x + 1, src, size);
|
||||||
memcpy(line + x + 1, src, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Battery
|
// Battery
|
||||||
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0;
|
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0;
|
||||||
@@ -282,5 +287,8 @@ void UI_DisplayStatus()
|
|||||||
|
|
||||||
// **************
|
// **************
|
||||||
|
|
||||||
|
// x2 -= (7 * strlen(str));
|
||||||
|
// UI_PrintStringSmallBufferNormal(FunctionStrings[gCurrentFunction], line + x2 - 20);
|
||||||
|
|
||||||
ST7565_BlitStatusLine();
|
ST7565_BlitStatusLine();
|
||||||
}
|
}
|
||||||
|
|||||||
2
ui/ui.c
2
ui/ui.c
@@ -39,6 +39,7 @@
|
|||||||
#include "ui/scanner.h"
|
#include "ui/scanner.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "../misc.h"
|
#include "../misc.h"
|
||||||
|
#include "messages.h"
|
||||||
|
|
||||||
GUI_DisplayType_t gScreenToDisplay;
|
GUI_DisplayType_t gScreenToDisplay;
|
||||||
GUI_DisplayType_t gRequestDisplayScreen = DISPLAY_INVALID;
|
GUI_DisplayType_t gRequestDisplayScreen = DISPLAY_INVALID;
|
||||||
@@ -52,6 +53,7 @@ void (*UI_DisplayFunctions[])(void) = {
|
|||||||
[DISPLAY_MAIN] = &UI_DisplayMain,
|
[DISPLAY_MAIN] = &UI_DisplayMain,
|
||||||
[DISPLAY_MENU] = &UI_DisplayMenu,
|
[DISPLAY_MENU] = &UI_DisplayMenu,
|
||||||
[DISPLAY_SCANNER] = &UI_DisplayScanner,
|
[DISPLAY_SCANNER] = &UI_DisplayScanner,
|
||||||
|
[DISPLAY_MESSAGES] = &UI_DisplayMessages,
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
[DISPLAY_FM] = &UI_DisplayFM,
|
[DISPLAY_FM] = &UI_DisplayFM,
|
||||||
|
|||||||
Reference in New Issue
Block a user