Merge pull request #196 from HorlogeSkynet/master

Fixes Fahrenheit missing conversion for JSON and RAW output modes
This commit is contained in:
Ondřej Lysoněk authored and GitHub committed 2019-10-08 09:13:25 +02:00
commit ec0e30ccc8
1 file changed
+11 -6
+11 -6
View File
@@ -34,6 +34,11 @@
static void scale_value(double *value, const char **prefixstr);
static inline double deg_ctof(double cel)
{
return cel * (9.0F / 5.0F) + 32.0F;
}
void print_chip_raw(const sensors_chip_name *name)
{
int a, b, err;
@@ -60,8 +65,11 @@ void print_chip_raw(const sensors_chip_name *name)
"value of subfeature %s: %s\n",
sub->name,
sensors_strerror(err));
else
else {
if (fahrenheit)
val = deg_ctof(val);
printf(" %s: %.3f\n", sub->name, val);
}
} else
printf("(%s)\n", label);
}
@@ -102,6 +110,8 @@ void print_chip_json(const sensors_chip_name *name)
} else {
if (subCnt > 0)
printf(",\n");
if (fahrenheit)
val = deg_ctof(val);
printf(" \"%s\": %.3f", sub->name, val);
subCnt++;
}
@@ -121,11 +131,6 @@ void print_chip_json(const sensors_chip_name *name)
static const char hyst_str[] = "hyst";
static inline double deg_ctof(double cel)
{
return cel * (9.0F / 5.0F) + 32.0F;
}
static void print_label(const char *label, int space)
{
int len = strlen(label)+1;