Skip to content

Commit

Permalink
Powersave switch.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyoung committed Jan 23, 2016
1 parent 00024f1 commit f5bed44
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions main/gen_gdl90.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ type settings struct {
PPM int
OwnshipModeS string
WatchList string
PowerSave bool
}

type status struct {
Expand Down
2 changes: 2 additions & 0 deletions main/managementinterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) {
globalSettings.GPS_Enabled = val.(bool)
case "AHRS_Enabled":
globalSettings.AHRS_Enabled = val.(bool)
case "PowerSave":
globalSettings.PowerSave = val.(bool)
case "DEBUG":
globalSettings.DEBUG = val.(bool)
case "ReplayLog":
Expand Down
2 changes: 1 addition & 1 deletion main/sdr.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func sdrWatcher() {
// UAT specific handling

// Shutdown UAT for 50 seconds, check every 60 seconds if the count is 0.
if stratuxClock.Since(lastUATCheck) >= 1*time.Minute {
if globalSettings.PowerSave && stratuxClock.Since(lastUATCheck) >= 1*time.Minute {
if UATDev != nil && globalStatus.UAT_messages_last_minute == 0 {
log.Printf("Pausing UAT listening for 50 seconds - none received.\n")
UATDev.shutdown()
Expand Down
3 changes: 2 additions & 1 deletion web/plates/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function SettingsCtrl($rootScope, $scope, $state, $http) {

$scope.$parent.helppage = 'plates/settings-help.html';

var toggles = ['UAT_Enabled', 'ES_Enabled', 'GPS_Enabled', 'AHRS_Enabled', 'DEBUG', 'ReplayLog']; // DEBUG is 'DspTrafficSrc'
var toggles = ['UAT_Enabled', 'ES_Enabled', 'GPS_Enabled', 'AHRS_Enabled', 'PowerSave', 'DEBUG', 'ReplayLog']; // DEBUG is 'DspTrafficSrc'
var settings = {};
for (i = 0; i < toggles.length; i++) {
settings[toggles[i]] = undefined;
Expand All @@ -20,6 +20,7 @@ function SettingsCtrl($rootScope, $scope, $state, $http) {
$scope.ES_Enabled = settings.ES_Enabled;
$scope.GPS_Enabled = settings.GPS_Enabled;
$scope.AHRS_Enabled = settings.AHRS_Enabled;
$scope.PowerSave = settings.PowerSave
$scope.DEBUG = settings.DEBUG;
$scope.ReplayLog = settings.ReplayLog;
$scope.PPM = settings.PPM;
Expand Down
6 changes: 6 additions & 0 deletions web/plates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
<ui-switch ng-model='AHRS_Enabled' settings-change></ui-switch>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-7">AHRS</label>
<div class="col-xs-5">
<ui-switch ng-model='PowerSave' settings-change></ui-switch>
</div>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit f5bed44

Please sign in to comment.