WiFi fail safe solution

About

This article describes how to have ability to select AP or STA with jumper.

Hardware

Put jumper between GND and GPIO7 to activate AP mode. Remove to leave in STA mode.

Configuring

#!/bin/sh

EXPORT='echo 7 > /sys/class/gpio/export'
DIRECTION='echo in > /sys/devices/virtual/gpio/gpio7/direction'

BODY=`cat /sys/devices/virtual/gpio/gpio7/value`;

if [ "$BODY" == 1 ];
then
        echo "AP mode"
        cp /etc/config/wireless_ap /etc/config/wireless
else
        echo "STA mode"
        cp /etc/config/wireless_sta /etc/config/wireless
fi

Run on boot

/usr/bin/wifi_mode.sh
wifi
exit 0