bitbank2 / Thermal_Printer

Arduino library to draw text and graphics on BLE thermal printers
Apache License 2.0
367 stars 54 forks source link

Phomemo T02 support #16

Open DieterKoblenz opened 2 years ago

DieterKoblenz commented 2 years ago

Is there a way to get the Phomemo T02 supported?

NB: I'll be analyzing the T02 to see if it can be included, unless someone already got it working. From the outside it looks similar to the cat devices, but it's not quite the same. Generic android BLE thermal apps can use the device, so I've got hope.

bitbank2 commented 2 years ago

If it uses the "standard" thermal printer command set, then it should be easy to add. Do you have it in your possession? If so, can you get the BLE advertised name and service/characteristic UUIDs?

DieterKoblenz commented 2 years ago

UTF8 name: T02

Service UUIDs:

0000FF01-0000-1000-8000-00805F9B34FB notify 0000FF02-0000-1000-8000-00805F9B34FB write 0000FF03-0000-1000-8000-00805F9B34FB notify

bitbank2 commented 2 years ago

I pushed an untested change to add support for your printer. Please do a git clone of this repo and try it.

DieterKoblenz commented 2 years ago

const uint8_t ucBLETypes[] = {PRINTER_MTP2, PRINTER_MTP3, PRINTER_MTP3, PRINTER_CAT, PRINTER_CAT, PRINTER_CAT, PRINTER_CAT, PRINTER_CAT, PRINTER_PERIPAGEPLUS, PRINTER_PERIPAGE, PRINTER_PHOMEMO};

Arduino:1.8.15 (Windows 10), Board:"Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Thermal_Printer.cpp:60:178: error: 'PRINTER_PHOMEMO' was not declared in this scope

const uint8_t ucBLETypes[] = {PRINTER_MTP2, PRINTER_MTP3, PRINTER_MTP3, PRINTER_CAT, PRINTER_CAT, PRINTER_CAT, PRINTER_CAT, PRINTER_CAT, PRINTER_PERIPAGEPLUS, PRINTER_PERIPAGE, PRINTER_PHOMEMO};

                                                                                                                                                                  PRINTER_FOMEMO

exit status 1

'PRINTER_PHOMEMO' was not declared in this scope

Never mind, should change FOMEMO in PHOMEMO. Struggling with my ESP32 atm.

DieterKoblenz commented 2 years ago

It works , only the example prints too short, only half the arduino logo is printed.

Edit: I've done some more testing and indeed it seems it cuts out too early. So it stops printing the last lines, and it doesn't feed enough paper to cut it at the right length.

bitbank2 commented 2 years ago

Can you send a photo? Is it that it doesn't print the last lines or that it doesn't feed the last lines?

DieterKoblenz commented 2 years ago

IMG_20211121_222618 This is after running the program.

IMG_20211121_222626 This is the full printed picture.

bitbank2 commented 2 years ago

The fact that the top half printed successfully makes me think that you defined the graphics "back buffer" to be half the height it needs to be. Otherwise the pixels/logo would be garbled if something else went wrong. Can you provide the whole example code?

cqx931 commented 2 years ago

I also tried this and despite the bmp part, the tpPrint plain texts are also not printed.

raychmond commented 2 years ago

I also tried on my Phomemo M02S, the 304dpi version. I added my model to the szBLENames and ucBLETypes. It can connect successfully. My service UUID is different from T02, which is "fee7". I don't know how to get the characteristic UUID. But it seems that it doesn't matter what UUID I use.

The result is similar to others have seen, half arduino after several reboots. I couldn't print plain texts at all.

Do you have plan to support Phomemo models?

Thank you!

bitbank2 commented 2 years ago

I wasn't planning on buying any more BLE thermal printers, so the answer is probable no :(

raychmond commented 2 years ago

Thank you!

taylorjdlee commented 1 year ago

@raychmond @DieterKoblenz our repo https://github.com/vivier/phomemo-tools is aiming to support as Phomemo printers as possible if you can collect the packets for the T02 and M02s that'll be great