test thermal code

This commit is contained in:
cuu 2022-05-21 05:57:03 +00:00
parent abeb662fba
commit 167b2f520e
3 changed files with 48 additions and 30 deletions

View File

@ -259,7 +259,7 @@ NULL
cfg->img->revert_bits = 0; cfg->img->revert_bits = 0;
cfg->align = ALIGN_LEFT; cfg->align = ALIGN_LEFT;
feed_pitch1(15, cfg->orient); print_lines8(NULL,15, cfg->orient);
cfg->align = ALIGN_CENTER; cfg->align = ALIGN_CENTER;
/* //selftest1 /* //selftest1
@ -285,7 +285,7 @@ NULL
} }
cfg->align = ALIGN_LEFT; cfg->align = ALIGN_LEFT;
feed_pitch1(32, cfg->orient); print_lines8(NULL,32, cfg->orient);
//--------------------------------------------- //---------------------------------------------
@ -308,7 +308,7 @@ NULL
} }
parse_serial_stream(cfg, 10); parse_serial_stream(cfg, 10);
// Serial.println(); // Serial.println();
feed_pitch1(48, cfg->orient); print_lines8(NULL,48, cfg->orient);
} }
printer_set_font_mode(cfg, FONT_MODE_0); printer_set_font_mode(cfg, FONT_MODE_0);
@ -328,7 +328,7 @@ NULL
} }
parse_serial_stream(cfg, 10); parse_serial_stream(cfg, 10);
// Serial.println(); // Serial.println();
feed_pitch1(48, cfg->orient); print_lines8(NULL,48, cfg->orient);
printer_set_font_mode(cfg, FONT_MODE_0); printer_set_font_mode(cfg, FONT_MODE_0);
printer_set_font(cfg, 0); printer_set_font(cfg, 0);
@ -347,7 +347,7 @@ NULL
} }
parse_serial_stream(cfg, 10); parse_serial_stream(cfg, 10);
// Serial.println(); // Serial.println();
feed_pitch1(28, cfg->orient); print_lines8(NULL,28, cfg->orient);
//------------------------------------------- //-------------------------------------------
@ -368,7 +368,7 @@ NULL
//------------------------------------------ //------------------------------------------
label_print_f(cfg, "Firmware version:", 0.1, ""); label_print_f(cfg, "Firmware version:", 0.1, "");
feed_pitch1(cfg->font->height, cfg->orient); print_lines8(NULL,cfg->font->height, cfg->orient);
//-------------------------------------------------------------- //--------------------------------------------------------------
printer_set_font_mode(cfg, FONT_MODE_0); printer_set_font_mode(cfg, FONT_MODE_0);
printer_set_font(cfg, 0); printer_set_font(cfg, 0);
@ -383,7 +383,7 @@ NULL
//----------------------------------- //-----------------------------------
// grid // grid
/* ENABLE_VH;
for(ch = 0;ch <16;ch++){ for(ch = 0;ch <16;ch++){
if(ch%2==0) if(ch%2==0)
j = 0xff; j = 0xff;
@ -401,9 +401,9 @@ NULL
print_dots_8bit_split(cfg,(uint8_t*)buf,48); print_dots_8bit_split(cfg,(uint8_t*)buf,48);
} }
} }
*/ DISABLE_VH;
//-------------------------------------------------------- //--------------------------------------------------------
feed_pitch1(cfg->font->height * 2, cfg->orient); print_lines8(NULL,cfg->font->height * 2, cfg->orient);
} }
void printer_set_font_mode(CONFIG *cfg, int mode) { void printer_set_font_mode(CONFIG *cfg, int mode) {
@ -499,16 +499,16 @@ void parse_cmd(CONFIG *cfg, uint8_t *cmd, uint8_t cmdidx) {
// ESC j n // ESC j n
if (cmd[0] == ASCII_ESC && cmd[1] == 0x4a) { if (cmd[0] == ASCII_ESC && cmd[1] == 0x4a) {
if (print_lines8(cfg) == 0) { if (print_lines8(cfg,0,0) == 0) {
feed_pitch1(cmd[2], cfg->orient); print_lines8(NULL,cmd[2], cfg->orient);
} }
reset_cmd(); reset_cmd();
} }
// ESC d n // ESC d n
if (cmd[0] == ASCII_ESC && cmd[1] == 0x64) { if (cmd[0] == ASCII_ESC && cmd[1] == 0x64) {
if (print_lines8(cfg) == 0) { if (print_lines8(cfg,0,0) == 0) {
feed_pitch1(cmd[2] * cfg->font->height, cfg->orient); print_lines8(NULL,cmd[2] * cfg->font->height, cfg->orient);
} }
reset_cmd(); reset_cmd();
} }
@ -712,14 +712,14 @@ void parse_serial_stream(CONFIG *cfg, uint8_t input_ch) {
switch (input_ch) { switch (input_ch) {
case ASCII_LF: case ASCII_LF:
if (ser_cache.idx == 0) { if (ser_cache.idx == 0) {
feed_pitch1(cfg->font->height, cfg->orient); print_lines8(NULL,cfg->font->height, cfg->orient);
} }
print_lines8(cfg); print_lines8(cfg,0,0);
reset_cmd(); reset_cmd();
break; break;
case ASCII_FF: case ASCII_FF:
print_lines8(cfg); print_lines8(cfg,0,0);
reset_cmd(); reset_cmd();
break; break;
case ASCII_DC2: case ASCII_DC2:
@ -777,9 +777,9 @@ void parse_serial_stream(CONFIG *cfg, uint8_t input_ch) {
if (a >= MAX_DOTS) // got enough points to print if (a >= MAX_DOTS) // got enough points to print
{ {
if (cfg->font->mode == FONT_MODE_1 && cfg->face != NULL ) { if (cfg->font->mode == FONT_MODE_1 && cfg->face != NULL ) {
print_lines_ft(cfg); print_lines_ft(cfg,0,0);
} else { } else {
print_lines8(cfg); print_lines8(cfg,0,0);
} }
reset_cmd(); reset_cmd();
} }
@ -840,7 +840,7 @@ void print_lowpower(CONFIG *cfg) {
parse_serial_stream(cfg, 10); parse_serial_stream(cfg, 10);
reset_cmd(); reset_cmd();
feed_pitch1(128, cfg->orient); print_lines8(NULL,128, cfg->orient);
printer_set_font(cfg, 0); printer_set_font(cfg, 0);
PRINTF("%s\n", msg); PRINTF("%s\n", msg);

View File

@ -200,9 +200,11 @@ uint8_t feed_pitch1(uint64_t lines, uint8_t forward_backward) {
restor &= 0x01; restor &= 0x01;
if (lines > 0) { if (lines > 0) {
/*
MOTOR_ENABLE1; MOTOR_ENABLE1;
MOTOR_ENABLE2; MOTOR_ENABLE2;
ENABLE_VH; ENABLE_VH;
*/
while (lines > 0) { while (lines > 0) {
motor_stepper_pos2(pos); /* 0.0625mm */ motor_stepper_pos2(pos); /* 0.0625mm */
@ -213,10 +215,11 @@ uint8_t feed_pitch1(uint64_t lines, uint8_t forward_backward) {
lines--; lines--;
} }
/*
MOTOR_DISABLE1; MOTOR_DISABLE1;
MOTOR_DISABLE2; MOTOR_DISABLE2;
DISABLE_VH; DISABLE_VH;
*/
} else { } else {
return ERROR_FEED_PITCH; return ERROR_FEED_PITCH;
} }
@ -268,7 +271,6 @@ void print_dots_8bit(CONFIG *cfg, uint8_t *Array, uint8_t characters,
uint8_t i = 0, y = 0, MAX = MAXPIXELS; uint8_t i = 0, y = 0, MAX = MAXPIXELS;
uint8_t blank; uint8_t blank;
ENABLE_VH;
if (cfg->align == 0) { if (cfg->align == 0) {
while ((i < characters) && (i < MAX)) { while ((i < characters) && (i < MAX)) {
@ -325,7 +327,6 @@ void print_dots_8bit(CONFIG *cfg, uint8_t *Array, uint8_t characters,
feed_pitch1(feed_num, cfg->orient); feed_pitch1(feed_num, cfg->orient);
DISABLE_VH;
return; return;
} }
@ -414,7 +415,8 @@ uint16_t get_serial_cache_font_width(CONFIG *cfg) {
} }
// print with freetype font dots glyph // print with freetype font dots glyph
uint8_t print_lines_ft(CONFIG *cfg) { uint8_t print_lines_ft(CONFIG *cfg,int lines,int bf) {
uint8_t i, j, k; uint8_t i, j, k;
int8_t w; int8_t w;
uint8_t dot_line_data[MAXPIXELS]; uint8_t dot_line_data[MAXPIXELS];
@ -428,6 +430,12 @@ uint8_t print_lines_ft(CONFIG *cfg) {
int8_t left = ser_cache.idx; int8_t left = ser_cache.idx;
uint8_t rv; uint8_t rv;
if(cfg == NULL && lines > 0) {
ENABLE_VH;
feed_pitch1(lines,bf);
DISABLE_VH;
return 0;
}
line_bits = cfg->margin.width; line_bits = cfg->margin.width;
dot_line_idx = line_bits / 8; dot_line_idx = line_bits / 8;
dot_line_bitsidx = line_bits % 8; dot_line_bitsidx = line_bits % 8;
@ -587,10 +595,18 @@ uint8_t print_lines_ft(CONFIG *cfg) {
} }
} }
uint8_t print_lines8(CONFIG *cfg) { uint8_t print_lines8(CONFIG *cfg,int lines,int backforward) {
if(lines > 0 && cfg == NULL ){
ENABLE_VH;
feed_pitch1(lines,backforward);
DISABLE_VH;
return 0;
}
if (cfg->font->mode == FONT_MODE_1 && cfg->face!=NULL) { if (cfg->font->mode == FONT_MODE_1 && cfg->face!=NULL) {
return print_lines_ft(cfg); return print_lines_ft(cfg,0,0);
} }
uint8_t i, j, k; uint8_t i, j, k;
int8_t w; int8_t w;
@ -635,6 +651,7 @@ uint8_t print_lines8(CONFIG *cfg) {
lastj = 0; lastj = 0;
// DEBUG("left",left); // DEBUG("left",left);
ENABLE_VH;
while (left > 0) { while (left > 0) {
i = lastidx; i = lastidx;
while (row < current_font.height) { while (row < current_font.height) {
@ -737,7 +754,7 @@ uint8_t print_lines8(CONFIG *cfg) {
// Serial.println("print ever"); // Serial.println("print ever");
free(data); free(data);
DISABLE_VH;
return rv; return rv;
} }
@ -755,7 +772,7 @@ uint8_t print_image8(CONFIG *cfg) {
addr = 0; addr = 0;
rv = IsPaper(); rv = IsPaper();
ENABLE_VH;
while (y < height) { while (y < height) {
x = 0; x = 0;
while (x < cfg->img->width) { while (x < cfg->img->width) {
@ -782,6 +799,7 @@ uint8_t print_image8(CONFIG *cfg) {
cfg->img->num = 0; cfg->img->num = 0;
cfg->img->idx = 0; cfg->img->idx = 0;
cfg->img->width = 0; cfg->img->width = 0;
DISABLE_VH;
return rv; return rv;
} }

View File

@ -31,8 +31,8 @@ uint16_t read_adc(char *);
uint16_t temperature(); uint16_t temperature();
int glob_file(char *); int glob_file(char *);
uint16_t get_serial_cache_font_width(CONFIG *); uint16_t get_serial_cache_font_width(CONFIG *);
uint8_t print_lines_ft(CONFIG *); uint8_t print_lines_ft(CONFIG *,int ,int);
uint8_t print_lines8(CONFIG *); uint8_t print_lines8(CONFIG *,int,int);
uint8_t invert_bit(uint8_t a); uint8_t invert_bit(uint8_t a);