Hi!
We've been debugging a problem we had with our Kiosks using Star printers the past few weeks.
Environment:
- Linux / Debian
- Printers:
Star TSP100 v1.3 ; Star TSP100 IIU v3.0
- Direct connection to
/dev/usb/lpX
- Setup:
npm i -g receiptio sharp
- Parameters:
receiptio -d /dev/usb/lpX -i -p stargraphic -m 3,2 -c 42 data.md
- Example data attached: data.md
Observed behavior:
- receiptio answers with
success almost immediately
- Printer does not react at all (no printing, no noise, no lights).
Solution:
We traced back the problem to a race condition when transforming a large ticket to graphics using sharp.
Here: https://github.com/receiptline/receiptio/blob/main/lib/receiptio.js#L521
Star printer can respond with a new status before the transform is finished, which will lead to state = 3 here: https://github.com/receiptline/receiptio/blob/main/lib/receiptio.js#L561
Our quickfix was to nullify drain = false before calling the async transform:
https://github.com/parody/receiptio/blob/features/star-printer-support/lib/receiptio.js#L524
This may apply to other printers as well, but we could only reproduce it with Star. Epson TM88 IV to VI had no problem in our experience.
--
Thank you very much for all the great work you're doing in this library.
Hi!
We've been debugging a problem we had with our Kiosks using Star printers the past few weeks.
Environment:
Star TSP100 v1.3;Star TSP100 IIU v3.0/dev/usb/lpXnpm i -g receiptio sharpreceiptio -d /dev/usb/lpX -i -p stargraphic -m 3,2 -c 42 data.mdObserved behavior:
successalmost immediatelySolution:
We traced back the problem to a race condition when transforming a large ticket to graphics using
sharp.Here: https://github.com/receiptline/receiptio/blob/main/lib/receiptio.js#L521
Star printer can respond with a new status before the
transformis finished, which will lead tostate = 3here: https://github.com/receiptline/receiptio/blob/main/lib/receiptio.js#L561Our quickfix was to nullify
drain = falsebefore calling the asynctransform:https://github.com/parody/receiptio/blob/features/star-printer-support/lib/receiptio.js#L524
This may apply to other printers as well, but we could only reproduce it with Star. Epson TM88 IV to VI had no problem in our experience.
--
Thank you very much for all the great work you're doing in this library.