AndBondStyle / niimprint

Python library for Niimbot label printers. Supports D11/B21/B1 via bluetooth or USB.
MIT License
224 stars 32 forks source link

Fixed image being cut off by adding longer timeout delay. #27

Open jhnnyb opened 5 months ago

jhnnyb commented 5 months ago

fix(printer): Fixed images not being able to print fully.

This change "fixes" an issue of images not being able to print fully. This is what I've done to allow my printer to print 50x80mm labels with a fair amount of detail and density. Only drawback is that it increases print time. This might be more of a patch job than a fix, but I figured I share what I did to make consistent prints.

Issue: #3

AndBondStyle commented 5 months ago

@jhnnyb I'm ok to merge this as a temporary fix, if it helps at least some people. Can you please clarify some things:

jhnnyb commented 5 months ago

If this is something that is seen a a viable solution for now, I have ideas on how to parameterize the wait time, so you would not need to wait the full duration if you're printing on a small label. I will work on this sometime this week and update the PR.

Is the data being sent to the Niimbot in some sort of standard protocol, or something that was reverse engineered?

AndBondStyle commented 5 months ago
  • I see around a 5-8s increase

That doesn't sound good...

  • the timeout param makes it so it cuts out at different parts of the image

Sounds like it's roughly equivalent to increasing the sleep delay before end_print (did you try playing around with this?). Except if it's actually not the timing problem, but rather overflowing the internal printer buffer.

standard protocol, or something that was reverse engineered

Mostly reverse engineered, but I also have some decompiled info from the official java app, but haven't looked at it in detail yet

joeripper commented 5 months ago

I'm tested out timeout for 0.9, it works pretty good

jhnnyb commented 4 months ago

Hi all sorry for being MIA. I hope to have some time this weekend to look at the root cause for this. The quick fix outlined in this PR has been enough for me and my purposes, but it would be nice to see the route cause. I'll update with my findings sometime later this weekend.