kopia lustrzana https://github.com/cyoung/stratux
Initial commit - user can set G limits for own aircraft.
rodzic
9ebe32e6e0
commit
5aefc145ac
|
@ -1036,26 +1036,27 @@ func getProductNameFromId(product_id int) string {
|
|||
}
|
||||
|
||||
type settings struct {
|
||||
UAT_Enabled bool
|
||||
ES_Enabled bool
|
||||
Ping_Enabled bool
|
||||
GPS_Enabled bool
|
||||
BMP_Sensor_Enabled bool
|
||||
IMU_Sensor_Enabled bool
|
||||
NetworkOutputs []networkConnection
|
||||
SerialOutputs map[string]serialConnection
|
||||
DisplayTrafficSource bool
|
||||
DEBUG bool
|
||||
ReplayLog bool
|
||||
AHRSLog bool
|
||||
IMUMapping [2]int // Map from aircraft axis to sensor axis: accelerometer
|
||||
PPM int
|
||||
OwnshipModeS string
|
||||
WatchList string
|
||||
DeveloperMode bool
|
||||
UAT_Enabled bool
|
||||
ES_Enabled bool
|
||||
Ping_Enabled bool
|
||||
GPS_Enabled bool
|
||||
BMP_Sensor_Enabled bool
|
||||
IMU_Sensor_Enabled bool
|
||||
NetworkOutputs []networkConnection
|
||||
SerialOutputs map[string]serialConnection
|
||||
DisplayTrafficSource bool
|
||||
DEBUG bool
|
||||
ReplayLog bool
|
||||
AHRSLog bool
|
||||
IMUMapping [2]int // Map from aircraft axis to sensor axis: accelerometer
|
||||
PPM int
|
||||
OwnshipModeS string
|
||||
WatchList string
|
||||
DeveloperMode bool
|
||||
AHRSSmoothingConstant float64
|
||||
AHRSGPSWeight float64
|
||||
StaticIps []string
|
||||
AHRSGPSWeight float64
|
||||
GLimits string
|
||||
StaticIps []string
|
||||
}
|
||||
|
||||
type status struct {
|
||||
|
|
|
@ -324,6 +324,8 @@ func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
case "WatchList":
|
||||
globalSettings.WatchList = val.(string)
|
||||
case "GLimits":
|
||||
globalSettings.GLimits = val.(string)
|
||||
case "AHRSSmoothingConstant":
|
||||
log.Printf("AHRS Info: received %s for Smoothing Const\n", val)
|
||||
globalSettings.AHRSSmoothingConstant = val.(float64)
|
||||
|
|
|
@ -143,9 +143,9 @@ AHRSRenderer.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
function GMeterRenderer(locationId, plim, nlim, resetCallback) {
|
||||
this.plim = plim;
|
||||
function GMeterRenderer(locationId, nlim, plim, resetCallback) {
|
||||
this.nlim = nlim;
|
||||
this.plim = plim;
|
||||
this.nticks = Math.floor(plim+1) - Math.floor(nlim) + 1;
|
||||
|
||||
this.width = -1;
|
||||
|
|
|
@ -362,7 +362,23 @@ function GPSCtrl($rootScope, $scope, $state, $http, $interval) {
|
|||
});
|
||||
};
|
||||
|
||||
var gMeter = new GMeterRenderer("gMeter_display", 4.4, -1.76, $scope.GMeterReset);
|
||||
function getAHRSSettings() {
|
||||
// Simple GET request example (note: response is asynchronous)
|
||||
$http.get(URL_SETTINGS_GET).
|
||||
then(function (response) {
|
||||
settings = angular.fromJson(response.data);
|
||||
if (settings.GLimits === "" || settings.GLimits === undefined) {
|
||||
settings.GLimits = "-1.76 4.4";
|
||||
}
|
||||
var glims = settings.GLimits.split(" ");
|
||||
$scope.gLimNegative = parseFloat(glims[0]);
|
||||
$scope.gLimPositive = parseFloat(glims[1]);
|
||||
gMeter = new GMeterRenderer("gMeter_display", $scope.gLimNegative, $scope.gLimPositive, $scope.GMeterReset);
|
||||
}, function (response) {});
|
||||
}
|
||||
|
||||
var gMeter;
|
||||
getAHRSSettings();
|
||||
|
||||
// GPS Controller tasks
|
||||
connect($scope); // connect - opens a socket and listens for messages
|
||||
|
|
|
@ -41,6 +41,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
|
|||
$scope.AHRSGPSWeight = settings.AHRSGPSWeight;
|
||||
$scope.OwnshipModeS = settings.OwnshipModeS;
|
||||
$scope.DeveloperMode = settings.DeveloperMode;
|
||||
$scope.GLimits = settings.GLimits;
|
||||
}
|
||||
|
||||
function getSettings() {
|
||||
|
@ -172,13 +173,23 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
|
|||
$scope.updatestaticips = function () {
|
||||
if ($scope.StaticIps !== settings.StaticIps) {
|
||||
newsettings = {
|
||||
"StaticIps": $scope.StaticIps === undefined? "" : $scope.StaticIps.join(' ')
|
||||
"StaticIps": $scope.StaticIps === undefined ? "" : $scope.StaticIps.join(' ')
|
||||
};
|
||||
// console.log(angular.toJson(newsettings));
|
||||
setSettings(angular.toJson(newsettings));
|
||||
}
|
||||
};
|
||||
|
||||
$scope.updateGLimits = function () {
|
||||
if ($scope.GLimits !== settings["GLimits"]) {
|
||||
settings["GLimits"] = $scope.GLimits;
|
||||
newsettings = {
|
||||
"GLimits": settings["GLimits"]
|
||||
};
|
||||
console.log(angular.toJson(newsettings));
|
||||
setSettings(angular.toJson(newsettings));
|
||||
}
|
||||
};
|
||||
|
||||
$scope.postShutdown = function () {
|
||||
$window.location.href = "/";
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
<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>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 valide Mode S value.
|
||||
|
|
|
@ -86,6 +86,12 @@
|
|||
Set AHRS Sensor Orientation
|
||||
</button>
|
||||
</span>
|
||||
<div class="form-group reset-flow">
|
||||
<label class="control-label col-xs-5">G Limits</label>
|
||||
<form name="GLimitForm" ng-submit="updateGLimits()" novalidate>
|
||||
<input class="col-xs-7" type="string" required ng-model="GLimits" placeholder="Space-separated negative and positive G meter limits" ng-blur="updateGLimits()" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Ładowanie…
Reference in New Issue