Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to specify per-machine default motor orientation #71

Open
oskay opened this issue Jan 11, 2016 · 0 comments
Open

Add ability to specify per-machine default motor orientation #71

oskay opened this issue Jan 11, 2016 · 0 comments

Comments

@oskay
Copy link
Collaborator

oskay commented Jan 11, 2016

Suppose that a given type of 2-axis XY machine normally has one or both of its axes oriented in the opposite direction than "conventional". It would be nice if the machine definition could encapsulate this.

A straightforward approach might be to specify the command in the machine definition (.ini) file as: movexy = "SM,%d,-%x,-%y".

However, this will not actually work because this block is interpreted by cmdstr as serialCommand(cmdstr('movexy', change));where that function is defined as

function cmdstr(name, values) {
  if (!name || !cncserver.bot.commands[name]) return ''; // Sanity check

  var out = cncserver.bot.commands[name];

  for(var v in values) {
    out = out.replace('%' + v, values[v]);
  }

  return out;
}

This function works well for many types of possible tweaks to the command strings. For example, it allows the X and Y coordinates to be swapped easily. However, this particular tweaked command string won't work with it: When the change values are negative, it would be interpreted somewhat like "SM,<duration>,--<abs(x change)>,--<abs(y change)>".

One approach would be to detect the "double negative" there and remove it. Another would be to forbid this "-%s" syntax, and add a separate option in the settings for default orientation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant