Skip to content

Commit 965c7cd

Browse files
committed
show fan rpm and rpm max
1 parent 5c57f19 commit 965c7cd

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

src/interface.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,17 +2226,30 @@ void print_snapshot(struct list_head *devices, bool use_fahrenheit_option) {
22262226
printf("%s\"temp\": null,\n", indent_level_four);
22272227
}
22282228

2229-
// Fan speed (percentage or RPM)
2230-
if (GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, fan_speed))
2229+
// Fan speed (percentage or RPM fallback)
2230+
if (GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, fan_speed)) {
22312231
printf("%s\"fan_speed\": \"%u%%\",\n", indent_level_four,
22322232
device->dynamic_info.fan_speed > 100 ? 100 : device->dynamic_info.fan_speed);
2233-
else if (GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, fan_rpm))
2234-
printf("%s\"fan_speed\": \"%uRPM\",\n", indent_level_four,
2235-
device->dynamic_info.fan_rpm > 9999 ? 9999 : device->dynamic_info.fan_rpm);
2236-
else if (device->static_info.integrated_graphics)
2233+
} else if (device->static_info.integrated_graphics) {
22372234
printf("%s\"fan_speed\": \"CPU Fan\",\n", indent_level_four);
2238-
else
2235+
} else {
22392236
printf("%s\"fan_speed\": null,\n", indent_level_four);
2237+
}
2238+
2239+
// Fan RPM (raw data)
2240+
if (GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, fan_rpm)) {
2241+
printf("%s\"fan_rpm\": \"%u\",\n", indent_level_four,
2242+
device->dynamic_info.fan_rpm > 9999 ? 9999 : device->dynamic_info.fan_rpm);
2243+
} else {
2244+
printf("%s\"fan_rpm\": null,\n", indent_level_four);
2245+
}
2246+
2247+
// Fan RPM Max
2248+
if (GPUINFO_STATIC_FIELD_VALID(&device->static_info, fan_rpm_max)) {
2249+
printf("%s\"fan_rpm_max\": \"%u\",\n", indent_level_four, device->static_info.fan_rpm_max);
2250+
} else {
2251+
printf("%s\"fan_rpm_max\": null,\n", indent_level_four);
2252+
}
22402253

22412254
// Power draw (current and max)
22422255
if (GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, power_draw))

0 commit comments

Comments
 (0)