WebIOPi version used?
=> 0.7.1
Python version used?
=> 3.2
Raspberry Pi board revision? (1 or 2)
=> 2
Issue #48 added a new vref parameter to the
webiopi.devices.analog.mcp492X.MCP492X class but the 2 subclasses for MCP4921
and MCP4922 were not correctly updated to reflect this.
As a result trying to use either results in:
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 75, in <module>
main(sys.argv)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 69, in main
server = Server(port=port, configfile=configfile, scriptfile=scriptfile)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/server/__init__.py", line 66, in __init__
manager.addDevice(name, driver, args)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/devices/manager.py", line 28, in addDevice
dev = devClass()
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/devices/analog/mcp492X.py", line 52, in __init__
MCP492X.__init__(self, chip, 2)
TypeError: __init__() takes exactly 4 arguments (3 given)
The fix is simple; pass on the `vref` parameter to the base class:
class MCP4921(MCP492X):
def __init__(self, chip=0, vref=3.3):
MCP492X.__init__(self, chip, 1, vref)
class MCP4922(MCP492X):
def __init__(self, chip=0, vref=3.3):
MCP492X.__init__(self, chip, 2, vref)
Original issue reported on code.google.com by zopati...@gmail.com on 1 Aug 2015 at 12:51
Original issue reported on code.google.com by
zopati...@gmail.com
on 1 Aug 2015 at 12:51