show tx power as dBm

pull/2/head
Ondřej Hruška 7 years ago
parent 5d907c11ef
commit d831d47f53
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 8
      js/wifi.js

@ -7,8 +7,8 @@ const tr = require('./lang')
let curSSID let curSSID
// Get XX % for a slider input // Get XX % for a slider input
function rangePt (inp) { function calc_dBm (inp) {
return Math.round(((inp.value / inp.max) * 100)) + '%' return `+${(inp.value * 0.25).toFixed(2)} dBm`
} }
// Display selected STA SSID etc // Display selected STA SSID etc
@ -142,11 +142,11 @@ const tr = require('./lang')
let inp = x.querySelector('input') let inp = x.querySelector('input')
let disp1 = x.querySelector('.x-disp1') let disp1 = x.querySelector('.x-disp1')
let disp2 = x.querySelector('.x-disp2') let disp2 = x.querySelector('.x-disp2')
let t = rangePt(inp) let t = calc_dBm(inp)
$(disp1).html(t) $(disp1).html(t)
$(disp2).html(t) $(disp2).html(t)
$(inp).on('input', function () { $(inp).on('input', function () {
t = rangePt(inp) t = calc_dBm(inp)
$(disp1).html(t) $(disp1).html(t)
$(disp2).html(t) $(disp2).html(t)
}) })

Loading…
Cancel
Save