local iw = luci.sys.wifi.getiwinfo(arg[1])
-local tx_powers = iw.txpwrlist or { }
local hw_modes = iw.hwmodelist or { }
-
+local tx_powers = iw.txpwrlist or { }
+local tx_power = tostring(
+ (iw.txpower and iw.txpower > 0 and iw.txpower) or
+ (#tx_powers > 0 and tx_powers[#tx_powers].dbm)
+)
s = m:section(NamedSection, wdev:name(), "wifi-device", translate("Device Configuration"))
s.addremove = false
"txpower", translate("Transmit Power"), "dBm")
tp.rmempty = true
- tp.default = tostring(iw and iw.txpower or tx_powers[#tx_powers])
+ tp.default = tx_power
for _, p in ipairs(tx_powers or {}) do
tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw })
end
"txpower", translate("Transmit Power"), "dBm")
tp.rmempty = true
- for _, p in ipairs(iw.txpwrlist) do
+ tp.default = tx_power
+ for _, p in ipairs(tx_powers or {}) do
tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw })
end
"txpower", translate("Transmit Power"), "dBm")
tp.rmempty = true
- for _, p in ipairs(iw.txpwrlist) do
+ tp.default = tx_power
+ for _, p in ipairs(tx_powers or {}) do
tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw })
end