From 71396e8ff1f92f70bf67584a9b65315229fedfb6 Mon Sep 17 00:00:00 2001 From: Dominic Radermacher Date: Sun, 11 Sep 2022 06:29:44 +0200 Subject: [PATCH] change init to first invalidate, then init (maybe needed for some ptouch models?) --- src/libptouch.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libptouch.c b/src/libptouch.c index 415a9ac..917edef 100644 --- a/src/libptouch.c +++ b/src/libptouch.c @@ -186,7 +186,11 @@ int ptouch_send(ptouch_dev ptdev, uint8_t *data, size_t len) int ptouch_init(ptouch_dev ptdev) { - char cmd[]="\x1b\x40"; /* 1B 40 = ESC @ = INIT */ + /* first invalidate, then send init command */ + uint8_t cmd[102]; + memset(cmd, 0, 100); + cmd[100] = 0x1b; /* ESC */ + cmd[101] = 0x40; /* @ */ return ptouch_send(ptdev, (uint8_t *)cmd, strlen(cmd)); }