Merge branch 'master' into wifi

pull/734/head
Eric Westphal 2018-08-05 22:24:25 -04:00
commit 65e80816c2
11 zmienionych plików z 845 dodań i 416 usunięć

Wyświetl plik

@ -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..."

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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)

Wyświetl plik

@ -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)
}

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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
});
});
});

0
web/plates/js/developer.js 100755 → 100644
Wyświetl plik

Wyświetl plik

@ -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);
}
};
});

Wyświetl plik

@ -1,40 +1,78 @@
<div class="section text-left help-page">
<p>The <strong>Settings</strong> page provides both control and configuration of your Stratux device.</p>
<p>The <strong>Settings</strong> page provides both control and configuration of your Stratux device.</p>
<p>Use the toggles in the <strong>Hardware</strong> section to control which devices are active.</p>
<p class="text-warning">NOTE: Only hardware toggled on here, will appear on the
<strong>Status</strong> page.</p>
<p>Use the toggles in the <strong>Hardware</strong> section to control which devices are active.</p>
<p class="text-warning">NOTE: Only hardware toggled on here, will appear on the
<strong>Status</strong> page.</p>
<p>The <strong>Diagnostics</strong> section helps with debugging and communicating with the Stratux project contributors via GitHub and the reddit subgroup.</p>
<ul class="list-simple">
<li>Toggling <strong>Traffic Source</strong> adds text for traffic targets within your navigation application. Traffic received via UAT will display <code>u</code> while traffic received via 1090 will display <code>e</code>.</li>
<li>Toggling <strong>Record Logs</strong> enables logging to a series of files for your Stratux device including data recorded for UAT traffic and weather, 1090 traffic, GPS messages, and AHRS messages. The log files are accessible from the <strong>Logs</strong> menu available on the left.</li>
</ul>
<p>
The <strong>WiFi</strong> section allows the user to change various WiFi Settings:
<dl class="dl-horizontal">
<dt>WiFi SSID</dt><dd>The name of your Stratux Network.
You might want to change this to match your A/C Tail Number (ex: Stratux-N12345).</dd>
<dt>Network Security</dt><dd>This switch will turn your wireless security <b>On</b> or <b>Off</b>.</dd>
<dt>WiFi Passphrase</dt><dd>When Security is turned on this will be the password for your network.</dd>
<dt>WiFi Channel</dt><dd>Changing the WiFi Channel can improve the wireless signal if in a congested WiFi area.</dd>
</dl>
</p>
<p>The <strong>AHRS</strong> section allows for calibration and future configuration of the AHRS function.
<strong>Calibrate AHRS Sensors</strong> guides initial setup of the AHRS function, specifying the orientation of the sensors relative to the airplane. Additional calibration may be added later.</p>
<p>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.</p>
<p>The direction of gravity is used to determine the forward and up orientations, and the left wing is determined based on this.</p>
<p>The <strong>Diagnostics</strong> section helps with debugging and communicating with the Stratux project contributors
via GitHub and the reddit subgroup.</p>
<ul class="list-simple">
<li>Toggling <strong>Traffic Source</strong> adds text for traffic targets within your navigation application.
Traffic received via UAT will display <code>u</code>
while traffic received via 1090 will display <code>e</code>.</li>
<li>Toggling <strong>Record Logs</strong> enables logging to a series of files for your Stratux device including
data recorded for UAT traffic and weather, 1090 traffic, GPS messages, and AHRS messages.
The log files are accessible from the <strong>Logs</strong> menu available on the left.</li>
</ul>
<p>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".</p>
<p>The <strong>AHRS</strong> section allows for calibration and future configuration of the AHRS function.
<strong>Calibrate AHRS Sensors</strong> guides initial setup of the AHRS function,
specifying the orientation of the sensors relative to the airplane.
Additional calibration may be added later.</p>
<p>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.</p>
<p>The direction of gravity is used to determine the forward orientation.</p>
<p>The <strong>Configuration</strong> section lets you adjust the default operation of your Stratux device.</p>
<ul class="list-simple">
<li>To avoid having your own aircraft appear as traffic, and scare the bejeezus our of you, you may provide your <strong>Mode S code</strong>. You can find this value in the FAA N-Number Registry for your aircraft. You should use the hexadecimal value (not the octal value) for this setting. No validation is done so please ensure you enter your valide Mode S value.
</li>
<li>The <strong>Weather</strong> page uses a user-defined <strong>Watch List</strong> to filter the large volume of ADS-B weather messages for display. Define a list of identifiers (airport, VOR, etc) separated by a spaces. For example <code>KBOS EEN LAH LKP</code>. You may change this list at any time and the <strong>Weather</strong> page will start watching for the updated list immediately.
<br/>
<span class="text-warning">NOTE: To save your changes, you must either tap somehwere else on the page or hit <code>ENTER</code> or <code>RETURN</code> or <code>GO</code> (or whatever your keyboard indicates).</span>
</li>
<li>The SDR (software defined radio) receiver support an adjustment in the form of a <strong>PPM Correction</strong>. From the Raspberry Pi, you may use the command <code>kal -g 48 -s GSM850</code> to scan for available channels in your area. Then use the command <code>kal -g 48 -c <em>channel#</em></code> to calculate the PPM.
<br/>
<span class="text-warning">NOTE: You will need to perform all commands as <code>root</code> by issuing the command: <code>sudo su -</code>. You will need to stop the Stratux software before running the calibration process. You can stop all of the Stratux processes with the command: <code>pkill screen</code>.</span>
</li>
<li>Addiitonal settings will be added in future releases.</li>
</ul>
<p>The <strong>System</strong> section lets you safely shutdown or reboot your Stratux device.</p>
<ul>
<li><strong>Shutdown</strong> will immediately shutdown the Stratux. You may then safely remove power.</li>
<li><strong>Reboot</strong> will immediately reboot the Stratux. After the reboot you may have to rejoin the WiFi connection to reconnect.</li>
</ul>
</div>
<p>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".</p>
<p>The <strong>Configuration</strong> section lets you adjust the default operation of your Stratux device.</p>
<ul class="list-simple">
<li>To avoid having your own aircraft appear as traffic, and scare the bejeezus our of you,
you may provide your <strong>Mode S code</strong>.
You can find this value in the FAA N-Number Registry for your aircraft.
You should use the hexadecimal value (not the octal value) for this setting.
No validation is done so please ensure you enter your valid Mode S value.
</li>
<li>The <strong>Weather</strong> page uses a user-defined <strong>Watch List</strong> to filter the
large volume of ADS-B weather messages for display.
Define a list of identifiers (airport, VOR, etc) separated by a spaces.
For example <code>KBOS EEN LAH LKP</code>.
You may change this list at any time and the <strong>Weather</strong> page will start watching for the
updated list immediately.
<br/>
<span class="text-warning">NOTE: To save your changes, you must either tap somewhere else on the page
or hit <code>ENTER</code> or <code>RETURN</code> or <code>GO</code>
(or whatever your keyboard indicates).</span>
</li>
<li>The SDR (software defined radio) receiver support an adjustment in the form of a
<strong>PPM Correction</strong>. From the Raspberry Pi, you may use the command
<code>kal -g 48 -s GSM850</code> to scan for available channels in your area.
Then use the command <code>kal -g 48 -c <em>channel#</em></code> to calculate the PPM.
<br/>
<span class="text-warning">NOTE: You will need to perform all commands as <code>root</code>
by issuing the command: <code>sudo su -</code>.
You will need to stop the Stratux software before running the calibration process.
You can stop all of the Stratux processes with the command: <code>pkill screen</code>.</span>
</li>
<li>Additional settings will be added in future releases.</li>
</ul>
<p>The <strong>System</strong> section lets you safely shutdown or reboot your Stratux device.</p>
<ul>
<li><strong>Shutdown</strong> will immediately shutdown the Stratux. You may then safely remove power.</li>
<li><strong>Reboot</strong> will immediately reboot the Stratux.
After the reboot you may have to rejoin the WiFi connection to reconnect.</li>
</ul>
</div>

