0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +03:00

Rename AF constant

This commit is contained in:
OneOfEleven
2023-10-04 10:01:07 +01:00
parent 9d990f7e67
commit 5f2e069437
11 changed files with 109 additions and 107 deletions

View File

@ -544,7 +544,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
}
{ // RF RX front end gain
// original setting
uint16_t lna_short = orig_lna_short;
uint16_t lna = orig_lna;
@ -577,7 +577,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
#ifdef ENABLE_VOICE
if (gVoiceWriteIndex == 0) // AM/FM RX mode will be set when the voice has finished
#endif
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN); // no need, set it now
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM); // no need, set it now
FUNCTION_Select(Function);
@ -2057,17 +2057,6 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (gEeprom.AUTO_KEYPAD_LOCK)
gKeyLockCountdown = 30; // 15 seconds
if (Key == KEY_EXIT && bKeyPressed && bKeyHeld && gDTMF_RX_live[0] != 0)
{ // clear the live DTMF decoder if the EXIT key is held
if (gDTMF_RX_live[0] != 0)
{
gDTMF_RX_live_timeout = 0;
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
gUpdateDisplay = true;
}
}
if (!bKeyPressed)
{
if (gFlagSaveVfo)
@ -2103,11 +2092,23 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
}
else
{
BACKLIGHT_TurnOn();
if (Key == KEY_EXIT && bKeyHeld)
{ // exit key held pressed
// clear the live DTMF decoder
if (gDTMF_RX_live[0] != 0)
{
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
gDTMF_RX_live_timeout = 0;
gUpdateDisplay = true;
}
}
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
gMenuCountdown = menu_timeout_500ms;
BACKLIGHT_TurnOn();
if (gDTMF_DecodeRingCountdown_500ms > 0)
{ // cancel the ringing
gDTMF_DecodeRingCountdown_500ms = 0;
@ -2164,24 +2165,27 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Key != KEY_MENU)
{
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
{ // frequency or CTCSS/DCS scanning
{ // FREQ/CTCSS/DCS scanning
if (bKeyPressed && !bKeyHeld)
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
return;
}
}
if (gPttWasPressed && Key == KEY_PTT)
if (Key == KEY_PTT)
{
bFlag = bKeyHeld;
if (!bKeyPressed)
if (gPttWasPressed)
{
bFlag = true;
gPttWasPressed = false;
bFlag = bKeyHeld;
if (!bKeyPressed)
{
bFlag = true;
gPttWasPressed = false;
}
}
}
if (gPttWasReleased && Key != KEY_PTT)
else
if (gPttWasReleased)
{
if (bKeyHeld)
bFlag = true;
@ -2268,7 +2272,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
ALARM_Off();
// TODO: fix side key 1750, you have to press it twice to restart the tone :(
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
{
//if (gCurrentFunction != FUNCTION_FOREGROUND)

View File

@ -47,26 +47,33 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
void writeXtalFreqCal(const int32_t value)
{
struct
#ifdef ENABLE_F_CAL_MENU
void writeXtalFreqCal(const int32_t value, const bool update_eeprom)
{
int16_t BK4819_XtalFreqLow;
uint16_t EEPROM_1F8A;
uint16_t EEPROM_1F8C;
uint8_t VOLUME_GAIN;
uint8_t DAC_GAIN;
} __attribute__((packed)) Misc;
gEeprom.BK4819_XTAL_FREQ_LOW = value;
BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW);
// radio 1 .. 04 00 46 00 50 00 2C 0E
// radio 2 .. 05 00 46 00 50 00 2C 0E
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
Misc.BK4819_XtalFreqLow = gEeprom.BK4819_XTAL_FREQ_LOW;
EEPROM_WriteBuffer(0x1F88, &Misc);
}
BK4819_WriteRegister(BK4819_REG_3B, 22656 + value);
if (update_eeprom)
{
struct
{
int16_t BK4819_XtalFreqLow;
uint16_t EEPROM_1F8A;
uint16_t EEPROM_1F8C;
uint8_t VOLUME_GAIN;
uint8_t DAC_GAIN;
} __attribute__((packed)) misc;
gEeprom.BK4819_XTAL_FREQ_LOW = value;
// radio 1 .. 04 00 46 00 50 00 2C 0E
// radio 2 .. 05 00 46 00 50 00 2C 0E
//
EEPROM_ReadBuffer(0x1F88, &misc, 8);
misc.BK4819_XtalFreqLow = value;
EEPROM_WriteBuffer(0x1F88, &misc);
}
}
#endif
void MENU_StartCssScan(int8_t Direction)
{
@ -746,7 +753,7 @@ void MENU_AcceptSetting(void)
#ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI:
writeXtalFreqCal(gSubMenuSelection);
writeXtalFreqCal(gSubMenuSelection, true);
return;
#endif

View File

@ -19,6 +19,10 @@
#include "driver/keyboard.h"
#ifdef ENABLE_F_CAL_MENU
void writeXtalFreqCal(const int32_t value, const bool update_eeprom);
#endif
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
void MENU_AcceptSetting(void);
void MENU_SelectNextCode(void);