|
|
@@ -2,6 +2,7 @@
|
|
|
#include "constants.h"
|
|
|
|
|
|
#include <furi.h>
|
|
|
+#include <furi_hal_power.h>
|
|
|
#include <gui/gui.h>
|
|
|
#include <string.h>
|
|
|
|
|
|
@@ -94,6 +95,14 @@ int32_t gps_app(void* p) {
|
|
|
|
|
|
FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(PluginEvent));
|
|
|
|
|
|
+ uint8_t attempts = 0;
|
|
|
+ bool otg_was_enabled = furi_hal_power_is_otg_enabled();
|
|
|
+ while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
|
|
+ furi_hal_power_enable_otg();
|
|
|
+ furi_delay_ms(10);
|
|
|
+ }
|
|
|
+ furi_delay_ms(200);
|
|
|
+
|
|
|
GpsUart* gps_uart = gps_uart_enable();
|
|
|
|
|
|
gps_uart->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
|
|
@@ -195,5 +204,9 @@ int32_t gps_app(void* p) {
|
|
|
furi_mutex_free(gps_uart->mutex);
|
|
|
gps_uart_disable(gps_uart);
|
|
|
|
|
|
+ if(furi_hal_power_is_otg_enabled() && !otg_was_enabled) {
|
|
|
+ furi_hal_power_disable_otg();
|
|
|
+ }
|
|
|
+
|
|
|
return 0;
|
|
|
}
|