Nick Raptis avatar Nick Raptis committed 634060b

Removed accepted patches, updated rest

Comments (0)

Files changed (9)

Available.diff

-# HG changeset patch
-# Parent e421765cc80307de1e8fd2cd4693635ed1f17c1e
-Function to query Board for available bytes.
-
-Since Board.iterate() blocks, this is useful.
-Also it's coherent with Arduino's Serial.available
-However, it returns a more pythonic 0 when there's
-nothing waiting instead of Arduino's C-like -1
-
-diff -r e421765cc803 -r b87536297995 pyfirmata/pyfirmata.py
---- a/pyfirmata/pyfirmata.py	Mon May 16 22:48:46 2011 +0300
-+++ b/pyfirmata/pyfirmata.py	Mon May 16 22:56:53 2011 +0300
-@@ -218,6 +218,9 @@
-             self.sp.write(byte)
-         self.sp.write(chr(END_SYSEX))
-         
-+    def available(self):
-+        return self.sp.inWaiting()
-+
-     def iterate(self):
-         """ 
-         Reads and handles data from the microcontroller over the serial port.
-diff -r e421765cc803 -r b87536297995 pyfirmata/util.py
---- a/pyfirmata/util.py	Mon May 16 22:48:46 2011 +0300
-+++ b/pyfirmata/util.py	Mon May 16 22:56:53 2011 +0300
-@@ -96,7 +96,7 @@
-     def run(self):
-         while 1:
-             try:
--                while self.board.iterate():
-+                while self.board.available():
-                     self.board.iterate()
-                 time.sleep(0.001)
-             except (AttributeError, serial.SerialException, OSError), e:

FirmwareString.diff

-# HG changeset patch
-# Parent 4ffd4fbde16a05ab6b4ee0f8d3edfb184717da1b
-Better way to get firmware string
-
-diff -r 4ffd4fbde16a -r e421765cc803 pyfirmata/pyfirmata.py
---- a/pyfirmata/pyfirmata.py	Sun Feb 20 14:18:56 2011 +0100
-+++ b/pyfirmata/pyfirmata.py	Mon May 16 22:48:46 2011 +0300
-@@ -95,6 +95,18 @@
-         lsb, msb = bytes
-         return msb << 7 | lsb
-         
-+    def two_byte_to_str(self, bytes):
-+        bytes = list(bytes)
-+        chars = []
-+        while bytes:
-+            lsb = bytes.pop(0)
-+            try:
-+                msb = bytes.pop(0)
-+            except IndexError:
-+                msb = 0x00
-+            chars.append(chr(self.received_as_two_bytes((lsb, msb))))
-+        return ''.join(chars)
-+
-     def setup_layout(self, board_layout):
-         """
-         Setup the Pin instances based on the given board-layout. Maybe it will
-@@ -288,7 +300,7 @@
-         major = data[0]
-         minor = data[1]
-         self.firmata_version = (major, minor)
--        self.firmware = ''.join([chr(x) for x in data[2:]]) # TODO this is more complicated, values is send as 7 bit bytes
-+        self.firmware = self.two_byte_to_str(data[2:])
- 
- class Port(object):
-     """ An 8-bit port on the board """

GetBoardBug.diff

