Change printf

This commit is contained in:
shakemid 2017-09-15 19:14:30 +09:00
parent 71a903e649
commit 5de95d4d16

View file

@ -428,18 +428,19 @@ int main(int argc, char **argv) {
devices[i].type->decode_func(answer, tempd, calibration);
// print temperature
if (formato==2) {
// in Fahrenheit
printf("%s\t%d\tinternal\t%.2f F\n", strdate, i, (9.0 / 5.0 * tempd[0] + 32.0));
printf("%s\t%d\t%s\t%.2f %s\n",
strdate,
i,
devices[i].type->has_sensor == 2 ? "internal" : "temperature",
formato == 2 ? 9.0 / 5.0 * tempd[0] + 32.0 : tempd[0],
formato == 2 ? "F" : "C");
if (devices[i].type->has_sensor == 2) {
printf("%s\t%d\texternal\t%.2f F\n", strdate, i, (9.0 / 5.0 * tempd[1] + 32.0));
}
} else {
// in Celsius
printf("%s\t%d\tinternal\t%.2f C\n", strdate, i, tempd[0]);
if (devices[i].type->has_sensor == 2) {
printf("%s\t%d\texternal\t%.2f C\n", strdate, i, tempd[1]);
}
printf("%s\t%d\texternal\t%.2f %s\n",
strdate,
i,
formato == 2 ? 9.0 / 5.0 * tempd[1] + 32.0 : tempd[1],
formato == 2 ? "F" : "C");
}
// print humidity