Skip to content

Spirit Board Improvements #2912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 17, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hello world
spirits are near
i <3 circuitpython
goodbye
19 changes: 13 additions & 6 deletions TFT_Spirit_Board/pyportal/spirit_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions TFT_Spirit_Board/pyportal/spirit_messages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hello world
spirits are near
i <3 circuitpython
goodbye
19 changes: 13 additions & 6 deletions TFT_Spirit_Board/pyportal_titano/spirit_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions TFT_Spirit_Board/pyportal_titano/spirit_messages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hello world
spirits are near
i <3 circuitpython
goodbye