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

Use correct variable for scope in i2c i/o errors #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions simbamon/mopiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def readConfig(self, input=0):
tries += 1
# unsucessfully read
if error != 0:
if e.errno == errno.EIO:
e.strerror = "I2C bus input/output error on read config"
raise e
if error.errno == errno.EIO:
error.strerror = "I2C bus input/output error on read config"
raise error
if tries == MAXTRIES or (self.maj == 3 and self.minr > 9 and data[0] == 255):
raise IOError(errno.ECOMM, "Communications protocol error on read config")
# behaivour changed at v3.10 to 5x0 so that 255 could serve as error detection
Expand Down Expand Up @@ -169,9 +169,9 @@ def writeConfig(self, battery, input=0):
tries += 1
# unsucessfully written
if error != 0:
if e.errno == errno.EIO:
e.strerror = "I2C bus input/output error on send config"
raise e
if error.errno == errno.EIO:
error.strerror = "I2C bus input/output error on send config"
raise error
if tries == MAXTRIES:
raise IOError(errno.ECOMM, "Communications protocol error on send config")

Expand Down Expand Up @@ -208,9 +208,9 @@ def baseReadWord(self, register):
tries += 1
# unsucessfully read
if error != 0:
if e.errno == errno.EIO:
e.strerror = "I2C bus input/output error on read word"
raise e
if error.errno == errno.EIO:
error.strerror = "I2C bus input/output error on read word"
raise error
if data == 0xFFFF:
raise IOError(errno.ECOMM, "Communications protocol error on read word")
return data
Expand Down Expand Up @@ -260,9 +260,9 @@ def writeWord(self, register, data):
tries += 1
# unsucessfully written
if error != 0:
if e.errno == errno.EIO:
e.strerror = "I2C bus input/output error on write word"
raise e
if error.errno == errno.EIO:
error.strerror = "I2C bus input/output error on write word"
raise error
if tries == MAXTRIES:
raise IOError(errno.ECOMM, "Communications protocol error on write word")

Expand Down