diff --git a/__root__stratux-pre-start.sh b/__root__stratux-pre-start.sh index cda14e54..7b309cd6 100755 --- a/__root__stratux-pre-start.sh +++ b/__root__stratux-pre-start.sh @@ -2,16 +2,40 @@ echo powersave >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor +#Logging Function +SCRIPT=`basename ${BASH_SOURCE[0]}` +STX_LOG="/var/log/stratux.log" +function wLog () { + echo "$(date +"%Y/%m/%d %H:%m:%S") - $SCRIPT - $1" >> ${STX_LOG} +} +wLog "Running Stratux Updater Script." + +SCRIPT_MASK="update*stratux*v*.sh" +TEMP_LOCATION="/boot/StratuxUpdates/$SCRIPT_MASK" +UPDATE_LOCATION="/root/$SCRIPT_MASK" + +if [ -e ${TEMP_LOCATION} ]; then + wLog "Found Update Script in $TEMP_LOCATION$SCRIPT_MASK" + TEMP_SCRIPT=`ls -1t ${TEMP_LOCATION} | head -1` + wLog "Moving Script $TEMP_SCRIPT" + cp -r ${TEMP_SCRIPT} /root/ + wLog "Changing permissions to chmod a+x $UPDATE_LOCATION" + chmod a+x ${UPDATE_LOCATION} + wLog "Removing Update file from $TEMP_LOCATION" + rm -rf ${TEMP_SCRIPT} +fi + # Check if we need to run an update. -if [ -e /root/update*stratux*v*.sh ] ; then - UPDATE_SCRIPT=`ls -1t /root/update*stratux*v*.sh | head -1` - if [ -n "$UPDATE_SCRIPT" ] ; then +if [ -e ${UPDATE_LOCATION} ]; then + UPDATE_SCRIPT=`ls -1t ${UPDATE_LOCATION} | head -1` + if [ -n ${UPDATE_SCRIPT} ] ; then # Execute the script, remove it, then reboot. - echo - echo "Running update script ${UPDATE_SCRIPT}..." + wLog "Running update script ${UPDATE_SCRIPT}..." bash ${UPDATE_SCRIPT} - rm -f $UPDATE_SCRIPT + wLog "Removing Update SH" + rm -f ${UPDATE_SCRIPT} + wLog "Finished... Rebooting... Bye" reboot fi fi - +wLog "Exited without updating anything..." diff --git a/image/hostapd_manager.sh b/image/hostapd_manager.sh index fa95cb32..0a3db390 100644 --- a/image/hostapd_manager.sh +++ b/image/hostapd_manager.sh @@ -3,8 +3,22 @@ # STRATUX HOSTAPD MANAGER # ###################################################################### -#Set Script Name variable +#Logging Function SCRIPT=`basename ${BASH_SOURCE[0]}` +STX_LOG="/var/log/stratux.log" +function wLog () { + echo "$(date +"%Y/%m/%d %H:%m:%S") - $SCRIPT - $1" >> $STX_LOG +} +wLog "Running Hostapd Manager Script." + +# files to edit +HOSTAPD=('/etc/hostapd/hostapd.user') + +# values to be added to hostapd.user for security. +HOSTAPD_SECURE_VALUES_DELETE=('auth_algs=1' 'wpa=3' 'wpa_passphrase=' 'wpa_key_mgmt=WPA-PSK' 'wpa_pairwise=TKIP' 'rsn_pairwise=CCMP') + +# 'wpa_passphrase=' was left out of this to set it with the $wifiPass. I assume you can not evaluate a variable from within an array variable +HOSTAPD_SECURE_VALUES_WRITE=('auth_algs=1' 'wpa=3' 'wpa_key_mgmt=WPA-PSK' 'wpa_pairwise=TKIP' 'rsn_pairwise=CCMP') #Initialize variables to default values. OPT_S=false @@ -12,8 +26,7 @@ OPT_C=false OPT_E=false OPT_O=false OPT_P=false -OPT_Q=false -defaultPass="SquawkDirtyToMe!" +wifiPass="SquawkDirtyToMe!" parm="*" err="####" @@ -40,15 +53,14 @@ function HELP { echo "${REV}-s${NORM} --Sets the SSID to ${BOLD}ssid${NORM}. \"-s stratux\"" echo "${REV}-c${NORM} --Sets the channel to ${BOLD}chan${NORM}. \"-c 1\"" echo "${REV}-o${NORM} --Turns off encryption and sets network to open. Cannot be used with -e or -p." - echo "${REV}-e${NORM} --Turns on encryption with passphrase ${BOLD}$defaultPass{NORM}. Cannot be used with -o or -p" + echo "${REV}-e${NORM} --Turns on encryption with passphrase ${BOLD}$wifiPass${NORM}. Cannot be used with -o or -p" echo "${REV}-p${NORM} --Turns on encryption with your chosen passphrase ${BOLD}pass${NORM}. 8-63 Printable Characters(ascii 32-126). Cannot be used with -o or -e. \"-p password!\"" - echo "${REV}-q${NORM} --Run silently. Still a work in progress, but quieter." echo -e "${REV}-h${NORM} --Displays this help message. No further functions are performed."\\n echo -e "Example: ${BOLD}$SCRIPT -s Stratux-N3558D -c 5 -p SquawkDirty!${NORM}"\\n exit 1 } -confirm() { +function confirm() { # call with a prompt string or use a default read -r -p "$1 " response case "$response" in @@ -61,31 +73,40 @@ confirm() { esac } +function cleanhostapd () { + wLog "Cleaning hostapd config at $1" + for j in "${HOSTAPD_SECURE_VALUES_DELETE[@]}" + do + sed -i "/$j/ d" ${1} + done + sed -i '/^\s*$/d' ${1} +} + +function writehostapd () { + wLog "Writing hostapd config at $1" + sed -i '/^\s*$/d' ${1} + echo "" >> ${1} + for j in "${HOSTAPD_SECURE_VALUES_WRITE[@]}" + do + echo "${j}" >> ${1} + done + echo "wpa_passphrase=$wifiPass" >> ${1} +} #apply settings and restart all processes -function APPLYSETTINGSLOUD { +function APPLYSETTINGS { + wLog "Restarting all wifi settings." echo "${RED}${BOLD} $att At this time the script will restart your WiFi services.${WHITE}${NORMAL}" echo "If you are connected to Stratux through the ${BOLD}192.168.10.1${NORMAL} interface then you will be disconnected" - echo "Please wait 1 min and look for the new SSID on your wireless device." + echo "Please wait up to 1 min and look for the new SSID on your wireless device." sleep 3 echo "${YELLOW}$att Restarting Stratux WiFi Services... $att ${WHITE}" - echo "${YELLOW}$att SSH will now disconnect if connected to http://192.168.1.10 ... $att ${WHITE}" - echo "Killing hostapd..." - sleep 2 - /usr/bin/killall -9 hostapd hostapd-edimax - echo "Killed..." - echo "" - echo "Killing DHCP Server..." - echo "" - /usr/sbin/service isc-dhcp-server stop - sleep 0.5 - echo "Killed..." - echo "" + echo "${YELLOW}$att SSH will now disconnect if connected to http://192.168.10.1 ... $att ${WHITE}" echo "ifdown wlan0..." ifdown wlan0 sleep 0.5 echo "ifup wlan0..." - echo "Calling Stratux WiFI Start Script(stratux-wifi.sh)..." + echo "Calling Stratux WiFI Start Script(stratux-wifi.sh) via ifup wlan0..." ifup wlan0 sleep 0.5 echo "" @@ -93,18 +114,6 @@ function APPLYSETTINGSLOUD { echo "All systems should be up and running and you should see your new SSID!" } -function APPLYSETTINGSQUIET { - sleep 2 - /usr/bin/killall -9 hostapd hostapd-edimax - sleep 1 - /usr/sbin/service isc-dhcp-server stop - sleep 0.5 - ifdown wlan0 - sleep 0.5 - ifup wlan0 - sleep 0.5 -} - clear echo "" @@ -129,13 +138,14 @@ fi #If an option should be followed by an argument, it should be followed by a ":". #Notice there is no ":" after "eoqh". The leading ":" suppresses error messages from #getopts. This is required to get my unrecognized option code to work. -options=':s:c:p:eoqh' +options=':s:c:p:eoh' #options=':s:c:h' while getopts $options option; do case $option in s) #set option "s" if [[ -z "${OPTARG}" || "${OPTARG}" == *[[:space:]]* || "${OPTARG}" == -* ]]; then echo "${BOLD}${RED}$err No SSID for -s, exiting...${WHITE}${NORMAL}" + wLog "No SSID for -s, exiting..." exit 1 else OPT_S=$OPTARG @@ -146,6 +156,7 @@ while getopts $options option; do c) #set option "c" if [[ -z "${OPTARG}" || "${OPTARG}" == *[[:space:]]* || "${OPTARG}" == -* ]]; then echo "${BOLD}${RED}$err Channel option(-c) used without value, exiting... ${WHITE}${NORMAL}" + wLog "Channel option(-c) used without value, exiting..." exit 1 else OPT_C=$OPTARG @@ -154,6 +165,7 @@ while getopts $options option; do echo "${GREEN} Channel will now be set to ${BOLD}${UNDR}$OPT_C${WHITE}${NORMAL}." else echo "${BOLD}${RED}$err Channel is not within acceptable values, exiting...${WHITE}${NORMAL}" + wLog "Channel is not within acceptable values, exiting..." exit 1 fi fi @@ -161,26 +173,30 @@ while getopts $options option; do e) #set option "e" with default passphrase if [[ -z "${OPTARG}" || "${OPTARG}" == *[[:space:]]* || "${OPTARG}" == -* ]]; then echo "$parm Encrypted WiFI Option -e used." - OPT_E=$defaultPass + OPT_E=$wifiPass echo "${GREEN} WiFi will be encrypted using ${BOLD}${UNDR}$OPT_E${NORMAL}${GREEN} as the passphrase!${WHITE}${NORMAL}" else - echo "${BOLD}${RED}$err Option -e does not require arguement.${WHITE}${NORMAL}" + echo "${BOLD}${RED}$err Option -e does not require argument. exiting...${WHITE}${NORMAL}" + wLog "Option -e does not require argument." exit 1 fi ;; p) #set encryption with user specified passphrase if [[ -z "${OPTARG}" || "${OPTARG}" =~ ^[[:space:]]*$ || "${OPTARG}" == -* ]]; then echo "${BOLD}${RED}$err Encryption option(-p) used without passphrase!${WHITE}${NORMAL}" - echo "${BOLD}${RED}$err Encryption option(-p) required an arguement \"-p passphrase\" ${WHITE}${NORMAL}" + echo "${BOLD}${RED}$err Encryption option(-p) required an argument \"-p passphrase\". exiting...${WHITE}${NORMAL}" + wLog "Encryption option(-p) used without passphrase!" else OPT_P=$OPTARG + wifiPass=$OPTARG fi echo "$parm Encryption option -p used:" if [ -z `echo $OPT_P | tr -d "[:print:]"` ] && [ ${#OPT_P} -ge 8 ] && [ ${#OPT_P} -le 63 ]; then echo "${GREEN} WiFi will be encrypted using ${BOLD}${UNDR}$OPT_P${NORMAL}${GREEN} as the passphrase!${WHITE}${NORMAL}" - else + else echo "${BOLD}${RED}$err Invalid PASSWORD: 8 - 63 printable characters, exiting...${WHITE}${NORMAL}" - exit 1 + wLog "Invalid PASSWORD: 8 - 63 printable characters, exiting..." + exit 1 fi ;; o) #set option "o" @@ -189,13 +205,11 @@ while getopts $options option; do echo "${GREEN} WiFi will be set to ${BOLD}${UNDR}OPEN${NORMAL}${GREEN} or ${BOLD}${UNDR}UNSECURE${WHITE}${NORMAL}" OPT_O=true else - echo "${BOLD}${RED}$err Option -o does not require arguement.${WHITE}${NORMAL}" + echo "${BOLD}${RED}$err Option -o does not require argument. exiting...${WHITE}${NORMAL}" + wLog "Option -o does not require argument. exiting..." exit 1 fi ;; - q) #set Quiet mode - OPT_Q=true - ;; h) #show help HELP ;; @@ -229,25 +243,22 @@ shift $((OPTIND-1)) #This tells getopts to move on to the next argument. #file processing tasks within the while-do loop. if [[ $OPT_O == true && ( $OPT_E != false || $OPT_P != false ) ]]; then - echo "${BOLD}${RED}$err Option -e , -p and -o cannot be used simultaneously ${WHITE}${NORMAL}" + echo "${BOLD}${RED}$err Option -e , -p and -o cannot be used simultaneously. Exiting... ${WHITE}${NORMAL}" + wLog "Option -e , -p and -o cannot be used simultaneously." exit 1 fi if [ $OPT_P != false ] && [ $OPT_E != false ]; then - echo "${BOLD}${RED}$err Option -e and -p cannot be used simultaneously ${WHITE}${NORMAL}" + echo "${BOLD}${RED}$err Option -e and -p cannot be used simultaneously. Exiting... ${WHITE}${NORMAL}" + wLog "Option -e and -p cannot be used simultaneously." exit 1 fi echo "" -echo "${BOLD}No errors found. Continuning...${NORMAL}" +echo "${BOLD}No errors found. Continuing...${NORMAL}" echo "" -if [ $OPT_Q == false ]; then - confirm "Are you ready to apply these settings? [y/n]" -fi - -# files to edit -HOSTAPD=('/etc/hostapd/hostapd.user') +confirm "Are you ready to apply these settings? [y/n]" #### #### File modification loop @@ -256,7 +267,9 @@ for i in "${HOSTAPD[@]}" do if [ -f ${i} ]; then echo "Working on $i..." - if [ $OPT_S != false ]; then + wLog "Working on $i..." + if [ $OPT_S != false ]; then + wLog "Writing SSID $OPT_S to file $i" echo "${MAGENTA}Setting ${YELLOW}SSID${MAGENTA} to ${YELLOW}$OPT_S ${MAGENTA}in $i...${WHITE}" if grep -q "^ssid=" ${HOSTAPD[$x]}; then sed -i "s/^ssid=.*/ssid=${OPT_S}/" ${i} @@ -266,6 +279,7 @@ do fi if [ $OPT_C != false ]; then + wLog "Writing channel $OPT_C to file $i" echo "${MAGENTA}Setting ${YELLOW}Channel${MAGENTA} to ${YELLOW}$OPT_C ${MAGENTA}in $i...${WHITE}" if grep -q "^channel=" ${i}; then sed -i "s/^channel=.*/channel=${OPT_C}/" ${i} @@ -274,73 +288,23 @@ do fi fi - if [ $OPT_P != false ]; then - OPT_E=$OPT_P + if [ $OPT_E != false ] || [ $OPT_P != false ]; then + wLog "Writing security and setting passphrase to $wifiPass to file $i" + echo "${MAGENTA}Adding WPA encryption with passphrase: ${YELLOW}$wifiPass ${MAGENTA}to $i...${WHITE}" + cleanhostapd $i + writehostapd $i fi - if [ $OPT_E != false ]; then - echo "${MAGENTA}Adding WPA encryption with passphrase: ${YELLOW}$OPT_E ${MAGENTA}to $i...${WHITE}" - if grep -q "^#auth_algs=" ${i}; then - #echo "uncomenting wpa" - sed -i "s/^#auth_algs=.*/auth_algs=1/" ${i} - sed -i "s/^#wpa=.*/wpa=3/" ${i} - sed -i "s/^#wpa_passphrase=.*/wpa_passphrase=$OPT_E/" ${i} - sed -i "s/^#wpa_key_mgmt=.*/wpa_key_mgmt=WPA-PSK/" ${i} - sed -i "s/^#wpa_pairwise=.*/wpa_pairwise=TKIP/" ${i} - sed -i "s/^#rsn_pairwise=.*/rsn_pairwise=CCMP/" ${i} - elif grep -q "^auth_algs=" ${i}; then - #echo "rewriting existing wpa" - sed -i "s/^auth_algs=.*/auth_algs=1/" ${i} - sed -i "s/^wpa=.*/wpa=3/" ${i} - sed -i "s/^wpa_passphrase=.*/wpa_passphrase=$OPT_E/" ${i} - sed -i "s/^wpa_key_mgmt=.*/wpa_key_mgmt=WPA-PSK/" ${i} - sed -i "s/^wpa_pairwise=.*/wpa_pairwise=TKIP/" ${i} - sed -i "s/^rsn_pairwise=.*/rsn_pairwise=CCMP/" ${i} - else -# #echo "adding wpa" - echo "" >> ${i} - echo "auth_algs=1" >> ${i} - echo "wpa=3" >> ${i} - echo "wpa_passphrase=$OPT_E" >> ${i} - echo "wpa_key_mgmt=WPA-PSK" >> ${i} - echo "wpa_pairwise=TKIP" >> ${i} - echo "rsn_pairwise=CCMP" >> ${i} - fi - fi if [ $OPT_O != false ]; then - echo "${MAGENTA}Removing WPA encryption in $i...${WHITE}" - if grep -q "^auth_algs=" ${i}; then - #echo "comenting out wpa" - sed -i "s/^auth_algs=.*/#auth_algs=1/" ${i} - sed -i "s/^wpa=.*/#wpa=3/" ${i} - sed -i "s/^wpa_passphrase=.*/#wpa_passphrase=$defaultPass/" ${i} - sed -i "s/^wpa_key_mgmt=.*/#wpa_key_mgmt=WPA-PSK/" ${i} - sed -i "s/^wpa_pairwise=.*/#wpa_pairwise=TKIP/" ${i} - sed -i "s/^rsn_pairwise=.*/#rsn_pairwise=CCMP/" ${i} - elif grep -q "^#auth_algs=" ${i}; then - #echo "rewriting comentied out wpa" - sed -i "s/^#auth_algs=.*/#auth_algs=1/" ${i} - sed -i "s/^#wpa=.*/#wpa=3/" ${i} - sed -i "s/^#wpa_passphrase=.*/#wpa_passphrase=$defaultPass/" ${i} - sed -i "s/^#wpa_key_mgmt=.*/#wpa_key_mgmt=WPA-PSK/" ${i} - sed -i "s/^#wpa_pairwise=.*/#wpa_pairwise=TKIP/" ${i} - sed -i "s/^#rsn_pairwise=.*/#rsn_pairwise=CCMP/" ${i} - else - #echo "adding commented out WPA" - echo "" >> ${i} - echo "#auth_algs=1" >> ${i} - echo "#wpa=3" >> ${i} - echo "#wpa_passphrase=$defaultPass" >> ${i} - echo "#wpa_key_mgmt=WPA-PSK" >> ${i} - echo "#wpa_pairwise=TKIP" >> ${i} - echo "#rsn_pairwise=CCMP" >> ${i} - fi + wLog "Removing WiFi security in file $i" + echo "${MAGENTA}Removing WPA encryption in $i...${WHITE}" + cleanhostapd $i fi echo "${GREEN}Modified ${i}...done${WHITE}" echo "" else - echo "${MAGENTA}No ${i} file found...${WHITE}${NORMAL}" + echo "${MAGENTA}No ${i} file found...${WHITE}${NORMAL}" echo "" fi done @@ -350,11 +314,6 @@ done ### End main loop ### ### Apply Settings and restart all services - -if [ $OPT_Q == false ]; then - APPLYSETTINGSLOUD -else - APPLYSETTINGSQUIET -fi +APPLYSETTINGS exit 0 diff --git a/image/stratux-wifi.sh b/image/stratux-wifi.sh index 5ea6dc5c..c5c67f18 100755 --- a/image/stratux-wifi.sh +++ b/image/stratux-wifi.sh @@ -10,6 +10,13 @@ # common variables DAEMON_USER_PREF=/etc/hostapd/hostapd.user +#Logging Function +SCRIPT=`basename ${BASH_SOURCE[0]}` +STX_LOG="/var/log/stratux.log" +function wLog () { + echo "$(date +"%Y/%m/%d %H:%m:%S") - $SCRIPT - $1" >> ${STX_LOG} +} +wLog "Running Stratux WiFI Script." ##### Function for setting up new file structure for hostapd settings ##### Look for hostapd.user and if found do nothing. @@ -19,8 +26,8 @@ function hostapd-upgrade { DAEMON_CONF=/etc/hostapd/hostapd.conf DAEMON_CONF_EDIMAX=/etc/hostapd/hostapd-edimax.conf HOSTAPD_VALUES=('ssid=' 'channel=' 'auth_algs=' 'wpa=' 'wpa_passphrase=' 'wpa_key_mgmt=' 'wpa_pairwise=' 'rsn_pairwise=') - HOSTAPD_VALUES_RM=('#auth_algs=' '#wpa=' '#wpa_passphrase=' '#wpa_key_mgmt=' '#wpa_pairwise=' '#rsn_pairwise=') + wLog "Moving existing values from $DAEMON_CONF to $DAEMON_USER_PREF if found" for i in "${HOSTAPD_VALUES[@]}" do if grep -q "^$i" $DAEMON_CONF @@ -30,18 +37,12 @@ function hostapd-upgrade { sed -i '/^'"$i"'/d' $DAEMON_CONF_EDIMAX fi done - for i in "${HOSTAPD_VALUES_RM[@]}" - do - if grep -q "^$i" $DAEMON_CONF - then - sed -i '/^'"$i"'/d' $DAEMON_CONF - sed -i '/^'"$i"'/d' $DAEMON_CONF_EDIMAX - fi - done sleep 1 #make sure there is time to get the file written before checking for it again # If once the code above runs and there is still no hostapd.user file then something is wrong and we will just create the file with basic settings. # Any more then this they somebody was messing with things and its not our fault things are this bad + wLog "Rechecking if $DAEMON_USER_PREF exists after moving files." if [ ! -f $DAEMON_USER_PREF ]; then + wLog "File not found. Creating default file. " echo "ssid=stratux" > $DAEMON_USER_PREF echo "channel=1" >> $DAEMON_USER_PREF fi @@ -52,7 +53,9 @@ function hostapd-upgrade { function ap-start { # Preliminaries. Kill off old services. - /usr/bin/killall -9 hostapd hostapd-edimax hostapd-edimax-alt hostapd-edimax-newest + wLog "Killing Hostapd services " + /usr/bin/killall -9 hostapd hostapd-edimax + wLog "Stopping DHCP services " /usr/sbin/service isc-dhcp-server stop #EDIMAX Mac Addresses from http://www.adminsub.net/mac-address-finder/edimax @@ -74,8 +77,9 @@ function ap-start { # Is there an Edimax Mac Address at wlan0 if [[ ${edimaxMac[*]} =~ "$wlan0mac" ]]; then - DAEMON_CONF=/etc/hostapd/hostapd-edimax.conf - DAEMON_SBIN=/usr/sbin/hostapd-edimax + DAEMON_CONF=/etc/hostapd/hostapd-edimax.conf + DAEMON_SBIN=/usr/sbin/hostapd-edimax + wLog "Edimax Dongle found at WLAN0. Using Edimad conf files $DAEMON_SBIN : $DAEMON_CONF" fi #Make a new hostapd or hostapd-edimax conf file based on logic above @@ -83,14 +87,18 @@ function ap-start { ${DAEMON_SBIN} -B ${DAEMON_TMP} - sleep 3 + sleep 2 + + wLog "Restarting DHCP services" /usr/sbin/service isc-dhcp-server start } ##### End Hostapd driver check function ##### #Do we need to upgrade the hostapd configuration files +wLog "Checking if $DAEMON_USER_PREF file exists" if [ ! -f $DAEMON_USER_PREF ]; then + wLog "File not found. Upgrading to new file structure." hostapd-upgrade fi diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index 58584575..3325f0f5 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -52,6 +52,7 @@ const ( dataLogFile = "stratux.sqlite" //FlightBox: log to /root. logDir_FB = "/root/" + wifiConfigLocation = "/etc/hostapd/hostapd.user" maxDatagramSize = 8192 maxUserMsgQueueSize = 25000 // About 10MB per port per connected client. @@ -1116,6 +1117,10 @@ type settings struct { DeveloperMode bool GLimits string StaticIps []string + WiFiSSID string + WiFiChannel int + WiFiSecurityEnabled bool + WiFiPassphrase string } type status struct { @@ -1213,6 +1218,7 @@ func readSettings() { } globalSettings = newSettings log.Printf("read in settings.\n") + readWiFiUserSettings() } func addSystemError(err error) { @@ -1246,6 +1252,58 @@ func saveSettings() { log.Printf("wrote settings.\n") } +func readWiFiUserSettings() { + fd, err := os.Open(wifiConfigLocation) + if err != nil { + log.Printf("can't read wifi settings %s: %s\n", wifiConfigLocation, err.Error()) + return + } + defer fd.Close() + + // Default values + globalSettings.WiFiSSID = "stratux" + globalSettings.WiFiChannel = 8 + globalSettings.WiFiSecurityEnabled = false + + scanner := bufio.NewScanner(fd) + var line []string + for scanner.Scan() { + line = strings.SplitN(scanner.Text(), "=", 2) + switch line[0] { + case "ssid": + globalSettings.WiFiSSID = line[1] + case "channel": + globalSettings.WiFiChannel, _ = strconv.Atoi(line[1]) + case "wpa_passphrase": + globalSettings.WiFiPassphrase = line[1] + globalSettings.WiFiSecurityEnabled = true + default: + } + } + return +} + +func saveWiFiUserSettings() { + fd, err := os.OpenFile(wifiConfigLocation, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(0644)) + if err != nil { + err_ret := fmt.Errorf("can't save settings %s: %s", wifiConfigLocation, err.Error()) + addSystemError(err_ret) + log.Printf("%s\n", err_ret.Error()) + return + } + defer fd.Close() + + writer := bufio.NewWriter(fd) + fmt.Fprintf(writer, "ssid=%s\n", globalSettings.WiFiSSID) + fmt.Fprintf(writer, "channel=%d\n", globalSettings.WiFiChannel) + fmt.Fprint(writer, "\n") + if globalSettings.WiFiSecurityEnabled { + fmt.Fprint(writer, "auth_algs=1\nwpa=3\nwpa_key_mgmt=WPA-PSK\nwpa_pairwise=TKIP\nrsn_pairwise=CCMP\n") + fmt.Fprintf(writer, "wpa_passphrase=%s\n", globalSettings.WiFiPassphrase) + } + writer.Flush() +} + func openReplay(fn string, compressed bool) (WriteCloser, error) { fp, err := os.OpenFile(fn, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) diff --git a/main/managementinterface.go b/main/managementinterface.go index f275543e..a0328d44 100644 --- a/main/managementinterface.go +++ b/main/managementinterface.go @@ -238,6 +238,7 @@ func handleSatellitesRequest(w http.ResponseWriter, r *http.Request) { func handleSettingsGetRequest(w http.ResponseWriter, r *http.Request) { setNoCache(w) setJSONHeaders(w) + readWiFiUserSettings() settingsJSON, _ := json.Marshal(&globalSettings) fmt.Fprintf(w, "%s\n", settingsJSON) } @@ -256,6 +257,7 @@ func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) { // raw, _ := httputil.DumpRequest(r, true) // log.Printf("handleSettingsSetRequest:raw: %s\n", raw) + var resetWiFi bool decoder := json.NewDecoder(r.Body) for { var msg map[string]interface{} // support arbitrary JSON @@ -364,15 +366,47 @@ func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) { continue } globalSettings.StaticIps = ips + case "WiFiSSID": + globalSettings.WiFiSSID = val.(string) + resetWiFi = true + case "WiFiChannel": + globalSettings.WiFiChannel = int(val.(float64)) + resetWiFi = true + case "WiFiSecurityEnabled": + globalSettings.WiFiSecurityEnabled = val.(bool) + resetWiFi = true + case "WiFiPassphrase": + globalSettings.WiFiPassphrase = val.(string) + resetWiFi = true default: log.Printf("handleSettingsSetRequest:json: unrecognized key:%s\n", key) } } saveSettings() + if resetWiFi { + saveWiFiUserSettings() + go func() { + time.Sleep(time.Second) + cmd := exec.Command("ifdown", "wlan0") + if err := cmd.Start(); err != nil { + log.Printf("Error shutting down WiFi: %s\n", err.Error()) + } + if err = cmd.Wait(); err != nil { + log.Printf("Error shutting down WiFi: %s\n", err.Error()) + } + cmd = exec.Command("ifup", "wlan0") + if err := cmd.Start(); err != nil { + log.Printf("Error starting WiFi: %s\n", err.Error()) + } + if err = cmd.Wait(); err != nil { + log.Printf("Error starting WiFi: %s\n", err.Error()) + } + }() + } } } - // while it may be redundent, we return the latest settings + // while it may be redundant, we return the latest settings settingsJSON, _ := json.Marshal(&globalSettings) fmt.Fprintf(w, "%s\n", settingsJSON) } diff --git a/web/css/main.css b/web/css/main.css index 643dc24f..cb783570 100644 --- a/web/css/main.css +++ b/web/css/main.css @@ -4,6 +4,13 @@ .modal { } + +.grayout { + opacity: 0.4; /* Real browsers */ + filter: alpha(opacity = 60); /* MSIE */ + background-color: #ffffff; +} + .vertical-alignment-helper { display:table; height: 100%; @@ -173,7 +180,6 @@ color: white; } -.paperairplane_left, .traffic-style1, .traffic-style10, .traffic-style11 { @@ -188,7 +194,6 @@ background-color: skyblue; } -.paperairplane_right, .traffic-style2, .traffic-style20, .traffic-style21 { @@ -422,6 +427,10 @@ body { font-weight: 400; } +input.ng-invalid:not(.grayout){ + background: pink; +} + /* change right sidebar behavior to always push */ @media (min-width: 992px) { diff --git a/web/js/main.js b/web/js/main.js index 4a2226f9..bf62e8b0 100755 --- a/web/js/main.js +++ b/web/js/main.js @@ -1,29 +1,32 @@ // application constants -var URL_HOST_BASE = window.location.hostname; -var URL_SETTINGS_GET = "http://" + URL_HOST_BASE + "/getSettings"; -var URL_SETTINGS_SET = "http://" + URL_HOST_BASE + "/setSettings"; -var URL_GPS_WS = "ws://" + URL_HOST_BASE + "/situation"; -var URL_TOWERS_GET = "http://" + URL_HOST_BASE + "/getTowers"; -var URL_STATUS_GET = "http://" + URL_HOST_BASE + "/getStatus"; -var URL_SATELLITES_GET = "http://" + URL_HOST_BASE + "/getSatellites"; -var URL_STATUS_WS = "ws://" + URL_HOST_BASE + "/status"; -var URL_TRAFFIC_WS = "ws://" + URL_HOST_BASE + "/traffic"; -var URL_WEATHER_WS = "ws://" + URL_HOST_BASE + "/weather"; -var URL_DEVELOPER_GET = "ws://" + URL_HOST_BASE + "/developer"; -var URL_UPDATE_UPLOAD = "http://" + URL_HOST_BASE + "/updateUpload"; -var URL_REBOOT = "http://" + URL_HOST_BASE + "/reboot"; -var URL_SHUTDOWN = "http://" + URL_HOST_BASE + "/shutdown"; -var URL_RESTARTAPP = "http://" + URL_HOST_BASE + "/restart"; -var URL_DEV_TOGGLE_GET = "http://" + URL_HOST_BASE + "/develmodetoggle"; -var URL_AHRS_ORIENT = "http://" + URL_HOST_BASE + "/orientAHRS"; -var URL_AHRS_CAL = "http://" + URL_HOST_BASE + "/calibrateAHRS"; -var URL_AHRS_CAGE = "http://" + URL_HOST_BASE + "/cageAHRS"; -var URL_GMETER_RESET = "http://" + URL_HOST_BASE + "/resetGMeter"; -var URL_DELETELOGFILE = "http://" + URL_HOST_BASE + "/deletelogfile"; -var URL_DOWNLOADLOGFILE = "http://" + URL_HOST_BASE + "/downloadlog"; -var URL_DELETEAHRSLOGFILES = "http://" + URL_HOST_BASE + "/deleteahrslogfiles"; -var URL_DOWNLOADAHRSLOGFILES = "http://" + URL_HOST_BASE + "/downloadahrslogs"; -var URL_DOWNLOADDB = "http://" + URL_HOST_BASE + "/downloaddb"; +var URL_HOST_BASE = window.location.hostname + (window.location.port ? ':' + window.location.port : ''); +var URL_HOST_PROTOCOL = window.location.protocol + "//"; + +var URL_AHRS_CAGE = URL_HOST_PROTOCOL + URL_HOST_BASE + "/cageAHRS"; +var URL_AHRS_CAL = URL_HOST_PROTOCOL + URL_HOST_BASE + "/calibrateAHRS"; +var URL_AHRS_ORIENT = URL_HOST_PROTOCOL + URL_HOST_BASE + "/orientAHRS"; +var URL_DELETEAHRSLOGFILES = URL_HOST_PROTOCOL + URL_HOST_BASE + "/deleteahrslogfiles"; +var URL_DELETELOGFILE = URL_HOST_PROTOCOL + URL_HOST_BASE + "/deletelogfile"; +var URL_DEV_TOGGLE_GET = URL_HOST_PROTOCOL + URL_HOST_BASE + "/develmodetoggle"; +var URL_DOWNLOADAHRSLOGFILES = URL_HOST_PROTOCOL + URL_HOST_BASE + "/downloadahrslogs"; +var URL_DOWNLOADDB = URL_HOST_PROTOCOL + URL_HOST_BASE + "/downloaddb"; +var URL_DOWNLOADLOGFILE = URL_HOST_PROTOCOL + URL_HOST_BASE + "/downloadlog"; +var URL_GMETER_RESET = URL_HOST_PROTOCOL + URL_HOST_BASE + "/resetGMeter"; +var URL_REBOOT = URL_HOST_PROTOCOL + URL_HOST_BASE + "/reboot"; +var URL_RESTARTAPP = URL_HOST_PROTOCOL + URL_HOST_BASE + "/restart"; +var URL_SATELLITES_GET = URL_HOST_PROTOCOL + URL_HOST_BASE + "/getSatellites"; +var URL_SETTINGS_GET = URL_HOST_PROTOCOL + URL_HOST_BASE + "/getSettings"; +var URL_SETTINGS_SET = URL_HOST_PROTOCOL + URL_HOST_BASE + "/setSettings"; +var URL_SHUTDOWN = URL_HOST_PROTOCOL + URL_HOST_BASE + "/shutdown"; +var URL_STATUS_GET = URL_HOST_PROTOCOL + URL_HOST_BASE + "/getStatus"; +var URL_TOWERS_GET = URL_HOST_PROTOCOL + URL_HOST_BASE + "/getTowers"; +var URL_UPDATE_UPLOAD = URL_HOST_PROTOCOL + URL_HOST_BASE + "/updateUpload"; + +var URL_DEVELOPER_WS = "ws://" + URL_HOST_BASE + "/developer"; +var URL_GPS_WS = "ws://" + URL_HOST_BASE + "/situation"; +var URL_STATUS_WS = "ws://" + URL_HOST_BASE + "/status"; +var URL_TRAFFIC_WS = "ws://" + URL_HOST_BASE + "/traffic"; +var URL_WEATHER_WS = "ws://" + URL_HOST_BASE + "/weather"; // define the module with dependency on mobile-angular-ui //var app = angular.module('stratux', ['ngRoute', 'mobile-angular-ui', 'mobile-angular-ui.gestures', 'appControllers']); @@ -99,4 +102,4 @@ app.controller('MainCtrl', function ($scope, $http) { }, function(response) { //Second function handles error }); -}); \ No newline at end of file +}); diff --git a/web/plates/js/developer.js b/web/plates/js/developer.js old mode 100755 new mode 100644 diff --git a/web/plates/js/settings.js b/web/plates/js/settings.js index d4fc166f..d7713c22 100644 --- a/web/plates/js/settings.js +++ b/web/plates/js/settings.js @@ -1,6 +1,7 @@ -angular.module('appControllers').controller('SettingsCtrl', SettingsCtrl); // get the main module contollers set +angular.module('appControllers').controller('SettingsCtrl', SettingsCtrl); // get the main module controllers set SettingsCtrl.$inject = ['$rootScope', '$scope', '$state', '$location', '$window', '$http']; // Inject my dependencies + // create our controller function with all necessary logic function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { @@ -9,7 +10,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { var toggles = ['UAT_Enabled', 'ES_Enabled', 'Ping_Enabled', 'GPS_Enabled', 'IMU_Sensor_Enabled', 'BMP_Sensor_Enabled', 'DisplayTrafficSource', 'DEBUG', 'ReplayLog', 'AHRSLog']; var settings = {}; - for (i = 0; i < toggles.length; i++) { + for (var i = 0; i < toggles.length; i++) { settings[toggles[i]] = undefined; } $scope.update_files = ''; @@ -40,6 +41,14 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { $scope.OwnshipModeS = settings.OwnshipModeS; $scope.DeveloperMode = settings.DeveloperMode; $scope.GLimits = settings.GLimits; + $scope.StaticIps = settings.StaticIps; + + $scope.WiFiSSID = settings.WiFiSSID; + $scope.WiFiPassphrase = settings.WiFiPassphrase; + $scope.WiFiSecurityEnabled = settings.WiFiSecurityEnabled; + $scope.WiFiChannel = settings.WiFiChannel; + + $scope.Channels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; } function getSettings() { @@ -73,6 +82,11 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { getSettings(); + // Reset all settings from a button on the page + $scope.resetSettings = function () { + getSettings(); + }; + $scope.$watchGroup(toggles, function (newValues, oldValues, scope) { var newsettings = {}; var dirty = false; @@ -95,7 +109,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { settings["PPM"] = 0; if (($scope.PPM !== undefined) && ($scope.PPM !== null) && ($scope.PPM !== settings["PPM"])) { settings["PPM"] = parseInt($scope.PPM); - newsettings = { + var newsettings = { "PPM": settings["PPM"] }; // console.log(angular.toJson(newsettings)); @@ -107,7 +121,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { settings["Baud"] = 0; if (($scope.Baud !== undefined) && ($scope.Baud !== null) && ($scope.Baud !== settings["Baud"])) { settings["Baud"] = parseInt($scope.Baud); - newsettings = { + var newsettings = { "Baud": settings["Baud"] }; // console.log(angular.toJson(newsettings)); @@ -115,24 +129,24 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { } }; - $scope.updatewatchlist = function () { - if ($scope.WatchList !== settings["WatchList"]) { - settings["WatchList"] = ""; - if ($scope.WatchList !== undefined) { - settings["WatchList"] = $scope.WatchList.toUpperCase(); - } - newsettings = { - "WatchList": settings["WatchList"] - }; - // console.log(angular.toJson(newsettings)); - setSettings(angular.toJson(newsettings)); - } - }; + $scope.updatewatchlist = function () { + if ($scope.WatchList !== settings["WatchList"]) { + settings["WatchList"] = ""; + if ($scope.WatchList !== undefined) { + settings["WatchList"] = $scope.WatchList.toUpperCase(); + } + var newsettings = { + "WatchList": settings["WatchList"] + }; + // console.log(angular.toJson(newsettings)); + setSettings(angular.toJson(newsettings)); + } + }; $scope.updatemodes = function () { if ($scope.OwnshipModeS !== settings["OwnshipModeS"]) { settings["OwnshipModeS"] = $scope.OwnshipModeS.toUpperCase(); - newsettings = { + var newsettings = { "OwnshipModeS": $scope.OwnshipModeS.toUpperCase() }; // console.log(angular.toJson(newsettings)); @@ -142,18 +156,18 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { $scope.updatestaticips = function () { if ($scope.StaticIps !== settings.StaticIps) { - newsettings = { - "StaticIps": $scope.StaticIps === undefined ? "" : $scope.StaticIps.join(' ') + var newsettings = { + "StaticIps": $scope.StaticIps === undefined? "" : $scope.StaticIps.join(' ') }; // console.log(angular.toJson(newsettings)); setSettings(angular.toJson(newsettings)); } }; - $scope.updateGLimits = function () { + $scope.updateGLimits = function () { if ($scope.GLimits !== settings["GLimits"]) { settings["GLimits"] = $scope.GLimits; - newsettings = { + var newsettings = { "GLimits": settings["GLimits"] }; // console.log(angular.toJson(newsettings)); @@ -161,16 +175,16 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { } }; - $scope.postShutdown = function () { - $window.location.href = "/"; - $location.path('/home'); - $http.post(URL_SHUTDOWN). - then(function (response) { - // do nothing - // $scope.$apply(); - }, function (response) { - // do nothing - }); + $scope.postShutdown = function () { + $window.location.href = "/"; + $location.path('/home'); + $http.post(URL_SHUTDOWN). + then(function (response) { + // do nothing + // $scope.$apply(); + }, function (response) { + // do nothing + }); }; $scope.postReboot = function () { @@ -189,10 +203,12 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { $scope.update_files = files; $scope.$apply(); }; + $scope.resetUploadFile = function () { $scope.update_files = ''; $scope.$apply(); }; + $scope.uploadFile = function () { var fd = new FormData(); //Take the first selected file @@ -209,7 +225,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { alert ("file does not appear to be an update"); return; } - + fd.append("update_file", file); $http.post(URL_UPDATE_UPLOAD, fd, { @@ -239,18 +255,170 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) { $scope.Ui.turnOff('modalCalibrateDone'); $scope.Ui.turnOn("modalCalibrateFailed"); }); - }; + }; - $scope.calibrateGyros = function() { - console.log("sending calibrate message."); - $http.post(URL_AHRS_CAL). - then(function(response) { - console.log("Sent calibrate message."); - }, function(response) { - console.log(response.data); - $scope.Calibration_Failure_Message = response.data; - $scope.Ui.turnOff("modalCalibrateGyros"); - $scope.Ui.turnOn("modalCalibrateGyrosFailed"); + $scope.calibrateGyros = function() { + console.log("sending calibrate message."); + $http.post(URL_AHRS_CAL).then(function (response) { + console.log("Sent calibrate message."); + }, function (response) { + console.log(response.data); + $scope.Calibration_Failure_Message = response.data; + $scope.Ui.turnOff("modalCalibrateGyros"); + $scope.Ui.turnOn("modalCalibrateGyrosFailed"); }); }; + + $scope.updateWiFi = function(action) { + $scope.WiFiErrors = { + 'WiFiSSID': '', + 'WiFiPassphrase': '', + 'Errors': false + }; + + if (($scope.WiFiSSID === undefined) || ($scope.WiFiSSID === null) || !isValidSSID($scope.WiFiSSID)) { + $scope.WiFiErrors.WiFiSSID = "Your Network Name(\"SSID\") must be at least 1 character " + + "but not more than 32 characters. It can only contain a-z, A-Z, 0-9, _ or -."; + $scope.WiFiErrors.Errors = true; + } + + if ($scope.WiFiSecurityEnabled) { + if (!isValidWPA($scope.WiFiPassphrase)) { + $scope.WiFiErrors.WiFiPassphrase = "Your WiFi Password, " + $scope.WiFiPassphrase + + ", contains invalid characters."; + $scope.WiFiErrors.Errors = true; + } + if ($scope.WiFiPassphrase.length < 8 || $scope.WiFiPassphrase.length > 63 ) { + $scope.WiFiErrors.WiFiPassphrase = "Your WiFi Password must be between 8 and 63 characters long."; + $scope.WiFiErrors.Errors = true; + } + } + + if (!$scope.WiFiErrors.Errors) { + var newsettings = { + "WiFiSSID" : $scope.WiFiSSID, + "WiFiSecurityEnabled" : $scope.WiFiSecurityEnabled, + "WiFiPassphrase" : $scope.WiFiPassphrase, + "WiFiChannel" : parseInt($scope.WiFiChannel) + }; + + // console.log(angular.toJson(newsettings)); + setSettings(angular.toJson(newsettings)); + $scope.Ui.turnOn("modalSuccessWiFi"); + } else { + $scope.Ui.turnOn("modalErrorWiFi"); + } + }; } + +function isValidSSID(str) { return /^[a-zA-Z0-9()_-]{1,32}$/g.test(str); } +function isValidWPA(str) { return /^[\u0020-\u007e]{8,63}$/g.test(str); } + +angular.module('appControllers') + .directive('hexInput', function() { // directive for ownship hex code validation + return { + require: 'ngModel', + link: function(scope, element, attr, ctrl) { + function hexValidation(value) { + var valid = /^$|^[0-9A-Fa-f]{6}$/.test(value); + ctrl.$setValidity('FAAHex', valid); + if (valid) { + return value; + } else { + return ""; + } + } + ctrl.$parsers.push(hexValidation); + } + }; + }) + .directive('watchlistInput', function() { // directive for ICAO space-separated watch list validation + return { + require: 'ngModel', + link: function(scope, element, attr, ctrl) { + function watchListValidation(value) { + // The list of METAR locations at http://www.aviationweather.gov/docs/metar/stations.txt + // lists only 4-letter/number ICAO codes. + var r = "[A-Za-z0-9]{4}"; + var valid = (new RegExp("^(" + r + "( " + r + ")*|)$", "g")).test(value); + ctrl.$setValidity('ICAOWatchList', valid); + if (valid) { + return value; + } else { + return ""; + } + } + ctrl.$parsers.push(watchListValidation); + } + }; + }) + .directive('ssidInput', function() { // directive for WiFi SSID validation + return { + require: 'ngModel', + link: function(scope, element, attr, ctrl) { + function ssidValidation(value) { + var valid = isValidSSID(value); + ctrl.$setValidity('ssid', valid); + if (valid) { + return value; + } else { + return ""; + } + } + ctrl.$parsers.push(ssidValidation); + } + }; + }) + .directive('wpaInput', function() { // directive for WiFi WPA Passphrase validation + return { + require: 'ngModel', + link: function(scope, element, attr, ctrl) { + function wpaValidation(value) { + var valid = isValidWPA(value); + ctrl.$setValidity('wpaPassphrase', valid); + if (valid) { + return value; + } else { + return ""; + } + } + ctrl.$parsers.push(wpaValidation); + } + }; + }) + .directive('ipListInput', function() { // directive for validation of list of IP addresses + return { + require: 'ngModel', + link: function(scope, element, attr, ctrl) { + function ipListValidation(value) { + var r = "(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"; + var valid = (new RegExp("^(" + r + "( " + r + ")*|)$", "g")).test(value); + ctrl.$setValidity('ipList', valid); + if (valid) { + return value; + } else { + return ""; + } + } + ctrl.$parsers.push(ipListValidation); + } + }; + }) + .directive('gLimitsInput', function() { // directive for validation of list of G Limits + return { + require: 'ngModel', + link: function(scope, element, attr, ctrl) { + function gLimitsValidation(value) { + var r = "[-+]?[0-9]*\.?[0-9]+"; + var valid = (new RegExp("^(" + r + "( " + r + ")*|)$", "g")).test(value); + ctrl.$setValidity('gLimits', valid); + if (valid) { + return value; + } else { + return ""; + } + } + ctrl.$parsers.push(gLimitsValidation); + } + }; + }); diff --git a/web/plates/settings-help.html b/web/plates/settings-help.html index 923bc1fc..0b9e81c0 100644 --- a/web/plates/settings-help.html +++ b/web/plates/settings-help.html @@ -1,40 +1,78 @@
-

