Apply changes to v0.22

This commit is contained in:
Armel FAUVEAU
2024-01-29 22:43:47 +01:00
parent ad9cc0c8b7
commit 74421ed6d7
23 changed files with 1181 additions and 22 deletions

View File

@@ -100,6 +100,13 @@ void (*action_opt_table[])(void) = {
#else
[ACTION_OPT_BLMIN_TMP_OFF] = &FUNCTION_NOP,
#endif
#ifdef ENABLE_FEAT_F4HWN
[ACTION_OPT_MAIN] = &ACTION_Main,
[ACTION_OPT_PTT] = &ACTION_Ptt,
#else
[ACTION_OPT_MAIN] = &FUNCTION_NOP,
#endif
};
static_assert(ARRAY_SIZE(action_opt_table) == ACTION_OPT_LEN);
@@ -441,3 +448,50 @@ void ACTION_BlminTmpOff(void)
}
}
#endif
#ifdef ENABLE_FEAT_F4HWN
void ACTION_Main(void)
{
static uint8_t cycle = 0;
static uint8_t a;
static uint8_t b;
if(gEeprom.DUAL_WATCH == 0 && gEeprom.CROSS_BAND_RX_TX == 0 && cycle != 1)
{
return;
}
else
{
if(cycle == 0)
{
a = gEeprom.DUAL_WATCH;
b = gEeprom.CROSS_BAND_RX_TX;
gEeprom.DUAL_WATCH = 0;
gEeprom.CROSS_BAND_RX_TX = 0;
gFlagReconfigureVfos = true;
gUpdateStatus = true;
cycle = 1;
}
else
{
gEeprom.DUAL_WATCH = a;
gEeprom.CROSS_BAND_RX_TX = b;
gFlagReconfigureVfos = true;
gUpdateStatus = true;
cycle = 0;
}
}
}
void ACTION_Ptt(void)
{
gSetting_set_ptt = (gSetting_set_ptt == 0) ? 1: 0;
}
#endif

View File

@@ -32,7 +32,12 @@ void ACTION_Scan(bool bRestart);
void ACTION_SwitchDemodul(void);
#ifdef ENABLE_BLMIN_TMP_OFF
void ACTION_BlminTmpOff(void);
void ACTION_BlminTmpOff(void);
#endif
#ifdef ENABLE_FEAT_F4HWN
void ACTION_Main(void);
void ACTION_Ptt(void);
#endif
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);

113
app/app.c
View File

@@ -825,10 +825,48 @@ void APP_Update(void)
}
#endif
#ifdef ENABLE_FEAT_F4HWN
if (gCurrentFunction == FUNCTION_TRANSMIT && (gTxTimeoutReachedAlert || SerialConfigInProgress()))
{
if (gEeprom.BACKLIGHT_TIME == 0) {
if (gBlinkCounter == 0)
{
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
else if(gBlinkCounter == 250)
{
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
}
else
{
if (gBlinkCounter == 0)
{
BACKLIGHT_TurnOn();
}
else if(gBlinkCounter == 15000)
{
BACKLIGHT_TurnOff();
}
}
gBlinkCounter++;
if(gBlinkCounter > 30000)
{
gBlinkCounter = 0;
}
}
#endif
if (gCurrentFunction == FUNCTION_TRANSMIT && (gTxTimeoutReached || SerialConfigInProgress()))
{ // transmitter timed out or must de-key
gTxTimeoutReached = false;
#ifdef ENABLE_FEAT_F4HWN
gTxTimeoutReachedAlert = false;
#endif
APP_EndTransmission();
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
@@ -1012,6 +1050,80 @@ static void CheckKeys(void)
#endif
// -------------------- PTT ------------------------
#ifdef ENABLE_FEAT_F4HWN
if (gSetting_set_ptt == 1)
{
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress() && gPttOnePushCounter == 0)
{ // PTT pressed
if (++gPttDebounceCounter >= 3) // 30ms
{ // start transmitting
boot_counter_10ms = 0;
gPttDebounceCounter = 0;
gPttIsPressed = true;
gPttOnePushCounter = 1;
ProcessKey(KEY_PTT, true, false);
}
}
else if ((GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress()) && gPttOnePushCounter == 1)
{
// PTT released or serial comms config in progress
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
{ // stop transmitting
gPttOnePushCounter = 2;
}
}
else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress() && gPttOnePushCounter == 2)
{ // PTT pressed again
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
{ // stop transmitting
ProcessKey(KEY_PTT, false, false);
gPttIsPressed = false;
gPttOnePushCounter = 3;
if (gKeyReading1 != KEY_INVALID)
gPttWasReleased = true;
}
}
else if ((GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress()) && gPttOnePushCounter == 3)
{ // PTT released or serial comms config in progress
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
{ // stop transmitting
gPttOnePushCounter = 0;
}
}
else
gPttDebounceCounter = 0;
}
else
{
if (gPttIsPressed)
{
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress())
{ // PTT released or serial comms config in progress
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
{ // stop transmitting
ProcessKey(KEY_PTT, false, false);
gPttIsPressed = false;
if (gKeyReading1 != KEY_INVALID)
gPttWasReleased = true;
}
}
else
gPttDebounceCounter = 0;
}
else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress())
{ // PTT pressed
if (++gPttDebounceCounter >= 3) // 30ms
{ // start transmitting
boot_counter_10ms = 0;
gPttDebounceCounter = 0;
gPttIsPressed = true;
ProcessKey(KEY_PTT, true, false);
}
}
else
gPttDebounceCounter = 0;
}
#else
if (gPttIsPressed)
{
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress())
@@ -1039,6 +1151,7 @@ static void CheckKeys(void)
}
else
gPttDebounceCounter = 0;
#endif
// --------------------- OTHER KEYS ----------------------------

View File

@@ -363,6 +363,17 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = gSubMenu_SIDEFUNCTIONS_size-1;
break;
#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_LOW:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_LOW) - 1;
break;
case MENU_SET_PTT:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
break;
#endif
default:
return -1;
}
@@ -797,6 +808,16 @@ void MENU_AcceptSetting(void)
}
break;
#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_LOW:
gSetting_set_low = gSubMenuSelection;
gRequestSaveChannel = 1;
break;
case MENU_SET_PTT:
gSetting_set_ptt = gSubMenuSelection;
gRequestSaveChannel = 1;
break;
#endif
}
gRequestSaveSettings = true;
@@ -1159,6 +1180,15 @@ void MENU_ShowCurrentSetting(void)
break;
}
#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_LOW:
gSubMenuSelection = gSetting_set_low;
break;
case MENU_SET_PTT:
gSubMenuSelection = gSetting_set_ptt;
break;
#endif
default:
return;
}