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

Implement Support for B1 Printer #6

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

LorisPolenz
Copy link

@LorisPolenz LorisPolenz commented Jul 22, 2024

As described in issue #5, there is an error when implementing sizes for the B1 printer.

Based on the browser implementation of @MultiMote (https://github.com/MultiMote/niimblue) newer version under (https://gitee.mmote.ru/MultiMote/niimblue-nightly) I was able to get the B1 printer working.

It looks like as if the commands that the B1 printer expects are not the same as the other printers.

By adding a new V2 function for

  • print_image
  • start_print
  • set_dimention

I could get basic prints running, the V2 implementations send some more data and don't require other packets to be sent. An end_print command, for instance, is not needed anymore in the V2 implementation. For better reliability while printing, I added a timeout of 2 seconds.

The implementation was tested on the following labels I have at hand:
50mm x 30mm
40mm x 30mm (T40*15/2R-460WHITE-HW)

I also enhanced parts of the debug logging and left it enabled for now.

I also had to change the rotation setting from 90 to 0 for me to get it working, if I find the time I am going to add that setting to the UI.

@LorisPolenz LorisPolenz marked this pull request as ready for review July 22, 2024 14:36
@@ -265,6 +290,10 @@ async def set_label_density(self, n):
async def start_print(self):
packet = await self.send_command(RequestCodeEnum.START_PRINT, b"\x01")
return bool(packet.data[0])

async def start_printV2(self):
packet = await self.send_command(RequestCodeEnum.START_PRINT, b"\x00\x01\x00\x00\x00\x00\x00")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First two bytes are indicating total page count of print. Here you send only one page. You should use variable. Otherwise set_dimensionV2 will not work for >1 pages.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I put that in for testing and then did not remove it.
Will add it later, thank you for the feedback.

@hadess
Copy link

hadess commented Oct 10, 2024

Tested successfully locally, thanks Loris!

@hadess
Copy link

hadess commented Oct 19, 2024

After a bit more testing, the print count doesn't seem to work. I wanted to print 2 copies of a label, it only printed one.

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