summaryrefslogtreecommitdiff
path: root/addons/hw_escpos
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-03-29 16:10:42 +0100
committerChristophe Simonis <chs@odoo.com>2019-03-29 16:10:42 +0100
commit82f8c37f697e4453458cd549a3e8c81cd3766fa7 (patch)
tree8cdc6d8abe4fd4b73b0a02ac4e6d643f5619769c /addons/hw_escpos
parentf2c301557d1f16f83c369dee14176d74c76b1dd3 (diff)
parentec29b4d364860313fb8eb866b566d8ce56882438 (diff)
[MERGE] forward port branch saas-11.3 up to ec29b4d3648
Diffstat (limited to 'addons/hw_escpos')
-rw-r--r--addons/hw_escpos/escpos/constants.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/hw_escpos/escpos/constants.py b/addons/hw_escpos/escpos/constants.py
index 238e8bdbf0f..0000109a964 100644
--- a/addons/hw_escpos/escpos/constants.py
+++ b/addons/hw_escpos/escpos/constants.py
@@ -2,6 +2,9 @@
""" ESC/POS Commands (Constants) """
+# Control characters
+ESC = '\x1b'
+
# Feed control sequences
CTL_LF = '\x0a' # Print and line feed
CTL_FF = '\x0c' # Form feed
@@ -19,9 +22,10 @@ DLE_EOT_PAPER = '\x10\x04\x04'
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