Jelajahi Sumber

fix uart related plugins to disable expansion protocol

MX 1 tahun lalu
induk
melakukan
6482de895f
1 mengubah file dengan 11 tambahan dan 0 penghapusan
  1. 11 0
      uhf_app.c

+ 11 - 0
uhf_app.c

@@ -1,4 +1,5 @@
 #include "uhf_app_i.h"
 #include "uhf_app_i.h"
+#include <expansion/expansion.h>
 
 
 char* convertToHexString(uint8_t* array, size_t length) {
 char* convertToHexString(uint8_t* array, size_t length) {
     if(array == NULL || length == 0) {
     if(array == NULL || length == 0) {
@@ -194,6 +195,11 @@ void uhf_show_loading_popup(void* ctx, bool show) {
 
 
 int32_t uhf_app_main(void* ctx) {
 int32_t uhf_app_main(void* ctx) {
     UNUSED(ctx);
     UNUSED(ctx);
+
+    // Disable expansion protocol to avoid interference with UART Handle
+    Expansion* expansion = furi_record_open(RECORD_EXPANSION);
+    expansion_disable(expansion);
+
     UHFApp* uhf_app = uhf_alloc();
     UHFApp* uhf_app = uhf_alloc();
 
 
     // enable 5v pin
     // enable 5v pin
@@ -216,5 +222,10 @@ int32_t uhf_app_main(void* ctx) {
     // furi_hal_gpio_disable_int_callback()
     // furi_hal_gpio_disable_int_callback()
     // exit app
     // exit app
     uhf_free(uhf_app);
     uhf_free(uhf_app);
+
+    // Return previous state of expansion
+    expansion_enable(expansion);
+    furi_record_close(RECORD_EXPANSION);
+
     return 0;
     return 0;
 }
 }