72
edits
No edit summary |
No edit summary |
||
Line 64: | Line 64: | ||
! Mode !! Emitted signals | ! Mode !! Emitted signals | ||
|- | |- | ||
| taxi-and-takeoff || approaching-runway, on-runway | | taxi-and-takeoff || approaching-runway, on-runway, on-short-runway | ||
|- | |- | ||
| taxi || approaching-runway | | taxi || approaching-runway | ||
|- | |- | ||
| takeoff || on-runway | | takeoff || on-runway, on-short-runway | ||
|} | |} | ||
Line 124: | Line 124: | ||
return func (data=nil) { | return func (data=nil) { | ||
if (format != nil) { | if (format != nil) { | ||
if (typeof(format) == "func") { | |||
var message_format = format(); | |||
} | |||
else { | |||
var message_format = format; | |||
} | |||
if (data != nil) { | if (data != nil) { | ||
var message = sprintf( | var message = sprintf(message_format, data.getValue()); | ||
} | } | ||
else { | else { | ||
var message = | var message = message_format; | ||
} | } | ||
Line 139: | Line 146: | ||
} | } | ||
}; | }; | ||
}; | |||
var on_short_runway_format = func { | |||
var distance = getprop("/sim/runway-announcer/short-runway-distance"); | |||
return sprintf("On runway %%s, %d %s remaining", distance, takeoff_config.distances_unit); | |||
}; | |||
var remaining_distance_format = func { | |||
return sprintf("%%d %s remaining", landing_config.distances_unit); | |||
}; | }; | ||
Line 146: | Line 162: | ||
takeoff_announcer.set_mode("taxi-and-takeoff"); | takeoff_announcer.set_mode("taxi-and-takeoff"); | ||
logger.warn(sprintf("Takeoff mode: %s", takeoff_announcer.mode)); | |||
}; | }; | ||
Line 153: | Line 170: | ||
if (takeoff_announcer.mode == "taxi-and-takeoff") { | if (takeoff_announcer.mode == "taxi-and-takeoff") { | ||
takeoff_announcer.set_mode("takeoff"); | takeoff_announcer.set_mode("takeoff"); | ||
logger.warn(sprintf("Takeoff mode: %s", takeoff_announcer.mode)); | |||
} | } | ||
}; | }; | ||
var takeoff_config = { parents: [runway.TakeoffRunwayAnnounceConfig] }; | var takeoff_config = { parents: [runway.TakeoffRunwayAnnounceConfig] }; | ||
# You can modify this setting from a GUI during runtime | |||
takeoff_config.distances_unit = "meter"; | |||
# Will cause the announcer to emit the "on-runway" signal if the | # Will cause the announcer to emit the "on-runway" signal if the | ||
# aircraft is | # aircraft is at most 15 meters from the center line of the runway | ||
takeoff_config.distance_center_line_m = 15; | takeoff_config.distance_center_line_m = 15; | ||
# Let the announcer emit the "approaching-runway" signal if the | # Let the announcer emit the "approaching-runway" signal if the | ||
Line 170: | Line 189: | ||
var takeoff_announcer = runway.TakeoffRunwayAnnounceClass.new(takeoff_config); | var takeoff_announcer = runway.TakeoffRunwayAnnounceClass.new(takeoff_config); | ||
takeoff_announcer.connect("on-runway", make_notification_cb("On runway %s", switch_to_takeoff)); | takeoff_announcer.connect("on-runway", make_notification_cb("On runway %s", switch_to_takeoff)); | ||
takeoff_announcer.connect("on-short-runway", make_notification_cb(on_short_runway_format, switch_to_takeoff)); | |||
takeoff_announcer.connect("approaching-runway", make_notification_cb("Approaching runway %s")); | takeoff_announcer.connect("approaching-runway", make_notification_cb("Approaching runway %s")); | ||
Line 179: | Line 199: | ||
var landing_announcer = runway.LandingRunwayAnnounceClass.new(landing_config); | var landing_announcer = runway.LandingRunwayAnnounceClass.new(landing_config); | ||
landing_announcer.connect("remaining-distance", make_notification_cb( | landing_announcer.connect("remaining-distance", make_notification_cb(remaining_distance_format)); | ||
landing_announcer.connect("vacated-runway", make_notification_cb("Vacated runway %s", stop_announcer)); | landing_announcer.connect("vacated-runway", make_notification_cb("Vacated runway %s", stop_announcer)); | ||
landing_announcer.connect("landed-runway", make_notification_cb("Touchdown on runway %s")); | landing_announcer.connect("landed-runway", make_notification_cb("Touchdown on runway %s")); | ||
Line 197: | Line 217: | ||
takeoff_announcer.set_mode(""); | takeoff_announcer.set_mode(""); | ||
} | } | ||
logger.warn(sprintf("Takeoff mode: %s", takeoff_announcer.mode)); | |||
}; | }; | ||
}; | }; | ||
Line 259: | Line 280: | ||
{{Note|You might want to replace copilot_say().}} | {{Note|You might want to replace copilot_say().}} | ||
The configuration object takeoff_config has a number of properties with default values. These properties can be modified if you want to change when certain signals are emitted. For example, in the example of runway.nas above, distance_center_line_m | The configuration object takeoff_config has a number of properties with default values. These properties can be modified if you want to change when certain signals are emitted. For example, in the example of runway.nas above, distance_center_line_m and distance_edge_max_m where overridden for large airliners. The defaults are: | ||
<syntaxhighlight lang="nasal"> | <syntaxhighlight lang="nasal"> | ||
distance_start_m: | distance_start_m: nil, | ||
# The maximum distance in meters from the starting position | # The maximum distance in meters from the starting position | ||
# on the runway. Large runways are usually 40 to 60 meters wide. | # on the runway. Large runways are usually 40 to 60 meters wide | ||
# to give you an idea of the scale. If nil then the distance is | |||
# not taken into account, which means the aircraft can be anywhere | |||
# on the runway for the on-runway signal to be emitted. | |||
diff_runway_heading_deg: | diff_runway_heading_deg: 20, | ||
# Difference in heading between runway and aircraft in order to | # Difference in heading between runway and aircraft in order to | ||
# get an announcement that the aircraft is on the runway for takeoff. | # get an announcement that the aircraft is on the runway for takeoff. | ||
Line 281: | Line 305: | ||
# Minimum and maximum distance in meters from the edge of the runway | # Minimum and maximum distance in meters from the edge of the runway | ||
# for announcing approaches. | # for announcing approaches. | ||
nominal_distance_takeoff_m: 3000, | |||
# Minimum distance in meters required for a normal takeoff. If | |||
# remaining distance when entering the runway is less than the distance | |||
# required for a normal takeoff, then the on-short-runway instead of | |||
# on-runway signal will be emitted. | |||
distances_unit: "meter", | |||
# The unit to use for the remaining distance of short runways. Can | |||
# be "meter" or "feet". | |||
</syntaxhighlight> | </syntaxhighlight> | ||
edits