Skip to content
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
13 changes: 7 additions & 6 deletions qwiic_alphanumeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class QwiicAlphanumeric(object):
colon_on_off = 0 # Tracks the on/off state of the colon segment
blink_rate = ALPHA_BLINK_RATE_NOBLINK # Tracks the current blinking status

display_RAM = [' '] * 16 * 4
display_RAM = [0] * 16 * 4
display_content = [' '] * (4 * 4 + 1)

def __init__(self, address=None, i2c_driver=None):
Expand Down Expand Up @@ -627,7 +627,7 @@ def display_on(self):

for i in range(1, self.number_of_displays + 1):
if self.display_on_single(i) == False:
status = false
status = False

return status

Expand Down Expand Up @@ -704,7 +704,8 @@ def set_decimal_on_off(self, display_number, turn_on_decimal):
self.decimal_on_off = self.ALPHA_DECIMAL_OFF
dat = 0x00

self.display_RAM[adr + (display_number - 1) * 16] = self.display_RAM[adr + (display_number - 1) * 16] | dat
self.display_RAM[adr + (display_number - 1) * 16] &= 0xFE
self.display_RAM[adr + (display_number - 1) * 16] |= dat
return self.update_display()

# ---------------------------------------------------------------------------------
Expand Down Expand Up @@ -801,7 +802,8 @@ def set_colon_on_off(self, display_number, turn_on_colon):
self.colon_on_off = self.ALPHA_COLON_OFF
dat = 0x00

self.display_RAM[adr + (display_number - 1) * 16] = self.display_RAM[adr + (display_number - 1) * 16] | dat
self.display_RAM[adr + (display_number - 1) * 16] &= 0xFE
self.display_RAM[adr + (display_number - 1) * 16] |= dat
return self.update_display()

# ---------------------------------------------------------------------------------
Expand Down Expand Up @@ -964,7 +966,7 @@ def print(self, print_string):

self.digit_position = 0

for i in range(0, len(print_string)):
for i in range(0, min(len(print_string), self.number_of_displays * 4)):
# For special characters like '.' or ':', do not increment the digit position
if print_string[i] == '.':
self.print_char('.', 0)
Expand All @@ -976,7 +978,6 @@ def print(self, print_string):
self.display_content[i] = print_string[i]

self.digit_position = self.digit_position + 1
self.digit_position = self.digit_position % (self.number_of_displays * 4)

self.update_display()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#version
version='0.0.2',
version='0.0.3',

description='SparkFun Electronics qwiic alphanumeric package',
long_description=long_description,
Expand Down