mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-22 02:08:48 +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;
|
||||
gFlagEndTransmission = true;
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -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;
|
||||
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;
|
||||
|
49
radio.c
49
radio.c
@ -924,8 +924,11 @@ 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;
|
||||
|
||||
@ -949,8 +952,6 @@ void RADIO_PrepareTX(void)
|
||||
(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;
|
||||
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