Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #112 [New/open] - Bug in PiFaceDigital driver preventing use of board parameter via config #9

Open
thortex opened this issue Sep 11, 2016 · 0 comments

Comments

@thortex
Copy link
Owner

thortex commented Sep 11, 2016

http://webiopi.trouch.com/issues/112/

Posted by andreas.riegg

The PiFaceDigital driver does not handle the board config parameter correct. It fails when providing a value via config file as the conversion from string to integer misses.

Proposed solution is:

... from webiopi.utils.types import toint ... class PiFaceDigital(): def init(self, board=0): self.board = toint(board) mcp = MCP23S17(0, 0x20 + self.board) mcp.writeRegister(mcp.getAddress(mcp.IODIR, 0), 0x00) # Port A as output mcp.writeRegister(mcp.getAddress(mcp.IODIR, 8), 0xFF) # Port B as input mcp.writeRegister(mcp.getAddress(mcp.GPPU, 0), 0x00) # Port A PU OFF mcp.writeRegister(mcp.getAddress(mcp.GPPU, 8), 0xFF) # Port B PU ON self.mcp = mcp

<<<<<

WebIOPi version used? => 0.7

Python version used? => 2/3

Distro used? (WebIOPi has only been tested on Raspbian Wheezy) => Raspbian Wheezy

Raspberry Pi board revision? (1 or 2) => n/a
Comment 1

Posted by andreas.riegg

Proposed solution was not correct, this one should work:

... from webiopi.utils.types import toint ...

class PiFaceDigital(): def init(self, board=0): board = toint(board) mcp = MCP23S17(0, 0x20 + board) mcp.writeRegister(mcp.getAddress(mcp.IODIR, 0), 0x00) # Port A as output mcp.writeRegister(mcp.getAddress(mcp.IODIR, 8), 0xFF) # Port B as input mcp.writeRegister(mcp.getAddress(mcp.GPPU, 0), 0x00) # Port A PU OFF mcp.writeRegister(mcp.getAddress(mcp.GPPU, 8), 0xFF) # Port B PU ON self.mcp = mcp self.board = board

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant