diff --git a/CHANGELOG.md b/CHANGELOG.md
index e47541e..af078d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
+| 4.26.7 | 2020-05-06 | `cpuTemperature()` fixed raspberry pi sensors issue |
| 4.26.6 | 2020-06-03 | `diskLayout()` fixed issue linux |
| 4.26.5 | 2020-05-27 | `cpuTemperature()` optimizes scanning AMD linux sensors |
| 4.26.4 | 2020-05-21 | `cpuTemperature()` fix (BSD), code cleanup |
diff --git a/docs/history.html b/docs/history.html
index d9776ca..d3a73ae 100644
--- a/docs/history.html
+++ b/docs/history.html
@@ -83,6 +83,11 @@
+
+ | 4.26.7 |
+ 2020-06-06 |
+ cpuTemperature() fixed raspberry pi sensors issue |
+
| 4.26.6 |
2020-06-03 |
diff --git a/docs/index.html b/docs/index.html
index 879b42e..8e40f22 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -207,7 +207,7 @@
Downloads last month
diff --git a/lib/cpu.js b/lib/cpu.js
index e55ca98..7113727 100644
--- a/lib/cpu.js
+++ b/lib/cpu.js
@@ -816,37 +816,38 @@ function cpuTemperature(callback) {
result.max = tdieTemp;
}
}
- if (callback) { callback(result); }
- resolve(result);
- } else {
- fs.stat('/sys/class/thermal/thermal_zone0/temp', function (err) {
- if (err === null) {
- fs.readFile('/sys/class/thermal/thermal_zone0/temp', function (error, stdout) {
- if (!error) {
- let lines = stdout.toString().split('\n');
- if (lines.length > 0) {
- result.main = parseFloat(lines[0]) / 1000.0;
- result.max = result.main;
- }
- }
- if (callback) { callback(result); }
- resolve(result);
- });
- } else {
- exec('/opt/vc/bin/vcgencmd measure_temp', function (error, stdout) {
- if (!error) {
- let lines = stdout.toString().split('\n');
- if (lines.length > 0 && lines[0].indexOf('=')) {
- result.main = parseFloat(lines[0].split('=')[1]);
- result.max = result.main;
- }
- }
- if (callback) { callback(result); }
- resolve(result);
- });
- }
- });
+ if (result.main !== -1.0 || result.max !== -1.0) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
}
+ fs.stat('/sys/class/thermal/thermal_zone0/temp', function (err) {
+ if (err === null) {
+ fs.readFile('/sys/class/thermal/thermal_zone0/temp', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ if (lines.length > 0) {
+ result.main = parseFloat(lines[0]) / 1000.0;
+ result.max = result.main;
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ exec('/opt/vc/bin/vcgencmd measure_temp', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ if (lines.length > 0 && lines[0].indexOf('=')) {
+ result.main = parseFloat(lines[0].split('=')[1]);
+ result.max = result.main;
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ });
});
});
}