Lv.label_set_text_fmt(), Cant update label on the screen

Show log … Seems is big problem for you do simple think copy code from message run it and show return. For me in VS Code is this 3 minute job.

1 Like

next step is this , etc. FYI

1 Like

Concerning log, there is only: ---- Opened the serial port COM4 ----
Counter: 0
I will do next step.

Counter 0 only and nothink after click button??? Then your system completely dont work not waste time…

1 Like

There was Counter: 0 at start,
after each click value increase by 1:
Counter: 1
Counter: 2,
but counting was very fast 115200 Baud rate.

Your the last code I applyed. There was not replaced label with Label2 on screen. Fathermore: counter was not increased after each click.

have you this aplyed and is very fast , are you sure ???

1 Like

Yes, but there was other error.
Now is screen blinking about 0.5Hz,
but I have log:

LVGL demo setup
LVGL Setup done
Counter: 0
Counter: 0
Label 2: Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x401270af PS : 0x00060830 A0 : 0x800d1eb7 A1 : 0x3ffb2250
A2 : 0x00000000 A3 : 0x3f40015b A4 : 0x0000000a A5 : 0x00000000
A6 : 0x00000000 A7 : 0x0000008f A8 : 0x80101c64 A9 : 0x3ffb2230
A10 : 0x00000009 A11 : 0x3f40015b A12 : 0x00000001 A13 : 0x3ffb2120
A14 : 0x0000000b A15 : 0x3ffb2120 SAR : 0x0000001b EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000002c LBEG : 0x400866e9 LEND : 0x400866f9 LCOUNT : 0xfffffffd

Backtrace: 0x401270ac:0x3ffb2250 0x400d1eb4:0x3ffb2270 0x401043f5:0x3ffb2290

ELF file SHA256: d0a26504df3835b8

Place your exact copy of loop code here

1 Like
void loop() {     
   
 static int lastcounter;
 static lv_obj_t * ui_Label2;
   static int counter = 0;
   static int lastTick = 0;
   
   
   
   //Update the tick timer 
  
  
   lv_tick_inc(millis() - lastTick);  //Update the tick timer. Tick is new for LVGL 9    
   lastTick = millis();
   lv_timer_handler();  //Update the UI
   delay(5);
  
   if(lastcounter!=counter) {
   Serial.print("Counter: ");
   Serial.println(counter);
   lastcounter=counter;
  
   if(! ui_Label2) {
    ui_Label2 = lv_label_create(lv_screen_active()); 
                lv_obj_set_pos(ui_Label2, 127, 19); 
                lv_obj_set_size(ui_Label2, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
                lv_obj_add_flag(ui_Label2, LV_OBJ_FLAG_OVERFLOW_VISIBLE);
                lv_obj_set_style_text_font(ui_Label2, &lv_font_montserrat_26, LV_PART_MAIN | LV_STATE_DEFAULT);
       }
       lv_label_set_text_fmt(ui_Label2, "%d", counter);
         }
       Serial.print("Counter: ");
   Serial.println(counter);
   printf("Counter: %d\n", counter);
   Serial.print("Label 2: ");   
   Serial.println(lv_label_get_text(ui_Label2));
   
    } 

seems you are better then i end with you … this line hangs mcu because label dont exist is created only on first change counter as next on display no replace. Learn basic C language or go back to LEGO land.
Next absurd line is

static int counter = 0;

BYE

1 Like

Sorry Milan, I like lego, I was using wirering Arduino language and now I go to eez studio. But I am technician and now litle slow, my age is 78 and my english is poor. I understand you, if you have no power to help mi, it is OK. But problem is solved - see the end of this message.

I removed 2 problem lines. Now log is:

LVGL demo setup
LVGL Setup done
Counter: 0
Counter: 0
Label 2: Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x401270af PS : 0x00060830 A0 : 0x800d1eb7 A1 : 0x3ffb2250
A2 : 0x00000000 A3 : 0x3f40015b A4 : 0x0000000a A5 : 0x00000000
A6 : 0x00000000 A7 : 0x0000008f A8 : 0x80101c64 A9 : 0x3ffb2230
A10 : 0x00000009 A11 : 0x3f40015b A12 : 0x00000001 A13 : 0x3ffb2120
A14 : 0x0000000b A15 : 0x3ffb2120 SAR : 0x0000001b EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000002c LBEG : 0x400866e9 LEND : 0x400866f9 LCOUNT : 0xfffffffd

Backtrace: 0x401270ac:0x3ffb2250 0x400d1eb4:0x3ffb2270 0x401043f5:0x3ffb2290

ELF file SHA256: 8fda0a4532b4f5c7

Rebooting…

Maybe the problem is nearly solved. There is next label above NUM on the screen. This new label is counter number. I need just to clear old label NUM.

try change to

static lv_obj_t * ui_Label2 = NULL;

and if line cahge to

if( ui_Label2 == NULL) {

and around your trouble maybe in EEZ you use label name incorectly , i dont have EEZ , but basic rule is no space in names . Maybe simpler for you will try Squareline instead EEZ.

1 Like

Your last code lines did not help.

But it is nearly OK. In your code was set position for label2 - counter value +30 px higher then is NUM. I place it in the same position and now is label overlapped with NUM and counter.

I agree that problem could be in EEZ to PlatformIO, because I was using Copilot with many alternatives and label was never replaced by mentioned function. This project was just test and learn and Thankyou very mach for your time.