javl / InstaxBLE

MIT License
54 stars 6 forks source link

Improve speed #10

Open javl opened 1 year ago

javl commented 1 year ago

Multiple users have responded saying printing through this script is (much) slower than through the official app. I know the Android app uses bluetooth sockets, which in my tests seem way faster, but can't be used cross-platform.

Would be great to find a way to speed things up.

javl commented 7 months ago

To add to this: an alternative would be to at least be able to select what backend system to use, so platforms that do work with sockets can use those, while other platforms use the current (slower) method.

bezmi commented 7 months ago

I have an instax square link printer. I reverted to a982f165 in order to use the socket backend as I couldn't make the latest BLE-only version work via my linux device (that's a separate issue).

Wireshark logs between my android device and the printer show that the data is actually being sent in chunks of 9891 bytes, which would imply a chunkSize of 9880 (removing 10 bytes for the header and 1 for the checksum). Setting this as the chunkSize instead of 900 or 1808 works and results in faster printing.

javl commented 7 months ago

The current backend already takes chunksize into account based on the printer model, see types.py.
I still would like to have an option to use both backends, in which case it would be good to implement this in the socket part as well so thanks for the reminder.

bezmi commented 7 months ago

The current backend already takes chunksize into account based on the printer model, see types.py.

Yep. The current default for the square link is 1808. I tried 9891 which is what the app uses instead and it was way faster with the socket code. I'd assume that increasing chunkSize would have similar effects on the speed of the BLE code, but I couldn't get it to connect to test this.

javl commented 7 months ago

Sorry I completely misread your message! I thought you suggested using 1808.

Your new size could mean a huge improvement. I don’t have a square myself but maybe someone else could try. Thanks for letting me know!