arduino-2020-07-31-1131.py
01234567890123456789012345678901234567890123456789012345678901234567890123456789









932933934935936937938939940941942943944945946947948949950951                   952953954955956957958959960961962963964965966967968969970971











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




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

      if 'test_servos_ordinal' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos_ordinal')
        ServoTestOrdinal(link, write_keys, write_format_tuple)
      elif 'test_servos_sweep' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos_sweep')
        ServoTestSweep(link, write_keys, write_format_tuple)
      elif 'test_servos_rgb' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos_rgb')
        ServoTestRgb(link, write_keys, write_format_tuple)
      elif 'test_servos_dim' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos_dim')
        ServoTestDim(
            link, write_keys, write_format_tuple,
            HexColorToRGBTuple(configuration['led_color']), gamma)




















      gamma = GetGamma(configuration)
      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
        message_dict = GenerateServoMessage(laser=LASER_OFF)
        message_tuple = DictToValueTuple(
            message_dict, write_keys, write_format_tuple)
        link.Write(message_tuple)

      last_flight = flight

    if time.time() >= next_read:
      bytes_read = []
      values_t = link.Read(bytes_read=bytes_read)




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





01234567890123456789012345678901234567890123456789012345678901234567890123456789









932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990











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




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

      if 'test_servos_ordinal' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos_ordinal')
        ServoTestOrdinal(link, write_keys, write_format_tuple)
      elif 'test_servos_sweep' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos_sweep')
        ServoTestSweep(link, write_keys, write_format_tuple)
      elif 'test_servos_rgb' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos_rgb')
        ServoTestRgb(link, write_keys, write_format_tuple)
      elif 'test_servos_dim' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos_dim')
        ServoTestDim(
            link, write_keys, write_format_tuple,
            HexColorToRGBTuple(configuration['led_color']), gamma)
      elif 'test_servos_position' in configuration:
        messageboard.RemoveSetting(configuration, 'test_servos_position')
        message_dict = GenerateServoMessage(
            laser=LASER_ALL,
            angles=(
                float(configuration.get('test_servos_position_azimuth'), 0),
                float(configuration.get('test_servos_position_altitude'), 0)),
            led=(0, 0, 0))
        message_tuple = DictToValueTuple(
            message_dict, write_keys, write_format_tuple)
        link.Write(message_tuple)
        time.sleep(5)








      gamma = GetGamma(configuration)
      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
        message_dict = GenerateServoMessage(laser=LASER_OFF)
        message_tuple = DictToValueTuple(
            message_dict, write_keys, write_format_tuple)
        link.Write(message_tuple)

      last_flight = flight

    if time.time() >= next_read:
      bytes_read = []
      values_t = link.Read(bytes_read=bytes_read)




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