Fix #25: When you stop the scan with the PTT the Walkie stays in permanent TX
This commit is contained in:
11
app/app.c
11
app/app.c
@@ -1298,6 +1298,7 @@ void APP_CheckKeys(void)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// -------------------- PTT ------------------------
|
||||||
if (gPttIsPressed)
|
if (gPttIsPressed)
|
||||||
{
|
{
|
||||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || gSerialConfigCountDown_500ms > 0)
|
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || gSerialConfigCountDown_500ms > 0)
|
||||||
@@ -1313,8 +1314,7 @@ void APP_CheckKeys(void)
|
|||||||
else
|
else
|
||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
}
|
}
|
||||||
else
|
else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && gSerialConfigCountDown_500ms == 0)
|
||||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && gSerialConfigCountDown_500ms == 0)
|
|
||||||
{ // PTT pressed
|
{ // PTT pressed
|
||||||
if (++gPttDebounceCounter >= 3) // 30ms
|
if (++gPttDebounceCounter >= 3) // 30ms
|
||||||
{ // start transmitting
|
{ // start transmitting
|
||||||
@@ -2226,8 +2226,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (gPttWasReleased)
|
||||||
if (gPttWasReleased)
|
|
||||||
{
|
{
|
||||||
if (bKeyHeld)
|
if (bKeyHeld)
|
||||||
bFlag = true;
|
bFlag = true;
|
||||||
@@ -2331,6 +2330,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
switch (gScreenToDisplay)
|
switch (gScreenToDisplay)
|
||||||
{
|
{
|
||||||
case DISPLAY_MAIN:
|
case DISPLAY_MAIN:
|
||||||
|
|
||||||
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
|
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
|
||||||
// bKeyHeld = false; // allow the channel setting to be saved
|
// bKeyHeld = false; // allow the channel setting to be saved
|
||||||
break;
|
break;
|
||||||
@@ -2369,8 +2369,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
ACTION_Handle(Key, bKeyPressed, bKeyHeld);
|
ACTION_Handle(Key, bKeyPressed, bKeyHeld);
|
||||||
}
|
}
|
||||||
else
|
else if (!bKeyHeld && bKeyPressed)
|
||||||
if (!bKeyHeld && bKeyPressed)
|
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,19 +37,19 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
if (gInputBoxIndex > 0)
|
if (gInputBoxIndex > 0)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed) // short pressed
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bKeyHeld || !bKeyPressed)
|
if (bKeyHeld || !bKeyPressed) // held or released
|
||||||
{
|
{
|
||||||
if (bKeyHeld || bKeyPressed)
|
if (bKeyHeld || bKeyPressed) // held or pressed (cannot be held and not pressed I guess, so it checks only if HELD?)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld)
|
if (!bKeyHeld) // won't ever pass
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed) // won't ever pass
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MENU &&
|
if (gScreenToDisplay != DISPLAY_MENU &&
|
||||||
@@ -65,7 +65,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
gRequestSaveSettings = true;
|
gRequestSaveSettings = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // released
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM)
|
if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM)
|
||||||
@@ -75,7 +75,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gWasFKeyPressed = !gWasFKeyPressed;
|
gWasFKeyPressed = !gWasFKeyPressed; // toggle F function
|
||||||
|
|
||||||
if (gWasFKeyPressed)
|
if (gWasFKeyPressed)
|
||||||
gKeyInputCountdown = key_input_timeout_500ms;
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
@@ -88,7 +88,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // short pressed
|
||||||
{
|
{
|
||||||
if (gScreenToDisplay != DISPLAY_FM)
|
if (gScreenToDisplay != DISPLAY_FM)
|
||||||
{
|
{
|
||||||
@@ -97,7 +97,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFM_ScanState == FM_SCAN_OFF)
|
if (gFM_ScanState == FM_SCAN_OFF) // not scanning
|
||||||
{
|
{
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
@@ -116,7 +116,6 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
|
|
||||||
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
|
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
|
||||||
{ // PTT released
|
{ // PTT released
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
{ // we are transmitting .. stop
|
{ // we are transmitting .. stop
|
||||||
|
|
||||||
@@ -255,7 +254,6 @@ start_tx:
|
|||||||
cancel_tx:
|
cancel_tx:
|
||||||
if (gPttIsPressed)
|
if (gPttIsPressed)
|
||||||
{
|
{
|
||||||
gPttIsPressed = false;
|
|
||||||
gPttWasPressed = true;
|
gPttWasPressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user