New serial control protocol with Python bindings

edited February 2014 in BlinkyTape Fun
Hey all. I was noodling with my BlinkyTape and I decided I was a little disappointed with the degree of control the default serial communications protocol offered, particularly not accepting brightness settings. So I figured rolling my own would be a neat little project; I wrote a new little firmware and some desktop-side (python) code to talk to it.

I ended up writing something I liked enough to find worth sharing, so I've put it up on GitHub with an MIT license. https://github.com/Nentuaby/blinkytape-advanced-protocol

Let me know if you use and enjoy it. Particularly let me know if you use it and ALMOST enjoy it except for a bug or feature weakness-- I'm looking for directions to improve it in. ;)

Comments

  • XanXan
    edited February 2014
    If the communication with this protocol gets interrupted, say, in the middle of setting colors for the whole strip, then the next connection to the serial port won't communicate properly, as commands will be interpreted as data bytes. You need to implement some sort of reset functionality in the client that will work regardless of the protocol state (spamming enough reset commands?) and call it on init maybe?

    (Upd.: Aha, I see you've got timeouts in the firmware, interesting)

    Also, I guess a command to set a single LED by its index would be appreciated.
  • Also, fact of life: if, on Linux using pySerial, you don't actually read out / flush diagnostic bytes you send from the firmware, after a certain amount the port will lock up and not work properly. I haven't personally tested your code, but it's highly probable that it will lock up.
  • Ah-- thanks for the info, I didn't know that. (On Windows it just starts dropping unconsumed bytes on the floor, it seems.) I'll fix that up then.

    And an indexed set command does seem logical, yeah. I'll add that too.
  • Stripped the unread writes and added an indexed set command.

    I also created a new demo that lets you pick a color for the BlinkyTape gui style.
Sign In or Register to comment.