Skip to content

Commit

Permalink
expose p_roc_hardware_version
Browse files Browse the repository at this point in the history
  • Loading branch information
jabdoa2 committed Sep 7, 2019
1 parent 6f06547 commit 7be95d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 9 additions & 2 deletions mpf/platforms/p_roc_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,21 @@ def initialize(self):
self.machine.variables.set_machine_var("p_roc_version", self.version)
'''machine_var: p_roc_version
desc: Holds the version number of the P-ROC or P3-ROC controller that's
desc: Holds the firmware version number of the P-ROC or P3-ROC controller that's
attached to MPF.
'''

self.machine.variables.set_machine_var("p_roc_revision", self.revision)
'''machine_var: p_roc_revision
desc: Holds the revision number of the P-ROC or P3-ROC controller
desc: Holds the firmware revision number of the P-ROC or P3-ROC controller
that's attached to MPF.
'''

self.machine.variables.set_machine_var("p_roc_hardware_version", self.hardware_version)
'''machine_var: p_roc_hardware_version
desc: Holds the hardware version number of the P-ROC or P3-ROC controller
that's attached to MPF.
'''

Expand Down
7 changes: 5 additions & 2 deletions mpf/tests/test_P3_Roc.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def setUp(self):
0x00: { # manager
0x00: 0, # chip id
0x01: 0x00020006, # version
0x03: 0x00FF, # dip switches
0x03: 0x01FF, # dip switches
},
0x02: { # switch controller
0x1000: 0xA3, # SW-16 Address 0 Reg 0
Expand Down Expand Up @@ -175,13 +175,16 @@ def test_platform(self):
self._test_steppers()

# test hardware scan
info_str = """Firmware Version: 2 Firmware Revision: 6 Hardware Board ID: 0
info_str = """Firmware Version: 2 Firmware Revision: 6 Hardware Board ID: 1
SW-16 boards found:
- Board: 0 Switches: 16 Device Type: A3 Board ID: 0
- Board: 1 Switches: 16 Device Type: A3 Board ID: 13
- Board: 2 Switches: 16 Device Type: A4 Board ID: 0
"""
self.assertEqual(info_str, self.machine.default_platform.get_info_string())
self.assertEqual(2, self.machine.variables["p_roc_version"])
self.assertEqual(6, self.machine.variables["p_roc_revision"])
self.assertEqual(1, self.machine.variables["p_roc_hardware_version"])

def _test_pulse(self):
self.assertEqual("PD-16 Board 1 Bank 1", self.machine.coils.c_test.hw_driver.get_board_name())
Expand Down

0 comments on commit 7be95d1

Please sign in to comment.