@@ -50,14 +50,16 @@ int32_t ghost_esp_app(void* p) {
5050 Expansion * expansion = furi_record_open (RECORD_EXPANSION );
5151 expansion_disable (expansion );
5252
53- // Power initialization
53+ // Modified power initialization
5454 uint8_t attempts = 0 ;
5555 bool otg_was_enabled = furi_hal_power_is_otg_enabled ();
56- while (!furi_hal_power_is_otg_enabled () && attempts ++ < 5 ) {
56+
57+ // Simply try to enable OTG if not already enabled
58+ while (!furi_hal_power_is_otg_enabled () && attempts ++ < 3 ) {
5759 furi_hal_power_enable_otg ();
58- furi_delay_ms (10 );
60+ furi_delay_ms (20 );
5961 }
60- furi_delay_ms (200 ); // Longer delay for power stabilization
62+ furi_delay_ms (50 ); // Reduced stabilization time
6163
6264 // Set up bare minimum UI state
6365 AppState * state = malloc (sizeof (AppState ));
@@ -150,6 +152,7 @@ int32_t ghost_esp_app(void* p) {
150152 UART_INIT_STACK_SIZE ,
151153 init_uart_task ,
152154 state );
155+ furi_thread_start (uart_init_thread ); // ACTUALLY START THE THREAD
153156
154157 // Add views to dispatcher - check each component before adding
155158 if (state -> view_dispatcher ) {
@@ -169,19 +172,6 @@ int32_t ghost_esp_app(void* p) {
169172 // Show main menu immediately
170173 show_main_menu (state );
171174
172- // Initialize UART in background
173- state -> uart_context = uart_init (state );
174-
175- // Check if ESP is connected, if not, try to initialize it
176- if (!uart_is_esp_connected (state -> uart_context )) {
177- FURI_LOG_W ("Ghost_ESP" , "ESP not connected, trying to initialize..." );
178- if (uart_init (state ) != NULL ) {
179- FURI_LOG_I ("Ghost_ESP" , "ESP initialized successfully" );
180- } else {
181- FURI_LOG_E ("Ghost_ESP" , "Failed to initialize ESP" );
182- }
183- }
184-
185175 // Set up and run GUI
186176 Gui * gui = furi_record_open ("gui" );
187177 if (gui && state -> view_dispatcher ) {
0 commit comments