BMP in Thermal Printer

Post test messages here

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
hannon
 
Posts: 1
Joined: Fri Nov 08, 2013 5:09 am

BMP in Thermal Printer

Post by hannon »

After feeling quite stupid, I managed to print a logo.

Based tutorial >> http://learn.adafruit.com/mini-thermal- ... p-printing

The main problem is that the windows application (LCD Assistant) doesn't work as expected, it gets random values and ends the array with a ",".
The processing file (in the lib\examples) works as expected in Processing 1.5.1 in new versions (>2) it warns about some code errors (selecting file).

Image
(looks like png, but I had a monochromatic bmp )

LCD Assistant:

Code: Select all

 "{
0x00, 0x00, 0x00, 0x1B, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF0, 0x7F, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFC, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF,
0xFF, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x1F,
0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00,
0x01, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x80, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x03, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x07, 0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F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x7F,
0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00,
0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0x00,
0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF,
0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,
0xFF, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 
}; "
Processing:

Code: Select all

 "{
  0x00,0x00,0x00,0x1B,0xE0,0x18,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x3F,0xF0,0x7F,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x7F,0xFC,0xFF,0xF0,0x00,0x00,0x00,
  0x00,0x00,0x07,0xFF,0xFF,0xFF,0xF4,0x00,0x00,0x00,
  0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,
  0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,
  0x00,0x00,0x9F,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,
  0x00,0x01,0xDF,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,
  0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,
  0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
  0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,
  0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,
  0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,
  0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,
  0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,
  0x3F,0xFF,0xF7,0xFF,0xFF,0xFF,0xFD,0xFF,0xFF,0x00,
  0x7F,0xFF,0xBB,0x3F,0xFD,0xFF,0x7B,0xFF,0xFF,0x80,
  0xFF,0xEF,0xB0,0x00,0xFD,0xFF,0x73,0xFF,0xFF,0xC0,
  0xFD,0xE5,0x00,0x00,0xFD,0xFC,0x00,0xDF,0x7F,0xE0,
  0x00,0x00,0x00,0x00,0x7D,0x90,0x00,0x02,0x01,0xE0,
  0x00,0x00,0x00,0x00,0x0D,0x80,0x00,0x00,0x00,0x00,
  0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,
  0x3F,0x80,0x00,0x00,0x00,0x00,0x06,0x76,0x67,0xC0,
  0x1F,0xE7,0xEE,0xE0,0x00,0x00,0x0F,0xFF,0xFF,0x80,
  0x0F,0xEF,0xFF,0xFE,0x00,0x00,0x7F,0xFF,0xFF,0x00,
  0x03,0xFF,0xFF,0xFE,0x64,0x1F,0xFF,0xFF,0xFE,0x00,
  0x01,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,
  0x00,0xFF,0xFF,0xFD,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,
  0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,
  0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x00,
  0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,
  0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
  0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,
  0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,
  0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,
  0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,
  0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,
  0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,
  0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,
  0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,
  0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,
  0x00,0x00,0x01,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,
  0x00,0x00,0x00,0x7F,0xFF,0xFF,0xE0,0x00,0x00,0x00,
  0x00,0x00,0x00,0x17,0xFF,0xFB,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x67,0x78,0x00,0x00,0x00,0x00
};"
For further users... just use the processing way!!!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: BMP in Thermal Printer

Post by adafruit_support_mike »

The array returned by LCD Assistant was more or less correct, but it looks like there was a truncation problem. If you arrange the output so there are 9 items on each row, you can see most of the original image. It seems to be missing one byte worth of information along the right side of the image, and some extra stuff has crept in at the bottom of the array.

The final comma in the data is syntactically valid, and many programmers use a comma after the last item in a list as a defensive programming technique: arrays frequently get extended, and it's easy to forget to add a comma to what's already there before putting in the new data. A comma-terminated array definition is ready to accept more data as is.

Locked
Please be positive and constructive with your questions and comments.

Return to “Test Message Forum (closed)”