Important: unclear posts may not receive useful answers.
Before posting
Get familiar with Markdown to format and structure your post
Be sure to update lvgl from the latest version from the master branch.
Be sure you have checked the FAQ and read the relevant part of the documentation.
If applicable use the Simulator to eliminate hardware related issues.
Delete this section if you read and applied the mentioned points.
Description
What MCU/Processor/Board and compiler are you using?
Adruino Giga R1 with giga display shield on arduino ide 2.3.6
What LVGL version are you using?
9.2.2
What do you want to achieve?
I want to set (with embedded keyboard) a float or double value on a text label, then multiplie them, and print the result on another label.
What have you tried so far?
All i want above, works perfect with integer type, but never with float or double. I extract the string with “lv_label_get_text” then convert it with “atoi” fonction (and made an operation).
I try fonction “atof” “strtod” “strtof” and it always print a big value (10 or 12 digits before dot when i expect 2).
I change the defaut code compiler by -std=gnuC99 : Works a little better but not as expected.
Code to reproduce
I don’t expect you to debug my code problem. I’m pretty sur that’s simple and i miss something basic.
So my question is : Show me an exemple of code (2 or 3 lines) of what you do for extract a value (float) from a label.
I search an exemple since one month but never find it.
Thanks for your replie.
I try this and it didn’t work. For example, when i multiplie 5.8 x 12.1 the printed result is 12 or 14 digits and always terminated by .00
things i try :
-I obviously enable LV_USE_FLOAT in lv_conf9.h
-Change float type by double type (and of course changing the function).
-Modifiy
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN
to
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_CLIB
or
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_CUSTOM
-Change <stdio.h> by <stdlib.h> : no compilation
-Add “#include <stdlib.h>” in the .ino file : Same problem.
-Change “atof()” by “strtof()” : arduino stop working.
I think i miss a parameter in some configuration file but where ? Is possibly a conflict with parameter files between arduino_H7_video library and lvgl library ?