luon-config-mode-geo-location/src/0400-geo-location.lua.in: refactor code

This commit is contained in:
Jan-Tarek Butt 2018-08-17 00:16:17 +02:00
parent 28267af47b
commit 94dd1da385

View File

@ -128,21 +128,15 @@ return function(form, uci)
uci:set("gluon-node-info", location, "latitude", latitude.data) uci:set("gluon-node-info", location, "latitude", latitude.data)
uci:set("gluon-node-info", location, "longitude", longitude.data) uci:set("gluon-node-info", location, "longitude", longitude.data)
if show_altitude() then if show_altitude() then
if altitude.data then uci:set("gluon-node-info", location, "altitude", altitude.data)
uci:set("gluon-node-info", location, "altitude", altitude.data)
else
uci:delete("gluon-node-info", location, "altitude")
end
end end
end end
if data == "none" then if data == "none" then
uci:delete("gluon-node-info", location, "altitude") uci:delete("gluon-node-info", location, "altitude")
uci:delete("gluon-node-info", location, "latitude") uci:delete("gluon-node-info", location, "latitude")
uci:delete("gluon-node-info", location, "longitude") uci:delete("gluon-node-info", location, "longitude")
uci:set("gluon-node-info", location, "share_location", 0)
else
uci:set("gluon-node-info", location, "share_location", share_location.data)
end end
uci:set("gluon-node-info", location, "share_location", share_location.data)
end end
return {'gluon-node-info'} return {'gluon-node-info'}
end end