Update comments and code review
This commit is contained in:
parent
29103533fb
commit
92fd83615d
25
aerotow.nas
25
aerotow.nas
@ -36,7 +36,7 @@ var g_altitude = nil; # AI plane altitude
|
|||||||
var g_towListeners = [];
|
var g_towListeners = [];
|
||||||
|
|
||||||
#
|
#
|
||||||
# Initialize thermal module
|
# Initialize aerotow module
|
||||||
#
|
#
|
||||||
var init = func () {
|
var init = func () {
|
||||||
# Listener for ai-model property triggered when the user select a tow aircraft from add-on menu
|
# Listener for ai-model property triggered when the user select a tow aircraft from add-on menu
|
||||||
@ -58,7 +58,7 @@ var init = func () {
|
|||||||
|
|
||||||
# Set listeners for distance fields for calculate altitude change
|
# Set listeners for distance fields for calculate altitude change
|
||||||
for (var i = 0; i < MAX_ROUTE_WAYPOINT; i = i + 1) {
|
for (var i = 0; i < MAX_ROUTE_WAYPOINT; i = i + 1) {
|
||||||
append(g_towListeners, setlistener(ADDON_NODE_PATH ~ "/addon-devel/route/wpt[" ~ i ~ "]/distance-m", func (node) {
|
append(g_towListeners, setlistener(ADDON_NODE_PATH ~ "/addon-devel/route/wpt[" ~ i ~ "]/distance-m", func () {
|
||||||
calculateAltChangeAndTotals();
|
calculateAltChangeAndTotals();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ var calculateAltChangeAndTotals = func () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Uninitialize thermal module
|
# Uninitialize aerotow module
|
||||||
#
|
#
|
||||||
var uninit = func () {
|
var uninit = func () {
|
||||||
foreach (var listener; g_towListeners) {
|
foreach (var listener; g_towListeners) {
|
||||||
@ -477,7 +477,7 @@ var generateFlightPlanXml = func () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return hash with "vs", "speed", "rolling".
|
# Return hash with "vs", "speed", "speedLimit", "rolling".
|
||||||
#
|
#
|
||||||
var getAircraftPerformance = func (isRouteMode = 0) {
|
var getAircraftPerformance = func (isRouteMode = 0) {
|
||||||
# Cub
|
# Cub
|
||||||
@ -501,10 +501,10 @@ var getAircraftPerformance = func (isRouteMode = 0) {
|
|||||||
var aiModel = getSelectedAircraft(isRouteMode);
|
var aiModel = getSelectedAircraft(isRouteMode);
|
||||||
if (aiModel == "DR400" or aiModel == "Robin DR400") {
|
if (aiModel == "DR400" or aiModel == "Robin DR400") {
|
||||||
return {
|
return {
|
||||||
"vs": 285, # ft per DISTANCE_DETERMINANT m
|
"vs": 285, # vertical speed in ft per DISTANCE_DETERMINANT m
|
||||||
"speed": 70,
|
"speed": 70, # take-off speed
|
||||||
"speedLimit": 75,
|
"speedLimit": 75, # max speed
|
||||||
"rolling": 2,
|
"rolling": 2, # factor for rolling
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,12 +668,9 @@ var wrireWpt = func (
|
|||||||
var alt = nil;
|
var alt = nil;
|
||||||
if (coord != nil and contains(performance, "elevationPlus")) {
|
if (coord != nil and contains(performance, "elevationPlus")) {
|
||||||
var elevation = geo.elevation(coord.lat(), coord.lon());
|
var elevation = geo.elevation(coord.lat(), coord.lon());
|
||||||
if (elevation == nil) {
|
g_altitude = elevation == nil
|
||||||
g_altitude = g_altitude + performance.elevationPlus;
|
? g_altitude + performance.elevationPlus
|
||||||
}
|
: elevation * globals.M2FT + performance.elevationPlus;
|
||||||
else {
|
|
||||||
g_altitude = elevation * globals.M2FT + performance.elevationPlus;
|
|
||||||
}
|
|
||||||
alt = g_altitude;
|
alt = g_altitude;
|
||||||
}
|
}
|
||||||
else if (contains(performance, "altChange")) {
|
else if (contains(performance, "altChange")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user