Skip to content
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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jhnnyb
Copy link

@jhnnyb jhnnyb commented May 28, 2024

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

@jhnnyb jhnnyb marked this pull request as draft May 28, 2024 04:49
@jhnnyb jhnnyb marked this pull request as ready for review May 28, 2024 04:49
@AndBondStyle
Copy link
Owner

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

  • Which printer / OS / connection method you're using
  • How bad is printing time affected?
  • Why do you think it helps? As far as I know, timeout param is only used for reading the data, so it's a little unclear why it works

@jhnnyb
Copy link
Author

jhnnyb commented May 29, 2024

  • Niimbot B1, Fedora Linux 40, USB
  • I see around a 5-8s increase, I'm assuming it is taking time to process the image/buffer alongside increasing the timeout time.
  • I'm assuming that somehow the connection times out while it is downloading data, which explains the cut off. Playing around with the timeout param makes it so it cuts out at different parts of the image. This is both based on time of timeout, and the density/complexity of the image.

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
Copy link
Owner

AndBondStyle commented May 29, 2024

  • 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
Copy link

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

@jhnnyb
Copy link
Author

jhnnyb commented Jul 12, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants