瀏覽代碼

Cross Remote: No ext IR if using ext CC1101

Willy-JL 11 月之前
父節點
當前提交
a0323eb330
共有 1 個文件被更改,包括 18 次插入15 次删除
  1. 18 15
      cross_remote/xremote.c

+ 18 - 15
cross_remote/xremote.c

@@ -195,6 +195,8 @@ void xremote_text_input_callback(void* context) {
 
 int32_t xremote_app(void* p) {
     UNUSED(p);
+    bool otg_was_enabled = furi_hal_power_is_otg_enabled();
+
     XRemote* app = xremote_app_alloc();
 
     view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
@@ -205,24 +207,25 @@ int32_t xremote_app(void* p) {
 
     furi_hal_power_suppress_charge_enter();
 
-    bool otg_was_enabled = furi_hal_power_is_otg_enabled();
-    InfraredSettings settings = {0};
-    infrared_settings_load(&settings);
-    if(settings.tx_pin < FuriHalInfraredTxPinMax) {
-        furi_hal_infrared_set_tx_output(settings.tx_pin);
-        if(settings.otg_enabled != otg_was_enabled) {
-            if(settings.otg_enabled) {
+    if(strcmp(subghz_txrx_radio_device_get_name(app->subghz->txrx), "cc1101_ext") != 0) {
+        InfraredSettings settings = {0};
+        infrared_settings_load(&settings);
+        if(settings.tx_pin < FuriHalInfraredTxPinMax) {
+            furi_hal_infrared_set_tx_output(settings.tx_pin);
+            if(settings.otg_enabled != otg_was_enabled) {
+                if(settings.otg_enabled) {
+                    furi_hal_power_enable_otg();
+                } else {
+                    furi_hal_power_disable_otg();
+                }
+            }
+        } else {
+            FuriHalInfraredTxPin tx_pin_detected = furi_hal_infrared_detect_tx_output();
+            furi_hal_infrared_set_tx_output(tx_pin_detected);
+            if(tx_pin_detected != FuriHalInfraredTxPinInternal) {
                 furi_hal_power_enable_otg();
-            } else {
-                furi_hal_power_disable_otg();
             }
         }
-    } else {
-        FuriHalInfraredTxPin tx_pin_detected = furi_hal_infrared_detect_tx_output();
-        furi_hal_infrared_set_tx_output(tx_pin_detected);
-        if(tx_pin_detected != FuriHalInfraredTxPinInternal) {
-            furi_hal_power_enable_otg();
-        }
     }
 
     view_dispatcher_run(app->view_dispatcher);