wifiConnections() fixed signal strength (windows)

This commit is contained in:
Sebastian Hildebrandt 2024-02-17 15:52:43 +01:00
parent f743b7d3c0
commit e1aa9827f7
4 changed files with 12 additions and 3 deletions

View File

@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment | | Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- | | ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.21.25 | 2024-02-17 | `wifiConnections()` fixed signal strength (windows) |
| 5.21.24 | 2024-01-21 | `osInfo()` improved release version parsing (linux) | | 5.21.24 | 2024-01-21 | `osInfo()` improved release version parsing (linux) |
| 5.21.23 | 2024-01-20 | `cpu()` improved CPU speed parsing (linux) | | 5.21.23 | 2024-01-20 | `cpu()` improved CPU speed parsing (linux) |
| 5.21.22 | 2023-12-22 | `README.md` updated docs and HTML | | 5.21.22 | 2023-12-22 | `README.md` updated docs and HTML |

View File

@ -57,6 +57,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">5.21.25</th>
<td>2024-02-17</td>
<td><span class="code">wifiConnections()</span> fixed signal strength (windows)</td>
</tr>
<tr> <tr>
<th scope="row">5.21.24</th> <th scope="row">5.21.24</th>
<td>2024-01-21</td> <td>2024-01-21</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo"> <img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div> <div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.21.24</span></div> <div class="version">New Version: <span id="version">5.21.25</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button> <button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div> </div>
<div class="down"> <div class="down">

View File

@ -25,7 +25,10 @@ const _darwin = (_platform === 'darwin');
const _windows = (_platform === 'win32'); const _windows = (_platform === 'win32');
function wifiDBFromQuality(quality) { function wifiDBFromQuality(quality) {
return (parseFloat(quality) / 2 - 100); const qual = parseFloat(quality);
if (qual < 0) { return 0; }
if (qual >= 100) { return -50; }
return (qual / 2 - 100);
} }
function wifiQualityFromDB(db) { function wifiQualityFromDB(db) {
@ -658,7 +661,7 @@ function wifiConnections(callback) {
const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : ''; const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : '';
const ssid = util.getValue(lines, 'SSID', ':', true); const ssid = util.getValue(lines, 'SSID', ':', true);
const bssid = util.getValue(lines, 'BSSID', ':', true); const bssid = util.getValue(lines, 'BSSID', ':', true);
const signalLevel = util.getValue(lines, 'Signal', ':', true); const signalLevel = wifiDBFromQuality(util.getValue(lines, 'Signal', ':', true));
const type = util.getValue(lines, 'Radio type', ':', true) || util.getValue(lines, 'Type de radio', ':', true) || util.getValue(lines, 'Funktyp', ':', true) || null; const type = util.getValue(lines, 'Radio type', ':', true) || util.getValue(lines, 'Type de radio', ':', true) || util.getValue(lines, 'Funktyp', ':', true) || null;
const security = util.getValue(lines, 'authentication', ':', true) || util.getValue(lines, 'Authentification', ':', true) || util.getValue(lines, 'Authentifizierung', ':', true) || null; const security = util.getValue(lines, 'authentication', ':', true) || util.getValue(lines, 'Authentification', ':', true) || util.getValue(lines, 'Authentifizierung', ':', true) || null;
const channel = util.getValue(lines, 'Channel', ':', true) || util.getValue(lines, 'Canal', ':', true) || util.getValue(lines, 'Kanal', ':', true) || null; const channel = util.getValue(lines, 'Channel', ':', true) || util.getValue(lines, 'Canal', ':', true) || util.getValue(lines, 'Kanal', ':', true) || null;