Преглед изворни кода

fix uart related plugins to disable expansion protocol

MX пре 1 година
родитељ
комит
eae9e729e5
1 измењених фајлова са 10 додато и 0 уклоњено
  1. 10 0
      ifttt_virtual_button.c

+ 10 - 0
ifttt_virtual_button.c

@@ -1,4 +1,5 @@
 #include "ifttt_virtual_button.h"
+#include <expansion/expansion.h>
 
 #define IFTTT_FOLDER "/ext/apps_data/ifttt"
 #define IFTTT_CONFIG_FOLDER "/ext/apps_data/ifttt/config"
@@ -227,6 +228,10 @@ void ifttt_virtual_button_app_free(VirtualButtonApp* app) {
 
 int32_t ifttt_virtual_button_app(void* p) {
     UNUSED(p);
+    
+    // Disable expansion protocol to avoid interference with UART Handle
+    Expansion* expansion = furi_record_open(RECORD_EXPANSION);
+    expansion_disable(expansion);
 
     Storage* storage = furi_record_open(RECORD_STORAGE);
     if(!storage_simply_mkdir(storage, IFTTT_FOLDER)) {
@@ -242,5 +247,10 @@ int32_t ifttt_virtual_button_app(void* p) {
 
     view_dispatcher_run(app->view_dispatcher);
     ifttt_virtual_button_app_free(app);
+
+    // Return previous state of expansion
+    expansion_enable(expansion);
+    furi_record_close(RECORD_EXPANSION);
+
     return 0;
 }