Commits

Tino de Bruijn committed 97d832f

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.

Comments (0)

Files changed (2)

pyfirmata/pyfirmata.py

     """
     firmata_version = None
     firmware = None
+    firmware_version = None
     _command_handlers = {}
     _command = None
     _stored_data = []
     def _handle_report_firmware(self, *data):
         major = data[0]
         minor = data[1]
-        self.firmata_version = (major, minor)
+        self.firmware_version = (major, minor)
         self.firmware = two_byte_iter_to_str(data[2:])
 
 class Port(object):
         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))
+        self.assertEqual(self.board.firmware_version, (2, 1))
         
     # type                command  channel    first byte            second byte 
     # ---------------------------------------------------------------------------
     # 6  END_SYSEX (0xF7)
     def test_incoming_report_firmware(self):
         self.assertEqual(self.board.firmware, None)
-        self.assertEqual(self.board.firmata_version, None)
+        self.assertEqual(self.board.firmware_version, None)
         msg = [chr(pyfirmata.START_SYSEX), 
                chr(pyfirmata.REPORT_FIRMWARE), 
                chr(2), 
         self.board.sp.write(msg)
         self.board.iterate()
         self.assertEqual(self.board.firmware, 'Firmware_name')
-        self.assertEqual(self.board.firmata_version, (2, 1))
+        self.assertEqual(self.board.firmware_version, (2, 1))
         
     # type                command  channel    first byte            second byte 
     # ---------------------------------------------------------------------------
         self.board.sp.write(sysex)
         while len(self.board.sp):
             self.board.iterate()
-        self.assertEqual(self.board.firmata_version, (2, 1))
+        self.assertEqual(self.board.firmware_version, (2, 1))
         self.assertEqual(self.board.firmware, 'abc')
         
     def test_too_much_data(self):
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.