Skip to content

Updating HT16K33 code to work with version 4.0.0 #58

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

Merged
merged 5 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions adafruit_featherwing/led_segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def print(self, value):
:type value: str or int or float

"""
# Attempt to round off so we can still display the value
if isinstance(value, float) and len(str(value)) > 5:
value = round(value)

self._segments.print(value)
self._segments.show()

Expand Down Expand Up @@ -97,8 +101,10 @@ def brightness(self):
Brightness returns the current display brightness.
0-15 = Dimmest to Brightest Setting
"""
return self._segments.brightness
return round(self._segments.brightness * 15)

@brightness.setter
def brightness(self, brightness):
self._segments.brightness = brightness
if not 0 <= brightness <= 15:
raise ValueError('Brightness must be a value between 0 and 15')
self._segments.brightness = brightness / 15
6 changes: 4 additions & 2 deletions adafruit_featherwing/matrix_featherwing.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,10 @@ def brightness(self):
Brightness returns the current display brightness.
0-15 = Dimmest to Brightest Setting
"""
return self._matrix.brightness
return round(self._matrix.brightness * 15)

@brightness.setter
def brightness(self, brightness):
self._matrix.brightness = brightness
if not 0 <= brightness <= 15:
raise ValueError('Brightness must be a value between 0 and 15')
self._matrix.brightness = brightness / 15