Mike Sizov 6fc08fded2 Add command for printing 4 shades of grayscale image. 1 year ago
..
etc 182dedb675 devterm-printer.service add Restart=on-failure 1 year ago
usr 682c67aabb update devtem-socat.sh 2 years ago
.gitignore dc41ceb9ab add gitignore for idea 2 years ago
Makefile 5d0727108d bug fix,first line disappear fixed,next is clear extra points that appear incorrectly at bottom,and word-to-word alignment 2 years ago
NotoSansCJK-Regular.ttf 22e587aa7a ser_cache add utf8idx to store utf8 chars 2 years ago
README.md 0d92f26384 readme 2 years ago
config.h 6fc08fded2 Add command for printing 4 shades of grayscale image. 1 year ago
devterm_thermal_printer.c 6fc08fded2 Add command for printing 4 shades of grayscale image. 1 year ago
ftype.c 8339687f04 Esc ! n to switch mode ,GS ! n to set font size 2 years ago
ftype.h ab06c8f192 cjk with printer_set_font 2 years ago
logo.h 9278b6bad3 add schematic pdfs and firmware code 3 years ago
pcf_5x7-ISO8859-1_5x7.h 9278b6bad3 add schematic pdfs and firmware code 3 years ago
pcf_6x12-ISO8859-1_6x12.h 9278b6bad3 add schematic pdfs and firmware code 3 years ago
pcf_7x14-ISO8859-1_7x14.h 9278b6bad3 add schematic pdfs and firmware code 3 years ago
printer.c 6fc08fded2 Add command for printing 4 shades of grayscale image. 1 year ago
printer.h 6fc08fded2 Add command for printing 4 shades of grayscale image. 1 year ago
test.txt 205ebf2c2c user bbox_height to be the max size of rows,left with too wide linesheight problem 2 years ago
ttf_Px437_PS2thin1_8x16.h 9278b6bad3 add schematic pdfs and firmware code 3 years ago
ttf_Px437_PS2thin2_8x16.h 9278b6bad3 add schematic pdfs and firmware code 3 years ago
utf8-utils.c 22e587aa7a ser_cache add utf8idx to store utf8 chars 2 years ago
utf8-utils.h 22e587aa7a ser_cache add utf8idx to store utf8 chars 2 years ago
utils.c 31670a4428 indent code with clang-format, add rotation 2 years ago
utils.h 31670a4428 indent code with clang-format, add rotation 2 years ago

README.md

DevTerm Thermal printer

Console commands example

echo "Hello DevTerm" > /tmp/DEVTERM_PRINTER_IN

echo -e "Hello DevTerm\n\n\n\n\n\n" > /tmp/DEVTERM_PRINTER_IN

cat file.txt > /tmp/DEVTERM_PRINTER_IN

ncal -hb | tee > /tmp/DEVTERM_PRINTER_IN

Eos/Pos commands example

ESC ! n

set printer font index,n:0-4
echo -en "\x1d\x21\x0" > /tmp/DEVTERM_PRINTER_IN
echo -en "\x1d\x21\x1" > /tmp/DEVTERM_PRINTER_IN
echo -en "\x1d\x21\x2" > /tmp/DEVTERM_PRINTER_IN
echo -en "\x1d\x21\x3" > /tmp/DEVTERM_PRINTER_IN
echo -en "\x1d\x21\x4" > /tmp/DEVTERM_PRINTER_IN

ascii font size
  1. 0 = 8x16
  2. 1 = 5x7
  3. 2 = 6x12
  4. 3 = 7x14
  5. 4 = 8x16
unicode font size
  1. 0 = 12x12
  2. 1 = 14x14
  3. 2 = 16x16
  4. 3 = 18x18
  5. 4 = 20x20

https://github.com/clockworkpi/DevTerm/blob/81addc7f4ba1eb4acb2f59fb1fef70386dbe1f0d/Code/thermal_printer/devterm_thermal_printer.c#L381

DC2 # n

n:0-F, set printer printing density

echo -en "\x12\x23\x8" > /tmp/DEVTERM_PRINTER_IN

DC2 T

print the test page
echo -en "\x12\x54" > /tmp/DEVTERM_PRINTER_IN

UNICODE

Edit /usr/local/etc/devterm-printer ,point to an existed ttf file,eg: TTF=/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc

then restart devterm-printer.service with

sudo systemctl restart devterm-printer

devterm-printer daemon will auto detect the ttf font file

switch to UNICODE MODE

echo -en "\x1b\x21\x1" > /tmp/DEVTERM_PRINTER_IN  

switch back to default ASCII mode

echo -en "\x1b\x21\x0" > /tmp/DEVTERM_PRINTER_IN  

then

echo "日月火水木金土 ΕΙΝΑΙ Ο ΘΕΟΣ ΓΕΩΜΕΤΡΗΣ" > /tmp/DEVTERM_PRINTER_IN

to print unicode characters

ESC V n rotation command,unicode mode only

echo -en "\x1b\x56\x0" >/tmp/DEVTERM_PRINTER_IN disable rotation

echo -en "\x1b\x56\x1" >/tmp/DEVTERM_PRINTER_IN 90 degree
echo -en "\x1b\x56\x2" >/tmp/DEVTERM_PRINTER_IN 180 degree
echo -en "\x1b\x56\x3" >/tmp/DEVTERM_PRINTER_IN 270 degree

How to run it from source

  • make
  • sudo systemctl stop devterm-printer
  • sudo cp -rf devterm_thermal_printer.elf /usr/local/bin
  • sudo systemctl start devterm-printer