01234567890123456789012345678901234567890123456789012345678901234567890123456789
6263646566676869707172737475767778798081 828384858687888990919293949596979899100101102 740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782 13571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379 | <----SKIPPED LINES----> LASER_GREEN = (False, True, False) LASER_BLUE = (False, False, True) if SIMULATE_ARDUINO: SERVO_CONNECTION = ( CONNECTION_FLAG_SIMULATED, (SERVO_SIMULATED_IN, SERVO_SIMULATED_OUT)) REMOTE_CONNECTION = ( CONNECTION_FLAG_SIMULATED, (REMOTE_SIMULATED_IN, REMOTE_SIMULATED_OUT)) KEY_NOT_PRESENT_STRING = 'N/A' DISP_LAST_FLIGHT_NUMB_ORIG_DEST = 0 DISP_LAST_FLIGHT_AZIMUTH_ELEVATION = 1 DISP_FLIGHT_COUNT_LAST_SEEN = 2 DISP_RADIO_RANGE = 3 DISPLAY_MODE_NAMES = [ 'LAST_FLIGHT_NUMB_ORIG_DEST', 'LAST_FLIGHT_AZIMUTH_ELEVATION', 'FLIGHT_COUNT_LAST_SEEN', 'RADIO_RANGE'] WRITE_DELAY_TIME = 0.2 # write to arduino every n seconds READ_DELAY_TIME = 0.1 # read from arduino every n seconds HISTOGRAM_TYPES = ( (0, 'hour'), (1, 'day_of_month'), (2, 'origin'), (3, 'destination'), (4, 'airline'), (5, 'aircraft'), (6, 'altitude'), (7, 'bearing'), (8, 'distance'), (9, 'day_of_week'), (10, 'all')) HISTOGRAM_HISTORY = ( (0, 'today'), (1, '24h'), (2, '7d'), (3, '30d')) <----SKIPPED LINES----> messageboard.RemoveSetting(configuration, 'test_servos_ordinal') ServoTestOrdinal(link) elif 'test_servos_sweep' in configuration: messageboard.RemoveSetting(configuration, 'test_servos_sweep') ServoTestSweep(link) new_flight = DifferentFlights(flight, last_flight) if new_flight: Log('Flight changed from %s to %s' % ( messageboard.DisplayFlightNumber(last_flight), messageboard.DisplayFlightNumber(flight) ), ser=link) # Turn off laser so line isn't traced while it moves to new position link.Write((*last_angles, *LASER_OFF)) last_flight = flight if time.time() >= next_read: heartbeat = link.Read() # simple ack message sent by servos next_read = time.time() + READ_DELAY_TIME if heartbeat and VERBOSE: Log(heartbeat) now = GetNow(json_desc_dict, additional_attr) current_angles = AzimuthAltitude(flight, now) 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_OFF)) next_write = time.time() + WRITE_DELAY_TIME link.Close(SHUTDOWN_TEXT) <----SKIPPED LINES----> time.sleep(1) TestDisplayMode(DISP_LAST_FLIGHT_NUMB_ORIG_DEST) TestDisplayMode(DISP_LAST_FLIGHT_AZIMUTH_ELEVATION) TestDisplayMode(DISP_FLIGHT_COUNT_LAST_SEEN) TestDisplayMode(DISP_RADIO_RANGE) if time.time() >= next_write: next_write = SendRemoteMessage( flight, json_desc_dict, configuration, additional_attr, display_mode, write_keys, write_format_tuple, link) if time.time() >= next_read: bytes_read = [] values_t = link.Read(bytes_read=bytes_read) values_d = dict(zip(read_keys, values_t)) if values_d.get('confirmed'): Log(str(bytes_read) + '\n' + str(values_t) + '\n' + str(values_d)) display_mode, low_batt = ExecuteArduinoCommand( values_d, configuration, display_mode, low_batt, to_parent_q, link) next_read = time.time() + READ_DELAY_TIME link.Close(SHUTDOWN_TEXT) |
01234567890123456789012345678901234567890123456789012345678901234567890123456789
6263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783 13581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380 | <----SKIPPED LINES----> LASER_GREEN = (False, True, False) LASER_BLUE = (False, False, True) if SIMULATE_ARDUINO: SERVO_CONNECTION = ( CONNECTION_FLAG_SIMULATED, (SERVO_SIMULATED_IN, SERVO_SIMULATED_OUT)) REMOTE_CONNECTION = ( CONNECTION_FLAG_SIMULATED, (REMOTE_SIMULATED_IN, REMOTE_SIMULATED_OUT)) KEY_NOT_PRESENT_STRING = 'N/A' DISP_LAST_FLIGHT_NUMB_ORIG_DEST = 0 DISP_LAST_FLIGHT_AZIMUTH_ELEVATION = 1 DISP_FLIGHT_COUNT_LAST_SEEN = 2 DISP_RADIO_RANGE = 3 DISPLAY_MODE_NAMES = [ 'LAST_FLIGHT_NUMB_ORIG_DEST', 'LAST_FLIGHT_AZIMUTH_ELEVATION', 'FLIGHT_COUNT_LAST_SEEN', 'RADIO_RANGE'] WRITE_DELAY_TIME = 0.2 # write to arduino every n seconds READ_DELAY_TIME_SERVO = 1 # read from arduino every n seconds READ_DELAY_TIME_REMOTE = 0.1 # read from arduino every n seconds HISTOGRAM_TYPES = ( (0, 'hour'), (1, 'day_of_month'), (2, 'origin'), (3, 'destination'), (4, 'airline'), (5, 'aircraft'), (6, 'altitude'), (7, 'bearing'), (8, 'distance'), (9, 'day_of_week'), (10, 'all')) HISTOGRAM_HISTORY = ( (0, 'today'), (1, '24h'), (2, '7d'), (3, '30d')) <----SKIPPED LINES----> messageboard.RemoveSetting(configuration, 'test_servos_ordinal') ServoTestOrdinal(link) elif 'test_servos_sweep' in configuration: messageboard.RemoveSetting(configuration, 'test_servos_sweep') ServoTestSweep(link) new_flight = DifferentFlights(flight, last_flight) if new_flight: Log('Flight changed from %s to %s' % ( messageboard.DisplayFlightNumber(last_flight), messageboard.DisplayFlightNumber(flight) ), ser=link) # Turn off laser so line isn't traced while it moves to new position link.Write((*last_angles, *LASER_OFF)) last_flight = flight if time.time() >= next_read: heartbeat = link.Read() # simple ack message sent by servos next_read = time.time() + READ_DELAY_TIME_SERVO if heartbeat and VERBOSE: Log('Heartbeat read by Servo: %d' % heartbeat) now = GetNow(json_desc_dict, additional_attr) current_angles = AzimuthAltitude(flight, now) 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_OFF)) next_write = time.time() + WRITE_DELAY_TIME link.Close(SHUTDOWN_TEXT) <----SKIPPED LINES----> time.sleep(1) TestDisplayMode(DISP_LAST_FLIGHT_NUMB_ORIG_DEST) TestDisplayMode(DISP_LAST_FLIGHT_AZIMUTH_ELEVATION) TestDisplayMode(DISP_FLIGHT_COUNT_LAST_SEEN) TestDisplayMode(DISP_RADIO_RANGE) if time.time() >= next_write: next_write = SendRemoteMessage( flight, json_desc_dict, configuration, additional_attr, display_mode, write_keys, write_format_tuple, link) if time.time() >= next_read: bytes_read = [] values_t = link.Read(bytes_read=bytes_read) values_d = dict(zip(read_keys, values_t)) if values_d.get('confirmed'): Log(str(bytes_read) + '\n' + str(values_t) + '\n' + str(values_d)) display_mode, low_batt = ExecuteArduinoCommand( values_d, configuration, display_mode, low_batt, to_parent_q, link) next_read = time.time() + READ_DELAY_TIME_REMOTE link.Close(SHUTDOWN_TEXT) |