mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
Changed the script so that the wifinetworks rotate
This commit is contained in:
parent
4160441a4b
commit
52650da0fe
@ -4,6 +4,13 @@
|
|||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
handle_interface() {
|
||||||
|
local config="$1"
|
||||||
|
logger $config
|
||||||
|
count=$((count + 1))
|
||||||
|
# run commands for every interface section
|
||||||
|
}
|
||||||
|
|
||||||
logger "$BUTTON pressed for $SEEN seconds"
|
logger "$BUTTON pressed for $SEEN seconds"
|
||||||
if [ "$SEEN" -lt 1 ]
|
if [ "$SEEN" -lt 1 ]
|
||||||
then
|
then
|
||||||
@ -11,7 +18,7 @@ then
|
|||||||
#check if network on top is in STA mode
|
#check if network on top is in STA mode
|
||||||
if [ $(uci get wireless.@wifi-iface[1].mode) == "ap" ]
|
if [ $(uci get wireless.@wifi-iface[1].mode) == "ap" ]
|
||||||
then
|
then
|
||||||
logger "switching to AP"
|
logger "switching to AP $(uci get wireless.@wifi-iface[1].ssid)"
|
||||||
if [ $(uci get wireless.@wifi-iface[1].network) != "wlan" ] #edge case when only the factory default openwrt network is available
|
if [ $(uci get wireless.@wifi-iface[1].network) != "wlan" ] #edge case when only the factory default openwrt network is available
|
||||||
then
|
then
|
||||||
uci set wireless.@wifi-iface[1].network=wlan
|
uci set wireless.@wifi-iface[1].network=wlan
|
||||||
@ -31,15 +38,26 @@ then
|
|||||||
|
|
||||||
uci set wireless.@wifi-iface[0].disabled=1 #disable current config
|
uci set wireless.@wifi-iface[0].disabled=1 #disable current config
|
||||||
uci set wireless.@wifi-iface[1].disabled=0 #enable last used network
|
uci set wireless.@wifi-iface[1].disabled=0 #enable last used network
|
||||||
uci reorder wireless.@wifi-iface[0]=2 #reorder networks so last used config goes to the top again
|
|
||||||
|
config_load wireless
|
||||||
|
config_foreach handle_interface wifi-iface
|
||||||
|
logger $count
|
||||||
|
|
||||||
|
uci reorder wireless.@wifi-iface[0]=$count #reorder networks so last used config goes to the top again
|
||||||
uci commit #commit changes
|
uci commit #commit changes
|
||||||
/etc/init.d/network reload #reload network module so changes become effective
|
/etc/init.d/network reload #reload network module so changes become effective
|
||||||
|
logger "setting status flag in /tmp/networkstatus.txt"
|
||||||
echo "4|" > /tmp/networkstatus.txt
|
echo "4|" > /tmp/networkstatus.txt
|
||||||
else
|
else
|
||||||
logger "switching to STA $(uci get wireless.@wifi-iface[0].mode)"
|
logger "switching to STA $(uci get wireless.@wifi-iface[1].ssid)"
|
||||||
uci set wireless.@wifi-iface[0].disabled=1 #disable current config
|
uci set wireless.@wifi-iface[0].disabled=1 #disable current config
|
||||||
uci set wireless.@wifi-iface[1].disabled=0 #enable last used network
|
uci set wireless.@wifi-iface[1].disabled=0 #enable last used network
|
||||||
uci reorder wireless.@wifi-iface[0]=2 #reorder networks so last used config goes to the top again
|
|
||||||
|
config_load wireless
|
||||||
|
config_foreach handle_interface wifi-iface
|
||||||
|
logger $count
|
||||||
|
|
||||||
|
uci reorder wireless.@wifi-iface[0]=$count #reorder networks so last used config goes to the top again
|
||||||
|
|
||||||
uci delete network.wlan
|
uci delete network.wlan
|
||||||
uci set network.wlan=interface
|
uci set network.wlan=interface
|
||||||
|
Loading…
Reference in New Issue
Block a user