More docs

This commit is contained in:
Dejvino 2025-12-23 09:09:26 +01:00
parent 4ee3d12933
commit 05f06c8bf9

View File

@ -12,7 +12,13 @@ from jobs.maze import MazeJob
# Example: 0x04b8 is Epson. # Example: 0x04b8 is Epson.
USB_VENDOR_ID = 0x0525 USB_VENDOR_ID = 0x0525
USB_PRODUCT_ID = 0xa700 USB_PRODUCT_ID = 0xa700
# Input interface:
# `lsusb -vvv -d xxxx:xxxx | grep iInterface`
# iInterface 0
INPUT_ENDPOINT = 0x00 INPUT_ENDPOINT = 0x00
# Output interface:
# `lsusb -vvv -d xxxx:xxxx | grep bEndpointAddress | grep OUT`
# bEndpointAddress 0x01 EP 1 OUT
OUTPUT_ENDPOINT = 0x01 OUTPUT_ENDPOINT = 0x01
# Set to True to print to console instead of physical printer (for testing) # Set to True to print to console instead of physical printer (for testing)
@ -28,12 +34,12 @@ def get_printer():
try: try:
# Initialize USB printer # Initialize USB printer
# profile="TM-T88V" is a generic profile, works for many ESC/POS printers # Generic printer with custom settings:
p = Usb(USB_VENDOR_ID, USB_PRODUCT_ID, 0, INPUT_ENDPOINT, OUTPUT_ENDPOINT, profile="default") p = Usb(USB_VENDOR_ID, USB_PRODUCT_ID, 0, INPUT_ENDPOINT, OUTPUT_ENDPOINT, profile="default")
p.profile.profile_data['media']['width']['mm'] = 80 p.profile.profile_data['media']['width']['mm'] = 80
p.profile.profile_data['media']['width']['pixels'] = 512 p.profile.profile_data['media']['width']['pixels'] = 512
# Specific printer based on a profile. See https://python-escpos.readthedocs.io/en/latest/printer_profiles/available-profiles.html
# p = Usb(USB_VENDOR_ID, USB_PRODUCT_ID, 0, INPUT_ENDPOINT, OUTPUT_ENDPOINT, profile="TM-T88V") # p = Usb(USB_VENDOR_ID, USB_PRODUCT_ID, 0, INPUT_ENDPOINT, OUTPUT_ENDPOINT, profile="TM-T88V")
return p return p
except USBNotFoundError: except USBNotFoundError: