Do some stuff
All checks were successful
Build Firmware / build (push) Successful in 2m19s

This commit is contained in:
2025-03-28 22:07:50 +01:00
parent 4fe99744e1
commit 85fb527020
23 changed files with 258 additions and 658 deletions

View File

@@ -4,12 +4,12 @@
# 1 = enable
# ---- STOCK QUANSHENG FEATURES ----
ENABLE_FMRADIO ?= 1
ENABLE_FMRADIO ?= 0
ENABLE_UART ?= 1
ENABLE_AIRCOPY ?= 0
ENABLE_NOAA ?= 0
ENABLE_VOICE ?= 0
ENABLE_VOX ?= 0
ENABLE_VOX ?= 1
ENABLE_ALARM ?= 0
ENABLE_TX1750 ?= 1
ENABLE_PWRON_PASSWORD ?= 0
@@ -47,7 +47,6 @@ ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 0
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
ENABLE_FEAT_F4HWN_SLEEP ?= 1
ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1
ENABLE_FEAT_F4HWN_NARROWER ?= 1
ENABLE_FEAT_F4HWN_INV ?= 1
ENABLE_FEAT_F4HWN_CTR ?= 0
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
@@ -449,9 +448,6 @@ endif
ifeq ($(ENABLE_FEAT_F4HWN_RESUME_STATE),1)
CFLAGS += -DENABLE_FEAT_F4HWN_RESUME_STATE
endif
ifeq ($(ENABLE_FEAT_F4HWN_NARROWER),1)
CFLAGS += -DENABLE_FEAT_F4HWN_NARROWER
endif
ifeq ($(ENABLE_FEAT_F4HWN_INV),1)
CFLAGS += -DENABLE_FEAT_F4HWN_INV
endif

View File

@@ -43,6 +43,7 @@
#include "ui/inputbox.h"
#include "ui/ui.h"
#include "driver/st7565.h"
#include "ui/menu.h"
#ifdef ENABLE_REGA
#include "app/rega.h"
@@ -128,10 +129,8 @@ void (*action_opt_table[])(void) = {
#else
[ACTION_OPT_MUTE] = &FUNCTION_NOP,
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
[ACTION_OPT_POWER_HIGH] = &ACTION_Power_High,
[ACTION_OPT_REMOVE_OFFSET] = &ACTION_Remove_Offset,
#endif
#else
[ACTION_OPT_RXMODE] = &FUNCTION_NOP,
#endif
@@ -145,8 +144,9 @@ static_assert(ARRAY_SIZE(action_opt_table) == ACTION_OPT_LEN);
void ACTION_Power(void)
{
if (++gTxVfo->OUTPUT_POWER > OUTPUT_POWER_HIGH)
gTxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
gTxVfo->OUTPUT_POWER++;
if (gTxVfo->OUTPUT_POWER >= ARRAY_SIZE(gSubMenu_TXP))
gTxVfo->OUTPUT_POWER = 0;
gRequestSaveChannel = 1;
@@ -561,40 +561,12 @@ void ACTION_Ptt(void)
void ACTION_Wn(void)
{
#ifdef ENABLE_FEAT_F4HWN_NARROWER
bool narrower = 0;
if (FUNCTION_IsRx())
{
gRxVfo->CHANNEL_BANDWIDTH = (gRxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0;
if(gRxVfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1)
{
narrower = 1;
gRxVfo->CHANNEL_BANDWIDTH++;
if (gRxVfo->CHANNEL_BANDWIDTH > BK4819_FILTER_BW_NARROWER) {
gRxVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_WIDE;
}
#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
BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH, true);
#else
@@ -603,14 +575,16 @@ void ACTION_Wn(void)
}
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
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true);
#else
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false);
#endif
}
#endif
}
void ACTION_BackLight(void)
@@ -667,7 +641,6 @@ void ACTION_BackLightOnDemand(void)
}
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
void ACTION_Power_High(void)
{
gPowerHigh = !gPowerHigh;
@@ -680,4 +653,3 @@ void ACTION_BackLightOnDemand(void)
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
}
#endif
#endif

View File

@@ -45,11 +45,9 @@ void ACTION_SwitchDemodul(void);
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
void ACTION_Mute(void);
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
void ACTION_Power_High(void);
void ACTION_Remove_Offset(void);
#endif
#endif
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);

View File

@@ -850,43 +850,6 @@ void APP_Update(void) {
}
#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 &&
(gTxTimeoutReached || SerialConfigInProgress())) { // transmitter timed out or must de-key
gTxTimeoutReached = false;
@@ -1310,11 +1273,9 @@ void APP_TimeSlice10ms(void) {
return;
#endif
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
#ifdef ENABLE_FLASHLIGHT
FlashlightTimeSlice();
#endif
#endif
#ifdef ENABLE_VOX
if (gVoxResumeCountdown > 0)
@@ -1932,10 +1893,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
BK4819_ExitDTMF_TX(false);
if (gCurrentVfo->SCRAMBLING_TYPE == 0)
BK4819_DisableScramble();
else
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
}
} else {
@@ -1944,7 +1902,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
gEnableSpeaker = true;
}
BK4819_DisableScramble();
BK4819_SetScramble(0);
if (Code == 0xFE)
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);

View File

