Skip to content

Commit 37e9292

Browse files
committed
Handle splash screen and force main repaint
Capture and remove the LVGL splash screen to avoid leftover objects and force an initial repaint of the main screen before other tasks contend for SPI. Added a splash_screen pointer (lv_screen_active()), invalidate and refresh the main_display immediately (lv_obj_invalidate + lv_refr_now), and delete the splash screen if it differs from the main screen. Also cleaned up .vscode/extensions.json by removing a duplicate PlatformIO recommendation.
1 parent b1c0d9b commit 37e9292

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

.vscode/extensions.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
// for the documentation about the extensions.json format
44
"recommendations": [
55
"ms-vscode.cpptools-extension-pack",
6-
"pioarduino.pioarduino-ide",
7-
"platformio.platformio-ide"
6+
"pioarduino.pioarduino-ide"
87
],
98
"unwantedRecommendations": [
109
"ms-vscode.cpptools-extension-pack"

src/sp140/main.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,10 @@ void setup() {
769769
setLEDColor(LED_GREEN);
770770

771771
// Show splash screen (blocking)
772+
lv_obj_t* splash_screen = NULL;
772773
if (xSemaphoreTake(lvglMutex, portMAX_DELAY) == pdTRUE) {
773774
displayLvglSplash(deviceData, 2000);
775+
splash_screen = lv_screen_active();
774776
// Keep mutex held through main screen setup
775777
} else {
776778
USBSerial.println("Failed to acquire LVGL mutex for splash");
@@ -782,9 +784,14 @@ void setup() {
782784
setupMainScreen(deviceData.theme == 1);
783785
}
784786

785-
// Load main screen
787+
// Force the first main-screen repaint before other tasks can contend for SPI.
786788
if (main_screen != NULL) {
787-
lv_screen_load(main_screen);
789+
lv_obj_invalidate(main_screen);
790+
lv_refr_now(main_display);
791+
if (splash_screen != NULL && splash_screen != main_screen) {
792+
lv_obj_delete(splash_screen);
793+
splash_screen = NULL;
794+
}
788795
USBSerial.println("Main screen loaded");
789796
} else {
790797
USBSerial.println("Error: Main screen object is NULL after setup attempt");

0 commit comments

Comments
 (0)