From 8b4357c5fc7ab973348900f32f1c3e29a4aee6f4 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 28 Sep 2025 17:03:19 -0600 Subject: [PATCH] feat: Add protosign script with send_sign for Vestaboard Co-authored-by: aider (gemini/gemini-2.5-pro) --- protosign.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/protosign.py b/protosign.py index e69de29..a976abf 100644 --- a/protosign.py +++ b/protosign.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from vestactrl import setup_digits, board_init_uart +import textwrap + +def send_sign(text): + """ + Wraps and sends text to the Vestaboard. + """ + COLS = 22 + ROWS = 6 + + # Wrap text to fit the board's width. + lines = textwrap.wrap(text, width=COLS) + + # Truncate if the message is too long for the board's height. + 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] + + # 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) + + +if __name__ == '__main__': + # Initialize communication with the board. + board_init_uart() + message = "This is a test of the protosign script. This message should wrap across multiple lines and be truncated if it is too long to fit on the display." + send_sign(message)