You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
first of all, thank you very much for your code, it works very fine, but...
trying your example.c, things goes very good if I comment out this function and read the values of cel, fah, kel, rh, using the Atollic TrueStudio debugger window.
If I uncomment the function, to prepare the messages to put on a terminal:
sprintf(buffer,
"%d.%dºC, %d.%dºF, %d.%d K, %d.%d%% RH\n",
SHT2x_Pre(cel), SHT2x_Post(cel, 1),
SHT2x_Pre(fah), SHT2x_Post(fah, 1),
SHT2x_Pre(kel), SHT2x_Post(kel, 1),
SHT2x_Pre(rh), SHT2x_Post(rh, 1));
The following errors are found:
undefined reference to "SHT2x_Post"
undefined reference to "SHT2x_Pre"
Where are these functions and what they do?
Thank you very much
Antoniomilano
The text was updated successfully, but these errors were encountered:
Hello. Sorry about the error. This is because I renamed these functions in the .c and .h files but forgot to update main.c. I have updated main.c just now.
The function int32_t SHT2x_GetInteger(float f) (previously defined asSHT2x_Pre(float f)) returns the integer part of a floating point value f.
The function uint32_t SHT2x_GetDecimal(float f, int digits) (previously defined asSHT2x_Post(float f, int digits)) returns the decimal part of a floating point value f, with precision up to digits.
For example, SHT2x_GetInteger(1.234) returns 1 and SHT2x_GetDecimal(1.234, 2) returns 23. Calling sprintf(buffer, "%d.%d", SHT2x_GetInteger(1.234), SHT2x_GetDecimal(1.234, 2)); formats the string buffer as "1.23".
If you can work with floating point values, you can directly use the values cel, rh, etc.
The reason I came up with these two functions is that I wanted to avoid floating point value formatting with sprintf, which takes up a lot of memory in the microcontroller.
Please update main.c and see if it compiles? Sorry again about the inconvenience.
Hello,
first of all, thank you very much for your code, it works very fine, but...
trying your example.c, things goes very good if I comment out this function and read the values of cel, fah, kel, rh, using the Atollic TrueStudio debugger window.
If I uncomment the function, to prepare the messages to put on a terminal:
sprintf(buffer,
"%d.%dºC, %d.%dºF, %d.%d K, %d.%d%% RH\n",
SHT2x_Pre(cel), SHT2x_Post(cel, 1),
SHT2x_Pre(fah), SHT2x_Post(fah, 1),
SHT2x_Pre(kel), SHT2x_Post(kel, 1),
SHT2x_Pre(rh), SHT2x_Post(rh, 1));
The following errors are found:
undefined reference to "SHT2x_Post"
undefined reference to "SHT2x_Pre"
Where are these functions and what they do?
Thank you very much
Antoniomilano
The text was updated successfully, but these errors were encountered: