Просмотр исходного кода

fix uart related plugins to disable expansion protocol

MX 1 год назад
Родитель
Сommit
6bc1f67579
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      esp_flasher_app.c

+ 9 - 0
esp_flasher_app.c

@@ -2,6 +2,7 @@
 
 #include <furi.h>
 #include <furi_hal.h>
+#include <expansion/expansion.h>
 
 static bool esp_flasher_app_custom_event_callback(void* context, uint32_t event) {
     furi_assert(context);
@@ -118,6 +119,10 @@ void esp_flasher_app_free(EspFlasherApp* app) {
 int32_t esp_flasher_app(void* p) {
     UNUSED(p);
 
+    // Disable expansion protocol to avoid interference with UART Handle
+    Expansion* expansion = furi_record_open(RECORD_EXPANSION);
+    expansion_disable(expansion);
+
     uint8_t attempts = 0;
     bool otg_was_enabled = furi_hal_power_is_otg_enabled();
     while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
@@ -140,5 +145,9 @@ int32_t esp_flasher_app(void* p) {
         furi_hal_power_disable_otg();
     }
 
+    // Return previous state of expansion
+    expansion_enable(expansion);
+    furi_record_close(RECORD_EXPANSION);
+
     return 0;
 }