Skip to content

Commit

Permalink
Deconvolute end-of-tx
Browse files Browse the repository at this point in the history
Additionally, gFlagEndTransmission == true, which was being set when
a serial config was in progress or when TX timeout (but not always...(?))
path was switching to foreground function w/o stopping the radio, and
some RF pulses were emited after the radio was kicked out from TX mode
upon, for instance, the beginning of a serial configuration process.
  • Loading branch information
JuantAldea authored and egzumer committed Dec 28, 2023
1 parent 289418f commit 3b96b2a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 69 deletions.
61 changes: 17 additions & 44 deletions app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,17 +721,20 @@ static void CheckRadioInterrupts(void)
}
}

void APP_EndTransmission(void)
void APP_EndTransmission(bool inmediately)
{
// back to RX mode
RADIO_SendEndOfTransmission();

gFlagEndTransmission = true;

if (gMonitor) {
//turn the monitor back on
gFlagReconfigureVfos = true;
}

if (inmediately || gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) {
FUNCTION_Select(FUNCTION_FOREGROUND);
} else {
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
}
}

#ifdef ENABLE_VOX
Expand Down Expand Up @@ -771,29 +774,10 @@ static void HandleVox(void)
else if (gVoxStopCountdown_10ms == 0)
gVOX_NoiseDetected = false;

if (gCurrentFunction == FUNCTION_TRANSMIT && !gPttIsPressed && !gVOX_NoiseDetected)
{
if (gFlagEndTransmission)
{
//if (gCurrentFunction != FUNCTION_FOREGROUND)
FUNCTION_Select(FUNCTION_FOREGROUND);
}
else
{
APP_EndTransmission();

if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
{
//if (gCurrentFunction != FUNCTION_FOREGROUND)
FUNCTION_Select(FUNCTION_FOREGROUND);
}
else
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
}

gUpdateStatus = true;
gUpdateDisplay = true;
gFlagEndTransmission = false;
if (gCurrentFunction == FUNCTION_TRANSMIT && !gPttIsPressed && !gVOX_NoiseDetected) {
APP_EndTransmission(false);
gUpdateStatus = true;
gUpdateDisplay = true;
}
return;
}
Expand Down Expand Up @@ -830,7 +814,7 @@ void APP_Update(void)
{ // transmitter timed out or must de-key
gTxTimeoutReached = false;

APP_EndTransmission();
APP_EndTransmission(true);

AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);

Expand Down Expand Up @@ -1231,16 +1215,10 @@ void APP_TimeSlice10ms(void)
#endif

// repeater tail tone elimination
if (gRTTECountdown > 0)
{
if (--gRTTECountdown == 0)
{
//if (gCurrentFunction != FUNCTION_FOREGROUND)
FUNCTION_Select(FUNCTION_FOREGROUND);

gUpdateStatus = true;
gUpdateDisplay = true;
}
if (gRTTECountdown > 0 && gRTTECountdown-- == 0) {
FUNCTION_Select(FUNCTION_FOREGROUND);
gUpdateStatus = true;
gUpdateDisplay = true;
}
}

Expand Down Expand Up @@ -1528,7 +1506,7 @@ static void ALARM_Off(void)
gEnableSpeaker = false;

if (gAlarmState == ALARM_STATE_TXALARM || gAlarmState == ALARM_STATE_TX1750) {
RADIO_SendEndOfTransmission();
APP_EndTransmission(false);
}

gAlarmState = ALARM_STATE_OFF;
Expand Down Expand Up @@ -1800,11 +1778,6 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
else if ((!bKeyHeld && bKeyPressed) || (gAlarmState == ALARM_STATE_TX1750 && bKeyHeld && !bKeyPressed)) {
ALARM_Off();

if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
FUNCTION_Select(FUNCTION_FOREGROUND);
else
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;

if (Key == KEY_PTT)
gPttWasPressed = true;
else
Expand Down
4 changes: 1 addition & 3 deletions app/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#include "functions.h"
#include "frequencies.h"
#include "radio.h"

void APP_EndTransmission(void);
void APP_EndTransmission(bool inmediately);
void APP_StartListening(FUNCTION_Type_t function);
uint32_t APP_SetFreqByStepAndLimits(VFO_Info_t *pInfo, int8_t direction, uint32_t lower, uint32_t upper);
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t direction);
Expand All @@ -32,4 +31,3 @@ void APP_TimeSlice10ms(void);
void APP_TimeSlice500ms(void);

#endif

23 changes: 4 additions & 19 deletions app/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,11 @@ void GENERIC_Key_PTT(bool bKeyPressed)
{ // PTT released
if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // we are transmitting .. stop
APP_EndTransmission(SerialConfigInProgress());

if (gFlagEndTransmission)
{
FUNCTION_Select(FUNCTION_FOREGROUND);
}
else
{
APP_EndTransmission();

if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
FUNCTION_Select(FUNCTION_FOREGROUND);
else
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
}

gFlagEndTransmission = false;

#ifdef ENABLE_VOX
gVOX_NoiseDetected = false;
#endif
#ifdef ENABLE_VOX
gVOX_NoiseDetected = false;
#endif

RADIO_SetVfoState(VFO_STATE_NORMAL);

Expand Down
1 change: 0 additions & 1 deletion misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ bool g_SquelchLost;

volatile uint16_t gFlashLightBlinkCounter;

bool gFlagEndTransmission;
uint8_t gNextMrChannel;
ReceptionMode_t gRxReceptionMode;

Expand Down
1 change: 0 additions & 1 deletion misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ extern bool g_SquelchLost;

extern volatile uint16_t gFlashLightBlinkCounter;

extern bool gFlagEndTransmission;
extern uint8_t gNextMrChannel;
extern ReceptionMode_t gRxReceptionMode;

Expand Down
1 change: 0 additions & 1 deletion radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,6 @@ void RADIO_PrepareTX(void)
}

gTxTimeoutReached = false;
gFlagEndTransmission = false;
gRTTECountdown = 0;

#ifdef ENABLE_DTMF_CALLING
Expand Down

0 comments on commit 3b96b2a

Please sign in to comment.