-# HG changeset patch
-# Parent cc2fbead01b6384500b380c6bfd34a0a2154024b
-Pass parameters to Boards.
-
-Previously, all user-passed parameters were discarded.
-
-diff -r cc2fbead01b6 -r 651f06a045e5 pyfirmata/util.py
---- a/pyfirmata/util.py	Mon May 16 23:01:17 2011 +0300
-+++ b/pyfirmata/util.py	Mon May 16 23:04:43 2011 +0300
-@@ -81,7 +81,7 @@
-     will raise an IOError if it can't find a board, on a serial, or if it
-     finds more than one.
-     """
--    boards = Boards(base_dir='/dev/', identifier='tty.usbserial')
-+    boards = Boards(base_dir=base_dir, identifier=identifier)
-     if len(boards) == 0:
-         raise IOError, "No boards found in %s with identifier %s" % (base_dir, identifier)
-     elif len(boards) > 1:
 # HG changeset patch
-# Parent db0ca50bf30598e0748f68252b7fa42271d9bb3c
+# Parent fd2e8de2c99b4a563b8f1c13c092a2f2d86006ac
 Ignore build directory
 
-diff -r db0ca50bf305 -r 7d9e0b39cb80 .hgignore
---- a/.hgignore	Tue May 17 01:26:08 2011 +0300
-+++ b/.hgignore	Tue May 17 01:31:30 2011 +0300
+diff -r fd2e8de2c99b .hgignore
+--- a/.hgignore	Tue May 17 14:35:37 2011 +0300
++++ b/.hgignore	Tue May 17 14:36:28 2011 +0300
 @@ -9,3 +9,4 @@
  Firmata
  hardwareAbstraction

SeparateVersions.diff

 # HG changeset patch
-# Parent 71affbbdfb46f14cb5e4c54c500dc69d88823076
+# Parent cb5d071fad399ef8565e273565b820c2c3ad1cb1
 Separated Firmware and Firmata versions
 
 While StandardFirmata firmwares are versioned according
 to the Protocol version, the firmware version can
 actually be distinct from the firmata protocol version.
 
-diff -r 71affbbdfb46 -r db0ca50bf305 pyfirmata/pyfirmata.py
---- a/pyfirmata/pyfirmata.py	Tue May 17 00:08:41 2011 +0300
-+++ b/pyfirmata/pyfirmata.py	Tue May 17 01:26:08 2011 +0300
+diff -r cb5d071fad39 pyfirmata/pyfirmata.py
+--- a/pyfirmata/pyfirmata.py	Tue May 17 09:55:11 2011 +0200
++++ b/pyfirmata/pyfirmata.py	Tue May 17 14:25:04 2011 +0300
 @@ -60,6 +60,7 @@
      """
      firmata_version = None
      _command_handlers = {}
      _command = None
      _stored_data = []
-@@ -306,7 +307,7 @@
+@@ -292,7 +293,7 @@
      def _handle_report_firmware(self, *data):
          major = data[0]
          minor = data[1]
 -        self.firmata_version = (major, minor)
 +        self.firmware_version = (major, minor)
-         self.firmware = self.two_byte_to_str(data[2:])
+         self.firmware = two_byte_iter_to_str(data[2:])
  
  class Port(object):
-@@ -482,4 +483,4 @@
-             except ValueError:
-                 byte = chr(byte >> 7) # TODO send multiple bytes
-             self.board.sp.write(byte)
--        self.board.sp.write(chr(END_SYSEX))
-\ No newline at end of file
-+        self.board.sp.write(chr(END_SYSEX))
-diff -r 71affbbdfb46 -r db0ca50bf305 tests.py
---- a/tests.py	Tue May 17 00:08:41 2011 +0300
-+++ b/tests.py	Tue May 17 01:26:08 2011 +0300
-@@ -63,7 +63,7 @@
-             data += [ord(x), 0]
+diff -r cb5d071fad39 tests.py
+--- a/tests.py	Tue May 17 09:55:11 2011 +0200
++++ b/tests.py	Tue May 17 14:25:04 2011 +0300
+@@ -61,7 +61,7 @@
+         data = [2, 1] + str_to_two_byte_iter('Firmware_name')
          self.board._handle_report_firmware(*data)
          self.assertEqual(self.board.firmware, 'Firmware_name')
 -        self.assertEqual(self.board.firmata_version, (2, 1))
          
      # type                command  channel    first byte            second byte 
      # ---------------------------------------------------------------------------
