fix bug and add service file

1.修正列印大小無法寫入BUG
2.加入SYSTEMD系統服務腳本
This commit is contained in:
Jay 2017-09-01 20:17:08 +08:00
parent 8c2913e8d6
commit fc7425e97d
2 changed files with 12 additions and 1 deletions

View File

@ -66,7 +66,7 @@ class PrinterDevice {
case 's':
let size = tmp.substring(2)
let sarr = size.trim().split(',')
if (sarr != 2) break
if (sarr.length != 2) break
if(!isFinite(sarr[0]) || !isFinite(sarr[1])) break
sarr = sarr.map(t => Math.floor(t))
this._printer.size(sarr[0], sarr[1])

View File

@ -0,0 +1,11 @@
[Unit]
Description=BLE Printer Server
[Service]
ExecStart=/usr/bin/node /usr/local/node/ble-server/app.js
Restart=always
User=root
Environment="NODE_ENV=production"
[Install]
WantedBy=multi-user.target