Add SetEot (End Of Transmission)

This commit is contained in:
Armel FAUVEAU
2024-02-10 23:41:54 +01:00
parent db56943296
commit 2307976c17
9 changed files with 86 additions and 15 deletions

View File

@@ -376,6 +376,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
break;
case MENU_SET_TOT:
case MENU_SET_EOT:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1;
break;
@@ -842,6 +843,9 @@ void MENU_AcceptSetting(void)
case MENU_SET_TOT:
gSetting_set_tot = gSubMenuSelection;
break;
case MENU_SET_EOT:
gSetting_set_eot = gSubMenuSelection;
break;
case MENU_SET_CTR:
gSetting_set_ctr = gSubMenuSelection;
break;
@@ -1225,6 +1229,9 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_TOT:
gSubMenuSelection = gSetting_set_tot;
break;
case MENU_SET_EOT:
gSubMenuSelection = gSetting_set_eot;
break;
case MENU_SET_CTR:
gSubMenuSelection = gSetting_set_ctr;
break;

24
audio.c
View File

@@ -42,6 +42,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
Beep != BEEP_440HZ_500MS &&
Beep != BEEP_880HZ_200MS &&
Beep != BEEP_880HZ_500MS &&
#ifdef ENABLE_FEAT_F4HWN
Beep != BEEP_800HZ_30MS &&
Beep != BEEP_1000HZ_30MS &&
#endif
!gEeprom.BEEP_CONTROL)
return;
@@ -94,6 +98,16 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
case BEEP_880HZ_500MS:
ToneFrequency = 880;
break;
#ifdef ENABLE_FEAT_F4HWN
case BEEP_800HZ_30MS:
ToneFrequency = 800;
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
break;
case BEEP_1000HZ_30MS:
ToneFrequency = 1000;
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
break;
#endif
}
BK4819_PlayTone(ToneFrequency, true);
@@ -133,6 +147,16 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
BK4819_ExitTxMute();
Duration = 200;
break;
#ifdef ENABLE_FEAT_F4HWN
case BEEP_800HZ_30MS:
BK4819_ExitTxMute();
Duration = 30;
break;
case BEEP_1000HZ_30MS:
BK4819_ExitTxMute();
Duration = 30;
break;
#endif
case BEEP_440HZ_500MS:
case BEEP_880HZ_500MS:
default:

View File

@@ -34,6 +34,10 @@ enum BEEP_Type_t
BEEP_500HZ_60MS_DOUBLE_BEEP,
BEEP_440HZ_40MS_OPTIONAL,
BEEP_880HZ_40MS_OPTIONAL,
#ifdef ENABLE_FEAT_F4HWN
BEEP_800HZ_30MS,
BEEP_1000HZ_30MS,
#endif
BEEP_880HZ_60MS_TRIPLE_BEEP
};

7
misc.c
View File

@@ -96,11 +96,12 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
#endif
#ifdef ENABLE_FEAT_F4HWN
uint8_t gSetting_set_low;
bool gSetting_set_ptt;
uint8_t gSetting_set_tot;
uint8_t gSetting_set_low = 1;
bool gSetting_set_ptt = 0;
uint8_t gSetting_set_tot = 0;
uint8_t gSetting_set_ctr = 11;
bool gSetting_set_inv = false;
uint8_t gSetting_set_eot = 0;
bool gSetting_set_ptt_session;
#endif

1
misc.h
View File

@@ -162,6 +162,7 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
extern uint8_t gSetting_set_tot;
extern uint8_t gSetting_set_ctr;
extern bool gSetting_set_inv;
extern uint8_t gSetting_set_eot;
extern bool gSetting_set_ptt_session;
#endif

View File

