Skip to content

Commit

Permalink
Fixed error with MFD on termination
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Aug 31, 2014
1 parent 752a511 commit 5ce9d57
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 21 additions & 1 deletion mfdwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# Multi-Function Display wrappers
#

import time

class DummyMFD(object):
"""
Base class for the MFD drivers, implemented as no-ops so that
Expand All @@ -35,6 +37,13 @@ def display(self, line1, line2="", line3="", delay=None):
pass


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


class X52ProMFD(DummyMFD):
"""
Wrapper for the Saitek X52 Pro MFD.
Expand All @@ -59,5 +68,16 @@ 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)

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)


1 change: 1 addition & 0 deletions trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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

0 comments on commit 5ce9d57

Please sign in to comment.