Skip to content

Commit 8c6a4b9

Browse files
committed
app: fix display lock during gui initialization
1 parent 706e947 commit 8c6a4b9

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

apps/tic_tac_toe/diagram.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": 1,
3+
"author": "Uri Shaked",
4+
"editor": "wokwi",
5+
"parts": [
6+
{
7+
"type": "board-esp32-s3-box-3",
8+
"id": "esp32",
9+
"top": -24.91,
10+
"left": -388.54,
11+
"attrs": { "psramSize": "16", "flashSize": "16" }
12+
}
13+
],
14+
"connections": [ [ "$serialMonitor:RX", "esp32:G43", "", [] ], [ "$serialMonitor:TX", "esp32:G44", "", [] ] ],
15+
"dependencies": {}
16+
}

apps/tic_tac_toe/main/tic_tac_toe.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ static void event_handler(lv_event_t *e) {
8989
}
9090
}
9191

92-
void lvgl_task(void *pvParameter) {
93-
while (1) {
94-
vTaskDelay(pdMS_TO_TICKS(1000)); // Add a small delay to prevent watchdog issues
95-
}
96-
}
97-
9892
void reset_to_factory_app() {
9993
// Get the partition structure for the factory partition
10094
const esp_partition_t *factory_partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL);
@@ -119,8 +113,8 @@ void app_main(void) {
119113
// Initialize the BSP
120114
bsp_i2c_init();
121115
bsp_display_start();
122-
lv_init();
123116

117+
bsp_display_lock(0);
124118
// Create a grid for buttons
125119
lv_obj_t *grid = lv_obj_create(lv_scr_act());
126120
static lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
@@ -140,11 +134,13 @@ void app_main(void) {
140134
btn_grid[row][col] = btn;
141135
}
142136
}
137+
bsp_display_unlock();
143138

144139
bsp_display_backlight_on();
145140

146141
reset_game();
147142

148-
// Create a task to handle LVGL
149-
xTaskCreate(lvgl_task, "lvgl_task", 16384, NULL, 1, NULL);
143+
while (1) {
144+
vTaskDelay(pdMS_TO_TICKS(1000)); // Add a small delay to prevent watchdog issues
145+
}
150146
}

apps/tic_tac_toe/wokwi.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[wokwi]
2+
version = 1
3+
elf = "build/uf2.bin"
4+
firmware = "build/uf2.bin"
5+

0 commit comments

Comments
 (0)