Skip to content

Commit

Permalink
Merge pull request #18 from kamilsss655/rc11
Browse files Browse the repository at this point in the history
Rc11
  • Loading branch information
kamilsss655 authored Dec 29, 2023
2 parents 0f0dc52 + 347d5b5 commit 99f6bc0
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 18 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Anyway, have fun.
* `ENABLE_ULTRA_LOW_POWER_TX` flag allows to transmit with ultra low power (thanks to egzumer work) for local testing of communication between radios.
* `ENABLE_ADJUSTABLE_RX_GAIN_SETTINGS` keeps the rx gain settings set in spectrum mode after exit (otherwise these are always overwritten to default value), this makes much more sense considering that we have a radio with user adjustable gain so why not use it to adjust to current radio conditions, maximum gain allows to greatly increase reception in scan memory channels mode (in this configuration default gain settings are only set at boot and when exiting AM modulation mode to set it to sane value after am fix)
* `ENABLE_SPECTRUM_CHANNEL_SCAN` this enables spectrum channel scan mode (enter by going into memory mode and press F+5, this allows SUPER fast channel scanning (4.5x faster than regular scanning), regular scan of 200 memory channels takes roughly 18 seconds, spectrum memory scan takes roughly 4 seconds, if you have less channels stored i.e 50 - the spectrum memory scan will take only **1 second**
* `VOXSen` fixed and improved VOX sensitivity setting from menu. Added `VoxDel` - VOX delay setting allowing to set value to `0` for no VOX delay which might be useful for packet radio enthusiasts (APRS etc.).

## Keyboard shortcuts
* In `VFO mode` long press `5` to enter `scan range mode`
Expand Down
2 changes: 1 addition & 1 deletion app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ void APP_Update(void)

#ifdef ENABLE_VOX
if (gEeprom.VOX_SWITCH)
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD, gEeprom.VOX_DELAY);
#endif

if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF &&
Expand Down
15 changes: 13 additions & 2 deletions app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)

#ifdef ENABLE_VOX
case MENU_VOX:
case MENU_VOX_DELAY:
#endif
case MENU_RP_STE:
*pMin = 0;
Expand Down Expand Up @@ -545,6 +546,13 @@ void MENU_AcceptSetting(void)
gFlagReconfigureVfos = true;
gUpdateStatus = true;
break;

case MENU_VOX_DELAY:
gEeprom.VOX_DELAY = gSubMenuSelection;
BOARD_EEPROM_LoadCalibration();
gFlagReconfigureVfos = true;
gUpdateStatus = true;
break;
#endif

case MENU_ABR:
Expand Down Expand Up @@ -956,11 +964,14 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gEeprom.BATTERY_SAVE;
break;

#ifdef ENABLE_VOX
#ifdef ENABLE_VOX
case MENU_VOX:
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
break;
#endif
case MENU_VOX_DELAY:
gSubMenuSelection = gEeprom.VOX_DELAY;
break;
#endif

case MENU_ABR:
gSubMenuSelection = gEeprom.BACKLIGHT_TIME;
Expand Down
9 changes: 5 additions & 4 deletions board.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,9 @@ void BOARD_EEPROM_Init(void)
memmove(&gEeprom.POWER_ON_PASSWORD, Data, 4);

// 0EA0..0EA7
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOX
EEPROM_ReadBuffer(0x0EA0, Data, 8);
gEeprom.VOICE_PROMPT = (Data[0] < 3) ? Data[0] : VOICE_PROMPT_ENGLISH;
gEeprom.VOX_DELAY = (Data[0] < 11) ? Data[0] : 4;
#endif

// 0EA8..0EAF
Expand Down Expand Up @@ -804,8 +804,9 @@ void BOARD_EEPROM_LoadCalibration(void)
gBatteryCalibration[5] = 2300;

#ifdef ENABLE_VOX
EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2);
EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2);
// fixed and improved VOX sensitivity, based on calibration data
gEeprom.VOX1_THRESHOLD = 205-(20*gEeprom.VOX_LEVEL);
gEeprom.VOX0_THRESHOLD = 215-(20*gEeprom.VOX_LEVEL);
#endif

//EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1);
Expand Down
Binary file modified docs/UV K5 EEPROM.xlsx
Binary file not shown.
12 changes: 8 additions & 4 deletions driver/bk4819.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void BK4819_SetTailDetection(const uint32_t freq_10Hz)
BK4819_WriteRegister(BK4819_REG_07, BK4819_REG_07_MODE_CTC2 | ((253910 + (freq_10Hz / 2)) / freq_10Hz)); // with rounding
}

