From a098e0561e667464ba8abe949083ea5267f64174 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 10 Feb 2023 00:56:29 +0300 Subject: [PATCH] Temp fix BUG: Now sound works but sending signal with sound on doesn't actually send signal!!! Need to return previous implementation with 2 channel Timer or find another way --- .../scenes/subghz_scene_ext_module_settings.c | 7 ------- applications/main/subghz/subghz_i.c | 13 +++++++++++++ firmware/targets/f7/furi_hal/furi_hal_subghz.c | 15 ++++++++++++++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c b/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c index 919c0042a..7d7a505cb 100644 --- a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c +++ b/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c @@ -34,13 +34,6 @@ static void subghz_scene_receiver_config_set_debug_pin(VariableItem* item) { variable_item_set_current_value_text(item, debug_pin_text[index]); - if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { - if(value_index2 == 1) { - furi_hal_subghz_set_async_mirror_pin(&gpio_ext_pa7); - } else { - furi_hal_subghz_set_async_mirror_pin(NULL); - } - } subghz->txrx->debug_pin_state = index == 1; } diff --git a/applications/main/subghz/subghz_i.c b/applications/main/subghz/subghz_i.c index b572a6f43..1fbe662ed 100644 --- a/applications/main/subghz/subghz_i.c +++ b/applications/main/subghz/subghz_i.c @@ -597,6 +597,10 @@ void subghz_hopper_update(SubGhz* subghz) { } void subghz_speaker_on(SubGhz* subghz) { + if(subghz->txrx->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(&gpio_ext_pa7); + } + if(subghz->txrx->speaker_state == SubGhzSpeakerStateEnable) { if(furi_hal_speaker_acquire(30)) { if(!subghz->txrx->debug_pin_state) { @@ -609,6 +613,9 @@ void subghz_speaker_on(SubGhz* subghz) { } void subghz_speaker_off(SubGhz* subghz) { + if(subghz->txrx->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(NULL); + } if(subghz->txrx->speaker_state != SubGhzSpeakerStateDisable) { if(furi_hal_speaker_is_mine()) { if(!subghz->txrx->debug_pin_state) { @@ -622,6 +629,9 @@ void subghz_speaker_off(SubGhz* subghz) { } void subghz_speaker_mute(SubGhz* subghz) { + if(subghz->txrx->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(NULL); + } if(subghz->txrx->speaker_state == SubGhzSpeakerStateEnable) { if(furi_hal_speaker_is_mine()) { if(!subghz->txrx->debug_pin_state) { @@ -632,6 +642,9 @@ void subghz_speaker_mute(SubGhz* subghz) { } void subghz_speaker_unmute(SubGhz* subghz) { + if(subghz->txrx->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(&gpio_ext_pa7); + } if(subghz->txrx->speaker_state == SubGhzSpeakerStateEnable) { if(furi_hal_speaker_is_mine()) { if(!subghz->txrx->debug_pin_state) { diff --git a/firmware/targets/f7/furi_hal/furi_hal_subghz.c b/firmware/targets/f7/furi_hal/furi_hal_subghz.c index 05afd758a..58bb844ef 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_subghz.c +++ b/firmware/targets/f7/furi_hal/furi_hal_subghz.c @@ -777,8 +777,18 @@ bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void* LL_TIM_SetCounter(TIM2, 0); LL_TIM_EnableCounter(TIM2); - //Signal generation for external G0 + //Signal generation for external module + + // Start debug (and speaker) + furi_hal_subghz_start_debug(); + const GpioPin* gpio = furi_hal_subghz.cc1101_g0_pin; + + if((furi_hal_subghz.async_mirror_pin != NULL) && + (furi_hal_subghz.radio_type == SubGhzRadioInternal)) { + gpio = furi_hal_subghz.async_mirror_pin; + } + furi_hal_subghz_debug_gpio_buff[0] = (uint32_t)gpio->pin << GPIO_NUMBER; furi_hal_subghz_debug_gpio_buff[1] = gpio->pin; @@ -828,6 +838,9 @@ void furi_hal_subghz_stop_async_tx() { // Deinitialize GPIO furi_hal_gpio_init(furi_hal_subghz.cc1101_g0_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow); + // Stop debug + furi_hal_subghz_stop_debug(); + LL_DMA_DisableChannel(SUBGHZ_DMA_CH2_DEF); FURI_CRITICAL_EXIT();