cpuTemperature() apple silicon support
This commit is contained in:
parent
ff91141a8a
commit
58cef5c046
@ -66,7 +66,7 @@ We had to make **several interface changes** to keep systeminformation as consis
|
||||
- `uuid()`: better value support
|
||||
- `uuid()`: added MACs
|
||||
- `uuid()`: better Raspberry Pi hardware ID
|
||||
- `Apple M1 Silicon extended support (now everything supported except of cpu temperature)
|
||||
- `Apple M1 Silicon extended support
|
||||
- `updated TypeScript definitions
|
||||
|
||||
#### Test Full Version 5 Functionality
|
||||
|
||||
@ -904,7 +904,7 @@ To be able to measure temperature on macOS I created a little additional package
|
||||
in NPM with `optionalDependencies` I unfortunately was getting unexpected warnings on other platforms.
|
||||
So I decided to drop this optional dependency for macOS - so by default, you will not get correct values.
|
||||
|
||||
This additional package will unfortunately NOT work on Apple Silicon M1 machines.
|
||||
This additional package is now also supporting Apple Silicon M1 machines.
|
||||
|
||||
But if you need to detect macOS temperature just run the following additional
|
||||
installation command:
|
||||
|
||||
@ -192,7 +192,7 @@
|
||||
<li><span class="code">uuid()</span>: added MACs</li>
|
||||
<li><span class="code">uuid()</span>: better Raspberry Pi hardware ID</li>
|
||||
<li><span class="code">versions()</span>: added bash, zsh, fish, powershell, dotnet</li>
|
||||
<li><span class="code">Apple M1 Silicon</span> extended support (now everything supported except of cpu temperature)</li>
|
||||
<li><span class="code">Apple M1 Silicon</span> extended support</li>
|
||||
<li>updated TypeScript definitions </li>
|
||||
</ul>
|
||||
<h4>Test Full Version 5 Functionality</h4>
|
||||
|
||||
@ -594,7 +594,7 @@ si.cpuTemperature().then(data => console.log(data));</code></pre class="example"
|
||||
I unfortunately was getting unexpected warnings on other platforms. So I decided to drop this optional dependency for macOS - so by default,
|
||||
you will not get correct values.</p>
|
||||
|
||||
<p>This additional package will unfortunately not work on Apple Silicon M1 machines.</p>
|
||||
<p>This additional package is now also suppprting Apple Silicon M1 machines.</p>
|
||||
|
||||
<p>But if you need to detect macOS temperature just run the following additional installation command:</p>
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
I unfortunately was getting unexpected warnings on other platforms. So I decided to drop this optional dependency for macOS - so by default,
|
||||
you will not get correct values.</p>
|
||||
|
||||
<p>This additional package will unfortunately not work on Apple Silicon M1 machines.</p>
|
||||
<p>This additional package is now also supporting Apple Silicon M1 machines.</p>
|
||||
|
||||
<p>But if you need to detect macOS temperature just run the following additional installation command:</p>
|
||||
|
||||
|
||||
12
lib/cpu.js
12
lib/cpu.js
@ -1204,6 +1204,18 @@ function cpuTemperature(callback) {
|
||||
}
|
||||
if (osxTemp) {
|
||||
result = osxTemp.cpuTemperature();
|
||||
// round to 2 digits
|
||||
if (result.main) {
|
||||
result.main = Math.round(result.main * 100) / 100;
|
||||
}
|
||||
if (result.max) {
|
||||
result.max = Math.round(result.max * 100) / 100;
|
||||
}
|
||||
if (result.cores && result.cores.length) {
|
||||
for (let i = 0; i < result.cores.length; i++) {
|
||||
result.cores[i] = Math.round(result.cores[i] * 100) / 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (callback) { callback(result); }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user