Example #1
0
js::Value GCodeLibrary::cutCB(const js::Arguments &args) {
  Axes axes = ctx.machine.getPosition();
  parseAxes(args, axes, args.getBoolean("incremental"));
  ctx.machine.move(axes);

  return js::Value();
}
Example #2
0
js::Value GCodeLibrary::probeCB(const js::Arguments &args) {
  bool toward = args.getBoolean("toward");
  bool error = args.getBoolean("error");
  uint32_t index = args.getUint32("index");
  int port = args.getInt32("port");
  bool invert = args.getInt32("invert");

  if (port == -1) port = ctx.machine.findPort(PROBE, index);
  if (port != -1)
    ctx.machine.input(port, toward ^ invert ? STOP_WHEN_HIGH : STOP_WHEN_LOW,
                  error);

  Axes axes = ctx.machine.getPosition();
  parseAxes(args, axes);
  ctx.machine.move(axes);

  return js::Value();
}