From 04da5ae1dc547e2ad550e1b589b058578fe97f32 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 16 Feb 2024 19:50:49 +0100 Subject: [PATCH] Fix EOT blocking issue and EOT is now fixed at 4s --- audio.c | 12 ++++----- audio.h | 2 +- misc.c | 19 +++++++++---- ui/main.c | 80 +++++++++++++++++++++++++------------------------------ 4 files changed, 57 insertions(+), 56 deletions(-) diff --git a/audio.c b/audio.c index c2020e8..1ac21a8 100644 --- a/audio.c +++ b/audio.c @@ -46,8 +46,8 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) #endif #ifdef ENABLE_FEAT_F4HWN Beep != BEEP_400HZ_30MS && + Beep != BEEP_500HZ_30MS && Beep != BEEP_600HZ_30MS && - Beep != BEEP_800HZ_30MS && #endif !gEeprom.BEEP_CONTROL) return; @@ -108,12 +108,12 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) ToneFrequency = 400; BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); break; - case BEEP_600HZ_30MS: - ToneFrequency = 600; + case BEEP_500HZ_30MS: + ToneFrequency = 500; BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); break; - case BEEP_800HZ_30MS: - ToneFrequency = 800; + case BEEP_600HZ_30MS: + ToneFrequency = 600; BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); break; #endif @@ -158,8 +158,8 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) break; #ifdef ENABLE_FEAT_F4HWN case BEEP_400HZ_30MS: + case BEEP_500HZ_30MS: case BEEP_600HZ_30MS: - case BEEP_800HZ_30MS: BK4819_ExitTxMute(); Duration = 30; break; diff --git a/audio.h b/audio.h index 8efb289..1e5d001 100644 --- a/audio.h +++ b/audio.h @@ -38,8 +38,8 @@ enum BEEP_Type_t BEEP_880HZ_40MS_OPTIONAL, #ifdef ENABLE_FEAT_F4HWN BEEP_400HZ_30MS, + BEEP_500HZ_30MS, BEEP_600HZ_30MS, - BEEP_800HZ_30MS, #endif BEEP_880HZ_60MS_TRIPLE_BEEP }; diff --git a/misc.c b/misc.c index ed707df..a403925 100644 --- a/misc.c +++ b/misc.c @@ -44,11 +44,20 @@ const uint16_t key_debounce_10ms = 20 / 10; // 20ms const uint8_t scan_delay_10ms = 210 / 10; // 210ms -const uint16_t dual_watch_count_after_tx_10ms = 3600 / 10; // 3.6 sec after TX ends -const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ? -const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec -const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec -const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms +#ifdef ENABLE_FEAT_F4HWN + const uint16_t dual_watch_count_after_tx_10ms = 420; // 4.2 sec after TX ends + const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ? + const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec + const uint16_t dual_watch_count_after_2_10ms = 420; // 4.2 sec + const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms +#else + const uint16_t dual_watch_count_after_tx_10ms = 3600 / 10; // 3.6 sec after TX ends + const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ? + const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec + const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec + const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms +#endif + #ifdef ENABLE_VOX const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms #endif diff --git a/ui/main.c b/ui/main.c index f3cf127..dc781d1 100644 --- a/ui/main.c +++ b/ui/main.c @@ -467,59 +467,51 @@ void UI_MAIN_TimeSlice500ms(void) DisplayRSSIBar(true); } #ifdef ENABLE_FEAT_F4HWN // Blink Green Led for white... - else if(gSetting_set_eot > 0) + else if(gSetting_set_eot > 0 && RxBlinkLed == 2) { - if(RxBlinkLed == 2) + if(RxBlinkLedCounter <= 8) { - if(RxBlinkLedCounter <= 10) + if(RxBlinkLedCounter % 2 == 0) { - if(RxBlinkLedCounter % 2 == 0) + if(gSetting_set_eot > 1 ) { - if(gSetting_set_eot > 1 ) - { - BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false); - } + BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false); } - else - { - 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_400HZ_30MS); - } - } - else - { - if(gSetting_set_eot == 1 || gSetting_set_eot == 3) - { - if(RxBlinkLedCounter <= 8) - { - AUDIO_PlayBeep(BEEP_600HZ_30MS); - } - else - { - AUDIO_PlayBeep(BEEP_800HZ_30MS); - } - SYSTEM_DelayMs(200); - } - else if(gSetting_set_eot == 2) - { - SYSTEM_DelayMs(400); - } - } - } - RxBlinkLedCounter += 1; } else { - RxBlinkLed = 0; + if(gSetting_set_eot > 1 ) + { + BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true); + } + + if(gSetting_set_eot == 1 || gSetting_set_eot == 3) + { + switch(RxBlinkLedCounter) + { + case 1: + AUDIO_PlayBeep(BEEP_400HZ_30MS); + break; + + case 3: + AUDIO_PlayBeep(BEEP_400HZ_30MS); + break; + + case 5: + AUDIO_PlayBeep(BEEP_500HZ_30MS); + break; + + case 7: + AUDIO_PlayBeep(BEEP_600HZ_30MS); + break; + } + } } + RxBlinkLedCounter += 1; + } + else + { + RxBlinkLed = 0; } } #endif