Skip to content

Conversation

malcolm-sparkfun
Copy link
Collaborator

Remove useless returns brought up in #8

Copy link

@sfe-SparkFro sfe-SparkFro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Can you confirm the examples still run fine? If so, please merge this and make a v2.1 release.

@sfe-SparkFro
Copy link

Actually, let's hold on a v2.1 release until we look at #9 and other outstanding issues for low hanging fruit.

Copy link

@sfe-SparkFro sfe-SparkFro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

begin() actually should return a Boolean

Comment on lines 197 to -212
def begin(self):
"""!
Initialize the operation of the SerLCD module

@return **bool** Returns true if the initialization was successful, otherwise False.
"""
# set default settings, as defined in constructor
result0 = self.specialCommand(LCD_DISPLAYCONTROL | self._displayControl)
self.specialCommand(LCD_DISPLAYCONTROL | self._displayControl)
time.sleep(1)
result1 = self.specialCommand(LCD_ENTRYMODESET | self._displayMode)
self.specialCommand(LCD_ENTRYMODESET | self._displayMode)
time.sleep(1)
result2 = self.clearScreen()
self.clearScreen()
time.sleep(1)

return (bool(result0) & bool(result1) & bool(result2))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should first check is_connected(). If it fails, return False immediately. Otherwise, proceed as before and return True.

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

Successfully merging this pull request may close these issues.

2 participants