labbots / NiimPrintX

NiimPrintX is a Python library designed to seamlessly interface with NiimBot label printers via Bluetooth. This library supports a range of models including D11/B21/B1, D110, and B18.
GNU General Public License v3.0
70 stars 4 forks source link

Implement Support for B1 Printer #6

Open LorisPolenz opened 1 month ago

LorisPolenz commented 1 month ago

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.