arduino-2020-06-11-0818.py
01234567890123456789012345678901234567890123456789012345678901234567890123456789









927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967











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




    low_battery: current battery status; only passed so that we may identify changes.
    to_parent_q: multiprocessing queue, where instructions to send back to messageboard,
      if any, can be placed.
    link: the open serial link.

  Returns:
    A 2-tuple of potentially-updated display_mode, and low_battery.
  """
  # command might update a setting; see if there's a change, and if so, write to disk
  setting_change = False
  # remote sees T/F whereas messageboard.py & the web interface expect 'on'/absent key
  if command['setting_screen_enabled_bool']:
    command['setting_screen_enabled'] = 'on'

  log_lines = []
  setting_keys = ['setting_screen_enabled', 'setting_max_distance', 'setting_max_altitude',
                  'setting_on_time', 'setting_off_time', 'setting_delay']
  for key in setting_keys:
    if command.get(key) != configuration.get(key):
      log_lines.append(' |-->Setting %s updated from %s to %s' % (
          key, str(configuration[key]), str(command[key])))
      setting_change = True
      configuration[key] = command[key]
  if setting_change:
    settings_string = messageboard.BuildSettings(configuration)
    to_parent_q.put(('update_configuration', (settings_string, )))

  # a command might request info about flight to be (re)displayed, irrespective of
  # whether the screen is on; if so, let's put that message at the front of the message
  # queue, and delete any subsequent messages in queue because presumably the button
  # was pushed either a) when the screen was off (so no messages in queue), or b)
  # because the screen was on, but the last flight details got lost after other screens!
  if command['last_plane']:
    to_parent_q.put(('replay', ()))
    log_lines.append(' |-->Requested last flight (re)display')

  # a command might request a histogram; simply generate and save a histogram file to disk
  if command['histogram_enabled']:
    h_type = GetName(HISTOGRAM_TYPES, command['current_hist_type'])
    h_history = GetName(HISTOGRAM_HISTORY, command['current_hist_history'])
    to_parent_q.put(('histogram', (h_type, h_history)))




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





01234567890123456789012345678901234567890123456789012345678901234567890123456789









927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967











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




    low_battery: current battery status; only passed so that we may identify changes.
    to_parent_q: multiprocessing queue, where instructions to send back to messageboard,
      if any, can be placed.
    link: the open serial link.

  Returns:
    A 2-tuple of potentially-updated display_mode, and low_battery.
  """
  # command might update a setting; see if there's a change, and if so, write to disk
  setting_change = False
  # remote sees T/F whereas messageboard.py & the web interface expect 'on'/absent key
  if command['setting_screen_enabled_bool']:
    command['setting_screen_enabled'] = 'on'

  log_lines = []
  setting_keys = ['setting_screen_enabled', 'setting_max_distance', 'setting_max_altitude',
                  'setting_on_time', 'setting_off_time', 'setting_delay']
  for key in setting_keys:
    if command.get(key) != configuration.get(key):
      log_lines.append(' |-->Setting %s updated from %s to %s' % (
          key, str(configuration.get(key)), str(command[key])))
      setting_change = True
      configuration[key] = command[key]
  if setting_change:
    settings_string = messageboard.BuildSettings(configuration)
    to_parent_q.put(('update_configuration', (settings_string, )))

  # a command might request info about flight to be (re)displayed, irrespective of
  # whether the screen is on; if so, let's put that message at the front of the message
  # queue, and delete any subsequent messages in queue because presumably the button
  # was pushed either a) when the screen was off (so no messages in queue), or b)
  # because the screen was on, but the last flight details got lost after other screens!
  if command['last_plane']:
    to_parent_q.put(('replay', ()))
    log_lines.append(' |-->Requested last flight (re)display')

  # a command might request a histogram; simply generate and save a histogram file to disk
  if command['histogram_enabled']:
    h_type = GetName(HISTOGRAM_TYPES, command['current_hist_type'])
    h_history = GetName(HISTOGRAM_HISTORY, command['current_hist_history'])
    to_parent_q.put(('histogram', (h_type, h_history)))




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