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

Add support for Royal PT-300 #14

Closed
lukevp opened this issue Dec 20, 2022 · 1 comment
Closed

Add support for Royal PT-300 #14

lukevp opened this issue Dec 20, 2022 · 1 comment

Comments

@lukevp
Copy link

lukevp commented Dec 20, 2022

I have a Royal PT-300 receipt printer, which supports both Classic Bluetooth and BLE. In order to make BLE work, I had to connect to the printer in setup mode and set the printer to "label mode". Once I did that, the printer started broadcasting as Printer_{first 4 hex of MAC address} i.e. Printer_AAAA. I added Printer_ to the list of valid printer names, and I was able to print images from my Mac using your library without any issues, so adding Printer_ to this list should be an easy way to add support for the Royal PT-300.

One thing I noticed is with larger images, I saw some buffer overrun issues. One image printed with part of it sheared off, and another printed garbled text. This usually happens when the source device's buffer is overwhelmed or when some data is written to the stream but is lost, which results in the printer's ESC/POS commands getting offset. I wonder if there's some issue with the BLE implementation where it's losing bits somewhere, or if this is specific to my printer (and likely a buffering issue)? I don't see the same issue using my library ESCPOS_NET and printing over WiFi to the printer, but the WiFi chip and the BLE chip may have different buffer sizes or something.

@bitbank2
Copy link
Owner

The data loss may be due to the writeWithoutResponse vs writeWithResponse. Some printers can't handle the data being sent too quickly and without responses. Try using writeWithResponse. It will probably go much slower, but the data will be reliable.

For the change to the library, please do a pull request - thanks

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

No branches or pull requests

2 participants