01234567890123456789012345678901234567890123456789012345678901234567890123456789
341342343344345346347348349350351352353354355356357358359360 361362363364365366367368369370371372373374375376377378379380 53565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396 6133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175 |
<----SKIPPED LINES---->
AIRCRAFT_LENGTH['Canadair Regional Jet CRJ-200 (twin-jet)'] = 26.77
AIRCRAFT_LENGTH['Canadair Regional Jet CRJ-700 (twin-jet)'] = 32.3
AIRCRAFT_LENGTH['Canadair Regional Jet CRJ-900 (twin-jet)'] = 36.2
AIRCRAFT_LENGTH['Canadair Challenger (twin-jet)'] = 20.9
AIRCRAFT_LENGTH['Canadair Challenger 350 (twin-jet)'] = 20.9
AIRCRAFT_LENGTH['Bombardier Challenger 300 (twin-jet)'] = 20.92
AIRCRAFT_LENGTH['Bombardier Global Express (twin-jet)'] = (29.5 + 30.3) / 2
AIRCRAFT_LENGTH['Embraer 170/175 (twin-jet)'] = (29.90 + 31.68) / 2
AIRCRAFT_LENGTH['Embraer Phenom 300 (twin-jet)'] = 15.9
AIRCRAFT_LENGTH['EMBRAER 175 (long wing) (twin-jet)'] = 31.68
AIRCRAFT_LENGTH['Embraer ERJ-135 (twin-jet)'] = 26.33
AIRCRAFT_LENGTH['Cessna Caravan (single-turboprop)'] = 11.46
AIRCRAFT_LENGTH['Cessna Citation CJ2+ (twin-jet)'] = 14.53
AIRCRAFT_LENGTH['Cessna Citation CJ3 (twin-jet)'] = 15.59
AIRCRAFT_LENGTH['Cessna Citation Excel/XLS (twin-jet)'] = 16.0
AIRCRAFT_LENGTH['Cessna Citation II (twin-jet)'] = 14.54
AIRCRAFT_LENGTH['Cessna Citation Latitude (twin-jet)'] = 18.97
AIRCRAFT_LENGTH['Cessna Citation Sovereign (twin-jet)'] = 19.35
AIRCRAFT_LENGTH['Cessna Citation V (twin-jet)'] = 14.91
AIRCRAFT_LENGTH['Cessna Citation X (twin-jet)'] = 22.04
AIRCRAFT_LENGTH['Cessna Skyhawk (piston-single)'] = 8.28
AIRCRAFT_LENGTH['Cessna Skylane (piston-single)'] = 8.84
AIRCRAFT_LENGTH['Cessna T206 Turbo Stationair (piston-single)'] = 8.61
AIRCRAFT_LENGTH['Beechcraft Bonanza (33) (piston-single)'] = 7.65
AIRCRAFT_LENGTH['Beechcraft Super King Air 200 (twin-turboprop)'] = 13.31
AIRCRAFT_LENGTH['Beechcraft Super King Air 350 (twin-turboprop)'] = 14.22
AIRCRAFT_LENGTH['Beechcraft King Air 90 (twin-turboprop)'] = 10.82
AIRCRAFT_LENGTH['Learjet 45 (twin-jet)'] = 17.68
AIRCRAFT_LENGTH['Pilatus PC-12 (single-turboprop)'] = 14.4
def Log(message, file=None, rolling=None):
"""Write a message to a logfile along with a timestamp.
Args:
message: string message to write
file: string representing file name and, if needed, path to the file to write to
rolling: name of file that will keep only the last n files of file
"""
# can't define as a default parameter because LOGFILE name is potentially
<----SKIPPED LINES---->
args: A tuple of function parameters to pass unmodified to start_function.
Returns:
The running process - either the same one that was passed in, or a new one if a
restart was needed.
"""
if not SHUTDOWN_SIGNAL:
if not enabled:
if p is not None: # must have just requested a disabling of single instance
args[2].value = 1 # trigger a shutdown on the single instance
return None
if p is None or not p.is_alive():
if p is None:
Log('Process for %s starting for first time' % str(start_function))
elif VERBOSE:
Log('Process (%s) for %s died; restarting' % (str(p), str(start_function)))
args[2].value = 0 # (re)set shutdown flag to allow function to run
p = multiprocessing.Process(target=start_function, args=args)
p.daemon = False # TODO: perhaps value of false will address correlated BT failures?
p.start()
return p
def LastFlightAvailable(flights, screen_history):
"""Returns True if last message sent to splitflap is not the last flight; else False."""
if not screen_history:
return False
last_message_tuple = screen_history[-1]
last_message_type = last_message_tuple[0]
if last_message_type == FLAG_MSG_FLIGHT:
last_message_flight = last_message_tuple[2]
if SameFlight(last_message_flight, flights[-1]):
return False # already displaying the last flight!
return True
def EnqueueArduinos(
<----SKIPPED LINES---->
(persistent_nearby_aircraft,
flight, now,
json_desc_dict,
persistent_path) = ScanForNewFlights(
persistent_nearby_aircraft,
persistent_path,
configuration.get('log_jsons', False))
# because this might just be an updated instance of the previous flight as more
# identifier information (squawk and or flight number) comes in, we only want to
# process this if its a truly new flight
new_flight_flag = ConfirmNewFlight(flight, flights)
if new_flight_flag:
flights.append(flight)
remote, servo = RefreshArduinos(
remote, servo,
to_remote_q, to_servo_q, to_main_q, shutdown,
flights, json_desc_dict, configuration, screen_history)
flight_meets_display_criteria = FlightMeetsDisplayCriteria(
flight, configuration, log=True)
if flight_meets_display_criteria:
flight_message = (FLAG_MSG_FLIGHT, CreateMessageAboutFlight(flight), flight)
# display the next message about this flight now!
next_message_time = time.time()
message_queue.insert(0, flight_message)
# and delete any queued insight messages about other flights that have
# not yet displayed, since a newer flight has taken precedence
message_queue = DeleteMessageTypes(message_queue, (FLAG_MSG_INSIGHT,))
# Though we also manage the message queue outside this conditional as well,
# because it can take a half second to generate the flight insights, this allows
# this message to start displaying on the board immediately, so it's up there
# when it's most relevant
next_message_time = ManageMessageQueue(
message_queue, next_message_time, configuration, screen_history)
insight_messages = CreateFlightInsights(
flights, configuration.get('insights'), insight_message_distribution)
if configuration.get('next_flight', 'off') == 'on':
next_flight_text = FlightInsightNextFlight(flights, configuration)
<----SKIPPED LINES---->
|
01234567890123456789012345678901234567890123456789012345678901234567890123456789
341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 53575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397 613461356136613761386139614061416142614361446145614661476148614961506151615261536154 61556156615761586159616061616162616361646165616661676168616961706171617261736174 |
<----SKIPPED LINES---->
AIRCRAFT_LENGTH['Canadair Regional Jet CRJ-200 (twin-jet)'] = 26.77
AIRCRAFT_LENGTH['Canadair Regional Jet CRJ-700 (twin-jet)'] = 32.3
AIRCRAFT_LENGTH['Canadair Regional Jet CRJ-900 (twin-jet)'] = 36.2
AIRCRAFT_LENGTH['Canadair Challenger (twin-jet)'] = 20.9
AIRCRAFT_LENGTH['Canadair Challenger 350 (twin-jet)'] = 20.9
AIRCRAFT_LENGTH['Bombardier Challenger 300 (twin-jet)'] = 20.92
AIRCRAFT_LENGTH['Bombardier Global Express (twin-jet)'] = (29.5 + 30.3) / 2
AIRCRAFT_LENGTH['Embraer 170/175 (twin-jet)'] = (29.90 + 31.68) / 2
AIRCRAFT_LENGTH['Embraer Phenom 300 (twin-jet)'] = 15.9
AIRCRAFT_LENGTH['EMBRAER 175 (long wing) (twin-jet)'] = 31.68
AIRCRAFT_LENGTH['Embraer ERJ-135 (twin-jet)'] = 26.33
AIRCRAFT_LENGTH['Cessna Caravan (single-turboprop)'] = 11.46
AIRCRAFT_LENGTH['Cessna Citation CJ2+ (twin-jet)'] = 14.53
AIRCRAFT_LENGTH['Cessna Citation CJ3 (twin-jet)'] = 15.59
AIRCRAFT_LENGTH['Cessna Citation Excel/XLS (twin-jet)'] = 16.0
AIRCRAFT_LENGTH['Cessna Citation II (twin-jet)'] = 14.54
AIRCRAFT_LENGTH['Cessna Citation Latitude (twin-jet)'] = 18.97
AIRCRAFT_LENGTH['Cessna Citation Sovereign (twin-jet)'] = 19.35
AIRCRAFT_LENGTH['Cessna Citation V (twin-jet)'] = 14.91
AIRCRAFT_LENGTH['Cessna Citation X (twin-jet)'] = 22.04
AIRCRAFT_LENGTH['Cessna Citation Mustang (twin-jet)'] = 12.37
AIRCRAFT_LENGTH['Cessna Skyhawk (piston-single)'] = 8.28
AIRCRAFT_LENGTH['Cessna Skylane (piston-single)'] = 8.84
AIRCRAFT_LENGTH['Cessna T206 Turbo Stationair (piston-single)'] = 8.61
AIRCRAFT_LENGTH['Beechcraft Bonanza (33) (piston-single)'] = 7.65
AIRCRAFT_LENGTH['Beechcraft Super King Air 200 (twin-turboprop)'] = 13.31
AIRCRAFT_LENGTH['Beechcraft Super King Air 350 (twin-turboprop)'] = 14.22
AIRCRAFT_LENGTH['Beechcraft King Air 90 (twin-turboprop)'] = 10.82
AIRCRAFT_LENGTH['Learjet 45 (twin-jet)'] = 17.68
AIRCRAFT_LENGTH['Pilatus PC-12 (single-turboprop)'] = 14.4
def Log(message, file=None, rolling=None):
"""Write a message to a logfile along with a timestamp.
Args:
message: string message to write
file: string representing file name and, if needed, path to the file to write to
rolling: name of file that will keep only the last n files of file
"""
# can't define as a default parameter because LOGFILE name is potentially
<----SKIPPED LINES---->
args: A tuple of function parameters to pass unmodified to start_function.
Returns:
The running process - either the same one that was passed in, or a new one if a
restart was needed.
"""
if not SHUTDOWN_SIGNAL:
if not enabled:
if p is not None: # must have just requested a disabling of single instance
args[2].value = 1 # trigger a shutdown on the single instance
return None
if p is None or not p.is_alive():
if p is None:
Log('Process for %s starting for first time' % str(start_function))
elif VERBOSE:
Log('Process (%s) for %s died; restarting' % (str(p), str(start_function)))
args[2].value = 0 # (re)set shutdown flag to allow function to run
p = multiprocessing.Process(target=start_function, args=args)
p.daemon = True # TODO: perhaps value of false will address correlated BT failures?
p.start()
return p
def LastFlightAvailable(flights, screen_history):
"""Returns True if last message sent to splitflap is not the last flight; else False."""
if not screen_history:
return False
last_message_tuple = screen_history[-1]
last_message_type = last_message_tuple[0]
if last_message_type == FLAG_MSG_FLIGHT:
last_message_flight = last_message_tuple[2]
if SameFlight(last_message_flight, flights[-1]):
return False # already displaying the last flight!
return True
def EnqueueArduinos(
<----SKIPPED LINES---->
(persistent_nearby_aircraft,
flight, now,
json_desc_dict,
persistent_path) = ScanForNewFlights(
persistent_nearby_aircraft,
persistent_path,
configuration.get('log_jsons', False))
# because this might just be an updated instance of the previous flight as more
# identifier information (squawk and or flight number) comes in, we only want to
# process this if its a truly new flight
new_flight_flag = ConfirmNewFlight(flight, flights)
if new_flight_flag:
flights.append(flight)
remote, servo = RefreshArduinos(
remote, servo,
to_remote_q, to_servo_q, to_main_q, shutdown,
flights, json_desc_dict, configuration, screen_history)
if FlightMeetsDisplayCriteria(flight, configuration, log=True):
flight_message = (FLAG_MSG_FLIGHT, CreateMessageAboutFlight(flight), flight)
# display the next message about this flight now!
next_message_time = time.time()
message_queue.insert(0, flight_message)
# and delete any queued insight messages about other flights that have
# not yet displayed, since a newer flight has taken precedence
message_queue = DeleteMessageTypes(message_queue, (FLAG_MSG_INSIGHT,))
# Though we also manage the message queue outside this conditional as well,
# because it can take a half second to generate the flight insights, this allows
# this message to start displaying on the board immediately, so it's up there
# when it's most relevant
next_message_time = ManageMessageQueue(
message_queue, next_message_time, configuration, screen_history)
insight_messages = CreateFlightInsights(
flights, configuration.get('insights'), insight_message_distribution)
if configuration.get('next_flight', 'off') == 'on':
next_flight_text = FlightInsightNextFlight(flights, configuration)
<----SKIPPED LINES---->
|