Example #1
0
js::Value GCodeLibrary::arcCB(const js::Arguments &args) {
  Vector3D
    offset(args.getNumber("x"), args.getNumber("y"), args.getNumber("z"));
  double angle = args.getNumber("angle");
  plane_t plane = args.has("plane") ? (plane_t)args.getUint32("plane") : XY;

  ctx.machine.arc(offset, angle, plane);

  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();
}