synthetos / node-g2core-api

NodeJS host communications, API and command line interface for g2 CNC system
GNU General Public License v2.0
8 stars 6 forks source link

Not working for Ubunto and Node version 8.9.1 #2

Closed tomasBjornfot closed 6 years ago

tomasBjornfot commented 6 years ago

(node:11888) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'match' of undefined (node:11888) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

justinclift commented 6 years ago

As a data point, a similar error message appears when running the g2 command on CentOS 7 x64:

$ g2 -l
(node:17128) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 1): ReferenceError: x is not defined

CentOS 7 seems to be using Node v6.x:

$ node --version
v6.12.3

As an initial workaround, passing the device name seems to help. For example, with both ports of an Arduino Due connected via USB, with the programming port as ttyACM0, and the data port as ttyACM1, it seems to like the data port:

$ g2 -p /dev/ttyACM1
Pos: X=0.00 Y=0.00 Z=0.00 A=0.00 Vel:0.00 (ALARM)
Pos: X=0.00 Y=0.00 Z=0.00 A=0.00 Vel:0.00 (Stop)
{"line":0,"posx":0,"posy":0,"posz":0,"feed":0,"vel":0,"momo":0,"stat":3}
g2#

G-Code seems to be accepted from there. eg:

g2# G00 X10 Y10 Z10
Pos: X=1.97 Y=1.97 Z=1.97 A=0.00 Vel:1732.05 (Running)
Pos: X=6.13 Y=6.13 Z=6.13 A=0.00 Vel:1732.05 (Running)
Pos: X=9.85 Y=9.85 Z=9.85 A=0.00 Vel:619.25 (Running)
Pos: X=10.00 Y=10.00 Z=10.00 A=0.00 Vel:0.00 (Stop)
Pos: X=10.00 Y=10.00 Z=10.00 A=0.00 Vel:0.00 (Stop)
{"line":0,"posx":10,"posy":10,"posz":10,"feed":0,"vel":0,"momo":0,"stat":3}

Control-C seems to quit:

g2# ## Received CTRL-C in State 'Stop' -- sending CTRL-D and exiting.
$

Hopefully that helps. :smile:

giseburt commented 6 years ago

This has been replaced with the more generic issue #8. Closing this as a duplicate (even though it was first) so the discussion will move to over there.

Thank you for bringing this up, and hopefully you’ll be able to test the updates once they’re release.