Hello friends
I have 2 problems and can't fix, 1 - the font size and 2 float number...
i created blank project and in center put label for live data of temperature sensor, in SL-Studio i set "montserrat 48" in style settings also checkmarked in flags > floating that's all..
after exporting i get error about font
/Users/macbook/Documents/Arduino/libraries/ui/src/screens/ui_Screen1.c: In function 'ui_Screen1_screen_init':
/Users/macbook/Documents/Arduino/libraries/ui/src/screens/ui_Screen1.c:17:40: error: 'lv_font_montserrat_48' undeclared (first use in this function); did you mean 'lv_font_montserrat_14'?
lv_obj_set_style_text_font(ui_Label1, &lv_font_montserrat_48, LV_PART_MAIN| LV_STATE_DEFAULT);
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
/Users/macbook/Documents/Arduino/libraries/ui/src/screens/ui_Screen1.c:17:40: note: each undeclared identifier is reported only once for each function it appears in
exit status 1
if export project with default font settings then i get live data but only in decimal format
Hi George, we must be literally doing the same UI at the same time. I have just run up against the exact same two problems. I tried copying the font file into the src/fonts folder manually but that just chucked up another error to do with not being able to find lvgl.h in the parent directory. I backed off and deleted the bigger font text box and put it in the "fix that later" bucket.
Regarding the float I think the way to do it will be to operate in integers, store the integer in your controller, then have it converted to a float in your code and then pull that number onto the screen as a text. I couldn't find any way of getting Squareline to handle decimal places other than when I tried using the spin box, which kind of worked but also highlighted the decimal - as that's kind of its purpose. That might be a way forward if I can find a way of stopping it highlighting the decimal but that also threw up an error in the code to do with styles. I deleted the offending line out of the generated code and then it compiled but it felt a bit messy and probably not the way forward.
I see we are both using Mac as a dev platform - I sometimes worry that might be an underlying issue.
To cut to the chase this is what I'm trying to replicate on the controller screen:
I'll be going back to it tomorrow. To be fair I only found out that LVGL existed on Friday and Squareline Studio shortly after, so I'm pretty stoked that I've got the bare bones of a UI on the display shield already.
Yes Mac is better in development and yesterday apple presented M3 Max
About font size I"m still working for it, if i figure out how to increase I'll share solution
Hi George, I store the temperature as an integer so 254 is 25.4
You could do this in your code:
int sensVal = temperature * 10; // sets the int sensVal to 10 times the temperature
lv_label_set_text_fmt(label1, "Temp: %d.%d",sensVal/10, sensVal-(sensVal/10*10));
This uses the trimming and prioritisation of integer maths to your advantage and give you the result you want.
@iamgeorge@leocavagnis
Hi both - I did a load more reading on lv_label_set_text_fmt and discovered that in the lv_conf.h you can change the value of #define LV_SPRINTF_USE_FLOAT 0
from 0 to 1 and in theory this will mean you can use %f in your sprintf formatting in lv_label_set_text_fmt command, however, it does not seem to work. I read around a bit more and this might be something to do with the Arduino IDE as the only other mention of this where someone managed to fix this specific problem was by moving away from the IDE and programming in a different environment. It's almost like it's not processing the lv_conf.h file, or at least the functionality of that line - or something is overriding it. For the moment I have to convert everything into integers to fake the float as above.
I even tried putting lv_conf.h in my IDE and including it in the normal way but that had no effect either.
Can either of you shed any further light on this one?
and finally I found the 100% Solution how to increase font sizes
Edit this file lv_conf.h but not in Arduino library,
in my case this is the path : ~/Users/macbook/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.0.8/libraries/Arduino_H7_Video/src/lv_conf.h
also I change Float setting from 0 to 1 but not working, still Searching the way how to show float numbers, i am prototyping Air Quality Monitor and this is important.
@farmer_giles@leocavagnis
I am searching Brightness control, did you know how to control brightness?
only find this code but this is not what i want...