kopia lustrzana https://github.com/cyoung/stratux
Add WiFi "Smart Mode" option.
No default gateway. Allows iOS to choose internet source (cellular or WiFi).pull/801/head
rodzic
eebe80d3c7
commit
be93f4290c
|
@ -0,0 +1,13 @@
|
||||||
|
ddns-update-style none;
|
||||||
|
default-lease-time 86400; # 24 hours
|
||||||
|
max-lease-time 172800; # 48 hours
|
||||||
|
authoritative;
|
||||||
|
log-facility local7;
|
||||||
|
subnet 192.168.10.0 netmask 255.255.255.0 {
|
||||||
|
range 192.168.10.10 192.168.10.50;
|
||||||
|
option broadcast-address 192.168.10.255;
|
||||||
|
default-lease-time 12000;
|
||||||
|
max-lease-time 12000;
|
||||||
|
option domain-name "stratux.local";
|
||||||
|
option domain-name-servers 4.2.2.2;
|
||||||
|
}
|
|
@ -296,8 +296,8 @@ func makeOwnshipReport() bool {
|
||||||
msg[0] = 0x0A // Message type "Ownship".
|
msg[0] = 0x0A // Message type "Ownship".
|
||||||
|
|
||||||
// Ownship Target Identify (see 3.5.1.2 of GDL-90 Specifications)
|
// Ownship Target Identify (see 3.5.1.2 of GDL-90 Specifications)
|
||||||
// First half of byte is 0 for 'No Traffic Alert'
|
// First half of byte is 0 for 'No Traffic Alert'
|
||||||
// Second half of byte is 0 for 'ADS-B with ICAO'
|
// Second half of byte is 0 for 'ADS-B with ICAO'
|
||||||
msg[1] = 0x00 // Alert status, address type.
|
msg[1] = 0x00 // Alert status, address type.
|
||||||
|
|
||||||
code, _ := hex.DecodeString(globalSettings.OwnshipModeS)
|
code, _ := hex.DecodeString(globalSettings.OwnshipModeS)
|
||||||
|
@ -1125,6 +1125,7 @@ type settings struct {
|
||||||
WiFiChannel int
|
WiFiChannel int
|
||||||
WiFiSecurityEnabled bool
|
WiFiSecurityEnabled bool
|
||||||
WiFiPassphrase string
|
WiFiPassphrase string
|
||||||
|
WiFiSmartEnabled bool // "Smart WiFi" - disables the default gateway for iOS.
|
||||||
}
|
}
|
||||||
|
|
||||||
type status struct {
|
type status struct {
|
||||||
|
@ -1309,6 +1310,13 @@ func saveWiFiUserSettings() {
|
||||||
fmt.Fprintf(writer, "wpa_passphrase=%s\n", globalSettings.WiFiPassphrase)
|
fmt.Fprintf(writer, "wpa_passphrase=%s\n", globalSettings.WiFiPassphrase)
|
||||||
}
|
}
|
||||||
writer.Flush()
|
writer.Flush()
|
||||||
|
|
||||||
|
// "Smart WiFi". Just use one of two pre-made dhcpd config files.
|
||||||
|
dhcpd_config := "/etc/dhcp/dhcpd-not_smart.conf"
|
||||||
|
if globalSettings.WiFiSmartEnabled {
|
||||||
|
dhcpd_config = "/etc/dhcp/dhcpd-smart.conf"
|
||||||
|
}
|
||||||
|
os.Symlink(dhcpd_config, "/etc/dhcp/dhcpd.conf")
|
||||||
}
|
}
|
||||||
|
|
||||||
func openReplay(fn string, compressed bool) (WriteCloser, error) {
|
func openReplay(fn string, compressed bool) (WriteCloser, error) {
|
||||||
|
|
|
@ -378,6 +378,9 @@ func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) {
|
||||||
case "WiFiPassphrase":
|
case "WiFiPassphrase":
|
||||||
globalSettings.WiFiPassphrase = val.(string)
|
globalSettings.WiFiPassphrase = val.(string)
|
||||||
resetWiFi = true
|
resetWiFi = true
|
||||||
|
case "WiFiSmartEnabled":
|
||||||
|
globalSettings.WiFiSmartEnabled = val.(bool)
|
||||||
|
resetWiFi = true
|
||||||
default:
|
default:
|
||||||
log.Printf("handleSettingsSetRequest:json: unrecognized key:%s\n", key)
|
log.Printf("handleSettingsSetRequest:json: unrecognized key:%s\n", key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ cp image/99-uavionix.rules work/bin/
|
||||||
cp image/motd work/bin/
|
cp image/motd work/bin/
|
||||||
cp image/stratux-wifi.sh work/bin/
|
cp image/stratux-wifi.sh work/bin/
|
||||||
cp image/rc.local work/bin/
|
cp image/rc.local work/bin/
|
||||||
cp image/dhcpd.conf work/bin/
|
cp image/dhcpd-not_smart.conf work/bin/
|
||||||
|
cp image/dhcpd-smart.conf work/bin/
|
||||||
cp image/interfaces work/bin/
|
cp image/interfaces work/bin/
|
||||||
cp image/logrotate.conf work/bin/
|
cp image/logrotate.conf work/bin/
|
||||||
cp image/logrotate_d_stratux work/bin/
|
cp image/logrotate_d_stratux work/bin/
|
||||||
|
|
|
@ -87,7 +87,9 @@ cp -f ahrs_approx /usr/bin/
|
||||||
chmod 755 /usr/bin/ahrs_approx
|
chmod 755 /usr/bin/ahrs_approx
|
||||||
|
|
||||||
# DHCPD Config.
|
# DHCPD Config.
|
||||||
cp -f dhcpd.conf /etc/dhcp/dhcpd.conf
|
cp -f dhcpd-not_smart.conf /etc/dhcp/
|
||||||
|
cp -f dhcpd-smart.conf /etc/dhcp/
|
||||||
|
ln -s /etc/dhcp/dhcpd-not_smart.conf /etc/dhcp/dhcpd.conf
|
||||||
|
|
||||||
# Interfaces file.
|
# Interfaces file.
|
||||||
cp -f interfaces /etc/network/interfaces
|
cp -f interfaces /etc/network/interfaces
|
||||||
|
|
|
@ -47,6 +47,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
|
||||||
$scope.WiFiPassphrase = settings.WiFiPassphrase;
|
$scope.WiFiPassphrase = settings.WiFiPassphrase;
|
||||||
$scope.WiFiSecurityEnabled = settings.WiFiSecurityEnabled;
|
$scope.WiFiSecurityEnabled = settings.WiFiSecurityEnabled;
|
||||||
$scope.WiFiChannel = settings.WiFiChannel;
|
$scope.WiFiChannel = settings.WiFiChannel;
|
||||||
|
$scope.WiFiSmartEnabled = settings.WiFiSmartEnabled;
|
||||||
|
|
||||||
$scope.Channels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
$scope.Channels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
||||||
}
|
}
|
||||||
|
@ -287,7 +288,8 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
|
||||||
"WiFiSSID" : $scope.WiFiSSID,
|
"WiFiSSID" : $scope.WiFiSSID,
|
||||||
"WiFiSecurityEnabled" : $scope.WiFiSecurityEnabled,
|
"WiFiSecurityEnabled" : $scope.WiFiSecurityEnabled,
|
||||||
"WiFiPassphrase" : $scope.WiFiPassphrase,
|
"WiFiPassphrase" : $scope.WiFiPassphrase,
|
||||||
"WiFiChannel" : parseInt($scope.WiFiChannel)
|
"WiFiChannel" : parseInt($scope.WiFiChannel),
|
||||||
|
"WiFiSmartEnabled": $scope.WiFiSmartEnabled
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log(angular.toJson(newsettings));
|
// console.log(angular.toJson(newsettings));
|
||||||
|
|
|
@ -134,6 +134,12 @@
|
||||||
<select id="WiFiChannel" class="input-small col-sm-2 form-control-sm"
|
<select id="WiFiChannel" class="input-small col-sm-2 form-control-sm"
|
||||||
ng-model="WiFiChannel" ng-options="x for x in Channels"></select>
|
ng-model="WiFiChannel" ng-options="x for x in Channels"></select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group reset-flow">
|
||||||
|
<label class="control-label col-xs-7">Smart WiFi</label>
|
||||||
|
<div class="col-xs-5">
|
||||||
|
<ui-switch ng-model="WiFiSmartEnabled" settings-change></ui-switch>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group reset-flow">
|
<div class="form-group reset-flow">
|
||||||
<button class="btn btn-primary btn-block" ng-click="updateWiFi()">Submit WiFi Changes</button>
|
<button class="btn btn-primary btn-block" ng-click="updateWiFi()">Submit WiFi Changes</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -383,6 +389,7 @@
|
||||||
<p>WiFi Security: <b>{{WiFiSecurityEnabled}}</b></p>
|
<p>WiFi Security: <b>{{WiFiSecurityEnabled}}</b></p>
|
||||||
<p>WiFi Passphrase: <b>{{WiFiPassphrase}}</b></p>
|
<p>WiFi Passphrase: <b>{{WiFiPassphrase}}</b></p>
|
||||||
<p>WiFi Channel: <b>{{WiFiChannel}}</b></p>
|
<p>WiFi Channel: <b>{{WiFiChannel}}</b></p>
|
||||||
|
<p>Smart mode: <b>{{WiFiSmartEnabled}}</b></p>
|
||||||
<p>Your Stratux's WiFi services are now restarting to apply the new settings. This could take up to 30 seconds.<br/>
|
<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>
|
You might have to reconnect to your new WiFi SSID. </p>
|
||||||
</div>
|
</div>
|
||||||
|
|
Ładowanie…
Reference in New Issue