Change to printer RESET and STROBE operation.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Generic ESC/P Dot-Matrix printer.
|
* Implementation of the Generic ESC/P Dot-Matrix printer.
|
||||||
*
|
*
|
||||||
* Version: @(#)prt_escp.c 1.0.3 2018/10/06
|
* Version: @(#)prt_escp.c 1.0.4 2018/11/09
|
||||||
*
|
*
|
||||||
* Authors: Michael Dr<44>ing, <michael@drueing.de>
|
* Authors: Michael Dr<44>ing, <michael@drueing.de>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -192,6 +192,7 @@ typedef struct {
|
|||||||
uint16_t pitch;
|
uint16_t pitch;
|
||||||
|
|
||||||
uint8_t *pixels; /* grayscale pixel data */
|
uint8_t *pixels; /* grayscale pixel data */
|
||||||
|
uint8_t ctrl;
|
||||||
} psurface_t;
|
} psurface_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -1865,7 +1866,7 @@ write_ctrl(uint8_t val, void *priv)
|
|||||||
dev->select = 1;
|
dev->select = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((val & 0x04) == 0) {
|
if ((val & 0x04) && !(dev->ctrl & 0x04)) {
|
||||||
/* reset printer */
|
/* reset printer */
|
||||||
dev->select = 0;
|
dev->select = 0;
|
||||||
|
|
||||||
@@ -1874,13 +1875,15 @@ write_ctrl(uint8_t val, void *priv)
|
|||||||
|
|
||||||
//pclog("Write control %02x\n", val & 1);
|
//pclog("Write control %02x\n", val & 1);
|
||||||
|
|
||||||
if (val & 0x01) { /* STROBE */
|
if (!(val & 0x01) && (dev->ctrl & 0x01)) { /* STROBE */
|
||||||
/* Process incoming character. */
|
/* Process incoming character. */
|
||||||
handle_char(dev);
|
handle_char(dev);
|
||||||
|
|
||||||
/* ACK it, will be read on next READ STATUS. */
|
/* ACK it, will be read on next READ STATUS. */
|
||||||
dev->ack = 1;
|
dev->ack = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev->ctrl = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* printer mechanics. This would lead to a page being 66 lines
|
* printer mechanics. This would lead to a page being 66 lines
|
||||||
* of 80 characters each.
|
* of 80 characters each.
|
||||||
*
|
*
|
||||||
* Version: @(#)prt_text.c 1.0.3 2018/10/05
|
* Version: @(#)prt_text.c 1.0.4 2018/11/09
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -92,6 +92,7 @@ typedef struct {
|
|||||||
uint8_t h;
|
uint8_t h;
|
||||||
|
|
||||||
char *chars; /* character data */
|
char *chars; /* character data */
|
||||||
|
uint8_t ctrl;
|
||||||
} psurface_t;
|
} psurface_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -361,20 +362,22 @@ write_ctrl(uint8_t val, void *priv)
|
|||||||
dev->select = 1;
|
dev->select = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((val & 0x04) == 0) {
|
if ((val & 0x04) && !(dev->ctrl & 0x04)) {
|
||||||
/* reset printer */
|
/* reset printer */
|
||||||
dev->select = 0;
|
dev->select = 0;
|
||||||
|
|
||||||
reset_printer(dev);
|
reset_printer(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val & 0x01) { /* STROBE */
|
if (!(val & 0x01) && (dev->ctrl & 0x01)) { /* STROBE */
|
||||||
/* Process incoming character. */
|
/* Process incoming character. */
|
||||||
handle_char(dev);
|
handle_char(dev);
|
||||||
|
|
||||||
/* ACK it, will be read on next READ STATUS. */
|
/* ACK it, will be read on next READ STATUS. */
|
||||||
dev->ack = 1;
|
dev->ack = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev->ctrl = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user