Skip to content

Commit

Permalink
Added 'attention' method to MFDs for drawing the users attention to t…
Browse files Browse the repository at this point in the history
…he device.

Because who doesn't want their X52 to flash at them?
  • Loading branch information
kfsone committed Aug 23, 2014
1 parent e6f8141 commit 0e6c71c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import argparse # For parsing command line args.
import sys # Inevitably.
import time

######################################################################
# The thing I hate most about Python is the global lock. What kind
Expand Down Expand Up @@ -66,6 +67,12 @@ def display(self, line1, line2="", line3="", delay=None):
"""
pass

def attention(self, duration):
"""
Draw the user's attention.
"""
print("\a")


class X52ProMFD(DummyMFD):
"""
Expand All @@ -86,7 +93,17 @@ def finish(self):

def display(self, line1, line2="", line3="", delay=None):
self.page[0], self.page[1], self.page[2] = line1, line2, line3
if delay: import time; time.sleep(delay)
if delay: time.sleep(delay)

def attention(self, duration):
page = self.page
iterNo = 0
cutoff = time.time() + duration
while time.time() <= cutoff:
for ledNo in range(0, 20):
page.set_led(ledNo, (iterNo + ledNo) % 4)
iterNo += 1
time.sleep(0.02)

######################################################################
# Functions
Expand Down

0 comments on commit 0e6c71c

Please sign in to comment.