Lable showing partial string

Description

label on screen only shows partial string

What MCU/Processor/Board and compiler are you using?

esp32 in ttgo t watch

What LVGL version are you using?

current as far as i can tell

What do you want to achieve?

display the full string recieved

What have you tried so far?

the default method of updating a label, readStringUntil looking for /r, /n, /0, full readString, plain read threw errors at me though

Code to reproduce

if (client.available() > 0){
        //read back from the server
        returnData = client.readStringUntil('\r');
        Serial.println(returnData);
        strncpy(testChar, returnData.c_str(), sizeof(returnData));
        lv_label_set_text(returnDataObj, testChar);

the logs indicate that the full string is recieved:
‘’’
[I][touch.cpp:160] touch_read(): touched @ 14,25 0
Connecting to 192.168.1.215
ok T:21.59 /0.00 B:23.92 /0.00 @:0 B@:0

Closing connection.
‘’’
but only T:21.59/ makes it to the screen. how do i get the rest of my line displayed in the label

Hi, i did not test this code, but i think the error is in the sizeof(returnData)
shouldn’t it be strlen(returnData)

i think, sizeof() gets the size of a pointer object in this case

(hope this helps)

You should be able to use lv_label_set_text(returnDataObj, returnData.c_str()), as lv_label_set_text doesn’t need the string to remain in scope after the function exits. Only lv_label_set_static_text has that requirement.

that worked, thank you!