-
Notifications
You must be signed in to change notification settings - Fork 15
Add support for a TextPacket, as sent using the UART module in the Ad… #33
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
Conversation
…aFruit BlueTooth app
…aFruit BlueTooth app
…aFruit BlueTooth app
…aFruit BlueTooth app
…aFruit BlueTooth app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this feature @TonyLHansen! The changes to the library look good to me, and I was able to test them successfully with modified simpletest on:
Adafruit CircuitPython 7.1.0-beta.2 on 2021-12-10; Adafruit Circuit Playground Bluefruit with nRF52840
Board ID:circuitplayground_bluefruit
One request though if you are up for it: I think it would be great to include an example of using the new TextPacket type.
For testing I added this to the main loop inside of the simpletest script in the examples directory:
if isinstance(packet, TextPacket):
print("Received Text Packet:")
print(packet.text)
I think we should either add that to the simpletest in the repo, or add a new example script that shows the TextPacket usage. This will make it easier for folks to find this new feature and see how to use it.
@FoamyGuy, I decided to add a separate simpletest2.py example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused. The Bluefruit Connect app UART page does not send text packets with any kind of header. It simply sends raw text characters. (It has been a misconception in the past that it sent a particular packet type.) So there is no "text packet" type. But maybe I'm missing something.
OK, I see that if you find unknown characters, you turn it into a If we do want to send arbitrary text, then perhaps we should add a real text packet type, with a header, and update the app. Then we can send the packet with a length header or similar. |
@dhalbert, You are correct that it is possible for the packets to get out of sync if characters are missed. However:
Possibly most important from my point of view:
I don't disagree with your statement that updating the app to have a real "send text" capability would be useful. However I think that approach can be dealt with separately, and shouldn't prevent changes that work with the current version of the app. |
@TonyLHansen Thanks for the reply. I was missing the context of this change - I apologize if I seemed critical. Other people have asked for text packet functionality in the past, and were expecting a "!"-type packet. How about we call this I would be fine with this PR after that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience!
Updating https://github.com/adafruit/Adafruit_CircuitPython_HT16K33 to 4.1.8 from 4.1.7: > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#80 from Daviey/moar_lolz > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_RA8875 to 3.1.8 from 3.1.7: > Merge pull request adafruit/Adafruit_CircuitPython_RA8875#28 from adafruit/dhalbert-ustruct > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_SI5351 to 1.2.10 from 1.2.9: > Merge pull request adafruit/Adafruit_CircuitPython_SI5351#24 from adafruit/dhalbert-ustruct > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_BroadcastNet to 0.11.0 from 0.10.7: > Merge pull request adafruit/Adafruit_CircuitPython_BLE_BroadcastNet#23 from tekktrik/feature/add-sound-level > Merge pull request adafruit/Adafruit_CircuitPython_BLE_BroadcastNet#22 from tekktrik/feature/add-typing > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_BluefruitConnect to 1.2.0 from 1.1.10: > Merge pull request adafruit/Adafruit_CircuitPython_BluefruitConnect#33 from TonyLHansen/main > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_BoardTest to 1.2.8 from 1.2.7: > Merge pull request adafruit/Adafruit_CircuitPython_BoardTest#19 from tekktrik/feature/add-typing > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_CursorControl to 2.5.1 from 2.5.0: > Merge pull request adafruit/Adafruit_CircuitPython_CursorControl#30 from tekktrik/feature/add-typing > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_hashlib to 1.4.0 from 1.3.6: > Update README.rst > Merge pull request adafruit/Adafruit_CircuitPython_hashlib#17 from timhawes/main > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_Motor to 3.3.3 from 3.3.2: > Merge pull request adafruit/Adafruit_CircuitPython_Motor#59 from FoamyGuy/typing_input_error_catch Updating https://github.com/adafruit/Adafruit_CircuitPython_Register to 1.9.7 from 1.9.6: > Merge pull request adafruit/Adafruit_CircuitPython_Register#46 from adafruit/dhalbert-ustruct > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 1.10.3 from 1.10.2: > Merge pull request adafruit/Adafruit_CircuitPython_Requests#87 from tekktrik/main > update rtd py version
Add support for a TextPacket, as sent using the UART module in the AdaFruit BlueTooth app
This code provides an exception case to the Packet creation logic, similar to how the sample Arduino BLE code for the LED Glasses also has an exception case when the UART stream has data that does not start with a "!".