Added B18 support (#6)

* Adding B18 support

* B18 work

* Removed some debugging print

* Update readme, remove extra example image

* Add extra printer models & density check

---------

Co-authored-by: AndBondStyle <[email protected]>
This commit is contained in:
Ryan Olds
2024-01-20 02:05:42 +03:00
committed by GitHub
co-authored by AndBondStyle
parent 2199e65588
commit 14237a9d05
2 changed files with 10 additions and 10 deletions
+7 -3
View File
@@ -11,7 +11,7 @@ from niimprint import BluetoothTransport, PrinterClient, SerialTransport
@click.option(
"-m",
"--model",
type=click.Choice(["b1", "b21", "d11"], False),
type=click.Choice(["b1", "b18", "b21", "d11", "d110"], False),
default="b21",
show_default=True,
help="Niimbot printer model",
@@ -73,11 +73,15 @@ def print_cmd(model, conn, addr, density, rotate, image, verbose):
port = addr if addr is not None else "auto"
transport = SerialTransport(port=port)
if model in ("b1", "b21"):
if model in ("b1", "b18", "b21"):
max_width_px = 384
if model == "d11":
if model in ("d11", "d110"):
max_width_px = 96
if model in ("b18", "d11", "d110") and density > 3:
logging.warning(f"{model.upper()} only supports density up to 3")
density = 3
image = Image.open(image)
if rotate != "0":
# PIL library rotates counter clockwise, so we need to multiply by -1