npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

g2core-api

v2.0.3

Published

Node module for controlling g2core devices.

Downloads

2

Readme

g2core-api

g2core-api is a node library module (g2core-api) and a bundled commmand-line utility (g2) to abstract communications and control of a device running Synthetos g2core firmware. Written and maintained by the Synthetos core team.

Usage as a library

// Require "g2core-api" to get access to the G2coreAPI class
const G2coreAPI = require("g2core-api");

// Then create a g2core_api object, we'll call it 'g2' in our examples
var g2 = new G2coreAPI();

Now you have a g2 object, you need to tell it to connect to a g2core device, then you can interact with that device.

See ./docs/ReadMe.adoc for more documentation

Usage as a command line utility

Note: This is for advanced users and is experimental.

First install the g2core-api npm globally, so the g2 command will be in your path:

  # NOTE: You may need to use sudo or log in as root
  npm install -g `g2core-api`

Now you can just execute the g2 command to get a full "terminal" experience to g2core device.

Or, if you have already g2core-api installed and in your local node_modules, you can refer to it as node_modules/.bin/g2 instead.

If there is only one g2core device attached over USB, then you don't need to provide any more parameters:

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

Note: Use Ctrl-C to exit.

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

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

If you wish to keep a log of the interaction between the g2core and the g2 utility, then add the -L option to make a log file next to the gcode filename with .log added to the name, or -g LOGFILE parameter to have it save the log in LOGFILE.

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

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

g2(1) usage

Usage: g2 [gcode] [options]

gcode     Gcode file to run

Options:
   -p PORT, --port PORT        Name of serial port. Use -l to see the available
                                  ports. If omitted then it will attempt to
                                  auto-detect a g2core device over USB.
   -d PORT, --dataport PORT    Name of data-only serial port (optional).
                                  Use -l to see the available ports.
   -L                          Make or add to a a log file next to the gcode
                                  file with '.log' added to the filename.
   -g LOGFILE, --log LOGFILE   Log to LOGFILE.
                                  The last -L or -g will be honored.
   -l, --list                  List the available ports that can be detected.
                                  Note that this only lists USB devices.
   -v                          Raise the verbosity level of the command line.
                                  (Does not effect logging to file, which is
                                  always at full verbosity.)