Skip to content

Commit

Permalink
luci-mod-dashboard: fix for devices that do not report noise floor
Browse files Browse the repository at this point in the history
Closes openwrt#7355

Signed-off-by: Paul Donald <[email protected]>
  • Loading branch information
systemcrash committed Oct 26, 2024
1 parent 0df7955 commit 392b7e6
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ return baseclass.extend({
E('th', { 'class': 'th nowrap' }, _('Hostname')),
E('th', { 'class': 'th' }, _('SSID')),
E('th', { 'class': 'th', 'width': '45%' }, _('Signal Strength')),
E('th', { 'class': 'th' }, 'Transferred %s / %s'.format( _('Up.'), _('Down.')))
E('th', { 'class': 'th' }, _('Transferred') + ' %s / %s'.format( _('Up.'), _('Down.')))
])
]);

Expand Down Expand Up @@ -205,8 +205,10 @@ return baseclass.extend({
name = hosthints.getHostnameByMACAddr(bss.mac);

var progress_style;
var defaultNF = -90; // default noise floor for devices that do not report it
var defaultCeil = -30;
// var q = Math.min((bss.signal + 110) / 70 * 100, 100);
var q = 100 * ((bss.signal - bss.noise) / (-30 - bss.noise));
var q = 100 * ((bss.signal - (bss.noise ? bss.noise: defaultNF) ) / (defaultCeil - (bss.noise ? bss.noise : defaultNF)));

if (q == 0 || q < 25)
progress_style = 'bg-danger';
Expand Down

0 comments on commit 392b7e6

Please sign in to comment.