Benoît Allard avatar Benoît Allard committed b287133

improve display, make unimportant message take less place

Comments (0)

Files changed (2)

python/antprotocol/connection.py

-import usb
+import usb, os, sys
 
 class ANTConnection(object):
     """ An abstract class that represents a connection """
 def getConn():
     for conn in [bc() for bc in CONNS]:
         if conn.open():
-            print "Found %s base" % (conn.NAME,)
+            os.write(sys.stdout.fileno(), "\n%s: " % conn.NAME)
             return conn
     print "Failed to find a base"
     return None

python/antprotocol/protocol.py

 # Added to and untwistedized and fixed up by Kyle Machulis <kyle@nonpolynomial.com>
 #
 
-import struct, array, time
+import struct, array, time, os, sys
 from message import MessageIN, MessageOUT
 
 class ANTException(Exception):
     def receive_bdcast(self):
         # FitBit device initialization
         for tries in range(60):
-            print "Waiting for beacon"
+            os.write(sys.stdout.fileno(), '.')
             try:
                 msg = self._receive_message()
             except NoMessageException:
                continue
             if msg.id == 0x4E:
-                print "Got it."
+                os.write(sys.stdout.fileno(), '!')
                 return
         raise FitBitBeaconTimeout("Timeout waiting for beacon, will restart")
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.