From 8052dfd52cc6ae59413b210f8097f76d84c3b17e Mon Sep 17 00:00:00 2001 From: Sil 333033 <333033@student.mboutrecht.nl> Date: Tue, 18 Jul 2023 13:17:52 +0200 Subject: [PATCH] added the check in the rx tx function --- lib/subghz/devices/devices.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/subghz/devices/devices.c b/lib/subghz/devices/devices.c index 2bed99acd..cc6a3e6e2 100644 --- a/lib/subghz/devices/devices.c +++ b/lib/subghz/devices/devices.c @@ -142,7 +142,15 @@ bool subghz_devices_set_tx(const SubGhzDevice* device) { furi_assert(device); if(device->interconnect->set_tx) { ret = device->interconnect->set_tx(); - furi_hal_gpio_write(&gpio_ext_pc3, 1); + + SubGhzLastSettings* last_settings = subghz_last_settings_alloc(); + subghz_last_settings_load(last_settings, 0); + + if(last_settings->external_module_power_amp) { + furi_hal_gpio_write(&gpio_ext_pc3, 1); + } + + subghz_last_settings_free(last_settings); } return ret; } @@ -183,7 +191,14 @@ void subghz_devices_set_rx(const SubGhzDevice* device) { furi_assert(device); if(device->interconnect->set_rx) { device->interconnect->set_rx(); - furi_hal_gpio_write(&gpio_ext_pc3, 0); + SubGhzLastSettings* last_settings = subghz_last_settings_alloc(); + subghz_last_settings_load(last_settings, 0); + + if(last_settings->external_module_power_amp) { + furi_hal_gpio_write(&gpio_ext_pc3, 0); + } + + subghz_last_settings_free(last_settings); } }