Berry lv.start() raises an error instead of crashing when the display can't start (#25193)

This commit is contained in:
s-hadinger authored and GitHub committed 2026-10-25 21:27:10 +01:00
1 parent 4d76e15306
commit d309da183d
3 files changed
+16 -8

No files matched your search

+1
View File
@@ -27,6 +27,7 @@ All notable changes to this project will be documented in this file.
- LVGL touch more responsive (#25172)
- VEML7700 lux/white rounding, add new command (#25150)
- WifiManager name the setup AP as it is turned on (#25169)
- Berry `lv.start()` raises an error instead of crashing when the display can't start
### Removed
@@ -111,7 +111,7 @@ public:
};
LVBE_globals lvbe;
extern void start_lvgl(const char * uconfig);
extern bool start_lvgl(const char * uconfig);
extern void lv_ex_get_started_1(void);
extern "C" {
@@ -496,7 +496,10 @@ extern "C" {
if (argc == 1) {
uconfig = be_tostring(vm, 1);
}
start_lvgl(uconfig);
if (!start_lvgl(uconfig)) {
// abort here, otherwise any following lv.* call crashes with LVGL not initialized
be_raise(vm, "internal_error", "LVGL could not start, check display configuration (display.ini, Option A3)");
}
// call lv.splash_remove() to kill any current splash screen
if (be_getglobal(vm, "lv")) {
+10 -6
View File
@@ -467,18 +467,21 @@ void lvgl_touchscreen_read(lv_indev_t *indev_drv, lv_indev_data_t *data) {
************************************************************/
extern Renderer *Init_uDisplay(const char *desc);
void start_lvgl(const char * uconfig);
void start_lvgl(const char * uconfig) {
// Returns true if LVGL is running (already or newly started), false on failure
bool start_lvgl(const char * uconfig);
bool start_lvgl(const char * uconfig) {
if (lvgl_glue != nullptr) {
AddLog(LOG_LEVEL_DEBUG_MORE, D_LOG_LVGL "LVGL was already initialized");
return;
return true;
}
if (!renderer || uconfig) {
renderer = Init_uDisplay((char*)uconfig);
AddLog(LOG_LEVEL_ERROR, "LVG: Could not start Universal Display");
if (!renderer) return;
if (!renderer) {
AddLog(LOG_LEVEL_ERROR, "LVG: Could not start Universal Display");
return false;
}
}
renderer->DisplayOnff(true);
@@ -539,7 +542,7 @@ void start_lvgl(const char * uconfig) {
delete lvgl_glue;
lvgl_glue = nullptr;
AddLog(LOG_LEVEL_ERROR, "LVG: Could not allocate buffers");
return;
return false;
}
// Initialize LvGL display driver
@@ -610,6 +613,7 @@ void start_lvgl(const char * uconfig) {
}
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_LVGL "LVGL initialized"));
return true;
}
/*********************************************************************************************\