ESC/P 2: Add "Auto LF" DIP switch

This commit is contained in:
Lili1228
2026-02-06 20:02:32 +01:00
parent e953c9e1ca
commit 50b961e0b6

View File

@@ -265,6 +265,8 @@ typedef struct escp_t {
uint8_t ctrl;
PALETTE palcol;
uint8_t auto_lf;
} escp_t;
/* Codepage table, needed for ESC t ( */
@@ -1749,7 +1751,7 @@ process_char(escp_t *dev, uint8_t ch)
case 0x0d: /* Carriage Return (CR) */
dev->curr_x = dev->left_margin;
if (!dev->autofeed)
if (!dev->autofeed && !dev->auto_lf)
return 1;
fallthrough;
@@ -2214,7 +2216,9 @@ escp_init(const device_t *info)
dev->page_height = LETTER_PAGE_HEIGHT;
}
dev->dpi = dev->lang >= LANG_ESCP ? 360 : 240;
dev->auto_lf = device_get_config_int("auto_lf");
dev->dpi = dev->lang >= LANG_ESCP ? 360 : 240;
/* Create 8-bit grayscale buffer for the page. */
dev->page = (psurface_t *) malloc(sizeof(psurface_t));
@@ -2328,6 +2332,17 @@ static const device_config_t lpt_prt_escp_config[] = {
},
.bios = { { 0 } }
},
{
.name = "auto_lf",
.description = "Auto LF",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
// clang-format on