@@ -5,11 +5,9 @@
#include "flashlight.h"
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
enum FlashlightMode_t gFlashLightState;
void FlashlightTimeSlice()
{
void FlashlightTimeSlice() {
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) {
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
return;
@@ -46,8 +44,7 @@
}
}
void ACTION_FlashLight(void)
{
void ACTION_FlashLight(void) {
switch (gFlashLightState) {
case FLASHLIGHT_OFF:
gFlashLightState++;
@@ -63,21 +60,5 @@
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
}
#else
void ACTION_FlashLight(void)
{
static bool gFlashLightState = false;
if(gFlashLightState)
{
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
else
{
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
gFlashLightState = (gFlashLightState) ? false : true;
}
#endif
#endif

View File

@@ -5,7 +5,6 @@
#include <stdint.h>
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
enum FlashlightMode_t {
FLASHLIGHT_OFF = 0,
FLASHLIGHT_ON,
@@ -17,7 +16,6 @@
extern volatile uint16_t gFlashLightBlinkCounter;
void FlashlightTimeSlice(void);
#endif
void ACTION_FlashLight(void);
#endif

View File

@@ -270,7 +270,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) {
break;
case KEY_8:
gTxVfo->FrequencyReverse = gTxVfo->FrequencyReverse == false;
gTxVfo->FrequencyReverse = !gTxVfo->FrequencyReverse;
gRequestSaveChannel = 1;
break;
@@ -360,10 +360,8 @@ void channelMove(uint16_t Channel) {
//gRequestSaveVFO = true;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
gRemoveOffset = false;
gPowerHigh = false;
#endif
RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
@@ -825,10 +823,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
}
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
gRemoveOffset = false;
gPowerHigh = false;
#endif
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
@@ -970,10 +966,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
RADIO_PrepareTX();
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
else
BK4819_DisableScramble();
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
MSG_FSKSendData(&dataPacket);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);

View File

@@ -121,6 +121,11 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
*pMax = 9;
break;
case MENU_TOT:
*pMin = 0;
*pMax = 179;
break;
case MENU_STEP:
//*pMin = 0;
*pMax = STEP_N_ELEM - 1;
@@ -259,7 +264,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
case MENU_SCR:
//*pMin = 0;
*pMax = 10;
*pMax = 65535;
break;
case MENU_AUTOLK:
@@ -271,11 +276,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
*pMin = 0;
break;
case MENU_TOT:
//*pMin = 0;
*pMin = 5;
*pMax = 179;
break;
#ifdef ENABLE_VOX
case MENU_VOX:
@@ -385,35 +385,18 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
//*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
break;
case MENU_SET_TOT:
case MENU_SET_EOT:
//*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1;
break;
#ifdef ENABLE_FEAT_F4HWN_INV
case MENU_SET_INV:
//*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
break;
#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
case MENU_SET_VOL:
//*pMin = 0;
*pMax = 63;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
case MENU_SET_KEY:
//*pMin = 0;
*pMax = 4;
break;
#endif
#endif
default:
@@ -512,10 +495,7 @@ void MENU_AcceptSetting(void) {
case MENU_SCR:
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
if (gSubMenuSelection > 0)
BK4819_EnableScramble(gSubMenuSelection - 1);
else
BK4819_DisableScramble();
BK4819_SetScramble(gSubMenuSelection);
gRequestSaveChannel = 1;
return;
@@ -524,6 +504,10 @@ void MENU_AcceptSetting(void) {
gRequestSaveChannel = 1;
return;
case MENU_TOT:
gEeprom.TX_TIMEOUT_TIMER = gSubMenuSelection;
break;
case MENU_MEM_CH:
gTxVfo->CHANNEL_SAVE = gSubMenuSelection;
#if 0
@@ -600,10 +584,6 @@ void MENU_AcceptSetting(void) {
gEeprom.BEEP_CONTROL = gSubMenuSelection;
break;
case MENU_TOT:
gEeprom.TX_TIMEOUT_TIMER = gSubMenuSelection;
break;
#ifdef ENABLE_VOICE
case MENU_VOICE:
gEeprom.VOICE_PROMPT = gSubMenuSelection;
@@ -843,31 +823,13 @@ void MENU_AcceptSetting(void) {
gSetting_set_ptt = gSubMenuSelection;
gSetting_set_ptt_session = gSetting_set_ptt; // Special for action
break;
case MENU_SET_TOT:
gSetting_set_tot = gSubMenuSelection;
break;
case MENU_SET_EOT:
gSetting_set_eot = gSubMenuSelection;
break;
case MENU_SET_INV:
gSetting_set_inv = 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
case MENU_SET_VOL:
gEeprom.VOLUME_GAIN = gSubMenuSelection;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
case MENU_SET_KEY:
gEeprom.SET_KEY = gSubMenuSelection;
break;
#endif
case MENU_SET_TMR:
gSetting_set_tmr = gSubMenuSelection;
@@ -978,6 +940,10 @@ void MENU_ShowCurrentSetting(void) {
gSubMenuSelection = gTxVfo->BUSY_CHANNEL_LOCK;
break;
case MENU_TOT:
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
break;
case MENU_MEM_CH:
#if 0
gSubMenuSelection = gEeprom.MrChannel[0];
@@ -1032,11 +998,6 @@ void MENU_ShowCurrentSetting(void) {
case MENU_BEEP:
gSubMenuSelection = gEeprom.BEEP_CONTROL;
break;
case MENU_TOT:
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
break;
#ifdef ENABLE_VOICE
case MENU_VOICE:
gSubMenuSelection = gEeprom.VOICE_PROMPT;
@@ -1242,29 +1203,13 @@ void MENU_ShowCurrentSetting(void) {
case MENU_SET_PTT:
gSubMenuSelection = gSetting_set_ptt_session;
break;
case MENU_SET_TOT:
gSubMenuSelection = gSetting_set_tot;
break;
case MENU_SET_EOT:
gSubMenuSelection = gSetting_set_eot;
break;
case MENU_SET_INV:
gSubMenuSelection = gSetting_set_inv;
break;
#ifdef ENABLE_FEAT_F4HWN_NARROWER
case MENU_SET_NFM:
gSubMenuSelection = gSetting_set_nfm;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL:
gSubMenuSelection = gEeprom.VOLUME_GAIN;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
case MENU_SET_KEY:
gSubMenuSelection = gEeprom.SET_KEY;
break;
#endif
case MENU_SET_TMR:
gSubMenuSelection = gSetting_set_tmr;
@@ -1400,7 +1345,15 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
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)

View File

@@ -66,12 +66,6 @@ void BACKLIGHT_InitHardware()
0;
}
static void BACKLIGHT_Sound(void)
{
gK5startup = false;
}
void BACKLIGHT_TurnOn(void)
{
#ifdef ENABLE_FEAT_F4HWN_SLEEP
@@ -84,38 +78,11 @@ void BACKLIGHT_TurnOn(void)
if (gEeprom.BACKLIGHT_TIME == 0) {
BACKLIGHT_TurnOff();
#ifdef ENABLE_FEAT_F4HWN
if(gK5startup == true)
{
BACKLIGHT_Sound();
}
#endif
return;
}
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);
}
#else
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
#endif
switch (gEeprom.BACKLIGHT_TIME) {
default:

View File

@@ -48,6 +48,12 @@ __inline uint16_t scale_freq(uint16_t freq)
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){
const uint16_t fsk_reg59 = BK4819_ReadRegister(BK4819_REG_59);
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);
BK4819_WriteRegister(BK4819_REG_31, Value & ~(1u << 1));
uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
if (Freq) {
Value |= (1u << 1);
} else {
Value &= ~(1u << 1);
}
BK4819_WriteRegister(BK4819_REG_31, Value);
void BK4819_EnableScramble(uint8_t Type)
{
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
//BK4819_WriteRegister(BK4819_REG_71, 0x68DC + (Freq * 1032)); // 0110 1000 1101 1100
BK4819_WriteRegister(BK4819_REG_71, Freq);
}
bool BK4819_CompanderEnabled(void)

View File

@@ -65,6 +65,7 @@ typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
// radio is asleep, not listening
extern bool gRxIdleMode;
uint16_t inverse_scale_freq(uint16_t scaled_freq);
uint16_t scale_freq(uint16_t freq);
void BK4819_Init(void);
@@ -102,8 +103,7 @@ void BK4819_SetupSquelch(
void BK4819_SetAF(BK4819_AF_Type_t AF);
void BK4819_RX_TurnOn(void);
void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency);
void BK4819_DisableScramble(void);
void BK4819_EnableScramble(uint8_t Type);
void BK4819_SetScramble(uint16_t Freq);
bool BK4819_CompanderEnabled(void);
void BK4819_SetCompander(const unsigned int mode);

View File

@@ -251,6 +251,7 @@ void FUNCTION_Transmit() {
DTMF_Reply();
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE);
@@ -285,10 +286,6 @@ void FUNCTION_Transmit() {
#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) {
BACKLIGHT_TurnOn();

View File

@@ -44,13 +44,6 @@ BOOT_Mode_t BOOT_GetMode(void) {
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]) {
gKeyReading0 = Keys[0];
gKeyReading1 = Keys[0];

7
misc.c
View File

@@ -111,12 +111,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
#ifdef ENABLE_FEAT_F4HWN
bool gSetting_set_ptt = 0;
uint8_t gSetting_set_tot = 0;
bool gSetting_set_inv = false;
uint8_t gSetting_set_eot = 0;
#ifdef ENABLE_FEAT_F4HWN_NARROWER
bool gSetting_set_nfm = 0;
#endif
bool gSetting_set_tmr = 0;
bool gSetting_set_ptt_session;
#ifdef ENABLE_FEAT_F4HWN_DEBUG
@@ -128,11 +123,9 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
uint8_t crc[15] = { 0 };
uint8_t lErrorsDuringAirCopy = 0;
uint8_t gAircopyStep = 0;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
bool gPowerHigh = false;
bool gRemoveOffset = false;
#endif
#endif
#ifdef ENABLE_AUDIO_BAR
bool gSetting_mic_bar;

7
misc.h
View File

@@ -165,12 +165,7 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
#ifdef ENABLE_FEAT_F4HWN
extern bool gSetting_set_ptt;
extern uint8_t gSetting_set_tot;
extern bool gSetting_set_inv;
extern uint8_t gSetting_set_eot;
#ifdef ENABLE_FEAT_F4HWN_NARROWER
extern bool gSetting_set_nfm;
#endif
extern bool gSetting_set_tmr;
extern bool gSetting_set_ptt_session;
#ifdef ENABLE_FEAT_F4HWN_DEBUG
@@ -182,11 +177,9 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
extern uint8_t crc[15];
extern uint8_t lErrorsDuringAirCopy;
extern uint8_t gAircopyStep;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
extern bool gPowerHigh;
extern bool gRemoveOffset;
#endif
#endif
#ifdef ENABLE_AUDIO_BAR
extern bool gSetting_mic_bar;

52
radio.c
View File

@@ -229,13 +229,13 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
uint16_t base;
if (IS_MR_CHANNEL(channel))
base = channel * 16;
base = channel * 24;
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)) {
uint8_t tmp;
uint8_t data[8];
uint8_t data[10];
// ***************
@@ -256,10 +256,10 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
pVfo->STEP_SETTING = tmp;
pVfo->StepFrequency = gStepFrequencyTable[tmp];
tmp = data[7];
if (tmp > 10)
tmp = 0;
tmp = data[8];
pVfo->SCRAMBLING_TYPE = tmp ;
tmp = data[9];
pVfo->SCRAMBLING_TYPE |= tmp << 8;
//pVfo->SCRAMBLING_TYPE = 0;
pVfo->freq_config_RX.CodeType = (data[2] >> 0) & 0x0F;
@@ -314,10 +314,10 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
pVfo->BUSY_CHANNEL_LOCK = false;
} else {
const uint8_t d4 = data[4];
pVfo->FrequencyReverse = !!((d4 >> 0) & 1u);
pVfo->CHANNEL_BANDWIDTH = !!((d4 >> 1) & 1u);
pVfo->OUTPUT_POWER = ((d4 >> 2) & 7u);
pVfo->BUSY_CHANNEL_LOCK = !!((d4 >> 5) & 1u);
pVfo->FrequencyReverse = ((d4 >> 0) & 1u) != 0;
pVfo->CHANNEL_BANDWIDTH = ((d4 >> 1) & 3u);
pVfo->OUTPUT_POWER = ((d4 >> 3) & 7u);
pVfo->BUSY_CHANNEL_LOCK = ((d4 >> 6) & 1u) != 0;
}
if (data[5] == 0xFF) {
@@ -388,7 +388,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
pVfo->Compander = att.compander;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gRemoveOffset)
{
pVfo->pTX = &pVfo->freq_config_RX;
@@ -398,7 +397,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
{
pVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH;
}
#endif
RADIO_ConfigureSquelchAndOutputPower(pVfo);
}
@@ -492,7 +490,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) {
}
currentPower--;
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (Op * 3), Txp, 3);
EEPROM_ReadBuffer(0x1ED0 + (Band * 20) + (Op * 3), Txp, 3);
#ifdef ENABLE_FEAT_F4HWN
// make low and mid even lower
@@ -620,12 +618,6 @@ void RADIO_SelectVfos(void) {
void RADIO_SetupRegisters(bool switchToForeground) {
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();
gEnableSpeaker = false;
@@ -746,10 +738,9 @@ void RADIO_SetupRegisters(bool switchToForeground) {
break;
}
if (gRxVfo->SCRAMBLING_TYPE > 0)
BK4819_EnableScramble(gRxVfo->SCRAMBLING_TYPE - 1);
else
BK4819_DisableScramble();
BK4819_SetScramble(0);
SYSTEM_DelayMs(10);
BK4819_SetScramble(gRxVfo->SCRAMBLING_TYPE);
}
}
#ifdef ENABLE_NOAA
@@ -846,12 +837,6 @@ void RADIO_ConfigureNOAA(void)
void RADIO_SetTxParameters(void) {
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();
gEnableSpeaker = false;
@@ -1085,15 +1070,6 @@ void RADIO_PrepareTX(void) {
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
gTxTimerCountdownAlert_500ms = gTxTimerCountdown_500ms;
#endif

27
radio.h
View File

@@ -42,8 +42,7 @@ enum PTT_ID_t {
};
typedef enum PTT_ID_t PTT_ID_t;
enum VfoState_t
{
enum VfoState_t {
VFO_STATE_NORMAL = 0,
VFO_STATE_BUSY,
VFO_STATE_BAT_LOW,
@@ -70,16 +69,14 @@ typedef enum {
extern const char gModulationStr[MODULATION_UKNOWN][4];
typedef struct
{
typedef struct {
uint32_t Frequency;
DCS_CodeType_t CodeType;
uint8_t Code;
uint8_t Padding[2];
} FREQ_Config_t;
typedef struct VFO_Info_t
{
typedef struct VFO_Info_t {
FREQ_Config_t freq_config_RX;
FREQ_Config_t freq_config_TX;
@@ -111,7 +108,7 @@ typedef struct VFO_Info_t
uint8_t TXP_CalculatedSetting;
bool FrequencyReverse;
uint8_t SCRAMBLING_TYPE;
uint16_t SCRAMBLING_TYPE;
uint8_t CHANNEL_BANDWIDTH;
uint8_t SCANLIST1_PARTICIPATION;
@@ -150,23 +147,39 @@ extern DCS_CodeType_t gCurrentCodeType;
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);
#ifdef ENABLE_NOAA
void RADIO_ConfigureNOAA(void);
#endif
void RADIO_SetTxParameters(void);
void RADIO_SetupAGC(bool listeningAM, bool disable);
void RADIO_SetModulation(ModulationMode_t modulation);
void RADIO_SetVfoState(VfoState_t State);
void RADIO_PrepareTX(void);
void RADIO_SendCssTail(void);
void RADIO_PrepareCssTX(void);
void RADIO_SendEndOfTransmission(void);
#endif

View File

@@ -57,13 +57,14 @@ void SystickHandler(void)
gNextTimeslice_500ms = true;
#ifdef ENABLE_FEAT_F4HWN
DECREMENT_AND_TRIGGER(gTxTimerCountdownAlert_500ms - ALERT_TOT * 2, gTxTimeoutReachedAlert);
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
DECREMENT(gRxTimerCountdown_500ms);
#endif
#endif
if (gEeprom.TX_TIMEOUT_TIMER != 0) {
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
}
DECREMENT(gSerialConfigCountDown_500ms);
}

View File

@@ -53,12 +53,9 @@ void SETTINGS_InitEEPROM(void) {
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
gEeprom.KEY_LOCK = (Data[4] & 0x01) != 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
gEeprom.KEY_LOCK = (Data[4] < 2) != 0 && Data[4];
#ifdef ENABLE_VOX
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
@@ -77,12 +74,8 @@ void SETTINGS_InitEEPROM(void) {
gEeprom.BATTERY_SAVE = (Data[3] < 6) ? Data[3] : 4;
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12;
#ifdef ENABLE_FEAT_F4HWN_NARROWER
gEeprom.TAIL_TONE_ELIMINATION = Data[6] & 0x01;
gSetting_set_nfm = (Data[6] >> 1) & 0x01;
#else
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
#endif
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) != 0 && Data[6];
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
gEeprom.VFO_OPEN = Data[7] & 0x01;
@@ -274,10 +267,11 @@ void SETTINGS_InitEEPROM(void) {
gEeprom.FSKSRCAddress |= Data[1] << 8;
gEeprom.FSKSRCAddress |= Data[2] << 16;
gEeprom.FSKSRCAddress |= Data[3] << 24;
#ifdef ENABLE_FMRADIO
gEeprom.BK1080_AGC_ENABLED = Data[4] & 0x01;
gEeprom.BK1080_BLEND_CONFIG = (Data[4] >> 1) & 0x03;
gEeprom.BK1080_DEEMPHASIS_CONFIG = (Data[4] >> 3) & 0x03;
#endif
// 0F40..0F47
EEPROM_ReadBuffer(0x0F40, Data, 8);
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
@@ -331,9 +325,6 @@ void SETTINGS_InitEEPROM(void) {
EEPROM_ReadBuffer(0x1FF0, Data, 8);
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);
@@ -427,7 +418,7 @@ uint32_t SETTINGS_FetchChannelFrequency(const int channel) {
uint32_t offset;
} __attribute__((packed)) info;
EEPROM_ReadBuffer(channel * 16, &info, sizeof(info));
EEPROM_ReadBuffer(channel * 20, &info, sizeof(info));
return info.frequency;
}
@@ -444,7 +435,7 @@ void SETTINGS_FetchChannelName(char *s, const int channel) {
if (!RADIO_CheckValidChannel(channel, false, 0))
return;
EEPROM_ReadBuffer(0x0F50 + (channel * 16), s, 10);
EEPROM_ReadBuffer(0x0F50 + (channel * 20), s, 10);
int i;
for (i = 0; i < 10; i++)
@@ -570,12 +561,7 @@ void SETTINGS_SaveSettings(void) {
State[3] = false;
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0) | (gEeprom.MENU_LOCK ? 0x02 :0) | ((gEeprom.SET_KEY & 0x0F) << 2);
#else
State[4] = gEeprom.KEY_LOCK;
#endif
State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0);
#ifdef ENABLE_VOX
State[5] = gEeprom.VOX_SWITCH;
State[6] = gEeprom.VOX_LEVEL;
@@ -606,11 +592,7 @@ void SETTINGS_SaveSettings(void) {
State[5] = gEeprom.BACKLIGHT_TIME;
#endif
#ifdef ENABLE_FEAT_F4HWN_NARROWER
State[6] = (gEeprom.TAIL_TONE_ELIMINATION & 0x01) | ((gSetting_set_nfm & 0x03) << 1);
#else
State[6] = gEeprom.TAIL_TONE_ELIMINATION;
#endif
State[6] = gEeprom.TAIL_TONE_ELIMINATION & 0x01;
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) |
@@ -703,9 +685,11 @@ void SETTINGS_SaveSettings(void) {
State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF;
State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF;
State[3] = (gEeprom.FSKSRCAddress >> 24) & 0xFF;
#ifdef ENABLE_FMRADIO
State[4] = ((gEeprom.BK1080_AGC_ENABLED & 0x01) |
((gEeprom.BK1080_BLEND_CONFIG & 0x03) << 1) |
((gEeprom.BK1080_DEEMPHASIS_CONFIG & 0x03) << 3));
#endif
EEPROM_WriteBuffer(0x0F20, State);
@@ -763,7 +747,6 @@ void SETTINGS_SaveSettings(void) {
tmp = (gSetting_set_inv << 0);
State[5] = (tmp << 4);
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
State[7] = gSetting_set_ptt & 0x0F;
EEPROM_WriteBuffer(0x1FF0, State);
@@ -780,10 +763,10 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
return;
#endif
uint16_t OffsetVFO = Channel * 16;
uint16_t OffsetVFO = Channel * 24;
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;
}
@@ -791,6 +774,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
union {
uint8_t _8[8];
uint32_t _32[2];
uint16_t _16[4];
} State;
State._32[0] = pVFO->freq_config_RX.Frequency;
@@ -802,8 +786,8 @@ 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[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION;
State._8[4] = 0
| (pVFO->BUSY_CHANNEL_LOCK << 5)
| (pVFO->OUTPUT_POWER << 2)
| (pVFO->BUSY_CHANNEL_LOCK << 6)
| (pVFO->OUTPUT_POWER << 3)
| (pVFO->CHANNEL_BANDWIDTH << 1)
| (pVFO->FrequencyReverse << 0);
State._8[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1)
@@ -813,8 +797,10 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
;
State._8[6] = pVFO->STEP_SETTING;
State._8[7] = pVFO->SCRAMBLING_TYPE;
EEPROM_WriteBuffer(OffsetVFO + 8, State._8);
State._16[0] = pVFO->SCRAMBLING_TYPE;
EEPROM_WriteBuffer(OffsetVFO + sizeof (State._32), State._8);
EEPROM_WriteBuffer(OffsetVFO + sizeof (State._32) + sizeof (State._8), State._16);
SETTINGS_UpdateChannel(Channel, pVFO, true, true, true);
@@ -842,7 +828,7 @@ void SETTINGS_SaveBatteryCalibration(const uint16_t *batteryCalibration) {
}
void SETTINGS_SaveChannelName(uint8_t channel, const char *name) {
uint16_t offset = channel * 16;
uint16_t offset = channel * 24;
uint8_t buf[16] = {0};
memcpy(buf, name, MIN(strlen(name), 10u));
EEPROM_WriteBuffer(0x0F50 + offset, buf);
@@ -950,10 +936,7 @@ void SETTINGS_WriteBuildOptions(void) {
#ifdef ENABLE_SPECTRUM
| (1 << 5)
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
| (1 << 6)
#endif
;
| (1 << 6);
EEPROM_WriteBuffer(0x1FF0, State);
}
@@ -986,7 +969,7 @@ void SETTINGS_WriteCurrentVol(void) {
void SETTINGS_ResetTxLock(void) {
uint8_t State[8];
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));
State[4] |= (1 << 6);
EEPROM_WriteBuffer(OffsetVFO + 8, State);

View File

@@ -98,8 +98,7 @@ enum {
};
enum {
OUTPUT_POWER_USER = 0,
OUTPUT_POWER_LOW1,
OUTPUT_POWER_LOW1 = 0,
OUTPUT_POWER_LOW2,
OUTPUT_POWER_LOW3,
OUTPUT_POWER_LOW4,
@@ -130,11 +129,9 @@ enum ACTION_OPT_t {
ACTION_OPT_WN,
ACTION_OPT_BACKLIGHT,
ACTION_OPT_MUTE,
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
ACTION_OPT_POWER_HIGH,
ACTION_OPT_REMOVE_OFFSET,
#endif
#endif
#ifdef ENABLE_REGA
ACTION_OPT_REGA_ALARM,
ACTION_OPT_REGA_TEST,
@@ -224,10 +221,7 @@ typedef struct {
#ifdef ENABLE_FEAT_F4HWN
bool KEY_LOCK_PTT;
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
bool MENU_LOCK;
uint8_t SET_KEY;
#endif
bool VOX_SWITCH;
uint8_t VOX_LEVEL;
#ifdef ENABLE_VOICE

View File

@@ -45,6 +45,7 @@
#ifdef ENABLE_FEAT_F4HWN
#include "driver/system.h"
#include "app/scanner.h"
#endif
@@ -418,44 +419,6 @@ void UI_MAIN_TimeSlice500ms(void) {
if (FUNCTION_IsRx()) {
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
}
}
@@ -1010,7 +973,6 @@ void UI_DisplayMain(void) {
#if ENABLE_FEAT_F4HWN
const FREQ_Config_t *pConfig = (mode == VFO_MODE_TX) ? vfoInfo->pTX : vfoInfo->pRX;
int8_t shift = 0;
switch ((int) pConfig->CodeType) {
case 1:
sprintf(String, "%u.%u", CTCSS_Options[pConfig->Code] / 10, CTCSS_Options[pConfig->Code] % 10);
@@ -1029,6 +991,8 @@ void UI_DisplayMain(void) {
shift = -10;
}
UI_PrintStringSmallNormal(s, 50, 0, line + 2);
UI_PrintStringSmallNormal(t, 2, 0, line + 2);
@@ -1047,25 +1011,20 @@ void UI_DisplayMain(void) {
#endif
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",
"HI"};
UI_PrintStringSmallNormal(pwr_short[currentPower], LCD_WIDTH + 25, 0, line + 1);
"HI", "UN"};
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
int i = vfoInfo->TX_OFFSET_FREQUENCY_DIRECTION % 3;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
const char dir_list[][2] = {"", "+", "-", "D"};
if(gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION != 0 && gTxVfo->pTX == &gTxVfo->freq_config_RX && !vfoInfo->FrequencyReverse)
{
i = 3;
}
#else
const char dir_list[][2] = {"", "+", "-"};
#endif
#if ENABLE_FEAT_F4HWN
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
@@ -1078,34 +1037,18 @@ void UI_DisplayMain(void) {
if (vfoInfo->FrequencyReverse)
#if ENABLE_FEAT_F4HWN
{
UI_PrintStringSmallNormal("R", LCD_WIDTH + 68, 0, line + 1);
UI_PrintStringSmallNormal("R", LCD_WIDTH + 110, 0, line + 1);
}
#else
UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1);
UI_PrintStringSmallNormal("R", LCD_WIDTH + 110, 0, line + 1);
#endif
#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+"};
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 30, 0,
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], LCD_WIDTH + 30, 0,
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
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
@@ -1119,8 +1062,8 @@ void UI_DisplayMain(void) {
// show the audio scramble symbol
if (vfoInfo->SCRAMBLING_TYPE > 0) {
sprintf(String, "S%d", vfoInfo->SCRAMBLING_TYPE + 25);
UI_PrintStringSmallNormal(String, 105, 0, line + 2);
sprintf(String, "S%d", inverse_scale_freq(vfoInfo->SCRAMBLING_TYPE));
UI_PrintStringSmallNormal(String, 90, 0, line + 2);
}
#ifdef ENABLE_FEAT_F4HWN

136
ui/menu.c
View File

@@ -48,7 +48,7 @@ const t_menu_item MenuList[] =
{"TCTCS", MENU_T_CTCS}, // was "T_CTCS"
{"TxODir", MENU_SFT_D}, // was "SFT_D"
{"TxOffs", MENU_OFFSET}, // was "OFFSET"
{"W/N", MENU_W_N},
{"WID", MENU_W_N},
{"SCR", MENU_SCR}, // was "SCR"
{"BusyL", MENU_BCL}, // was "BCL"
{"COMP", MENU_COMPAND},
@@ -79,7 +79,7 @@ const t_menu_item MenuList[] =
{"ML", MENU_MLONG},
{"KeyLck", MENU_AUTOLK}, // was "AUTOLk"
{"TxTOut", MENU_TOT}, // was "TOT"
{"TXTime", MENU_TOT},
{"BatSav", MENU_SAVE}, // was "SAVE"
{"BatTxt", MENU_BAT_TXT},
{"Mic", MENU_MIC},
@@ -131,22 +131,14 @@ const t_menu_item MenuList[] =
{"Sql", MENU_SQL},
#ifdef ENABLE_FEAT_F4HWN
{"SPTT", MENU_SET_PTT},
{"STOT", MENU_SET_TOT},
{"SEOT", MENU_SET_EOT},
{"SInv", MENU_SET_INV},
{"STmr", MENU_SET_TMR},
#ifdef ENABLE_FEAT_F4HWN_SLEEP
{"SOff", MENU_SET_OFF},
#endif
#ifdef ENABLE_FEAT_F4HWN_NARROWER
{"SNFM", MENU_SET_NFM},
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
{"SVol", MENU_SET_VOL},
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
{"SKey", MENU_SET_KEY },
#endif
#ifdef ENABLE_NOAA
{"SNWR", MENU_NOAA_S },
#endif
@@ -182,10 +174,11 @@ const char gSubMenu_SFT_D[][4] =
"-"
};
const char gSubMenu_W_N[][7] =
const char gSubMenu_W_N[][5] =
{
"WIDE",
"NARR"
"NARR",
"NAR+"
};
const char gSubMenu_OFF_ON[][4] =
@@ -203,8 +196,8 @@ const char *const gSubMenu_RXMode[] =
{
"MAIN", // TX and RX on main only
"RESP", // Watch both and respond
"XBAND ONLY", // TX on main, RX on secondary
"DUALMON" // always TX on main, but RX on both
"XBAND", // TX on main, RX on secondary
"DMON" // always TX on main, but RX on both
};
#ifdef ENABLE_VOICE
@@ -219,7 +212,7 @@ const char gSubMenu_VOICE[][4] =
const char *const gSubMenu_MDF[] =
{
"FREQ",
"CHNUMB",
"CHNUM",
"NAME",
"NAME\n+\nFREQ"
};
@@ -303,14 +296,14 @@ const char gSubMenu_RX_TX[][6] =
"TX/RX"
};
const char gSubMenu_BAT_TXT[][8] =
const char gSubMenu_BAT_TXT[][5] =
{
"NONE",
"VLT",
"PRC"
};
const char gSubMenu_BATTYP[][9] =
const char gSubMenu_BATTYP[][3] =
{
"16",
"22",
@@ -319,38 +312,11 @@ const char gSubMenu_BATTYP[][9] =
#ifdef ENABLE_FEAT_F4HWN
const char gSubMenu_SET_PTT[][8] =
const char gSubMenu_SET_PTT[][4] =
{
"HOLD",
"TAP"
"HOL",
"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
const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
@@ -393,10 +359,8 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
{"MUTE", ACTION_OPT_MUTE},
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
{"POWER\nHIGH", ACTION_OPT_POWER_HIGH},
{"REMOVE\nOFFSET", ACTION_OPT_REMOVE_OFFSET},
#endif
#endif
{"SSTV", ACTION_REQ_SSTV},
};
@@ -543,12 +507,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
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()) {
case MENU_SQL:
sprintf(String, "%ld", gSubMenuSelection);
@@ -623,12 +581,11 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
case MENU_SCR:
if (gSubMenuSelection > 0) {
sprintf(String, "%ld00", gSubMenuSelection + 25);
BK4819_EnableScramble(gSubMenuSelection - 1);
sprintf(String, "%huHz\n%ld", inverse_scale_freq(gSubMenuSelection), gSubMenuSelection);
} else {
strcpy(String, "OFF");
BK4819_DisableScramble();
}
BK4819_SetScramble(gSubMenuSelection);
break;
case MENU_VOX:
@@ -644,12 +601,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
strcpy(String, gSubMenu_OFF_ON[0]);
} else if (gSubMenuSelection < 61) {
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 {
strcpy(String, "ON");
}
@@ -673,17 +624,19 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
strcpy(String, gModulationStr[gSubMenuSelection]);
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:
if (gSubMenuSelection == 0)
strcpy(String, gSubMenu_OFF_ON[0]);
else {
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;
@@ -783,16 +736,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
strcpy(String, gSubMenu_RXMode[gSubMenuSelection]);
break;
case MENU_TOT:
sprintf(String, "%02ldm:%02lds", (((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
case MENU_VOICE:
strcpy(String, gSubMenu_VOICE[gSubMenuSelection]);
@@ -807,18 +750,12 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
((gSubMenuSelection * 250) % 1000));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
//ST7565_Gauge(5, 1, 80, gSubMenuSelection);
gaugeLine = 5;
gaugeMin = 1;
gaugeMax = 80;
#endif
} else {
sprintf(String, "TIMEOUT\n%02ldm:%02lds", (((gSubMenuSelection - 80) * 5) / 60),
(((gSubMenuSelection - 80) * 5) % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
//ST7565_Gauge(5, 80, 104, gSubMenuSelection);
gaugeLine = 5;
gaugeMin = 80;
gaugeMax = 104;
#endif
}
break;
@@ -946,12 +883,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
strcpy(String, gSubMenu_OFF_ON[0]);
} else if (gSubMenuSelection < 121) {
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;
#endif
@@ -961,11 +892,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
break;
case MENU_SET_TOT:
case MENU_SET_EOT:
strcpy(String, gSubMenu_SET_TOT[gSubMenuSelection]); // Same as SET_TOT
break;
case MENU_SET_INV:
#ifdef ENABLE_FEAT_F4HWN_INV
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
@@ -975,12 +901,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#endif
break;
#ifdef ENABLE_FEAT_F4HWN_NARROWER
case MENU_SET_NFM:
strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]);
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL:
if (gSubMenuSelection == 0) {
@@ -988,10 +908,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
} else if (gSubMenuSelection < 64) {
sprintf(String, "%02lu", gSubMenuSelection);
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
//ST7565_Gauge(4, 1, 63, gSubMenuSelection);
gaugeLine = 4;
gaugeMin = 1;
gaugeMax = 63;
#endif
}
gEeprom.VOLUME_GAIN = gSubMenuSelection;
@@ -1002,12 +918,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
case MENU_SET_KEY:
strcpy(String, gSubMenu_SET_KEY[gSubMenuSelection]);
break;
#endif
#endif
}

View File

@@ -115,21 +115,11 @@ enum {
#endif
#ifdef ENABLE_FEAT_F4HWN
MENU_SET_PTT,
MENU_SET_TOT,
MENU_SET_EOT,
MENU_SET_CTR,
MENU_SET_INV,
MENU_SET_LCK,
MENU_SET_TMR,
#ifdef ENABLE_FEAT_F4HWN_NARROWER
MENU_SET_NFM,
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
MENU_SET_VOL,
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
MENU_SET_KEY,
#endif
#ifdef ENABLE_NOAA
MENU_NOAA_S,
#endif
@@ -147,10 +137,9 @@ extern const t_menu_item MenuList[];
extern const char gSubMenu_TXP[7][5];
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_NA[4];
extern const char gSubMenu_TOT[11][7];
extern const char *const gSubMenu_RXMode[4];
#ifdef ENABLE_VOICE
@@ -165,14 +154,7 @@ extern const char gSubMenu_D_RSP[4][11];
#endif
#ifdef ENABLE_FEAT_F4HWN
extern const char gSubMenu_SET_PTT[2][8];
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
extern const char gSubMenu_SET_PTT[2][4];
#endif
extern const char *const gSubMenu_PTT_ID[5];
@@ -181,8 +163,8 @@ extern const char gSubMenu_ROGER[3][6];
extern const char gSubMenu_RESET[2][4];
extern const char *const gSubMenu_F_LOCK[F_LOCK_LEN];
extern const char gSubMenu_RX_TX[4][6];
extern const char gSubMenu_BAT_TXT[3][8];
extern const char gSubMenu_BATTYP[3][9];
extern const char gSubMenu_BAT_TXT[3][5];
extern const char gSubMenu_BATTYP[3][3];
typedef struct {
char *name;