Value of a float is being truncated when passed to addConfigFloat #274
Labels
No labels
bug
conflicts
documentation
DO NOT MERGE
duplicate
enhancement
good first issue
hardware
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
greg/info-orbs#274
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It looks like if you define a variable as float and give it a value like this
float m_log_id = 34.65432;
Then you store the value using the addConfigFloat
config.addConfigFloat("WeatherWidget", "openWeatherLong", &m_long_id, t_openWeatherLong);
When you access the field in the web interface and afterwards in the application, it has been shorten to just 2 decimal places, so "34.65".
Can the addConfigFloat be changed to keep all the decimal places?
Thanks
I think I've found the issue...
In "WifiManagerCustomParameters.h", the float is converted to a string on line 112, this gives a default 2 decimal places..
Thus need to modify the line to this:
init(id, placeholder, String(value, 4).c_str(), length, "", WFM_LABEL_BEFORE);
To have 4 decimal places
merged into the DEV branch as part of PR #281