Overload set_envdata#14
Conversation
…put and automatic data type conversion to uint16
|
I see there is a similar pull request with the code from SparkFun. I did see the code from SparkFun before making my own, but I found it a bit hard to follow, which is why I made it. I can't tell which one performs the fastest though - I'll let that up to you to decide. |
|
Hi @troelsy thanks for your contribution. One is that I deliberately left out floating point operations in my library, so that I do not force my users to link in the float runtime library, which has a relatively large foot print in small microcontrollers. How do you feel about that? Secondly, if the users wants to use float in his embedded application (e.g. the microcontroller has plenty of flash), it is rather easy too use the library. I believe something like this would work: Please let me know what you think. |
|
Huh, I should have thought about multiplying both parts - that's a lot easier than splitting them up. Shouldn't they both be multiplied by 512? Wouldn't it still make sense to have the overloaded function? The compiler will eliminate it, if it is unused. |
Overload set_envdata with (float temperature, float humidity) for direct celsius and RH input and automatic data type conversion to uint16.
I use a temperature and humidity sensor/library that gives the temperature and humidity as floating points. I made a conversion function to the uint16 data type specified in the datasheet and thought somebody else might like it as well.