Wyświetl plik

@ -1,212 +1,272 @@
<div class="col-sm-12">
<div class="panel-group col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">AHRS</div>
<div class="panel-body">
<div class="col-xs-12">
<span style="position:relative; overflow: hidden;">
<button class="btn btn-primary btn-block" ui-turn-on="modalCalibrateForward"
ng-disabled="!IMU_Sensor_Enabled">Set AHRS Sensor Orientation</button>
</span>
</div>
<div class="form-group reset-flow">
<!-- Begin Left Col -->
<div class="col-sm-6">
<!-- AHRS Options -->
<div class="panel-group col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">AHRS</div>
<div class="panel-body">
<div class="col-xs-12">
<button class="btn btn-primary btn-block" ui-turn-on="modalCalibrateGyros"
ng-disabled="!IMU_Sensor_Enabled">Calibrate Gyros</button>
</div>
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-5">G Limits</label>
<form name="GLimitForm" ng-submit="updateGLimits()" novalidate ng-disabled="!IMU_Sensor_Enabled">
<input class="col-xs-7" type="string" required ng-model="GLimits" ng-blur="updateGLimits()"
placeholder="Space-separated negative and positive G meter limits"/>
</form>
</div>
</div>
</div>
</div>
<div class="panel-group col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Configuration</div>
<div class="panel-body">
<div class="form-group reset-flow">
<label class="control-label col-xs-5">Mode S Code (Hex)</label>
<form name="modeForm" ng-submit="updatemodes()" novalidate>
<!-- type="number" not supported except on mobile -->
<!-- RegEx for validation: ^[A-Fa-f0-9]{6}$ -->
<input class="col-xs-7" type="string" required ng-model="OwnshipModeS" placeholder="FAA HEX code" ng-blur="updatemodes()" />
</form>
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-5">Watch List</label>
<form name="watchForm" ng-submit="updatewatchlist()" novalidate>
<!-- type="number" not supported except on mobile -->
<input class="col-xs-7" type="string" required ng-model="WatchList" placeholder="space-delimited identifiers" ng-blur="updatewatchlist()" />
</form>
</div>
<div ng-show="DeveloperMode" class="form-group reset-flow">
<label class="control-label col-xs-5">PPM Correction</label>
<form name="ppmForm" ng-submit="updateppm()" novalidate>
<!-- type="number" not supported except on mobile -->
<input class="col-xs-7" type="number_format" required ng-model="PPM" placeholder="integer" ng-blur="updateppm()" />
</form>
</div>
<div class="form-group reset-flow" ng-class="{ 'section_invisible': (!visible_serialout)}">
<label class="control-label col-xs-5">Serial Output Baudrate</label>
<form name="ppmForm" ng-submit="updateBaud()" novalidate>
<!-- type="number" not supported except on mobile -->
<input class="col-xs-7" type="number_format" required ng-model="Baud" placeholder="integer" ng-blur="updateBaud()" />
</form>
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-5">Static IPs</label>
<form name="staticipForm" ng-submit="updatestaticips()" novalidate>
<input class="col-xs-7" type="string" required ng-model="StaticIps" ng-list=" " ng-trim="false" placeholder="space-delimited ip's to send network data" ng-blur="updatestaticips()" />
</form>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="panel-group col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Commands</div>
<div class="panel-body">
<!-- Upload. Temporary. -->
<div class="col-xs-12">
<span ng-show="update_files == ''">
<span style="position:relative; overflow: hidden;">
<span class="fake-btn fake-btn-block">Click to select System Update file</span>
<input style="opacity:0.0; position: absolute; top: 0; right: 0;" class="col-xs-12" type="file" name="update_file" onchange="angular.element(this).scope().setUploadFile(this.files)"/>
<button class="btn btn-primary btn-block" ui-turn-on="modalCalibrateForward"
ng-disabled="!IMU_Sensor_Enabled">Set AHRS Sensor Orientation</button>
</span>
</span>
<span ng-hide="update_files == ''">
<button class="btn btn-block" onclick="angular.element(this).scope().uploadFile()">Install {{update_files[0].name}}</button>
</span>
</div>
<div class="form-group reset-flow">
<div class="col-xs-12">
<button class="btn btn-primary btn-block" ui-turn-on="modalReboot">Reboot</button>
</div>
<div class="form-group reset-flow">
<div class="col-xs-12">
<button class="btn btn-primary btn-block" ui-turn-on="modalCalibrateGyros"
ng-disabled="!IMU_Sensor_Enabled">Calibrate Gyros</button>
</div>
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-3">G Limits</label>
<form name="GLimitForm" ng-submit="updateGLimits()" novalidate>
<input class="col-xs-9" type="text" g-limits-input ng-model="GLimits"
ng-blur="updateGLimits()" ng-disabled="!IMU_Sensor_Enabled"
ng-class="{grayout: !IMU_Sensor_Enabled}"
placeholder="Space-separated negative and positive G meter limits"/>
</form>
</div>
</div>
<div class="form-group reset-flow">
</div>
</div>
<!-- App Commands -->
<div class="panel-group col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Commands</div>
<div class="panel-body">
<!-- Upload. Temporary. -->
<div class="col-xs-12">
<button class="btn btn-primary btn-block"ui-turn-on="modalShutdown">Shutdown</button>
<span ng-show="update_files == ''">
<span style="position:relative; overflow: hidden;">
<span class="fake-btn fake-btn-block">Click to select System Update file</span>
<input style="opacity:0.0; position: absolute; top: 0; right: 0;" class="col-xs-12" type="file" name="update_file"
onchange="angular.element(this).scope().setUploadFile(this.files)"/>
</span>
</span>
<span ng-hide="update_files == ''">
<button class="btn btn-block" onclick="angular.element(this).scope().uploadFile()">
Install {{update_files[0].name}}</button>
</span>
</div>
<div class="form-group reset-flow">
<div class="col-xs-12">
<button class="btn btn-primary btn-block" ui-turn-on="modalReboot">Reboot</button>
</div>
</div>
<div class="form-group reset-flow">
<div class="col-xs-12">
<button class="btn btn-primary btn-block"ui-turn-on="modalShutdown">Shutdown</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Left Col -->
<!-- Begin Right Col -->
<div class="col-sm-6">
<!-- System Configuration -->
<div class="panel-group col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Configuration</div>
<div class="panel-body">
<div class="form-group reset-flow">
<label class="control-label col-xs-5">Mode S Code (Hex)</label>
<form name="modeForm" ng-submit="updatemodes()" novalidate>
<input class="col-xs-7" type="text" hex-input ng-model="OwnshipModeS"
placeholder="FAA HEX code" ng-blur="updatemodes()" />
</form>
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-5">Watch List</label>
<form name="watchForm" ng-submit="updatewatchlist()" novalidate>
<input class="col-xs-7" type="text" watchlist-input ng-model="WatchList"
placeholder="space-delimited 4-letter identifiers" ng-blur="updatewatchlist()" />
</form>
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-5">PPM Correction</label>
<form name="ppmForm" ng-submit="updateppm()" novalidate>
<!-- type="number" not supported except on mobile -->
<input class="col-xs-7" type="number" ng-model="PPM" placeholder="integer"
ng-blur="updateppm()" />
</form>
</div>
<div class="form-group reset-flow" ng-class="{ 'section_invisible': (!visible_serialout)}">
<label class="control-label col-xs-5">Serial Output Baudrate</label>
<form name="ppmForm" ng-submit="updateBaud()" novalidate>
<!-- type="number" not supported except on mobile -->
<input class="col-xs-7" type="number" ng-model="Baud" placeholder="integer"
ng-blur="updateBaud()" />
</form>
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-5">Static IPs</label>
<form name="staticipForm" ng-submit="updatestaticips()" novalidate>
<input class="col-xs-7" type="text" ip-list-input ng-model="StaticIps" ng-list=" "
ng-trim="false" placeholder="space-delimited ip's to send network data"
ng-blur="updatestaticips()" />
</form>
</div>
</div>
</div>
</div>
<!-- WiFi Settings -->
<div class="panel-group col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">WiFi Settings</div>
<div class="panel-body">
<form name="WiFiSettings">
<div class="form-group reset-flow">
<label class="control-label col-xs-5">WiFi SSID</label>
<input class="col-xs-7" type="text" ssid-input ng-model="WiFiSSID"
placeholder="WiFi Network Name" />
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-7">Network Security</label>
<div class="col-xs-5">
<ui-switch ng-model="WiFiSecurityEnabled" settings-change></ui-switch>
</div>
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-5">WiFi Passphrase</label>
<input class="col-xs-7" type="text" wpa-input ng-model="WiFiPassphrase"
ng-disabled="!WiFiSecurityEnabled" ng-class="{grayout: !WiFiSecurityEnabled}"
ng-required="WiFiSecurityEnabled" placeholder="WiFi Passphrase" />
</div>
<div class="form-group reset-flow">
<label class="control-label col-xs-7">WiFi Channel</label>
<select id="WiFiChannel" class="input-small col-sm-2 form-control-sm"
ng-model="WiFiChannel" ng-options="x for x in Channels"></select>
</div>
<div class="form-group reset-flow">
<button class="btn btn-primary btn-block" ng-click="updateWiFi()">Submit WiFi Changes</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- End Right Col -->
</div>
<!-- Developer mode area -->
<div class="col-sm-12">
<div ng-show="DeveloperMode" class="panel-group col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Hardware</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label col-xs-7">978 MHz</label>
<div class="col-xs-5">
<ui-switch ng-model='UAT_Enabled' settings-change></ui-switch>
<div ng-show="DeveloperMode" class="col-sm-12">
<!-- Begin Left Col -->
<div class="col-sm-6">
<!-- Hardware Settings -->
<div class="panel-group col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Hardware</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label col-xs-7">978 MHz</label>
<div class="col-xs-5">
<ui-switch ng-model='UAT_Enabled' settings-change></ui-switch>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-7">1090 MHz</label>
<div class="col-xs-5">
<ui-switch ng-model='ES_Enabled' settings-change></ui-switch>
<div class="form-group">
<label class="control-label col-xs-7">1090 MHz</label>
<div class="col-xs-5">
<ui-switch ng-model='ES_Enabled' settings-change></ui-switch>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-7">Ping ADS-B</label>
<div class="col-xs-5">
<ui-switch ng-model='Ping_Enabled' settings-change></ui-switch>
<div class="form-group">
<label class="control-label col-xs-7">Ping ADS-B</label>
<div class="col-xs-5">
<ui-switch ng-model='Ping_Enabled' settings-change></ui-switch>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-7">GPS</label>
<div class="col-xs-5">
<ui-switch ng-model='GPS_Enabled' settings-change></ui-switch>
<div class="form-group">
<label class="control-label col-xs-7">GPS</label>
<div class="col-xs-5">
<ui-switch ng-model='GPS_Enabled' settings-change></ui-switch>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-7">AHRS Sensor</label>
<div class="col-xs-5">
<ui-switch ng-model='IMU_Sensor_Enabled' settings-change></ui-switch>
<div class="form-group">
<label class="control-label col-xs-7">AHRS Sensor</label>
<div class="col-xs-5">
<ui-switch ng-model='IMU_Sensor_Enabled' settings-change></ui-switch>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-7">Baro Sensor</label>
<div class="col-xs-5">
<ui-switch ng-model='BMP_Sensor_Enabled' settings-change></ui-switch>
<div class="form-group">
<label class="control-label col-xs-7">Baro Sensor</label>
<div class="col-xs-5">
<ui-switch ng-model='BMP_Sensor_Enabled' settings-change></ui-switch>
</div>
</div>
</div>
</div>
</div>
</div>
<div ng-show="DeveloperMode" class="panel-group col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Diagnostics</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label col-xs-7">Show Traffic Source in Callsign</label>
<div class="col-xs-5">
<ui-switch ng-model='DisplayTrafficSource' settings-change></ui-switch>
<!-- End Left Col -->
<!-- Begin Right Col -->
<div class="col-sm-6">
<!-- Diagnostics Values -->
<div ng-show="DeveloperMode" class="panel-group col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Diagnostics</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label col-xs-7">Show Traffic Source in Callsign</label>
<div class="col-xs-5">
<ui-switch ng-model='DisplayTrafficSource' settings-change></ui-switch>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-7">Verbose Message Log</label>
<div class="col-xs-5">
<ui-switch ng-model='DEBUG' settings-change></ui-switch>
<div class="form-group">
<label class="control-label col-xs-7">Verbose Message Log</label>
<div class="col-xs-5">
<ui-switch ng-model='DEBUG' settings-change></ui-switch>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-7">Record Replay Logs</label>
<div class="col-xs-5">
<ui-switch ng-model='ReplayLog' settings-change></ui-switch>
<div class="form-group">
<label class="control-label col-xs-7">Record Replay Logs</label>
<div class="col-xs-5">
<ui-switch ng-model='ReplayLog' settings-change></ui-switch>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-7">Record AHRS Logs</label>
<div class="col-xs-5">
<ui-switch ng-model='AHRSLog' settings-change></ui-switch>
<div class="form-group">
<label class="control-label col-xs-7">Record AHRS Logs</label>
<div class="col-xs-5">
<ui-switch ng-model='AHRSLog' settings-change></ui-switch>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12" ng-show="DeveloperMode" >
<div class="panel panel-default">
<div class="panel-heading">Raw Configuration</div>
<div class="panel-body">
<p>stratux.conf:</p>
<pre>{{rawSettings}}</pre>
<!-- End Right Col -->
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Raw Configuration</div>
<div class="panel-body">
<p>stratux.conf:</p>
<pre>{{rawSettings}}</pre>
</div>
</div>
</div>
</div>
<!-- ############################################## -->
<!-- Modal popups -->
<!-- ############################################## -->
<!-- Messages Modal -->
<div class="col-sm-12">
<h3 ui-if="rebooting" ui-state="rebooting">Stratux is rebooting. You may need to reconnect WiFi once it reboots.</h3>
<h3 ui-if="shuttingdown" ui-state="shuttingdown">Stratux is shutting down. You may disconnect power.</h3>
<h3 ui-if="WiFiRestart" ui-state="WiFiRestart">Stratux WiFi is Restarting Services. You may need to reconnect WiFi
once services are restored.</h3>
</div>
<div ui-content-for="modals">
<!-- Reboot Config Modal -->
<div class="modal" ui-if="modalReboot" ui-state="modalReboot">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button class="close"
ui-turn-off="modalReboot"></button>
<button class="close" ui-turn-off="modalReboot"></button>
<h4 class="modal-title">Are you really sure?</h4>
</div>
<div class="modal-body">
@ -215,22 +275,21 @@
</div>
<div class="modal-footer">
<a ui-turn-off="modalReboot" class="btn btn-default">Cancel</a>
<a ng-click="postReboot()" ui-turn-off="modalReboot" ui-turn-on="rebooting" class="btn btn-primary">Reboot</a>
<a ng-click="postReboot()" ui-turn-off="modalReboot" ui-turn-on="rebooting"
class="btn btn-primary">Reboot</a>
</div>
</div>
</div>
</div>
</div>
<!-- Shutdown Modal -->
<div class="modal" ui-if="modalShutdown" ui-state="modalShutdown">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button class="close"
ui-turn-off="modalShutdown"></button>
<button class="close" ui-turn-off="modalShutdown"></button>
<h4 class="modal-title">Are you really sure?</h4>
</div>
<div class="modal-body">
@ -239,13 +298,14 @@
</div>
<div class="modal-footer">
<a ui-turn-off="modalShutdown" class="btn btn-default">Cancel</a>
<a ng-click="postShutdown()" ui-turn-off="modalShutdown" ui-turn-on="shuttingdown" class="btn btn-primary">Shutdown</a>
<a ng-click="postShutdown()" ui-turn-off="modalShutdown" ui-turn-on="shuttingdown"
class="btn btn-primary">Shutdown</a>
</div>
</div>
</div>
</div>
</div>
<!-- Calibrate Forward Modal -->
<div class="modal" ui-if="modalCalibrateForward" ui-state="modalCalibrateForward">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
@ -269,6 +329,7 @@
</div>
</div>
</div>
<!-- Calibration Success Modal -->
<div class="modal" ui-if="modalCalibrateDone" ui-state="modalCalibrateDone">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
@ -280,8 +341,8 @@
</div>
<div class="modal-body">
<p>The sensor orientation is set. These settings will be saved for future flights.
Place the Stratux in its in-flight orientation and keep it stationary for 5 seconds
after you press the <strong>Done</strong> button.</p>
Place the Stratux in its in-flight orientation and keep it stationary for 5 seconds
after you press the <strong>Done</strong> button.</p>
</div>
<div class="modal-footer">
<a ng-click="setOrientation('done')" ui-turn-off="modalCalibrateDone"
@ -291,6 +352,7 @@
</div>
</div>
</div>
<!-- Calibration Failed Modal -->
<div class="modal" ui-if="modalCalibrateFailed" ui-state="modalCalibrateFailed">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
@ -312,7 +374,7 @@
</div>
</div>
</div>
<!-- Gyro Calibration Modal -->
<div class="modal" ui-if="modalCalibrateGyros" ui-state="modalCalibrateGyros">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
@ -335,4 +397,70 @@
</div>
</div>
</div>
<!-- WiFi Success Modal -->
<div class="modal" ui-if="modalSuccessWiFi" ui-state="modalSuccessWiFi" id="WiFiSuccessModal">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button class="close" ui-turn-off="modalSuccessWiFi"></button>
<h4 class="modal-title">Your WiFi settings were successfully changed.</h4>
</div>
<div class="modal-body">
<p>WiFi SSID: <b>{{WiFiSSID}}</b></p>
<p>WiFi Security: <b>{{WiFiSecurityEnabled}}</b></p>
<p>WiFi Passphrase: <b>{{WiFiPassphrase}}</b></p>
<p>WiFi Channel: <b>{{WiFiChannel}}</b></p>
<p>Your Stratux's WiFi services are now restarting to apply the new settings. This could take up to 30 seconds.<br/>
You might have to reconnect to your new WiFi SSID. </p>
</div>
<div class="modal-footer">
<a ui-turn-off="modalSuccessWiFi" class="btn btn-primary btn-default">Close</a>
</div>
</div>
</div>
</div>
</div>
<!-- WiFi Error Modal -->
<div class="modal" ui-if="modalErrorWiFi" ui-state="modalErrorWiFi">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button class="close" ui-turn-off="modalErrorWiFi"></button>
<h4 class="modal-title">Errors in your WiFi Settings</h4>
</div>
<div class="modal-body">
<div>{{WiFiErrors.WiFiSSID}}</div>
<div>{{WiFiErrors.WiFiPassphrase}}</div>
</div>
<div class="modal-footer">
<a ui-turn-off="modalErrorWiFi" ng-click="resetSettings()" class="btn btn-default">Close</a>
</div>
</div>
</div>
</div>
</div>
<!-- WiFi Canceled Modal -->
<div class="modal" ui-if="modalCancelWiFi" ui-state="modalCancelWiFi">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button class="close" ui-turn-off="modalCancelWiFi"></button>
<h4 class="modal-title">WiFi Settings: Canceled</h4>
</div>
<div class="modal-body">
<p>WiFi Settings Canceled.</p>
</div>
<div class="modal-footer">
<a ui-turn-off="modalCancelWiFi" ng-click="resetSettings()" class="btn btn-default btn-primary">OK</a>
</div>
</div>
</div>
</div>
</div>
</div>