Skip to content

A module to abstract communications and control of the TinyG from node.

License

Notifications You must be signed in to change notification settings

giseburt/TinyG-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1bf5155 · Apr 27, 2017
May 17, 2016
Mar 16, 2016
Oct 19, 2014
Jul 17, 2013
Jul 17, 2013
Apr 27, 2017
Jul 29, 2013
Feb 13, 2015
Apr 27, 2017
Jul 26, 2016

Repository files navigation

TinyG-node

NOTICE This module has been renamed g2core-api and the tinyg npm module has been deprecated. Please use g2core-api instead.

A library module and commmand-line utility to abstract communications and control of a Synthetos TinyG (or a device running G2 Core). Written and maintained by the Synthetos core team.

Usage as a command line utility

First install the tinyg npm globally, so it'll be in your path:

  # If you run as root you can remove sudo
  sudo npm install -g tinyg

Now you can just execute the g command to get a full "terminal" experience to TinyG. If there is only one TinyG attached, then you don't need to provide any more parameters:

  my_host$ g
  Pos: X=0.00 Y=0.00 Z=0.00 A=0.00 Vel:0.00 (Ended)
  TinyG# g0x10
  Pos: X=10.00 Y=0.00 Z=0.00 A=0.00 Vel:0.00 (Stop)
  TinyG# ^C

Note: Use Ctrl-C to exit.

To send a file with the g utility, simply pass the filename of a gcode file, and it'll give you interactive progress bar:

  my_host$ g my_awesome_project.gcode
  Found command port: '/dev/cu.usbmodem14521' with data port '/dev/cu.usbmodem14523'.
  TinyG# Opening file 'my_awesome_project.gcode' for streaming.
  Progress |=========================================================______|  91%

If you wish to keep a log of the interaction between the TinyG and the g utility, then add the -g LOGFILE parameter to have it save the log in LOGFILE.

  my_host$ g my_awesome_project.gcode -g logfile.log
  Found command port: '/dev/cu.usbmodem14521' with data port '/dev/cu.usbmodem14523'.
  TinyG# Opening file 'my_awesome_project.gcode' for streaming.
  Progress |=========================================================______|  91%

Note: The g command line utility is still a little rough around the edges. It's still in active development, so update often!

##g(1) usage

Usage: q [gcode] [options]

gcode     Gcode file to run

Options:
   -p PORT, --port PORT        Name of serial port. Use -l to see the available ports.
   -d PORT, --dataport PORT    Name of data serial port. Use -l to see the available ports.
   -g LOGFILE, --log LOGFILE   Name of file to log to. Piping STDERR to a file will do the same thing (and trump this option).  [STDERR]
   -l, --list                  Name of data serial port. Use -l to see the available ports.

g TODO

  • Cleanup formatting output -- the status line often overwrites the prompt, leaving the promt in the wrong place.
  • Provide more control over the status line. Possibly go full-screen?

#Usage as a library

// Create a TinyG library object
var TinyG = require("tinyg");

// Then create a TinyG object called 'g'
var g = new TinyG();

Now you have a g object, you need to tell it to connect to a TinyG, then you can interact with the TinyG.

See ./docs/ReadMe.adoc