Cody Tolene 1 год назад
Родитель
Сommit
64ed31fba3
2 измененных файлов с 12 добавлено и 1 удалено
  1. 11 0
      camera_suite.c
  2. 1 1
      views/camera_suite_view_camera.c

+ 11 - 0
camera_suite.c

@@ -1,5 +1,6 @@
 #include "camera_suite.h"
 #include <stdlib.h>
+#include <expansion/expansion.h>
 
 bool camera_suite_custom_event_callback(void* context, uint32_t event) {
     furi_assert(context);
@@ -130,6 +131,11 @@ void camera_suite_app_free(CameraSuite* app) {
 /** Main entry point for initialization. */
 int32_t camera_suite_app(void* p) {
     UNUSED(p);
+
+    // Disable expansion protocol to avoid interference with UART Handle
+    Expansion* expansion = furi_record_open(RECORD_EXPANSION);
+    expansion_disable(expansion);
+
     CameraSuite* app = camera_suite_app_alloc();
     view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
     // Init with start scene.
@@ -139,5 +145,10 @@ int32_t camera_suite_app(void* p) {
     camera_suite_save_settings(app);
     furi_hal_power_suppress_charge_exit();
     camera_suite_app_free(app);
+
+    // Return previous state of expansion
+    expansion_enable(expansion);
+    furi_record_close(RECORD_EXPANSION);
+
     return 0;
 }

+ 1 - 1
views/camera_suite_view_camera.c

@@ -613,7 +613,7 @@ CameraSuiteViewCamera* camera_suite_view_camera_alloc() {
     // 115200 is the default baud rate for the ESP32-CAM.
     furi_hal_serial_init(instance->serial_handle, 230400);
 
-    // Enable UART1 and set the IRQ callback.
+    // Start the asynchronous receive.
     furi_hal_serial_async_rx_start(instance->serial_handle, camera_on_irq_cb, instance, false);
 
     return instance;