The Settings page provides both control and configuration of your Stratux device.

+

The Settings page provides both control and configuration of your Stratux device.

-

Use the toggles in the Hardware section to control which devices are active.

-

NOTE: Only hardware toggled on here, will appear on the - Status page.

+

Use the toggles in the Hardware section to control which devices are active.

+

NOTE: Only hardware toggled on here, will appear on the + Status page.

-

The Diagnostics section helps with debugging and communicating with the Stratux project contributors via GitHub and the reddit subgroup.

- +

+ The WiFi section allows the user to change various WiFi Settings: +

+
WiFi SSID
The name of your Stratux Network. + You might want to change this to match your A/C Tail Number (ex: Stratux-N12345).
+
Network Security
This switch will turn your wireless security On or Off.
+
WiFi Passphrase
When Security is turned on this will be the password for your network.
+
WiFi Channel
Changing the WiFi Channel can improve the wireless signal if in a congested WiFi area.
+
+

-

The AHRS section allows for calibration and future configuration of the AHRS function. - Calibrate AHRS Sensors guides initial setup of the AHRS function, specifying the orientation of the sensors relative to the airplane. Additional calibration may be added later.

-

The calibration process determines which sensor direction will be forward, which toward the left wing, and which toward the ground. You only have to do this once. The settings for this sensor will be saved for future flights.

