summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr/local/www/widgets/javascript/thermal_sensors.js33
1 files changed, 8 insertions, 25 deletions
diff --git a/usr/local/www/widgets/javascript/thermal_sensors.js b/usr/local/www/widgets/javascript/thermal_sensors.js
index 17f07d0..edc9990 100644
--- a/usr/local/www/widgets/javascript/thermal_sensors.js
+++ b/usr/local/www/widgets/javascript/thermal_sensors.js
@@ -278,33 +278,16 @@ function pulsateThermalSensorsItems(itemsToPulsate) {
}
function getSensorFriendlyName(sensorFullName){
+ var rzone = /^hw\.acpi\.thermal\.tz([0-9]+)\.temperature$/;
+ var rcore = /^dev\.cpu\.([0-9]+)\.temperature$/;
- var friendlyName = "";
-
- switch (sensorFullName) {
- case "hw.acpi.thermal.tz0.temperature":
- friendlyName = "Zone 0";
- break;
- case "hw.acpi.thermal.tz1.temperature":
- friendlyName = "Zone 1";
- break;
- case "dev.cpu.0.temperature":
- friendlyName = "Core 0";
- break;
- case "dev.cpu.1.temperature":
- friendlyName = "Core 1";
- break;
- case "dev.cpu.2.temperature":
- friendlyName = "Core 2";
- break;
- case "dev.cpu.3.temperature":
- friendlyName = "Core 3";
- break;
- default:
- friendlyName = sensorFullName;
- }
+ if (rzone.test(sensorFullName))
+ return "Zone " + rzone.exec(sensorFullName)[1];
+
+ if (rcore.test(sensorFullName))
+ return "Core " + rcore.exec(sensorFullName)[1];
- return friendlyName;
+ return sensorFullName;
}
function getThermalSensorValue(stringValue){
OpenPOWER on IntegriCloud