@@ -287,10 +287,11 @@ void SETTINGS_InitEEPROM(void)
#ifdef ENABLE_FEAT_F4HWN
// 1FF0..0x1FF7
EEPROM_ReadBuffer(0x1FF0, Data, 8);
gSetting_set_low = (Data[7] < 5) ? Data[7] : 0;
gSetting_set_low = (((Data[7] & 0xF0) >> 4) < 5) ? ((Data[7] & 0xF0) >> 4) : 0;
gSetting_set_ptt = (((Data[7] & 0x0F)) < 2) ? ((Data[7] & 0x0F)) : 0;
gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0;
gSetting_set_ptt = (((Data[6] & 0x0F)) < 2) ? ((Data[6] & 0x0F)) : 0;
gSetting_set_eot = (((Data[6] & 0x0F)) < 4) ? ((Data[6] & 0x0F)) : 0;
gSetting_set_inv = (((Data[5] & 0xF0) >> 4) < 2) ? ((Data[5] & 0xF0) >> 4) : 0;
gSetting_set_ctr = (((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 5;
@@ -624,8 +625,8 @@ void SETTINGS_SaveSettings(void)
memset(State, 0xFF, sizeof(State));
State[5] = ((gSetting_set_inv << 4) | (gSetting_set_ctr & 0x0F));
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_ptt & 0x0F));
State[7] = gSetting_set_low;
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
State[7] = ((gSetting_set_low << 4) | (gSetting_set_ptt & 0x0F));
EEPROM_WriteBuffer(0x1FF0, State);
#endif
}

View File

@@ -36,6 +36,7 @@
#include "ui/inputbox.h"
#include "ui/main.h"
#include "ui/ui.h"
#include "audio.h"
#ifdef ENABLE_FEAT_F4HWN
#include "driver/system.h"
@@ -445,8 +446,8 @@ void UI_MAIN_TimeSlice500ms(void)
if(FUNCTION_IsRx()) {
DisplayRSSIBar(true);
}
#ifdef ENABLE_FEAT_F4HWN
else
#ifdef ENABLE_FEAT_F4HWN // Blink Green Led for white...
else if(gSetting_set_eot > 0)
{
if(RXBlinkLed == 2)
{
@@ -454,13 +455,39 @@ void UI_MAIN_TimeSlice500ms(void)
{
if(RXBlinkLedCounter % 2 == 0)
{
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
if(gSetting_set_eot > 1 )
{
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
}
}
else
{
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true);
if(RXBlinkLedCounter > 6)
SYSTEM_DelayMs(350);
if(gSetting_set_eot > 1 )
{
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true);
}
if(RXBlinkLedCounter <= 6)
{
if(gSetting_set_eot == 1 || gSetting_set_eot == 3)
{
AUDIO_PlayBeep(BEEP_800HZ_30MS);
}
}
else
{
if(gSetting_set_eot == 1 || gSetting_set_eot == 3)
{
AUDIO_PlayBeep(BEEP_800HZ_30MS);
SYSTEM_DelayMs(100);
AUDIO_PlayBeep(BEEP_1000HZ_30MS);
SYSTEM_DelayMs(100);
}
else if(gSetting_set_eot == 2)
{
SYSTEM_DelayMs(350);
}
}
}
RXBlinkLedCounter += 1;
}

View File

@@ -129,6 +129,7 @@ const t_menu_item MenuList[] =
{"SetLow", VOICE_ID_INVALID, MENU_SET_LOW },
{"SetPtt", VOICE_ID_INVALID, MENU_SET_PTT },
{"SetTot", VOICE_ID_INVALID, MENU_SET_TOT },
{"SetEot", VOICE_ID_INVALID, MENU_SET_EOT },
{"SetCtr", VOICE_ID_INVALID, MENU_SET_CTR },
{"SetInv", VOICE_ID_INVALID, MENU_SET_INV },
#endif
@@ -362,7 +363,7 @@ const char gSubMenu_SCRAMBLER[][7] =
"ONEPUSH"
};
const char gSubMenu_SET_TOT[][7] =
const char gSubMenu_SET_TOT[][7] = // Use by SET_EOT too
{
"OFF",
"SOUND",
@@ -907,6 +908,10 @@ void UI_DisplayMenu(void)
strcpy(String, gSubMenu_SET_TOT[gSubMenuSelection]);
break;
case MENU_SET_EOT:
strcpy(String, gSubMenu_SET_TOT[gSubMenuSelection]); // Same as SET_TOT
break;
case MENU_SET_CTR:
sprintf(String, "%d", gSubMenuSelection);
gSetting_set_ctr = gSubMenuSelection;

View File

@@ -125,6 +125,7 @@ enum
MENU_SET_LOW,
MENU_SET_PTT,
MENU_SET_TOT,
MENU_SET_EOT,
MENU_SET_CTR,
MENU_SET_INV,
#endif