gluon-web: don't display outdoor mode on preserve_channels (#2074)

This will hide the outdoor mode setting on compatible devices in case
the defined channels should be preserved.

Otherwise a user might be under the impression their device is compliant
with outdoor operation when in reality it still uses prohibited
channels.
This commit is contained in:
David Bauer 2020-07-05 19:05:27 +02:00 committed by GitHub
parent 1fc71a73b3
commit 73b830eb32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions

View File

@ -1,11 +1,17 @@
return function(form, uci)
local platform = require 'gluon.platform'
local wireless = require 'gluon.wireless'
if not (platform.is_outdoor_device() and platform.device_uses_11a(uci)) then
-- only visible on wizard for outdoor devices
return
end
if wireless.preserve_channels(uci) then
-- Don't show if channel should be preserved
return
end
local pkg_i18n = i18n 'gluon-config-mode-outdoor'
local section = form:section(Section, nil, pkg_i18n.translate(

View File

@ -54,7 +54,7 @@ end
local function get_channel(radio, config)
local channel
if uci:get_first('gluon-core', 'wireless', 'preserve_channels') then
if wireless.preserve_channels(uci) then
-- preserved channel always wins
channel = radio.channel
elseif (radio.hwmode == '11a' or radio.hwmode == '11na') and is_outdoor() then

View File

@ -96,4 +96,8 @@ function M.foreach_radio(uci, f)
end
end
function M.preserve_channels(uci)
return uci:get_first('gluon-core', 'wireless', 'preserve_channels')
end
return M

View File

@ -142,7 +142,7 @@ uci:foreach('wireless', 'wifi-device', function(config)
end)
if has_5ghz_radio() then
if has_5ghz_radio() and not wireless.preserve_channels(uci) then
local r = f:section(Section, translate("Outdoor Installation"), translate(
"Configuring the node for outdoor use tunes the 5 GHz radio to a frequency "
.. "and transmission power that conforms with the local regulatory requirements. "