From 66398d4359bca32e1b2a3825e08150d45662c218 Mon Sep 17 00:00:00 2001 From: Tanner Date: Mon, 6 Oct 2025 00:52:52 +0100 Subject: [PATCH] Merge --- protoboard.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/protoboard.py b/protoboard.py index 9d1302f..a0b74c4 100644 --- a/protoboard.py +++ b/protoboard.py @@ -21,12 +21,28 @@ def send_sign(text): if len(lines) > ROWS: lines = lines[:ROWS] - # The board controller expects spaces to be replaced with `0 for a blank character. - board_lines = [line.replace(' ', '`0') for line in lines] + special_chars = { + ' ': '`0', + '\\w': '`1', # white + '\\r': '`2', # red + '\\o': '`3', # orange + '\\y': '`4', # yellow + '\\g': '`5', # green + '\\b': '`6', # blue + '\\v': '`7', # violet + '\\d': '`8', # degree + # '`9', # also degree + } + + for code, color in special_chars.items(): + lines = [line.replace(code, color) for line in lines] # setup_digits handles displaying the lines on the board. # It will also vertically center the block of text. - setup_digits(board_lines, left_to_right_swap=False, real_hw=True) + try: + setup_digits(lines, left_to_right_swap=False, real_hw=True) + except BaseException as e: + print "Error setting digits:" + str(e) def poll_and_display():