I have a problem deleting the childrens. If I do that and add more than one object then the esp32 throws an error.
These are the objects I added in squareLine. I delete all TextPanels with the Arduino Sketch and add new ones again. If I click on a button, the esp32 resets and issues an error message.
If I don’t delete the children, then everything works. If I delete the children and only execute one object, i.e. “GenerateMessage” once, then it also works. It doesn’t work when “GenerateMessage” is run multiple times.
Error:
12:37:02.464 -> 0Which button was clicked?
12:37:02.464 -> Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
12:37:02.497 ->
12:37:02.497 -> Core 0 register dump:
12:37:02.497 -> PC : 0x400d76c2 PS : 0x00060330 A0 : 0x800da479 A1 : 0x3ffb4d70
12:37:02.497 -> A2 : 0x3f8113f4 A3 : 0x00000000 A4 : 0x00000404 A5 : 0x00000001
12:37:02.497 -> A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00290023 A9 : 0x3f405efc
12:37:02.497 -> A10 : 0x00000001 A11 : 0x00000000 A12 : 0x00000021 A13 : 0x0000002c
12:37:02.531 -> A14 : 0x3ffbdac8 A15 : 0x00000001 SAR : 0x00000003 EXCCAUSE: 0x0000001c
12:37:02.531 -> EXCVADDR: 0x00290027 LBEG : 0x400887d9 LEND : 0x400887e9 LCOUNT : 0xfffffff9
12:37:02.531 ->
12:37:02.531 ->
12:37:02.531 -> Backtrace: 0x400d76bf:0x3ffb4d70 0x400da476:0x3ffb4d90 0x40132f0f:0x3ffb4db0 0x400def6c:0x3ffb4dd0 0x400defa9:0x3ffb4df0 0x400df0f9:0x3ffb4e10 0x400d1c39:0x3ffb4e30 0x40100a6a:0x3ffb4e80 0x400d7631:0x3ffb4ea0 0x400d7691:0x3ffb4ec0 0x400d7cfa:0x3ffb4f00 0x400d843c:0x3ffb4f30 0x400f67e0:0x3ffb4f80 0x400d2300:0x3ffb4fb0
12:37:02.571 ->
void GenerateMessage(String Titel,String Text){
lv_obj_t * ui_TextPanel1;
ui_TextPanel1 = lv_obj_create(ui_MessagePanel);
lv_obj_set_width(ui_TextPanel1, lv_pct(100));
lv_obj_set_height(ui_TextPanel1, LV_SIZE_CONTENT); /// 1
lv_obj_set_align(ui_TextPanel1, LV_ALIGN_CENTER);
lv_obj_set_flex_flow(ui_TextPanel1, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(ui_TextPanel1, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
lv_obj_clear_flag(ui_TextPanel1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_pad_left(ui_TextPanel1, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui_TextPanel1, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui_TextPanel1, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui_TextPanel1, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_t * ui_Titel1;
ui_Titel1 = lv_label_create(ui_TextPanel1);
lv_obj_set_width(ui_Titel1, lv_pct(100));
lv_obj_set_height(ui_Titel1, LV_SIZE_CONTENT); /// 1
lv_label_set_long_mode(ui_Titel1, LV_LABEL_LONG_DOT);
lv_label_set_text(ui_Titel1, Titel.c_str());
lv_label_set_recolor(ui_Titel1, "true");
lv_obj_t * ui_Text1;
ui_Text1 = lv_label_create(ui_TextPanel1);
lv_obj_set_width(ui_Text1, lv_pct(100));
lv_obj_set_height(ui_Text1, LV_SIZE_CONTENT); /// 1
lv_obj_set_align(ui_Text1, LV_ALIGN_CENTER);
lv_label_set_text(ui_Text1, Text.c_str());
lv_obj_set_style_text_font(ui_Text1, &lv_font_montserrat_10, LV_PART_MAIN | LV_STATE_DEFAULT);
}
void NotifyCall(lv_event_t * e, int Button)
{
Serial.print(Button);
Serial.println("Which button was clicked?");
lv_obj_clean(ui_MessagePanel);
lv_obj_clear_flag(ui_MessagePanel, LV_OBJ_FLAG_HIDDEN); /// Flags
switch (Button) {
case 0:
GenerateMessage("Test","Das ist nur ein Test mit einlangem Text.");
GenerateMessage("Test","Das ist nur ein Test mit Megaaaaaaa langem Text. Und ich hoffe es funktioniert.");
//GenerateMessage("Test","Das ist nur ein Test. Keine Ahnung ob es Funktioniert. Aber bisher klappt ja alles :)");
//GenerateMessage("Test","Das ist nur ein Test. Bin gespannt ob es auch Scrollen kann.");
break;
case 1:
// statements
break;
case 2:
// statements
break;
case 3:
// statements
break;
}