miccayo 1 год назад
Родитель
Сommit
1563fe51fa
2 измененных файлов с 57 добавлено и 2 удалено
  1. 6 0
      .vscode/settings.json
  2. 51 2
      scenes/xremote_scene_transmit.c

+ 6 - 0
.vscode/settings.json

@@ -0,0 +1,6 @@
+{
+    "files.associations": {
+        "xremote_ir_signal.h": "c",
+        "xremote_transmit.h": "c"
+    }
+}

+ 51 - 2
scenes/xremote_scene_transmit.c

@@ -114,11 +114,10 @@ void xremote_scene_transmit_send_signal(void* context, CrossRemoteItem* item) {
     }
 }
 
-void xremote_scene_transmit_run_remote(void* context) {
+void xremote_scene_transmit_run_remote_inner(void* context) {
     furi_assert(context);
     XRemote* app = context;
     CrossRemote* remote = app->cross_remote;
-
     size_t item_count = xremote_cross_remote_get_item_count(remote);
     for(size_t i = 0; i < item_count;) {
         if(xremote_cross_remote_get_transmitting(remote) == XRemoteTransmittingIdle) {
@@ -145,6 +144,56 @@ void xremote_scene_transmit_run_remote(void* context) {
     //xremote_transmit_model_set_name(app->xremote_transmit, xremote_cross_remote_get_name(remote));
 }
 
+void xremote_scene_transmit_run_remote(void* context) {
+    furi_assert(context);
+    XRemote* app = context;
+    CrossRemote* remote = app->cross_remote;
+
+    size_t item_count = xremote_cross_remote_get_item_count(remote);
+    if (app->loopir) {
+        while (true) {
+            for (size_t i = 0; i < item_count;) {
+                if (xremote_cross_remote_get_transmitting(remote) == XRemoteTransmittingIdle) {
+                    xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingStart);
+                    CrossRemoteItem* item = xremote_cross_remote_get_item(remote, i);
+                    xremote_scene_transmit_send_signal(app, item);
+                } else if (xremote_cross_remote_get_transmitting(remote) == XRemoteTransmittingStopSubghz) {
+                    i++;
+                    app->state_notifications = SubGhzNotificationStateIDLE;
+                    app->transmitting = false;
+                    subghz_txrx_stop(app->subghz->txrx);
+                    xremote_scene_ir_notification_message(app, SubGhzNotificationMessageBlinkStop);
+                    xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingIdle);
+                } else if (xremote_cross_remote_get_transmitting(remote) == XRemoteTransmittingStop) {
+                    i++;
+                    xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingIdle);
+                }
+            }
+        }
+    } else {
+        for (size_t i = 0; i < item_count;) {
+                if (xremote_cross_remote_get_transmitting(remote) == XRemoteTransmittingIdle) {
+                    xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingStart);
+                    CrossRemoteItem* item = xremote_cross_remote_get_item(remote, i);
+                    xremote_scene_transmit_send_signal(app, item);
+                } else if (xremote_cross_remote_get_transmitting(remote) == XRemoteTransmittingStopSubghz) {
+                    i++;
+                    app->state_notifications = SubGhzNotificationStateIDLE;
+                    app->transmitting = false;
+                    subghz_txrx_stop(app->subghz->txrx);
+                    xremote_scene_ir_notification_message(app, SubGhzNotificationMessageBlinkStop);
+                    xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingIdle);
+                } else if (xremote_cross_remote_get_transmitting(remote) == XRemoteTransmittingStop) {
+                    i++;
+                    xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingIdle);
+                }
+            }
+    }
+    xremote_scene_ir_notification_message(app, InfraredNotificationMessageBlinkStop);
+
+    scene_manager_previous_scene(app->scene_manager);
+}
+
 void xremote_scene_transmit_on_enter(void* context) {
     furi_assert(context);
     XRemote* app = context;