01234567890123456789012345678901234567890123456789012345678901234567890123456789
679680681682683684685686687688689690691692693694695696697698699700701 702703704705706707708709710711712713714715716717718719720721 |
<----SKIPPED LINES---->
if current_angles and time.time() > next_write:
if current_angles[1] >= configuration['minimum_altitude_servo_tracking']:
if VERBOSE:
Log('Flight #: %s current_angles: %s' % (
messageboard.DisplayFlightNumber(flight), str(current_angles)))
laser_rgb = LaserRGBFlight(flight)
link.Write((*current_angles, *laser_rgb))
last_angles = current_angles
else:
link.Write((*last_angles, *LASER_RGB_OFF))
next_write = time.time() + WRITE_DELAY_TIME
link.Close(SHUTDOWN_TEXT)
LASER_RGB_OFF = (0, 0, 0)
def LaserRGBFlight(flight):
"""Based on flight attributes, set the laser."""
if not flight:
return LASER_RGB_OFF
return 1, 0, 0
def DifferentFlights(f1, f2):
"""True if both squawk and flight number different; false otherwise."""
if f1 is None and f2 is None:
return True
if f1 is None or f2 is None:
return True
if (
f1.get('flight_number') != f2.get('flight_number')
and f1.get('squawk') != f2.get('squawk')):
return True
return False
def FloatToAlphanumericStr(x, decimals, total_length, sign=True):
"""Formats a float as a string without a decimal point.
Since the decimal point is controlled independently on the alphanumeric display,
<----SKIPPED LINES---->
|
01234567890123456789012345678901234567890123456789012345678901234567890123456789
679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738 |
<----SKIPPED LINES---->
if current_angles and time.time() > next_write:
if current_angles[1] >= configuration['minimum_altitude_servo_tracking']:
if VERBOSE:
Log('Flight #: %s current_angles: %s' % (
messageboard.DisplayFlightNumber(flight), str(current_angles)))
laser_rgb = LaserRGBFlight(flight)
link.Write((*current_angles, *laser_rgb))
last_angles = current_angles
else:
link.Write((*last_angles, *LASER_RGB_OFF))
next_write = time.time() + WRITE_DELAY_TIME
link.Close(SHUTDOWN_TEXT)
LASER_RGB_OFF = (0, 0, 0)
def LaserRGBFlight(flight):
"""Based on flight attributes, set the laser."""
# Possible assignment based on:
# - ascending / descending / level
# - to SFO / from SFO / other
# - big plane / med plane / small plane
# - low alt / med alt / high alt
# - low speed / med speed / high speed
# - rare destination / common destination
red = False
green = False
blue = False
aircraft_length = AircraftLength(flight)
if AircraftLength(flight) > 50:
red = True
elif AircraftLength(flight) > 30:
green = True
else:
blue = True
return red, green, blue
def DifferentFlights(f1, f2):
"""True if both squawk and flight number different; false otherwise."""
if f1 is None and f2 is None:
return True
if f1 is None or f2 is None:
return True
if (
f1.get('flight_number') != f2.get('flight_number')
and f1.get('squawk') != f2.get('squawk')):
return True
return False
def FloatToAlphanumericStr(x, decimals, total_length, sign=True):
"""Formats a float as a string without a decimal point.
Since the decimal point is controlled independently on the alphanumeric display,
<----SKIPPED LINES---->
|