applications/luci-olsr: Fix problem with float values
This commit is contained in:
parent
37f83d57e3
commit
7996c4f92c
2 changed files with 33 additions and 4 deletions
|
@ -35,8 +35,14 @@ function m.on_parse()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function write_float(self, section, value)
|
||||||
|
local n = tonumber(value)
|
||||||
|
if n ~= nil then
|
||||||
|
return Value.write(self, section, "%.1f" % n)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
s = m:section(TypedSection, "olsrd", translate("General settings"))
|
s = m:section(TypedSection, "olsrd", translate("General settings"))
|
||||||
--s.dynamic = true
|
|
||||||
s.anonymous = true
|
s.anonymous = true
|
||||||
|
|
||||||
s:tab("general", translate("General Settings"))
|
s:tab("general", translate("General Settings"))
|
||||||
|
@ -122,6 +128,7 @@ hyst.enabled = "yes"
|
||||||
hyst.disabled = "no"
|
hyst.disabled = "no"
|
||||||
hyst:depends("LinkQualityLevel", "0")
|
hyst:depends("LinkQualityLevel", "0")
|
||||||
hyst.optional = true
|
hyst.optional = true
|
||||||
|
hyst.rmempty = true
|
||||||
|
|
||||||
port = s:taboption("general", Value, "OlsrPort", translate("Port"),
|
port = s:taboption("general", Value, "OlsrPort", translate("Port"),
|
||||||
translate("The port OLSR uses. This should usually stay at the IANA assigned port 698. It can have a value between 1 and 65535."))
|
translate("The port OLSR uses. This should usually stay at the IANA assigned port 698. It can have a value between 1 and 65535."))
|
||||||
|
@ -157,8 +164,9 @@ end
|
||||||
natthr:depends("LinkQualityAlgorithm", "etx_ff")
|
natthr:depends("LinkQualityAlgorithm", "etx_ff")
|
||||||
natthr:depends("LinkQualityAlgorithm", "etx_float")
|
natthr:depends("LinkQualityAlgorithm", "etx_float")
|
||||||
natthr:depends("LinkQualityAlgorithm", "etx_fpm")
|
natthr:depends("LinkQualityAlgorithm", "etx_fpm")
|
||||||
natthr.default = 1
|
natthr.default = "1.0"
|
||||||
natthr.optional = true
|
natthr.optional = true
|
||||||
|
natthr.write = write_float
|
||||||
|
|
||||||
|
|
||||||
i = m:section(TypedSection, "InterfaceDefaults", translate("Interfaces Defaults"))
|
i = m:section(TypedSection, "InterfaceDefaults", translate("Interfaces Defaults"))
|
||||||
|
@ -230,41 +238,49 @@ hi = i:taboption("timing", Value, "HelloInterval", translate("Hello interval"))
|
||||||
hi.optional = true
|
hi.optional = true
|
||||||
hi.datatype = "ufloat"
|
hi.datatype = "ufloat"
|
||||||
hi.placeholder = "5.0"
|
hi.placeholder = "5.0"
|
||||||
|
hi.write = write_float
|
||||||
|
|
||||||
hv = i:taboption("timing", Value, "HelloValidityTime", translate("Hello validity time"))
|
hv = i:taboption("timing", Value, "HelloValidityTime", translate("Hello validity time"))
|
||||||
hv.optional = true
|
hv.optional = true
|
||||||
hv.datatype = "ufloat"
|
hv.datatype = "ufloat"
|
||||||
hv.placeholder = "40.0"
|
hv.placeholder = "40.0"
|
||||||
|
hv.write = write_float
|
||||||
|
|
||||||
ti = i:taboption("timing", Value, "TcInterval", translate("TC interval"))
|
ti = i:taboption("timing", Value, "TcInterval", translate("TC interval"))
|
||||||
ti.optional = true
|
ti.optional = true
|
||||||
ti.datatype = "ufloat"
|
ti.datatype = "ufloat"
|
||||||
ti.placeholder = "2.0"
|
ti.placeholder = "2.0"
|
||||||
|
ti.write = write_float
|
||||||
|
|
||||||
tv = i:taboption("timing", Value, "TcValidityTime", translate("TC validity time"))
|
tv = i:taboption("timing", Value, "TcValidityTime", translate("TC validity time"))
|
||||||
tv.optional = true
|
tv.optional = true
|
||||||
tv.datatype = "ufloat"
|
tv.datatype = "ufloat"
|
||||||
tv.placeholder = "256.0"
|
tv.placeholder = "256.0"
|
||||||
|
tv.write = write_float
|
||||||
|
|
||||||
mi = i:taboption("timing", Value, "MidInterval", translate("MID interval"))
|
mi = i:taboption("timing", Value, "MidInterval", translate("MID interval"))
|
||||||
mi.optional = true
|
mi.optional = true
|
||||||
mi.datatype = "ufloat"
|
mi.datatype = "ufloat"
|
||||||
mi.placeholder = "18.0"
|
mi.placeholder = "18.0"
|
||||||
|
mi.write = write_float
|
||||||
|
|
||||||
mv = i:taboption("timing", Value, "MidValidityTime", translate("MID validity time"))
|
mv = i:taboption("timing", Value, "MidValidityTime", translate("MID validity time"))
|
||||||
mv.optional = true
|
mv.optional = true
|
||||||
mv.datatype = "ufloat"
|
mv.datatype = "ufloat"
|
||||||
mv.placeholder = "324.0"
|
mv.placeholder = "324.0"
|
||||||
|
mv.write = write_float
|
||||||
|
|
||||||
ai = i:taboption("timing", Value, "HnaInterval", translate("HNA interval"))
|
ai = i:taboption("timing", Value, "HnaInterval", translate("HNA interval"))
|
||||||
ai.optional = true
|
ai.optional = true
|
||||||
ai.datatype = "ufloat"
|
ai.datatype = "ufloat"
|
||||||
ai.placeholder = "18.0"
|
ai.placeholder = "18.0"
|
||||||
|
ai.write = write_float
|
||||||
|
|
||||||
av = i:taboption("timing", Value, "HnaValidityTime", translate("HNA validity time"))
|
av = i:taboption("timing", Value, "HnaValidityTime", translate("HNA validity time"))
|
||||||
av.optional = true
|
av.optional = true
|
||||||
av.datatype = "ufloat"
|
av.datatype = "ufloat"
|
||||||
av.placeholder = "108.0"
|
av.placeholder = "108.0"
|
||||||
|
av.write = write_float
|
||||||
|
|
||||||
|
|
||||||
ifs = m:section(TypedSection, "Interface", translate("Interfaces"))
|
ifs = m:section(TypedSection, "Interface", translate("Interfaces"))
|
||||||
|
|
|
@ -13,6 +13,13 @@ $Id$
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
function write_float(self, section, value)
|
||||||
|
local n = tonumber(value)
|
||||||
|
if n ~= nil then
|
||||||
|
return Value.write(self, section, "%.1f" % n)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
m = Map("olsrd", translate("OLSR Daemon - Interface"),
|
m = Map("olsrd", translate("OLSR Daemon - Interface"),
|
||||||
translate("The OLSR daemon is an implementation of the Optimized Link State Routing protocol. "..
|
translate("The OLSR daemon is an implementation of the Optimized Link State Routing protocol. "..
|
||||||
"As such it allows mesh routing for any network equipment. "..
|
"As such it allows mesh routing for any network equipment. "..
|
||||||
|
@ -106,46 +113,52 @@ ip6s.optional = true
|
||||||
ip6s.datatype = "ip6addr"
|
ip6s.datatype = "ip6addr"
|
||||||
ip6s.placeholder = "0::/0"
|
ip6s.placeholder = "0::/0"
|
||||||
|
|
||||||
|
|
||||||
hi = i:taboption("timing", Value, "HelloInterval", translate("Hello interval"))
|
hi = i:taboption("timing", Value, "HelloInterval", translate("Hello interval"))
|
||||||
hi.optional = true
|
hi.optional = true
|
||||||
hi.datatype = "ufloat"
|
hi.datatype = "ufloat"
|
||||||
hi.placeholder = "5.0"
|
hi.placeholder = "5.0"
|
||||||
|
hi.write = write_float
|
||||||
|
|
||||||
hv = i:taboption("timing", Value, "HelloValidityTime", translate("Hello validity time"))
|
hv = i:taboption("timing", Value, "HelloValidityTime", translate("Hello validity time"))
|
||||||
hv.optional = true
|
hv.optional = true
|
||||||
hv.datatype = "ufloat"
|
hv.datatype = "ufloat"
|
||||||
hv.placeholder = "40.0"
|
hv.placeholder = "40.0"
|
||||||
|
hv.write = write_float
|
||||||
|
|
||||||
ti = i:taboption("timing", Value, "TcInterval", translate("TC interval"))
|
ti = i:taboption("timing", Value, "TcInterval", translate("TC interval"))
|
||||||
ti.optional = true
|
ti.optional = true
|
||||||
ti.datatype = "ufloat"
|
ti.datatype = "ufloat"
|
||||||
ti.placeholder = "2.0"
|
ti.placeholder = "2.0"
|
||||||
|
ti.write = write_float
|
||||||
|
|
||||||
tv = i:taboption("timing", Value, "TcValidityTime", translate("TC validity time"))
|
tv = i:taboption("timing", Value, "TcValidityTime", translate("TC validity time"))
|
||||||
tv.optional = true
|
tv.optional = true
|
||||||
tv.datatype = "ufloat"
|
tv.datatype = "ufloat"
|
||||||
tv.placeholder = "256.0"
|
tv.placeholder = "256.0"
|
||||||
|
tv.write = write_float
|
||||||
|
|
||||||
mi = i:taboption("timing", Value, "MidInterval", translate("MID interval"))
|
mi = i:taboption("timing", Value, "MidInterval", translate("MID interval"))
|
||||||
mi.optional = true
|
mi.optional = true
|
||||||
mi.datatype = "ufloat"
|
mi.datatype = "ufloat"
|
||||||
mi.placeholder = "18.0"
|
mi.placeholder = "18.0"
|
||||||
|
mi.write = write_float
|
||||||
|
|
||||||
mv = i:taboption("timing", Value, "MidValidityTime", translate("MID validity time"))
|
mv = i:taboption("timing", Value, "MidValidityTime", translate("MID validity time"))
|
||||||
mv.optional = true
|
mv.optional = true
|
||||||
mv.datatype = "ufloat"
|
mv.datatype = "ufloat"
|
||||||
mv.placeholder = "324.0"
|
mv.placeholder = "324.0"
|
||||||
|
mv.write = write_float
|
||||||
|
|
||||||
ai = i:taboption("timing", Value, "HnaInterval", translate("HNA interval"))
|
ai = i:taboption("timing", Value, "HnaInterval", translate("HNA interval"))
|
||||||
ai.optional = true
|
ai.optional = true
|
||||||
ai.datatype = "ufloat"
|
ai.datatype = "ufloat"
|
||||||
ai.placeholder = "18.0"
|
ai.placeholder = "18.0"
|
||||||
|
ai.write = write_float
|
||||||
|
|
||||||
av = i:taboption("timing", Value, "HnaValidityTime", translate("HNA validity time"))
|
av = i:taboption("timing", Value, "HnaValidityTime", translate("HNA validity time"))
|
||||||
av.optional = true
|
av.optional = true
|
||||||
av.datatype = "ufloat"
|
av.datatype = "ufloat"
|
||||||
av.placeholder = "108.0"
|
av.placeholder = "108.0"
|
||||||
|
av.write = write_float
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
|
Loading…
Reference in a new issue