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; *pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
break; break;
case MENU_SET_TOT: case MENU_SET_TOT:
case MENU_SET_EOT:
*pMin = 0; *pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1; *pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1;
break; break;
@@ -842,6 +843,9 @@ void MENU_AcceptSetting(void)
case MENU_SET_TOT: case MENU_SET_TOT:
gSetting_set_tot = gSubMenuSelection; gSetting_set_tot = gSubMenuSelection;
break; break;
case MENU_SET_EOT:
gSetting_set_eot = gSubMenuSelection;
break;
case MENU_SET_CTR: case MENU_SET_CTR:
gSetting_set_ctr = gSubMenuSelection; gSetting_set_ctr = gSubMenuSelection;
break; break;
@@ -1225,6 +1229,9 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_TOT: case MENU_SET_TOT:
gSubMenuSelection = gSetting_set_tot; gSubMenuSelection = gSetting_set_tot;
break; break;
case MENU_SET_EOT:
gSubMenuSelection = gSetting_set_eot;
break;
case MENU_SET_CTR: case MENU_SET_CTR:
gSubMenuSelection = gSetting_set_ctr; gSubMenuSelection = gSetting_set_ctr;
break; break;

24
audio.c
View File

@@ -42,6 +42,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
Beep != BEEP_440HZ_500MS && Beep != BEEP_440HZ_500MS &&
Beep != BEEP_880HZ_200MS && Beep != BEEP_880HZ_200MS &&
Beep != BEEP_880HZ_500MS && Beep != BEEP_880HZ_500MS &&
#ifdef ENABLE_FEAT_F4HWN
Beep != BEEP_800HZ_30MS &&
Beep != BEEP_1000HZ_30MS &&
#endif
!gEeprom.BEEP_CONTROL) !gEeprom.BEEP_CONTROL)
return; return;
@@ -94,6 +98,16 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
case BEEP_880HZ_500MS: case BEEP_880HZ_500MS:
ToneFrequency = 880; ToneFrequency = 880;
break; 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); BK4819_PlayTone(ToneFrequency, true);
@@ -133,6 +147,16 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
BK4819_ExitTxMute(); BK4819_ExitTxMute();
Duration = 200; Duration = 200;
break; 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_440HZ_500MS:
case BEEP_880HZ_500MS: case BEEP_880HZ_500MS:
default: default:

View File

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

7
misc.c
View File

@@ -96,11 +96,12 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
uint8_t gSetting_set_low; uint8_t gSetting_set_low = 1;
bool gSetting_set_ptt; bool gSetting_set_ptt = 0;
uint8_t gSetting_set_tot; uint8_t gSetting_set_tot = 0;
uint8_t gSetting_set_ctr = 11; uint8_t gSetting_set_ctr = 11;
bool gSetting_set_inv = false; bool gSetting_set_inv = false;
uint8_t gSetting_set_eot = 0;
bool gSetting_set_ptt_session; bool gSetting_set_ptt_session;
#endif #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_tot;
extern uint8_t gSetting_set_ctr; extern uint8_t gSetting_set_ctr;
extern bool gSetting_set_inv; extern bool gSetting_set_inv;
extern uint8_t gSetting_set_eot;
extern bool gSetting_set_ptt_session; extern bool gSetting_set_ptt_session;
#endif #endif

View File

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

View File

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

View File

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

View File

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