Skip to content

Commit

Permalink
[FIX] hw_escpos: opening pulse cashdrawer
Browse files Browse the repository at this point in the history
Some cashdrawers will not open when the command is send. This can be
solved by sending a longer opening pulse.

Used fix of newer library:
https://github.com/python-escpos/python-escpos/blob/0a89ee2b8610452f18b521af71b1ab1af7932894/escpos/constants.py#L40
Explanation for command:
http://www.beaglehardware.com/howtoprogramcashdrawer.html

closes odoo#32079

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
  • Loading branch information
Gert Pellin committed Mar 25, 2019
1 parent a95811e commit 6814f27
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions addons/hw_escpos/escpos/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
HW_INIT = '\x1b\x40' # Clear data in buffer and reset modes
HW_SELECT = '\x1b\x3d\x01' # Printer select
HW_RESET = '\x1b\x3f\x0a\x00' # Reset printer hardware
# Cash Drawer
CD_KICK_2 = '\x1b\x70\x00' # Sends a pulse to pin 2 []
CD_KICK_5 = '\x1b\x70\x01' # Sends a pulse to pin 5 []
# Cash Drawer (ESC p <pin> <on time: 2*ms> <off time: 2*ms>)
_CASH_DRAWER = lambda m, t1='', t2='': ESC + 'p' + m + chr(t1) + chr(t2)
CD_KICK_2 = _CASH_DRAWER('\x00', 50, 50) # Sends a pulse to pin 2 []
CD_KICK_5 = _CASH_DRAWER('\x01', 50, 50) # Sends a pulse to pin 5 []
# Paper
PAPER_FULL_CUT = '\x1d\x56\x00' # Full cut paper
PAPER_PART_CUT = '\x1d\x56\x01' # Partial cut paper
Expand Down

0 comments on commit 6814f27

Please sign in to comment.