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):