From fcf478016d8162bf84dcafcede85ca9777fdc128 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Wed, 27 Dec 2023 17:03:26 +0100 Subject: [PATCH] sensors: Use quantity unit to determine when to translate to fahrenheit --- prog/sensors/chips.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index c270e35f..311b1daa 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -60,7 +60,7 @@ void print_chip_raw(const sensors_chip_name *name) b = 0; while ((sub = sensors_get_all_subfeatures(name, feature, &b))) { if (sub->flags & SENSORS_MODE_R) { - is_temp = feature->type == SENSORS_FEATURE_TEMP; + is_temp = !strcmp("°C", sensors_get_quantity(sub->type)->unit); if ((err = sensors_get_value(name, sub->number, &val))) @@ -105,7 +105,7 @@ void print_chip_json(const sensors_chip_name *name) subCnt = 0; while ((sub = sensors_get_all_subfeatures(name, feature, &b))) { if (sub->flags & SENSORS_MODE_R) { - is_temp = feature->type == SENSORS_FEATURE_TEMP; + is_temp = !strcmp("°C", sensors_get_quantity(sub->type)->unit); if ((err = sensors_get_value(name, sub->number, &val))) {