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); devices[i].type->decode_func(answer, tempd, calibration);
// print temperature // print temperature
if (formato==2) { printf("%s\t%d\t%s\t%.2f %s\n",
// in Fahrenheit strdate,
printf("%s\t%d\tinternal\t%.2f F\n", strdate, i, (9.0 / 5.0 * tempd[0] + 32.0)); i,
if (devices[i].type->has_sensor == 2) { devices[i].type->has_sensor == 2 ? "internal" : "temperature",
printf("%s\t%d\texternal\t%.2f F\n", strdate, i, (9.0 / 5.0 * tempd[1] + 32.0)); formato == 2 ? 9.0 / 5.0 * tempd[0] + 32.0 : tempd[0],
} formato == 2 ? "F" : "C");
} else {
// in Celsius if (devices[i].type->has_sensor == 2) {
printf("%s\t%d\tinternal\t%.2f C\n", strdate, i, tempd[0]); printf("%s\t%d\texternal\t%.2f %s\n",
if (devices[i].type->has_sensor == 2) { strdate,
printf("%s\t%d\texternal\t%.2f C\n", strdate, i, tempd[1]); i,
} formato == 2 ? 9.0 / 5.0 * tempd[1] + 32.0 : tempd[1],
formato == 2 ? "F" : "C");
} }
// print humidity // print humidity