Make the apply/reapply to be done by button since some devices are slow

main
Jason Hawks 1 year ago
parent 9e872ab3bd
commit e53320cfe9

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for easymesh LUCI_TITLE:=LuCI Support for easymesh
LUCI_DEPENDS:= +kmod-cfg80211 +batctl-default +kmod-batman-adv +dawn +bash LUCI_DEPENDS:= +kmod-cfg80211 +batctl-default +kmod-batman-adv +dawn +bash
PKG_VERSION:=2.8.9 PKG_VERSION:=2.8.10
include $(TOPDIR)/feeds/luci/luci.mk include $(TOPDIR)/feeds/luci/luci.mk

@ -73,8 +73,8 @@ o.default = 0
o = s:taboption("setup", ListValue, "role", translate("Mesh Mode"), translate('<p style="text-align: justify; padding: 0;"><strong>Choose the role this device will play in your mesh network. There are two options available:</strong></p> <p style="text-align: justify; padding: 0;"><strong>1. Server:</strong> If you select this option, this device will act as the Mesh Gateway Server. The server manages the routing of data in the network and handles connections to the internet. It is the central point of your mesh network.</p> <p style="text-align: justify; padding: 0;"><strong>2. Node:</strong> The device functions as a Mesh Node if this option is selected. Nodes connect to the Mesh Gateway Server and other nodes to extend the range of the network. Nodes can also route traffic between each other to increase network efficiency.</p> <p style="text-align: justify; padding: 0;"><strong>Remember to set up the Mesh Gateway Server first before setting up the nodes.</strong></p>')) o = s:taboption("setup", ListValue, "role", translate("Mesh Mode"), translate('<p style="text-align: justify; padding: 0;"><strong>Choose the role this device will play in your mesh network. There are two options available:</strong></p> <p style="text-align: justify; padding: 0;"><strong>1. Server:</strong> If you select this option, this device will act as the Mesh Gateway Server. The server manages the routing of data in the network and handles connections to the internet. It is the central point of your mesh network.</p> <p style="text-align: justify; padding: 0;"><strong>2. Node:</strong> The device functions as a Mesh Node if this option is selected. Nodes connect to the Mesh Gateway Server and other nodes to extend the range of the network. Nodes can also route traffic between each other to increase network efficiency.</p> <p style="text-align: justify; padding: 0;"><strong>Remember to set up the Mesh Gateway Server first before setting up the nodes.</strong></p>'))
o:value("server", translate("Server")) o:value("server", translate("Server"))
o:value("off", translate("Node")) o:value("off", translate("Node"))
o:value("client", translate("Client"))
o.default = "server" o.default = "server"
--o:value("client", translate("Client (advanced)"))
apRadio = s:taboption("setup", MultiValue, "apRadio", translate("Mesh Radio(s)"), translate('<p style="text-align: justify; padding: 0;">Select one or multiple radio interfaces to be used for the mesh network. Each selected radio interface will be configured to participate in the mesh network, extending its range and improving its resilience. By using multiple radios, your mesh network can balance the network load and handle a larger number of connected devices.</p><strong><p style="text-align: justify; padding: 0;">Ensure the radios you select support mesh networking</p></strong>')) apRadio = s:taboption("setup", MultiValue, "apRadio", translate("Mesh Radio(s)"), translate('<p style="text-align: justify; padding: 0;">Select one or multiple radio interfaces to be used for the mesh network. Each selected radio interface will be configured to participate in the mesh network, extending its range and improving its resilience. By using multiple radios, your mesh network can balance the network load and handle a larger number of connected devices.</p><strong><p style="text-align: justify; padding: 0;">Ensure the radios you select support mesh networking</p></strong>'))
@ -100,6 +100,11 @@ o:depends("encryption", 1)
o.password = true o.password = true
o.datatype = "minlength(8)" o.datatype = "minlength(8)"
btnReapply = s:taboption("setup", Button, "_btn_reapply", translate("Reapply EasyMesh Settings"), translate('<p style="text-align: justify; padding: 0;"><strong>Use this button to apply/reapply EasyMesh configuration after you Save & Apply.</p></strong>'))
function btnReapply.write()
io.popen("/easymesh/easymesh.sh &")
end
enable_kvr = s:taboption("advanced", Flag, "kvr", translate("K/V/R"), translate('<p style="text-align: justify; padding: 0;"><strong>Leave these settings as default unless you know what you\'re doing</p></strong>')) enable_kvr = s:taboption("advanced", Flag, "kvr", translate("K/V/R"), translate('<p style="text-align: justify; padding: 0;"><strong>Leave these settings as default unless you know what you\'re doing</p></strong>'))
enable_kvr.default = 1 enable_kvr.default = 1
@ -127,7 +132,7 @@ o:value("node7", "node7")
o:value("node8", "node8") o:value("node8", "node8")
o:value("node9", "node9") o:value("node9", "node9")
o.datatype = "string" o.datatype = "string"
o:depends("role", "off") o:depends({role="off",role="client"})
-- IP Mode (DHCP or Static) -- IP Mode (DHCP or Static)
ipmode = s:taboption("apmode", ListValue, "ipmode", translate("IP Mode"), translate("Choose if the node uses DHCP or a Static IP")) ipmode = s:taboption("apmode", ListValue, "ipmode", translate("IP Mode"), translate("Choose if the node uses DHCP or a Static IP"))
@ -166,13 +171,4 @@ function btnAPMode.write()
end end
btnAPMode:depends("role", "off") btnAPMode:depends("role", "off")
m.on_before_apply = function(self)
local enabled = m:formvalue("cbid.easymesh.config.enabled")
if enabled and enabled == "1" then
luci.sys.call("/easymesh/easymesh.sh enable &")
else
luci.sys.call("/easymesh/easymesh.sh disable &")
end
end
return m return m

@ -492,19 +492,18 @@ disable_easymesh() {
uci del easymesh.config.running uci del easymesh.config.running
} }
if [ "$1" = "enable" ]; then if [ "$1" = "dumbap" ]; then
enable_easymesh
exit 0
elif [ "$1" = "disable" ]; then
disable_easymesh
exit 0
elif [ "$1" = "dumbap" ]; then
set_apmode set_apmode
exit 0 exit 0
elif [ "$1" = "undumb" ]; then elif [ "$1" = "undumb" ]; then
disable_apmode disable_apmode
exit 0 exit 0
# If no params passed, we disable or enable easymesh based on config
else else
echo "Invalid argument. Please use 'start', 'stop' or 'dumbap'" # Check if easymesh is enabled
exit 1 if [ "$(uci -q get easymesh.config.enabled)" = 1 ]; then
enable_easymesh
else
disable_easymesh
fi
fi fi

Loading…
Cancel
Save