javl / InstaxBLE

MIT License
54 stars 6 forks source link

Improve the way script waits for printer #11

Open javl opened 1 year ago

javl commented 1 year ago

The way this script works is that we send a message to the printer, and receive a response in a listener function, which then triggers sending the next message to the printer.

Problem here is that Python thinks we're done as soon as we've send our message, and exists the script. To prevent this I've added an ugly hack by calling sleep(60), which keeps our script running for at least a minute. During this time the listener is still active and can respond to messages from the printer.

It would be great if we could somehow get rid of this hack and implement a better way of making sure we're done before exiting.

sidharthb0 commented 8 months ago

Implemented threading to help with this. A pull request has been created. Please test and give feedback on results.