- ch = s:taboption("general", Value, "channel", translate("Channel"))
- ch:value("auto", translate("auto"))
- for _, f in ipairs(iw and iw.freqlist or { }) do
- if not f.restricted then
- ch:value(f.channel, "%i (%.3f GHz)" %{ f.channel, f.mhz / 1000 })
- end
+ ch = s:taboption("general", Value, "_mode_freq", '<br />'..translate("Operating frequency"))
+ ch.hwmodes = iw.hwmodelist
+ ch.freqlist = iw.freqlist
+ ch.template = "cbi/wireless_modefreq"
+
+ function ch.cfgvalue(self, section)
+ return {
+ m:get(section, "hwmode") or "",
+ m:get(section, "channel") or "auto",
+ m:get(section, "htmode") or ""
+ }
+ end
+
+ function ch.formvalue(self, section)
+ return {
+ m:formvalue(self:cbid(section) .. ".band") or (iw.hwmodelist.g and "11g" or "11a"),
+ m:formvalue(self:cbid(section) .. ".channel") or "auto",
+ m:formvalue(self:cbid(section) .. ".htmode") or ""
+ }
+ end
+
+ function ch.write(self, section, value)
+ m:set(section, "hwmode", value[1])
+ m:set(section, "channel", value[2])
+ m:set(section, "htmode", value[3])