Skip to content

Commit 9f42c91

Browse files
Merge pull request #34 from jaylikesbunda/main
v1.2.2
2 parents e0ab324 + 441d5f8 commit 9f42c91

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v1.2.2
4+
5+
- fixed race condition and blocking of UART initialization causing freeze on launch
6+
- slightly improved startup time
7+
38
## v1.2.1
49

510
- Added 'apcred' commands to change and reset WebUI SSID & Password

src/main.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {

src/menu.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "settings_def.h"
77
#include "confirmation_view.h"
88

9-
// Struct definitions must come before they are used
109
typedef struct {
1110
const char* label; // Display label in menu
1211
const char* command; // UART command to send

src/settings_ui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ bool settings_custom_event_callback(void* context, uint32_t event_id) {
524524
"Updated by: Jay Candel\n"
525525
"Built with <3";
526526

527-
confirmation_view_set_header(app_state->confirmation_view, "Ghost ESP v1.2.1");
527+
confirmation_view_set_header(app_state->confirmation_view, "Ghost ESP v1.2.2");
528528
confirmation_view_set_text(app_state->confirmation_view, info_text);
529529

530530
// Save current view before switching

0 commit comments

Comments
 (0)