Skip to content

Commit 5b1d44f

Browse files
authored
Merge pull request #7 from sparkfun/v0.0.4
v0.0.4
2 parents f1f5a80 + 324e829 commit 5b1d44f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

qwiic_alphanumeric.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -965,19 +965,21 @@ def print(self, print_string):
965965
self.clear()
966966

967967
self.digit_position = 0
968+
string_index = 0
968969

969-
for i in range(0, min(len(print_string), self.number_of_displays * 4)):
970+
while string_index < len(print_string) and self.digit_position < (4 * self.number_of_displays):
970971
# For special characters like '.' or ':', do not increment the digit position
971-
if print_string[i] == '.':
972+
if print_string[string_index] == '.':
972973
self.print_char('.', 0)
973-
elif print_string[i] == ':':
974+
elif print_string[string_index] == ':':
974975
self.print_char(':', 0)
975976
else:
976-
self.print_char(print_string[i], self.digit_position)
977+
self.print_char(print_string[string_index], self.digit_position)
977978
# Record to internal list
978-
self.display_content[i] = print_string[i]
979+
self.display_content[self.digit_position] = print_string[string_index]
979980

980-
self.digit_position = self.digit_position + 1
981+
self.digit_position += 1
982+
string_index += 1
981983

982984
self.update_display()
983985

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# Versions should comply with PEP440. For a discussion on single-sourcing
5353
# the version across setup.py and the project code, see
5454
# http://packaging.python.org/en/latest/tutorial.html#version
55-
version='0.0.3',
55+
version='0.0.4',
5656

5757
description='SparkFun Electronics qwiic alphanumeric package',
5858
long_description=long_description,

0 commit comments

Comments
 (0)