-

The direction of gravity is used to determine the forward and up orientations, and the left wing is determined based on this.

+

The Diagnostics section helps with debugging and communicating with the Stratux project contributors + via GitHub and the reddit subgroup.

+ -

GLoad Limits allows the user to set which limits will show on the G Meter on the GPS/AHRS page. Enter a space-separated list of G limits, e.g. "-1.76 4.4".

+

The AHRS section allows for calibration and future configuration of the AHRS function. + Calibrate AHRS Sensors guides initial setup of the AHRS function, + specifying the orientation of the sensors relative to the airplane. + Additional calibration may be added later.

+

The calibration process determines which sensor direction will be forward. + You only have to do this once. The settings for this sensor will be saved for future flights.

+

The direction of gravity is used to determine the forward orientation.

-

The Configuration section lets you adjust the default operation of your Stratux device.

- -

The System section lets you safely shutdown or reboot your Stratux device.

- -
\ No newline at end of file +

GLoad Limits allows the user to set which limits will show on the G Meter on the GPS/AHRS page. + Enter a space-separated list of G limits, e.g. "-1.76 4.4".

+ +

The Configuration section lets you adjust the default operation of your Stratux device.

+ +

The System section lets you safely shutdown or reboot your Stratux device.

+ + diff --git a/web/plates/settings.html b/web/plates/settings.html index d5202597..2316fcff 100644 --- a/web/plates/settings.html +++ b/web/plates/settings.html @@ -1,212 +1,272 @@
-
-
-
AHRS
-
-
- - - -
-
+ +
+ +
+
+
AHRS
+
- -
-
-
- -
- -
-
-
-
-
- -
-
-
Configuration
-
-
- -
- - - -
-
-
- -
- - -
-
-
- -
- - -
-
-
- -
- - -
-
-
- -
- -
-
-
-
-
-
- -
-
-
-
Commands
-
- -
- - Click to select System Update file - + - - - - -
-
-
- +
+
+
+ +
+
+
+ +
+ +
-
+
+
+ +
+
+
Commands
+
+
- + + + Click to select System Update file + + + + + + +
+
+
+ +
+
+
+
+ +
+ + +
+ +
+
+
Configuration
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
WiFi Settings
+
+
+
+ + +
+
+ +
+ +
+
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+
+
- -
-
-
-
Hardware
-
-
- -
- +
+ +
+ +
+
+
Hardware
+
+
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
-
Diagnostics
-
-
- -
- + + +
+ +
+
+
Diagnostics
+
+
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
- -
- - -
-
-
Raw Configuration
-
-

stratux.conf:

-
{{rawSettings}}
+ +
+
+
Raw Configuration
+
+

stratux.conf:

+
{{rawSettings}}
+
+ + + +

Stratux is rebooting. You may need to reconnect WiFi once it reboots.

Stratux is shutting down. You may disconnect power.

+

Stratux WiFi is Restarting Services. You may need to reconnect WiFi + once services are restored.

+ - + - +
+ +
- +
+ + + + + +