-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Pitch/Roll and Yaw Rate Parameters
New feature : Adding pitch/roll and yaw rate parameters that were active when log was made will allow rcCommand to show actual deg/s value alongside raw input. This is then used to calculate new PID_Error values as deg/s
- Loading branch information
Gary Keeble
authored and
Gary Keeble
committed
Apr 11, 2016
1 parent
b90d0d6
commit eb13746
Showing
4 changed files
with
197 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
"use strict"; | ||
|
||
function FlightLogSetupDialog(dialog, onSave) { | ||
|
||
function renderParameter(parameter) { | ||
var | ||
elem = $( | ||
'<li class="setup-parameter">' | ||
+ '<label class="col-sm-2 control-label">' + parameter.label + '</label>' | ||
+ '<input class="form-control" type="text" placeholder="Enter the value">' | ||
+ '</li>' | ||
); | ||
|
||
$("input", elem).val(parameter.value); | ||
|
||
return elem; | ||
} | ||
|
||
function renderParameters(setting) { | ||
var | ||
parametersElem = $( | ||
'<li class="setup-parameters">' | ||
+ '<dl>' | ||
+ '<dt><h4>' + setting.label + '</dt>' | ||
+ '<dd>' | ||
+ '<div class="form-horizontal">' | ||
+ '<div class="form-group form-group-sm">' | ||
+ '<ul class="setup-parameter-list form-inline list-unstyled"></ul>' | ||
+ '</div>' | ||
+ '</div>' | ||
+ '</dd>' | ||
+ '</dl>' | ||
+ '</li>' | ||
), | ||
parameterList = $(".setup-parameter-list", parametersElem); | ||
|
||
for (var i = 0; i < setting.parameters.length; i++) { | ||
var | ||
parameter = setting.parameters[i], | ||
parameterElem = renderParameter(parameter); | ||
|
||
parameterList.append(parameterElem); | ||
} | ||
|
||
return parametersElem; | ||
} | ||
|
||
function renderSettings(flightLog) { | ||
var | ||
settingsList = $(".setup-flightlog-list", dialog); | ||
|
||
settingsList.empty(); | ||
|
||
for (var i = 0; i < flightLog.settings.length; i++) { | ||
settingsList.append(renderParameters(flightLog.settings[i])); | ||
} | ||
} | ||
|
||
function convertUIToFlightLogSettings() { | ||
var | ||
settings = [], | ||
setting, | ||
parameter; | ||
|
||
$(".setup-parameters", dialog).each(function() { | ||
setting = { | ||
label: '', | ||
parameters: [] | ||
}; | ||
|
||
setting.label = $("h4", this).text(); | ||
|
||
$(".setup-parameter", this).each(function() { | ||
parameter = { | ||
label: $("label", this).text(), | ||
value: parseInt($("input[type='text']", this).val()), | ||
}; | ||
setting.parameters.push(parameter); | ||
}); | ||
|
||
settings.push(setting); | ||
}); | ||
|
||
return settings; | ||
} | ||
|
||
this.show = function(flightLog, settings) { | ||
dialog.modal('show'); | ||
|
||
// Assign the settings | ||
flightLog.settings = settings; | ||
|
||
renderSettings(flightLog); | ||
}; | ||
|
||
$(".flightlog-setup-dialog-save").click(function(e) { | ||
onSave(convertUIToFlightLogSettings()); | ||
}); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters