arduino-2020-06-04-0054.py
01234567890123456789012345678901234567890123456789012345678901234567890123456789









639640641642643644645646647648649650651652653654655656657658 659660661662663664665666667668669670671672673674675676677678











                            <----SKIPPED LINES---->




  flight_present = False

  while not shutdown.value:
    timing.append((time.time(), 2))
    if not to_arduino_q.empty():
      flight, json_desc_dict, configuration, additional_attr = to_arduino_q.get(
          block=False)

      if 'test_servos' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos')
        link.Write((0, 0, *LASER_RGB_OFF))
        time.sleep(1)
        link.Write((90, 0, *LASER_RGB_OFF))
        time.sleep(1)
        link.Write((180, 0, *LASER_RGB_OFF))
        time.sleep(1)
        link.Write((270, 0, *LASER_RGB_OFF))

      timing.append((time.time(), 3))
      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)

        timing.append((time.time(), 4))
        # Turn off laser so that line isn't traced while it moves to new position
        link.Write((*last_angles, *LASER_RGB_OFF))

      last_flight = flight
      timing.append((time.time(), 5))

    if time.time() >= next_read:
      link.Read()  # simple ack message sent by servos
      next_read = time.time() + READ_DELAY_TIME
      timing.append((time.time(), 6))

    now = GetNow(json_desc_dict, additional_attr)
    timing.append((time.time(), 7))




                            <----SKIPPED LINES---->





01234567890123456789012345678901234567890123456789012345678901234567890123456789









639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679











                            <----SKIPPED LINES---->




  flight_present = False

  while not shutdown.value:
    timing.append((time.time(), 2))
    if not to_arduino_q.empty():
      flight, json_desc_dict, configuration, additional_attr = to_arduino_q.get(
          block=False)

      if 'test_servos' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos')
        link.Write((0, 0, *LASER_RGB_OFF))
        time.sleep(1)
        link.Write((90, 0, *LASER_RGB_OFF))
        time.sleep(1)
        link.Write((180, 0, *LASER_RGB_OFF))
        time.sleep(1)
        link.Write((270, 0, *LASER_RGB_OFF))

      timing.append((time.time(), 3))
      new_flight = DifferentFlights(flight, last_flight)
      timing.append((time.time(), 3.5))
      if new_flight:
        Log('Flight changed from %s to %s' % (
            messageboard.DisplayFlightNumber(last_flight),
            messageboard.DisplayFlightNumber(flight)
        ), ser=link)

        timing.append((time.time(), 4))
        # Turn off laser so that line isn't traced while it moves to new position
        link.Write((*last_angles, *LASER_RGB_OFF))

      last_flight = flight
      timing.append((time.time(), 5))

    if time.time() >= next_read:
      link.Read()  # simple ack message sent by servos
      next_read = time.time() + READ_DELAY_TIME
      timing.append((time.time(), 6))

    now = GetNow(json_desc_dict, additional_attr)
    timing.append((time.time(), 7))




                            <----SKIPPED LINES---->