Skip to content

Remove returns that don't do anything (addresses #8) #10

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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