Sfoglia il codice sorgente

Fix UART deinit issues and crashes

Remove interrupt callback before stopping thread
Prevents race condition of interrupt setting flag on free'd thread
Also correctly stop async rx events
Willy-JL 1 anno fa
parent
commit
1492b617c0
1 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 4 3
      magspoof/scenes/mag_scene_read.c

+ 4 - 3
magspoof/scenes/mag_scene_read.c

@@ -169,6 +169,10 @@ void mag_scene_read_on_exit(void* context) {
     widget_reset(mag->widget);
     // view_dispatcher_remove_view(mag->view_dispatcher, MagViewWidget);
 
+    furi_hal_serial_async_rx_stop(mag->serial_handle);
+    furi_hal_serial_deinit(mag->serial_handle);
+    furi_hal_serial_control_release(mag->serial_handle);
+
     // Stop UART worker
     FURI_LOG_D(TAG, "Stopping UART worker");
     furi_thread_flags_set(furi_thread_get_id(mag->uart_rx_thread), WorkerEvtStop);
@@ -178,8 +182,5 @@ void mag_scene_read_on_exit(void* context) {
 
     furi_string_free(mag->uart_text_box_store);
 
-    furi_hal_serial_deinit(mag->serial_handle);
-    furi_hal_serial_control_release(mag->serial_handle);
-
     notification_message(mag->notifications, &sequence_blink_stop);
 }