Skip to content
Snippets Groups Projects
Commit ec582b77 authored by David Bauer's avatar David Bauer Committed by David Bauer
Browse files

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.

(cherry picked from commit 73b830eb)
parent d3613ac5
No related branches found
No related tags found
No related merge requests found
return function(form, uci) return function(form, uci)
local platform = require 'gluon.platform' local platform = require 'gluon.platform'
local wireless = require 'gluon.wireless'
if not (platform.is_outdoor_device() and platform.device_uses_11a(uci)) then if not (platform.is_outdoor_device() and platform.device_uses_11a(uci)) then
-- only visible on wizard for outdoor devices -- only visible on wizard for outdoor devices
return return
end 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 pkg_i18n = i18n 'gluon-config-mode-outdoor'
local section = form:section(Section, nil, pkg_i18n.translate( local section = form:section(Section, nil, pkg_i18n.translate(
......
...@@ -54,7 +54,7 @@ end ...@@ -54,7 +54,7 @@ end
local function get_channel(radio, config) local function get_channel(radio, config)
local channel local channel
if uci:get_first('gluon-core', 'wireless', 'preserve_channels') then if wireless.preserve_channels(uci) then
-- preserved channel always wins -- preserved channel always wins
channel = radio.channel channel = radio.channel
elseif (radio.hwmode == '11a' or radio.hwmode == '11na') and is_outdoor() then elseif (radio.hwmode == '11a' or radio.hwmode == '11na') and is_outdoor() then
......
...@@ -96,4 +96,8 @@ function M.foreach_radio(uci, f) ...@@ -96,4 +96,8 @@ function M.foreach_radio(uci, f)
end end
end end
function M.preserve_channels(uci)
return uci:get_first('gluon-core', 'wireless', 'preserve_channels')
end
return M return M
...@@ -142,7 +142,7 @@ uci:foreach('wireless', 'wifi-device', function(config) ...@@ -142,7 +142,7 @@ uci:foreach('wireless', 'wifi-device', function(config)
end) 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( local r = f:section(Section, translate("Outdoor Installation"), translate(
"Configuring the node for outdoor use tunes the 5 GHz radio to a frequency " "Configuring the node for outdoor use tunes the 5 GHz radio to a frequency "
.. "and transmission power that conforms with the local regulatory requirements. " .. "and transmission power that conforms with the local regulatory requirements. "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment