Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit 645eddb

Browse files
committed
Disable bitmap printing, too slow for printer to reliably recieve data.
1 parent cfcb164 commit 645eddb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

adafruit_thermal_printer/thermal_printer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,18 @@ def print_barcode(self, text, barcode_type):
297297
self._set_timeout((self._barcode_height + 40) * self._dot_print_s)
298298
self._column = 0
299299

300-
def print_bitmap(self, width, height, data):
300+
def _print_bitmap(self, width, height, data):
301301
"""Print a bitmap image of the specified width, height and data bytes.
302302
Data bytes must be in 1-bit per pixel format, i.e. each byte represents
303303
8 pixels of image data along a row of the image. You will want to
304304
pre-process your images with a script, you CANNOT send .jpg/.bmp/etc.
305305
image formats. See this Processing sketch for preprocessing:
306306
https://github.com/adafruit/Adafruit-Thermal-Printer-Library/blob/master/processing/bitmapImageConvert/bitmapImageConvert.pde
307+
NOTE: This is currently not working because it appears the bytes are
308+
sent too slowly and the printer gets confused with not enough data being
309+
sent to it in the expected time.
307310
"""
308-
assert len(data) >= ((width * height) // 8)
311+
assert len(data) >= (width // 8) * height
309312
row_bytes = (width + 7) // 8 # Round up to next byte boundary.
310313
row_bytes_clipped = min(row_bytes, 48) # 384 pixels max width.
311314
chunk_height_limit = 256 // row_bytes_clipped

0 commit comments

Comments
 (0)