Merge pull request #12164 from keestux/driver_sht2x_cleanup

tests/driver_sht2x: avoid negative number after decimal dot
This commit is contained in:
Alexandre Abadie 2019-09-04 07:58:18 +02:00 committed by GitHub
commit aa6f9e5b25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -5,6 +5,5 @@ FEATURES_REQUIRED = periph_i2c
USEMODULE += sht2x
USEMODULE += xtimer
USEMODULE += printf_float
include $(RIOTBASE)/Makefile.include

View File

@ -19,6 +19,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
@ -88,7 +89,7 @@ int main(void)
printf("Temperature [°C]: %d.%d\n"
"Humidity [%%RH]: %u.%02u\n"
"\n+-------------------------------------+\n",
temperature / 100, (temperature % 100) / 10,
temperature / 100, abs(temperature % 100) / 10,
(unsigned int)(humidity / 100), (unsigned int)(humidity % 100)
);
}