01234567890123456789012345678901234567890123456789012345678901234567890123456789
51005101510251035104510551065107510851095110511151125113511451155116511751185119 51205121512251235124512551265127512851295130513151325133513451355136513751385139 |
<----SKIPPED LINES---->
with the attributes to follow thru.
Possible commands are updating a GPIO pin, replaying a recent flight to the board,
generating a histogram, or updating the saved settings.
Args:
q: multiprocessing queue provided to both the Arduino processes
flights: list of flights
configuration: dictionary of settings
message_queue: current message queue
next_message_time: epoch of the next message to display to screen
Returns:
A 2-tuple of the (possibly-updated) message_queue and next_message_time.
"""
while not q.empty():
command, args = q.get()
if command == 'pin':
UpdateStatusLight(*args)
elif command == 'replay':
# 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
# that we're no longer interested in
messageboard_flight_index = IdentifyFlightDisplayed(
flights, configuration, display_all_hours=True)
if messageboard_flight_index is not None:
message_queue = [m for m in message_queue if m[0] != FLAG_MSG_INTERESTING]
flight_message = CreateMessageAboutFlight(flights[messageboard_flight_index])
message_queue = [(FLAG_MSG_FLIGHT, flight_message)]
next_message_time = time.time()
elif command == 'histogram':
if not flights:
Log('Histogram requested by remote %s but no flights in memory' % str(args))
else:
<----SKIPPED LINES---->
|
01234567890123456789012345678901234567890123456789012345678901234567890123456789
510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141 |
<----SKIPPED LINES---->
with the attributes to follow thru.
Possible commands are updating a GPIO pin, replaying a recent flight to the board,
generating a histogram, or updating the saved settings.
Args:
q: multiprocessing queue provided to both the Arduino processes
flights: list of flights
configuration: dictionary of settings
message_queue: current message queue
next_message_time: epoch of the next message to display to screen
Returns:
A 2-tuple of the (possibly-updated) message_queue and next_message_time.
"""
while not q.empty():
command, args = q.get()
if command == 'pin':
UpdateStatusLight(*args)
msg= '|'.join(args) #TODO
Log(msg)
elif command == 'replay':
# 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
# that we're no longer interested in
messageboard_flight_index = IdentifyFlightDisplayed(
flights, configuration, display_all_hours=True)
if messageboard_flight_index is not None:
message_queue = [m for m in message_queue if m[0] != FLAG_MSG_INTERESTING]
flight_message = CreateMessageAboutFlight(flights[messageboard_flight_index])
message_queue = [(FLAG_MSG_FLIGHT, flight_message)]
next_message_time = time.time()
elif command == 'histogram':
if not flights:
Log('Histogram requested by remote %s but no flights in memory' % str(args))
else:
<----SKIPPED LINES---->
|