Skip to content

Fixed Flicker for Numbers when Autowrite is on #30

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 3 commits into from
Jan 30, 2019
Merged
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
9 changes: 5 additions & 4 deletions adafruit_ht16k33/segments.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ def print(self, value):

def __setitem__(self, key, value):
self._put(value, key)
if self._auto_write:
self.show()

def scroll(self, count=1):
"""Scroll the display by specified number of places."""
Expand All @@ -182,8 +184,6 @@ def _put(self, char, index=0):
character = ord(char) * 2 - 64
self._set_buffer(index * 2, CHARS[1 + character])
self._set_buffer(index * 2 + 1, CHARS[character])
if self._auto_write:
self.show()

def _push(self, char):
"""Scroll the display and add a character at the end."""
Expand All @@ -199,6 +199,8 @@ def _text(self, text):

def _number(self, number):
"""Display the specified decimal number."""
auto_write = self._auto_write
self._auto_write = False
string = "{}".format(number)
if len(string) > 4:
if string.find('.') > 4:
Expand All @@ -208,6 +210,7 @@ def _number(self, number):
if '.' in string:
places += 1
self._text(string[:places])
self._auto_write = auto_write

class Seg7x4(Seg14x4):
"""Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
Expand Down Expand Up @@ -257,8 +260,6 @@ def _put(self, char, index=0):
else:
return
self._set_buffer(index, NUMBERS[character])
if self._auto_write:
self.show()

class BigSeg7x4(Seg7x4):
"""Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
Expand Down