-
Notifications
You must be signed in to change notification settings - Fork 10
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
base: main
Are you sure you want to change the base?
Conversation
NiimPrintX/nimmy/printer.py
Outdated
@@ -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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Tested successfully locally, thanks Loris! |
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. |
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
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.