void BK4819_EnableVox(uint16_t VoxEnableThreshold, uint16_t VoxDisableThreshold)
void BK4819_EnableVox(uint16_t VoxEnableThreshold, uint16_t VoxDisableThreshold, uint8_t VoxDelay)
{
//VOX Algorithm
//if (voxamp>VoxEnableThreshold) VOX = 1;
Expand All @@ -505,10 +505,14 @@ void BK4819_EnableVox(uint16_t VoxEnableThreshold, uint16_t VoxDisableThreshold)
// 0x1800 is undocumented?
BK4819_WriteRegister(BK4819_REG_79, 0x1800 | (VoxDisableThreshold & 0x07FF));

// Set VOX delay
// Bottom 12 bits are undocumented, 15:12 vox disable delay *128ms
BK4819_WriteRegister(BK4819_REG_7A, 0x289A); // vox disable delay = 128*5 = 640ms

// Enable VOX
// BK4819_WriteRegister(BK4819_REG_7A, 0x289A); // vox disable delay = 128*5 = 640ms
// max delay = F89A = 1920ms
// min delay = 089A = 0ms
BK4819_WriteRegister(BK4819_REG_7A, (0x289A & ~(0xF << 12))|(VoxDelay<<12));

// Enable VOX
BK4819_WriteRegister(BK4819_REG_31, REG_31_Value | (1u << 2)); // VOX Enable
}

Expand Down
2 changes: 1 addition & 1 deletion driver/bk4819.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet);
void BK4819_SetCDCSSCodeWord(uint32_t CodeWord);
void BK4819_SetCTCSSFrequency(uint32_t BaudRate);
void BK4819_SetTailDetection(const uint32_t freq_10Hz);
void BK4819_EnableVox(uint16_t Vox1Threshold, uint16_t Vox0Threshold);
void BK4819_EnableVox(uint16_t Vox1Threshold, uint16_t Vox0Threshold, uint8_t VoxDelay);
void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const bool weak_no_different);
void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency);
void BK4819_SetDefaultAmplifierSettings();
Expand Down
2 changes: 1 addition & 1 deletion radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
#endif
#endif
{
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD, gEeprom.VOX_DELAY);
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
}
else
Expand Down
4 changes: 2 additions & 2 deletions settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ void SETTINGS_SaveSettings(void)
EEPROM_WriteBuffer(0x0E98, State);

memset(State, 0xFF, sizeof(State));
#ifdef ENABLE_VOICE
State[0] = gEeprom.VOICE_PROMPT;
#ifdef ENABLE_VOX
State[0] = gEeprom.VOX_DELAY;
EEPROM_WriteBuffer(0x0EA0, State);
#endif

Expand Down
3 changes: 2 additions & 1 deletion settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ typedef struct {
uint8_t TX_TIMEOUT_TIMER;
bool KEY_LOCK;
bool VOX_SWITCH;
uint8_t VOX_LEVEL;
uint8_t VOX_LEVEL; // sensitivity and OFF when 0
uint8_t VOX_DELAY; // vox delay (0-10)
#ifdef ENABLE_VOICE
VOICE_Prompt_t VOICE_PROMPT;
#endif
Expand Down
6 changes: 5 additions & 1 deletion ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ const t_menu_item MenuList[] =
{"AM Fix", VOICE_ID_INVALID, MENU_AM_FIX },
#endif
#ifdef ENABLE_VOX
{"VOX", VOICE_ID_VOX, MENU_VOX },
{"VOXSen", VOICE_ID_VOX, MENU_VOX }, // VOX Sensibility or OFF
{"VOXDel", VOICE_ID_VOX, MENU_VOX_DELAY }, // VOX delay
#endif
{"BatVol", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
{"RxMode", VOICE_ID_DUAL_STANDBY, MENU_TDR },
Expand Down Expand Up @@ -596,6 +597,9 @@ void UI_DisplayMenu(void)
else
sprintf(String, "%d", gSubMenuSelection);
break;
case MENU_VOX_DELAY:
sprintf(String, "%d", gSubMenuSelection);
break;
#endif

case MENU_ABR:
Expand Down
3 changes: 2 additions & 1 deletion ui/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum
MENU_T_CTCS,
MENU_SFT_D,
MENU_OFFSET,
MENU_RX_OFFSET,
MENU_RX_OFFSET,
MENU_TOT,
MENU_W_N,
MENU_SCR,
Expand All @@ -52,6 +52,7 @@ enum
MENU_SAVE,
#ifdef ENABLE_VOX
MENU_VOX,
MENU_VOX_DELAY,
#endif
MENU_ABR,
MENU_ABR_ON_TX_RX,
Expand Down

0 comments on commit 99f6bc0

Please sign in to comment.