瀏覽代碼

app exit still broken here

frux-c 2 年之前
父節點
當前提交
c30b8504cf
共有 4 個文件被更改,包括 26 次插入12 次删除
  1. 18 6
      scenes/uhf_scene_read_tag.c
  2. 1 1
      scenes/uhf_scene_start.c
  3. 3 3
      uhf_app_i.h
  4. 4 2
      uhf_worker.c

+ 18 - 6
scenes/uhf_scene_read_tag.c

@@ -2,12 +2,18 @@
 #include <dolphin/dolphin.h>
 
 void uhf_read_tag_worker_callback(UHFWorkerEvent event, void* ctx) {
-    FURI_LOG_E("read_callback", "%d", event);
-    UHFApp* uhf_app = ctx;
-    view_dispatcher_send_custom_event(uhf_app->view_dispatcher, UHFCustomEventWorkerExit);
+    UNUSED(event);
+    UNUSED(ctx);
+    // UHFApp* uhf_app = ctx;
+    // testing
+    FURI_LOG_E("THREAD", "uhf_read_tag_worker_callback %d", event);
+    // furi_delay_ms(3000);
+    // scene_manager_set_scene_state(uhf_app->scene_manager, UHFSceneReadTag, UHFSceneStart);
+    // view_dispatcher_send_custom_event(uhf_app->view_dispatcher, UHFCustomEventWorkerExit);
 }
 
 void uhf_scene_read_tag_on_enter(void* ctx) {
+    FURI_LOG_E("33", "uhf_scene_read_tag_on_enter was called!");
     UHFApp* uhf_app = ctx;
     dolphin_deed(DolphinDeedNfcRead);
 
@@ -21,21 +27,27 @@ void uhf_scene_read_tag_on_enter(void* ctx) {
     uhf_worker_start(uhf_app->worker, UHFWorkerStateDetect, uhf_read_tag_worker_callback, uhf_app);
 
     uhf_blink_start(uhf_app);
+
+    // furi_delay_ms(2000);
+    // view_dispatcher_send_custom_event(uhf_app->view_dispatcher, UHFCustomEventWorkerExit);
 }
 
 bool uhf_scene_read_tag_on_event(void* ctx, SceneManagerEvent event) {
-    UHFApp* uhf_app = ctx;
+    UNUSED(ctx);
+    // UHFApp* uhf_app = ctx;
     bool consumed = false;
-
+    FURI_LOG_E("33", "uhf_scene_read_tag_on_event was called! event.event: %lu", event.event);
     if(event.type == SceneManagerEventTypeCustom) {
+        FURI_LOG_E("36", "SceneManagerEventTypeCustom");
         if(event.event == UHFCustomEventWorkerExit) {
+            FURI_LOG_E("38", "UHFCustomEventWorkerExit");
             // if(memcmp(uhf_app->dev->dev_data.pacs.key, uhf_factory_debit_key, PICOPASS_BLOCK_LEN) ==
             //    0) {
             //     scene_manager_next_scene(uhf_app->scene_manager, PicopassSceneReadFactorySuccess);
             // } else {
             //     scene_manager_next_scene(uhf_app->scene_manager, PicopassSceneReadCardSuccess);
             // }
-            scene_manager_next_scene(uhf_app->scene_manager, UHFSceneStart);
+            // scene_manager_next_scene(uhf_app->scene_manager, UHFSceneStart);
             consumed = true;
         }
     }

+ 1 - 1
scenes/uhf_scene_start.c

@@ -6,6 +6,7 @@ void uhf_scene_start_submenu_callback(void* ctx, uint32_t index) {
     UHFApp* uhf_app = ctx;
     view_dispatcher_send_custom_event(uhf_app->view_dispatcher, index);
 }
+
 void uhf_scene_start_on_enter(void* ctx) {
     UHFApp* uhf_app = ctx;
 
@@ -27,7 +28,6 @@ bool uhf_scene_start_on_event(void* ctx, SceneManagerEvent event) {
     bool consumed = false;
 
     if(event.type == SceneManagerEventTypeCustom) {
-        FURI_LOG_E("EVENT", "%lu", event.event);
         if(event.event == SubmenuIndexRead) {
             scene_manager_set_scene_state(uhf_app->scene_manager, UHFSceneStart, SubmenuIndexRead);
             scene_manager_next_scene(uhf_app->scene_manager, UHFSceneReadTag);

+ 3 - 3
uhf_app_i.h

@@ -1,8 +1,5 @@
 #pragma once
 
-#include "uhf_app.h"
-#include "uhf_worker.h"
-
 #include <furi.h>
 #include <gui/gui.h>
 #include <gui/view_dispatcher.h>
@@ -21,6 +18,9 @@
 
 #include <storage/storage.h>
 #include <lib/toolbox/path.h>
+
+#include "uhf_app.h"
+#include "uhf_worker.h"
 #include <uhf_rfid_icons.h>
 
 #define UHF_TEXT_STORE_SIZE 128

+ 4 - 2
uhf_worker.c

@@ -1,10 +1,12 @@
-
 #include "uhf_worker.h"
 #include "uhf_data.h"
 
 int32_t uhf_worker_task(void* ctx) {
-    UNUSED(ctx);
+    UHFWorker* uhf_worker = ctx;
     FURI_LOG_E("uhf_worker", "worker callback has been called");
+    if(uhf_worker->callback) {
+        uhf_worker->callback((UHFWorkerEvent)NULL, uhf_worker->ctx);
+    }
     return 0;
 }