mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-21 17:57:59 +00:00
Added 30 sec TX timeout option
This commit is contained in:
parent
81bc398908
commit
618d6962ff
@ -963,13 +963,14 @@ void APP_Update(void)
|
||||
#endif
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gTxTimeoutReached)
|
||||
{ // transmitting, but just timed out
|
||||
{ // transmitter timed out
|
||||
gTxTimeoutReached = false;
|
||||
|
||||
gTxTimeoutReached = false;
|
||||
gFlagEndTransmission = true;
|
||||
|
||||
APP_EndTransmission();
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP);
|
||||
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
|
||||
RADIO_SetVfoState(VFO_STATE_TIMEOUT);
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
|
11
app/menu.c
11
app/menu.c
@ -214,8 +214,12 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SCRAMBLER) - 1;
|
||||
break;
|
||||
|
||||
case MENU_VOX:
|
||||
case MENU_TOT:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_TOT) - 1;
|
||||
break;
|
||||
|
||||
case MENU_VOX:
|
||||
case MENU_RP_STE:
|
||||
*pMin = 0;
|
||||
*pMax = 10;
|
||||
@ -317,13 +321,12 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_STEP:
|
||||
gTxVfo->STEP_SETTING = gSubMenuSelection;
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
gTxVfo->STEP_SETTING = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
}
|
||||
gTxVfo->STEP_SETTING = gSubMenuSelection;
|
||||
return;
|
||||
|
||||
case MENU_TXP:
|
||||
|
12
audio.c
12
audio.c
@ -76,7 +76,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
uint16_t ToneFrequency;
|
||||
uint16_t Duration;
|
||||
|
||||
if (Beep != BEEP_500HZ_60MS_DOUBLE_BEEP && Beep != BEEP_440HZ_500MS && !gEeprom.BEEP_CONTROL)
|
||||
if (Beep != BEEP_880HZ_60MS_TRIPLE_BEEP && Beep != BEEP_500HZ_60MS_DOUBLE_BEEP && Beep != BEEP_440HZ_500MS && !gEeprom.BEEP_CONTROL)
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
@ -122,6 +122,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
ToneFrequency = 440;
|
||||
break;
|
||||
case BEEP_880HZ_40MS_OPTIONAL:
|
||||
case BEEP_880HZ_60MS_TRIPLE_BEEP:
|
||||
ToneFrequency = 880;
|
||||
break;
|
||||
}
|
||||
@ -136,6 +137,12 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
|
||||
switch (Beep)
|
||||
{
|
||||
case BEEP_880HZ_60MS_TRIPLE_BEEP:
|
||||
BK4819_ExitTxMute();
|
||||
SYSTEM_DelayMs(60);
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
case BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL:
|
||||
case BEEP_500HZ_60MS_DOUBLE_BEEP:
|
||||
BK4819_ExitTxMute();
|
||||
@ -143,8 +150,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
// Fallthrough
|
||||
|
||||
case BEEP_1KHZ_60MS_OPTIONAL:
|
||||
BK4819_ExitTxMute();
|
||||
Duration = 60;
|
||||
@ -166,6 +171,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
SYSTEM_DelayMs(Duration);
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
gVoxResumeCountdown = 80;
|
||||
|
3
audio.h
3
audio.h
@ -28,7 +28,8 @@ enum BEEP_Type_t
|
||||
BEEP_440HZ_500MS,
|
||||
BEEP_500HZ_60MS_DOUBLE_BEEP,
|
||||
BEEP_440HZ_40MS_OPTIONAL,
|
||||
BEEP_880HZ_40MS_OPTIONAL
|
||||
BEEP_880HZ_40MS_OPTIONAL,
|
||||
BEEP_880HZ_60MS_TRIPLE_BEEP
|
||||
};
|
||||
|
||||
typedef enum BEEP_Type_t BEEP_Type_t;
|
||||
|
@ -52,6 +52,7 @@ void BK4819_Init(void)
|
||||
BK4819_WriteRegister(BK4819_REG_36, 0x0022);
|
||||
|
||||
BK4819_SetAGC(0);
|
||||
// BK4819_SetAGC(1);
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_19, 0b0001000001000001); // <15> MIC AGC 1 = disable 0 = enable
|
||||
|
||||
@ -239,9 +240,9 @@ void BK4819_SetAGC(uint8_t Value)
|
||||
//
|
||||
// <9:8> = LNA Gain Short
|
||||
// 3 = 0dB
|
||||
// 2 = -11dB
|
||||
// 1 = -16dB
|
||||
// 0 = -19dB
|
||||
// 2 = -24dB // was -11
|
||||
// 1 = -30dB // was -16
|
||||
// 0 = -33dB // was -19
|
||||
//
|
||||
// <7:5> = LNA Gain
|
||||
// 7 = 0dB
|
||||
@ -286,7 +287,8 @@ void BK4819_SetAGC(uint8_t Value)
|
||||
}
|
||||
else
|
||||
if (Value == 1)
|
||||
{
|
||||
{ // what does this do ?????????
|
||||
|
||||
unsigned int i;
|
||||
|
||||
// REG_10
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
4
main.c
4
main.c
@ -191,10 +191,10 @@ void Main(void)
|
||||
gNextTimeslice = false;
|
||||
}
|
||||
|
||||
if (gNextTimeslice500ms)
|
||||
if (gNextTimeslice_500ms)
|
||||
{
|
||||
APP_TimeSlice500ms();
|
||||
gNextTimeslice500ms = false;
|
||||
gNextTimeslice_500ms = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
9
misc.c
9
misc.c
@ -121,9 +121,13 @@ volatile uint16_t gDualWatchCountdown_10ms;
|
||||
volatile bool gDualWatchCountdownExpired = true;
|
||||
bool gDualWatchActive = false;
|
||||
|
||||
volatile bool gNextTimeslice500ms;
|
||||
volatile uint16_t gTxTimerCountdown;
|
||||
volatile bool gNextTimeslice_500ms;
|
||||
|
||||
volatile uint16_t gTxTimerCountdown_500ms;
|
||||
volatile bool gTxTimeoutReached;
|
||||
|
||||
volatile uint16_t gTailNoteEliminationCountdown_10ms;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
volatile uint16_t gNOAA_Countdown_10ms;
|
||||
#endif
|
||||
@ -220,7 +224,6 @@ volatile bool gNextTimeslice;
|
||||
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||
volatile uint16_t gVoxStopCountdown_10ms;
|
||||
volatile bool gTxTimeoutReached;
|
||||
volatile bool gNextTimeslice40ms;
|
||||
#ifdef ENABLE_NOAA
|
||||
volatile uint16_t gNOAACountdown_10ms = 0;
|
||||
|
9
misc.h
9
misc.h
@ -185,9 +185,13 @@ extern volatile uint16_t gDualWatchCountdown_10ms;
|
||||
extern volatile bool gDualWatchCountdownExpired;
|
||||
extern bool gDualWatchActive;
|
||||
|
||||
extern volatile bool gNextTimeslice500ms;
|
||||
extern volatile uint16_t gTxTimerCountdown;
|
||||
extern volatile bool gNextTimeslice_500ms;
|
||||
|
||||
extern volatile uint16_t gTxTimerCountdown_500ms;
|
||||
extern volatile bool gTxTimeoutReached;
|
||||
|
||||
extern volatile uint16_t gTailNoteEliminationCountdown_10ms;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
extern volatile uint16_t gFmPlayCountdown_10ms;
|
||||
#endif
|
||||
@ -282,7 +286,6 @@ extern uint8_t gShowChPrefix;
|
||||
extern volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||
extern volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||
extern volatile uint16_t gVoxStopCountdown_10ms;
|
||||
extern volatile bool gTxTimeoutReached;
|
||||
extern volatile bool gNextTimeslice40ms;
|
||||
#ifdef ENABLE_NOAA
|
||||
extern volatile uint16_t gNOAACountdown_10ms;
|
||||
|
79
radio.c
79
radio.c
@ -133,7 +133,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32
|
||||
#ifdef ENABLE_COMPANDER
|
||||
pInfo->Compander = 0; // off
|
||||
#endif
|
||||
|
||||
|
||||
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
||||
{
|
||||
pInfo->AM_CHANNEL_MODE = true;
|
||||
@ -223,7 +223,7 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
|
||||
// Band = BAND6_400MHz;
|
||||
Band = FREQUENCY_GetBand(gEeprom.ScreenChannel[VFO]); // 111 bug fix, or have I broke it ?
|
||||
}
|
||||
|
||||
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
{
|
||||
gEeprom.VfoInfo[VFO].Band = Band;
|
||||
@ -466,10 +466,10 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
{
|
||||
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 11) / 12;
|
||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 9) / 10;
|
||||
|
||||
|
||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 10) / 9;
|
||||
|
||||
|
||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 10) / 9;
|
||||
}
|
||||
@ -477,16 +477,16 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
{
|
||||
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 3) / 4;
|
||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 9) / 10;
|
||||
|
||||
|
||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 4) / 3;
|
||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 10) / 9;
|
||||
|
||||
|
||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 4) / 3;
|
||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 10) / 9;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (pInfo->SquelchOpenNoiseThresh > 127)
|
||||
pInfo->SquelchOpenNoiseThresh = 127;
|
||||
if (pInfo->SquelchCloseNoiseThresh > 127)
|
||||
@ -537,7 +537,7 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||
if (Frequency > UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1])
|
||||
Frequency = UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1];
|
||||
#endif
|
||||
|
||||
|
||||
pInfo->freq_config_TX.Frequency = Frequency;
|
||||
}
|
||||
|
||||
@ -598,7 +598,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
|
||||
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
@ -662,7 +662,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
default:
|
||||
case CODE_TYPE_OFF:
|
||||
BK4819_SetCTCSSFrequency(670);
|
||||
|
||||
|
||||
//#ifndef ENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||
BK4819_SetTailDetection(550); // QS's 55Hz tone method
|
||||
//#else
|
||||
@ -687,7 +687,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
| BK4819_REG_3F_CTCSS_LOST
|
||||
| BK4819_REG_3F_SQUELCH_FOUND
|
||||
| BK4819_REG_3F_SQUELCH_LOST;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case CODE_TYPE_DIGITAL:
|
||||
@ -924,10 +924,13 @@ void RADIO_SetVfoState(VfoState_t State)
|
||||
|
||||
void RADIO_PrepareTX(void)
|
||||
{
|
||||
VfoState_t State = VFO_STATE_NORMAL; // default to OK to TX
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
{ // dual-RX is enabled
|
||||
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_tx_10ms;
|
||||
gScheduleDualWatch = false;
|
||||
gScheduleDualWatch = false;
|
||||
|
||||
if (!gRxVfoIsActive)
|
||||
{
|
||||
@ -944,13 +947,11 @@ void RADIO_PrepareTX(void)
|
||||
RADIO_SelectCurrentVfo();
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
if (gAlarmState == ALARM_STATE_OFF ||
|
||||
if (gAlarmState == ALARM_STATE_OFF ||
|
||||
gAlarmState == ALARM_STATE_TX1750 ||
|
||||
(gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE))
|
||||
#endif
|
||||
{
|
||||
VfoState_t State;
|
||||
|
||||
#ifndef ENABLE_TX_WHEN_AM
|
||||
if (gCurrentVfo->IsAM)
|
||||
{ // not allowed to TX if in AM mode
|
||||
@ -963,38 +964,36 @@ void RADIO_PrepareTX(void)
|
||||
State = VFO_STATE_TX_DISABLE;
|
||||
}
|
||||
else
|
||||
if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST)
|
||||
{
|
||||
//if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST)
|
||||
if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0)
|
||||
{ // TX frequency is allowed
|
||||
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
|
||||
State = VFO_STATE_BUSY;
|
||||
State = VFO_STATE_BUSY; // busy RX'ing a station
|
||||
else
|
||||
if (gBatteryDisplayLevel == 0)
|
||||
State = VFO_STATE_BAT_LOW;
|
||||
State = VFO_STATE_BAT_LOW; // charge your battery !
|
||||
else
|
||||
// if (gBatteryDisplayLevel >= 6)
|
||||
if (gBatteryDisplayLevel >= 11)
|
||||
State = VFO_STATE_VOLTAGE_HIGH;
|
||||
else
|
||||
goto Skip;
|
||||
//if (gBatteryDisplayLevel >= 6)
|
||||
if (gBatteryDisplayLevel >= 11) // I've increased the battery level bar resolution
|
||||
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
|
||||
}
|
||||
else
|
||||
{
|
||||
State = VFO_STATE_TX_DISABLE;
|
||||
}
|
||||
|
||||
RADIO_SetVfoState(State);
|
||||
State = VFO_STATE_TX_DISABLE; // TX frequency not allowed
|
||||
}
|
||||
|
||||
if (State != VFO_STATE_NORMAL)
|
||||
{ // TX not allowed
|
||||
RADIO_SetVfoState(State);
|
||||
#ifdef ENABLE_ALARM
|
||||
gAlarmState = ALARM_STATE_OFF;
|
||||
#endif
|
||||
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
return;
|
||||
}
|
||||
|
||||
Skip:
|
||||
// TX is allowed
|
||||
|
||||
if (gDTMF_ReplyState == DTMF_REPLY_ANI)
|
||||
{
|
||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||
@ -1012,13 +1011,19 @@ Skip:
|
||||
|
||||
FUNCTION_Select(FUNCTION_TRANSMIT);
|
||||
|
||||
gTxTimerCountdown_500ms = 0; // no timeout
|
||||
#ifdef ENABLE_ALARM
|
||||
gTxTimerCountdown = (gAlarmState == ALARM_STATE_OFF) ? gEeprom.TX_TIMEOUT_TIMER * 120 : 0;
|
||||
#else
|
||||
gTxTimerCountdown = gEeprom.TX_TIMEOUT_TIMER * 120;
|
||||
if (gAlarmState == ALARM_STATE_OFF)
|
||||
#endif
|
||||
|
||||
{
|
||||
if (gEeprom.TX_TIMEOUT_TIMER == 1)
|
||||
gTxTimerCountdown_500ms = 60; // 30 sec
|
||||
else
|
||||
if (gEeprom.TX_TIMEOUT_TIMER >= 2)
|
||||
gTxTimerCountdown_500ms = (gEeprom.TX_TIMEOUT_TIMER - 1) * 120; // minutes
|
||||
}
|
||||
gTxTimeoutReached = false;
|
||||
|
||||
gFlagEndTransmission = false;
|
||||
gRTTECountdown = 0;
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
|
@ -54,8 +54,9 @@ void SystickHandler(void)
|
||||
|
||||
if ((gGlobalSysTickCounter % 50) == 0)
|
||||
{
|
||||
gNextTimeslice500ms = true;
|
||||
DECREMENT_AND_TRIGGER(gTxTimerCountdown, gTxTimeoutReached);
|
||||
gNextTimeslice_500ms = true;
|
||||
|
||||
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
||||
}
|
||||
|
||||
if ((gGlobalSysTickCounter & 3) == 0)
|
||||
|
20
ui/menu.c
20
ui/menu.c
@ -166,6 +166,21 @@ const char gSubMenu_SAVE[5][4] =
|
||||
"1:4"
|
||||
};
|
||||
|
||||
const char gSubMenu_TOT[11][7] =
|
||||
{
|
||||
"OFF",
|
||||
"30 sec",
|
||||
"1 min",
|
||||
"2 min",
|
||||
"3 min",
|
||||
"4 min",
|
||||
"5 min",
|
||||
"6 min",
|
||||
"7 min",
|
||||
"8 min",
|
||||
"9 min"
|
||||
};
|
||||
|
||||
const char gSubMenu_CHAN[3][7] =
|
||||
{
|
||||
"OFF",
|
||||
@ -565,10 +580,7 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_TOT:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%dmin", gSubMenuSelection);
|
||||
strcpy(String, gSubMenu_TOT[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
|
@ -123,6 +123,7 @@ extern const char gSubMenu_SFT_D[3][4];
|
||||
extern const char gSubMenu_W_N[2][7];
|
||||
extern const char gSubMenu_OFF_ON[2][4];
|
||||
extern const char gSubMenu_SAVE[5][4];
|
||||
extern const char gSubMenu_TOT[11][7];
|
||||
extern const char gSubMenu_CHAN[3][7];
|
||||
#ifdef ENABLE_VOICE
|
||||
extern const char gSubMenu_VOICE[3][4];
|
||||
|
Loading…
Reference in New Issue
Block a user