diff --git a/TFT_Spirit_Board/esp32s3_s2_tft_featherwing_480x320/spirit_board.py b/TFT_Spirit_Board/esp32s3_s2_tft_featherwing_480x320/spirit_board.py index 18ec02828..9a889f608 100644 --- a/TFT_Spirit_Board/esp32s3_s2_tft_featherwing_480x320/spirit_board.py +++ b/TFT_Spirit_Board/esp32s3_s2_tft_featherwing_480x320/spirit_board.py @@ -240,6 +240,8 @@ def write_message(self, message, skip_spaces=True, step_size=6, delay=0.02): # loop over the words in the message for index, word in enumerate(message_words): print(f"index: {index}, word: {word}") + # send it to lowercase to get rid of capital letters + word = word.lower() # if the current word is one of the full words on the board if word in SpiritBoard.FULL_WORDS: @@ -269,12 +271,17 @@ def write_message(self, message, skip_spaces=True, step_size=6, delay=0.02): # loop over each character in the word for character in word: - # slide the planchette to the current characters location - self.slide_planchette(SpiritBoard.LOCATIONS[character], - delay=delay, step_size=step_size) - - # pause after we arrive - time.sleep(0.5) + # if the character is in our locations mapping + if character in SpiritBoard.LOCATIONS: + # slide the planchette to the current characters location + self.slide_planchette(SpiritBoard.LOCATIONS[character], + delay=delay, step_size=step_size) + + # pause after we arrive + time.sleep(0.5) + else: + # character is not in our mapping + print(f"Skipping '{character}', it's not on the board.") # if we are not skipping spaces, and we are not done with the message if not skip_spaces and index < len(message_words) - 1: diff --git a/TFT_Spirit_Board/esp32s3_s2_tft_featherwing_480x320/spirit_messages.txt b/TFT_Spirit_Board/esp32s3_s2_tft_featherwing_480x320/spirit_messages.txt new file mode 100644 index 000000000..7125df197 --- /dev/null +++ b/TFT_Spirit_Board/esp32s3_s2_tft_featherwing_480x320/spirit_messages.txt @@ -0,0 +1,4 @@ +hello world +spirits are near +i <3 circuitpython +goodbye \ No newline at end of file diff --git a/TFT_Spirit_Board/pyportal/spirit_board.py b/TFT_Spirit_Board/pyportal/spirit_board.py index 18ec02828..9a889f608 100644 --- a/TFT_Spirit_Board/pyportal/spirit_board.py +++ b/TFT_Spirit_Board/pyportal/spirit_board.py @@ -240,6 +240,8 @@ def write_message(self, message, skip_spaces=True, step_size=6, delay=0.02): # loop over the words in the message for index, word in enumerate(message_words): print(f"index: {index}, word: {word}") + # send it to lowercase to get rid of capital letters + word = word.lower() # if the current word is one of the full words on the board if word in SpiritBoard.FULL_WORDS: @@ -269,12 +271,17 @@ def write_message(self, message, skip_spaces=True, step_size=6, delay=0.02): # loop over each character in the word for character in word: - # slide the planchette to the current characters location - self.slide_planchette(SpiritBoard.LOCATIONS[character], - delay=delay, step_size=step_size) - - # pause after we arrive - time.sleep(0.5) + # if the character is in our locations mapping + if character in SpiritBoard.LOCATIONS: + # slide the planchette to the current characters location + self.slide_planchette(SpiritBoard.LOCATIONS[character], + delay=delay, step_size=step_size) + + # pause after we arrive + time.sleep(0.5) + else: + # character is not in our mapping + print(f"Skipping '{character}', it's not on the board.") # if we are not skipping spaces, and we are not done with the message if not skip_spaces and index < len(message_words) - 1: diff --git a/TFT_Spirit_Board/pyportal/spirit_messages.txt b/TFT_Spirit_Board/pyportal/spirit_messages.txt new file mode 100644 index 000000000..7125df197 --- /dev/null +++ b/TFT_Spirit_Board/pyportal/spirit_messages.txt @@ -0,0 +1,4 @@ +hello world +spirits are near +i <3 circuitpython +goodbye \ No newline at end of file diff --git a/TFT_Spirit_Board/pyportal_titano/spirit_board.py b/TFT_Spirit_Board/pyportal_titano/spirit_board.py index 18ec02828..9a889f608 100644 --- a/TFT_Spirit_Board/pyportal_titano/spirit_board.py +++ b/TFT_Spirit_Board/pyportal_titano/spirit_board.py @@ -240,6 +240,8 @@ def write_message(self, message, skip_spaces=True, step_size=6, delay=0.02): # loop over the words in the message for index, word in enumerate(message_words): print(f"index: {index}, word: {word}") + # send it to lowercase to get rid of capital letters + word = word.lower() # if the current word is one of the full words on the board if word in SpiritBoard.FULL_WORDS: @@ -269,12 +271,17 @@ def write_message(self, message, skip_spaces=True, step_size=6, delay=0.02): # loop over each character in the word for character in word: - # slide the planchette to the current characters location - self.slide_planchette(SpiritBoard.LOCATIONS[character], - delay=delay, step_size=step_size) - - # pause after we arrive - time.sleep(0.5) + # if the character is in our locations mapping + if character in SpiritBoard.LOCATIONS: + # slide the planchette to the current characters location + self.slide_planchette(SpiritBoard.LOCATIONS[character], + delay=delay, step_size=step_size) + + # pause after we arrive + time.sleep(0.5) + else: + # character is not in our mapping + print(f"Skipping '{character}', it's not on the board.") # if we are not skipping spaces, and we are not done with the message if not skip_spaces and index < len(message_words) - 1: diff --git a/TFT_Spirit_Board/pyportal_titano/spirit_messages.txt b/TFT_Spirit_Board/pyportal_titano/spirit_messages.txt new file mode 100644 index 000000000..7125df197 --- /dev/null +++ b/TFT_Spirit_Board/pyportal_titano/spirit_messages.txt @@ -0,0 +1,4 @@ +hello world +spirits are near +i <3 circuitpython +goodbye \ No newline at end of file