-@@ -121,7 +121,7 @@
+@@ -119,7 +119,7 @@
      # 6  END_SYSEX (0xF7)
      def test_incoming_report_firmware(self):
          self.assertEqual(self.board.firmware, None)
          msg = [chr(pyfirmata.START_SYSEX), 
                 chr(pyfirmata.REPORT_FIRMWARE), 
                 chr(2), 
-@@ -132,7 +132,7 @@
+@@ -128,7 +128,7 @@
          self.board.sp.write(msg)
          self.board.iterate()
          self.assertEqual(self.board.firmware, 'Firmware_name')
          
      # type                command  channel    first byte            second byte 
      # ---------------------------------------------------------------------------
-@@ -175,7 +175,7 @@
+@@ -170,7 +170,7 @@
          self.board.sp.write(sysex)
          while len(self.board.sp):
              self.board.iterate()

TestFirmware7bit.diff

-# HG changeset patch
-# Parent f240bc4e31bba4a706a44ae59b36f022081c0aad
-tests: Updated Firmware tests for 7bit bytes
-
-diff -r f240bc4e31bb -r 6afee073fe8a tests.py
---- a/tests.py	Tue May 17 00:04:54 2011 +0300
-+++ b/tests.py	Tue May 17 00:06:21 2011 +0300
-@@ -58,7 +58,9 @@
-         
-     def test_handle_report_firmware(self):
-         self.assertEqual(self.board.firmware, None)
--        data = [2, 1] + [ord(x) for x in 'Firmware_name']
-+        data = [2, 1]
-+        for x in 'Firmware_name':
-+            data += [ord(x), 0]
-         self.board._handle_report_firmware(*data)
-         self.assertEqual(self.board.firmware, 'Firmware_name')
-         self.assertEqual(self.board.firmata_version, (2, 1))
-@@ -123,8 +125,10 @@
-         msg = [chr(pyfirmata.START_SYSEX), 
-                chr(pyfirmata.REPORT_FIRMWARE), 
-                chr(2), 
--               chr(1)] + [i for i in 'Firmware_name'] + \
--              [chr(pyfirmata.END_SYSEX)]
-+               chr(1)]
-+        for i in 'Firmware_name':
-+            msg += [i, chr(0)]
-+        msg += [chr(pyfirmata.END_SYSEX)]
-         self.board.sp.write(msg)
-         self.board.iterate()
-         self.assertEqual(self.board.firmware, 'Firmware_name')
-@@ -165,7 +169,9 @@
-         self.assert_serial(*sysex)
-         
-     def test_receive_sysex_message(self):
--        sysex = (chr(0xF0), chr(0x79), chr(2), chr(1), 'a', 'b', 'c', chr(0xF7))
-+        sysex = (chr(0xF0), chr(0x79), chr(2), chr(1),
-+         'a', chr(0), 'b', chr(0), 'c', chr(0),
-+         chr(0xF7))
-         self.board.sp.write(sysex)
-         while len(self.board.sp):
-             self.board.iterate()

TestMockupInWaiting.diff

-# HG changeset patch
-# Parent 651f06a045e52af82b28a1544e32404c1befd7e3
-tests: Add pyserial's inWaiting to mockup
-
-diff -r 651f06a045e5 -r f240bc4e31bb pyfirmata/mockup.py
---- a/pyfirmata/mockup.py	Mon May 16 23:04:43 2011 +0300
-+++ b/pyfirmata/mockup.py	Tue May 17 00:04:54 2011 +0300
-@@ -12,6 +12,8 @@
-     >>> s.write(chr(100))
-     >>> s.write('blaat')
-     >>> s.write(100000)
-+    >>> s.inWaiting()
-+    3
-     >>> s.read(2)
-     ['d', 'blaat']
-     >>> s.read()
-@@ -20,6 +22,8 @@
-     ''
-     >>> s.read(2)
-     ['', '']
-+    >>> s.inWaiting()
-+    0
-     >>> s.close()
-     """
-     def __init__(self, port, baudrate, timeout=0.02):
-@@ -49,6 +53,9 @@
-         else:
-             self.append(value)
-             
-+    def inWaiting(self):
-+        return len(self)
-+
-     def close(self):
-         self.clear()
-         

WaitAndInit.diff

-# HG changeset patch
-# Parent b87536297995a9e7f51b475f47c92bdf473aa94d
-Wait and iterate over initial firmata messages
-
-Specifically get Firmware and Port Init messages
-when openning a Board, instead of depending to the
-user to set up an iterator or loop.
-
-diff -r b87536297995 -r cc2fbead01b6 pyfirmata/pyfirmata.py
---- a/pyfirmata/pyfirmata.py	Mon May 16 22:56:53 2011 +0300
-+++ b/pyfirmata/pyfirmata.py	Mon May 16 23:01:17 2011 +0300
-@@ -67,14 +67,18 @@
-     
-     def __init__(self, port, layout, baudrate=57600, name=None):
-         self.sp = serial.Serial(port, baudrate)
--        # Allow 2 secs for Arduino's auto-reset to happen
--        # TODO Is this still necessary?
--        self.pass_time(2)
-+        # Allow 5 secs for Arduino's auto-reset to happen
-+        # Alas, Firmata blinks it's version before printing it to serial
-+        # For 2.3, even 5 seconds might not be enough.
-+        self.pass_time(5)
-         self.name = name
-         if not self.name:
-             self.name = port
-         self.setup_layout(layout)
--        # TODO Test if we get a firmware name and version, otherwise there 
-+        # Iterate over the first messages to get firmware data
-+        while self.available():
-+            self.iterate()
-+        # TODO Test whether we got a firmware name and version, otherwise there 
-         # probably isn't any Firmata installed
-         
-     def __str__(self):
-Available.diff
-TestMockupInWaiting.diff
-FirmwareString.diff
-TestFirmware7bit.diff
-WaitAndInit.diff
-GetBoardBug.diff
 SeparateVersions.diff
 IgnoreBuild.diff
 # Placed by Bitbucket
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.