mirror of
https://github.com/clockworkpi/DevTerm.git
synced 2025-12-12 18:28:50 +01:00
add mtp03
This commit is contained in:
parent
649e727920
commit
a900c2fff5
@ -3,7 +3,7 @@ CC = gcc
|
||||
CFLAGS = -g -Wall
|
||||
LDFLAUS =
|
||||
INCLUDES =
|
||||
LIBS = -lwiringPi -lm
|
||||
LIBS = -lwiringPi -lm -lcrypt -lpthread -lrt
|
||||
|
||||
MAIN = devterm_thermal_printer.elf
|
||||
|
||||
|
||||
@ -134,9 +134,7 @@
|
||||
#define Fontrows ((uint8_t)24)
|
||||
#define FontColums ((uint8_t)16)
|
||||
|
||||
#define Maxdotsperline ((uint16_t)384)
|
||||
#define nextcharactercolum ((uint8_t)Fontrows/8) // = 3
|
||||
#define Maxcharacterperline ((uint16_t)Maxdotsperline/FontColums) // 384/16=24
|
||||
|
||||
|
||||
|
||||
@ -155,18 +153,26 @@
|
||||
#define ESC_STATE 1
|
||||
#define GET_IMAGE 2
|
||||
|
||||
|
||||
#define ALIGN_LEFT 0
|
||||
#define ALIGN_CENTER 1
|
||||
#define ALIGN_RIGHT 2
|
||||
|
||||
#define MAX_DOTS 384
|
||||
#define IMAGE_MAX 9224
|
||||
|
||||
#define BITS8 8
|
||||
#define PRINTER_BITS 384
|
||||
|
||||
|
||||
#define MAX_DOTS 384
|
||||
#define PRINTER_BITS MAX_DOTS
|
||||
#define MAXPIXELS 48
|
||||
|
||||
#ifdef MTP03
|
||||
#define MAX_DOTS 576
|
||||
#define PRINTER_BITS MAX_DOTS
|
||||
#define MAXPIXELS 72
|
||||
#endif
|
||||
|
||||
|
||||
//extract bits
|
||||
#define LAST(k,n) ((k) & ((1<<(n))-1))
|
||||
#define MID(k,m,n) LAST((k)>>(m),((n)-(m)))
|
||||
|
||||
@ -164,7 +164,7 @@ void label_print_f(CONFIG*cfg,char*label,float m,char*last){
|
||||
}
|
||||
|
||||
void label_print_i(CONFIG*cfg,char*label,int m,char*last){
|
||||
char buf[48];
|
||||
char buf[MAXPIXELS];
|
||||
uint8_t i,j;
|
||||
|
||||
if(m == -1)
|
||||
@ -173,7 +173,7 @@ void label_print_i(CONFIG*cfg,char*label,int m,char*last){
|
||||
sprintf(buf,"%d%s",m,last);
|
||||
|
||||
j = strlen(buf);
|
||||
i = 48-strlen(label)-j-1;
|
||||
i = MAXPIXELS-strlen(label)-j-1;
|
||||
|
||||
if(m == -1)
|
||||
sprintf(buf,"%s%*s%s",label,i,"",last);
|
||||
@ -198,7 +198,7 @@ void printer_test(CONFIG*cfg){
|
||||
uint8_t ch;
|
||||
uint16_t k;
|
||||
|
||||
char buf[48];
|
||||
char buf[MAXPIXELS];
|
||||
char *font_names[]={"8x16thin_1","5x7_ISO8859_1","6x12_ISO8859_1","7x14_ISO8859_1","8x16thin_2",NULL};
|
||||
|
||||
/*
|
||||
|
||||
@ -59,7 +59,8 @@ uint8_t IsPaper()
|
||||
{
|
||||
uint8_t status;
|
||||
uint8_t tmp;
|
||||
|
||||
return IS_PAPER;
|
||||
|
||||
if( millis() - printer_vps_time > 10) {
|
||||
ENABLE_PEM;
|
||||
if(ASK4PAPER==LOW) // * LOW is what we want**
|
||||
@ -240,26 +241,26 @@ uint8_t feed_pitch1(uint64_t lines, uint8_t forward_backward)
|
||||
|
||||
void print_dots_8bit_split(CONFIG*cfg,uint8_t *Array, uint8_t characters)
|
||||
{
|
||||
uint8_t i=0,y=0, MAX=48;
|
||||
uint8_t i=0,y=0, MAX=MAXPIXELS;
|
||||
uint8_t blank;
|
||||
uint16_t pts;
|
||||
uint8_t temp[48];
|
||||
uint8_t _array[48];
|
||||
uint8_t temp[MAXPIXELS];
|
||||
uint8_t _array[MAXPIXELS];
|
||||
pts = 0;
|
||||
memcpy(_array,Array,48);
|
||||
memcpy(_array,Array,MAXPIXELS);
|
||||
|
||||
while( (i< characters) && (i < MAX)) {
|
||||
|
||||
pts = pts + bits_number(Array[i]);
|
||||
|
||||
if(pts > cfg->max_pts) {
|
||||
memset(temp,0,48);
|
||||
memset(temp,0,MAXPIXELS);
|
||||
memcpy(temp,_array,i);
|
||||
print_dots_8bit(cfg,temp,characters,0);
|
||||
pts = bits_number(_array[i]);
|
||||
memset(_array,0,i);
|
||||
}else if(pts==cfg->max_pts) {
|
||||
memset(temp,0,48);
|
||||
memset(temp,0,MAXPIXELS);
|
||||
memcpy(temp,_array,i+1);
|
||||
print_dots_8bit(cfg,temp,characters,0);
|
||||
pts=0;
|
||||
@ -280,7 +281,7 @@ void print_dots_8bit_split(CONFIG*cfg,uint8_t *Array, uint8_t characters)
|
||||
|
||||
void print_dots_8bit(CONFIG*cfg,uint8_t *Array, uint8_t characters,uint8_t feed_num)
|
||||
{
|
||||
uint8_t i=0,y=0, MAX=48;
|
||||
uint8_t i=0,y=0, MAX=MAXPIXELS;
|
||||
uint8_t blank;
|
||||
|
||||
ENABLE_VH;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user