TinyG support for user parameters (e.g. #1, #2, etc.)

From the original Synthetos forum (2011–2025)

Started by RichL on in TinyG Support. 5 replies, last activity Aug 20, 2018.

#

Based on some experiments it appears that TinyG does not support user parameters in G-Code files. Is this correct or is there some trick? An example I tried is:

#1=10
#2=20
G0X#1Y#2

I also tried:

G0X[5+5]Y[10+10]

but that doesn't work either. It appears that neither the #1= form is allowed nor calculating a result in [].

Is there a way around this?

RichL

Staff #

I don't see user parameters listed here
https://github.com/synthetos/TinyG/wiki/Gcode-Support,
so likely not supported

I don't see a workaround in tinyG, you of course could develop a Gcode stream preprocessor., but not clear how that would help.

You are generating your own Gcode?

#

Thanks for confirming that. I'm writing g-code templates to control the scan path of an instrument we are building. We will need to insert the parameters (position, size and scan speed) into the template. We will just have to do a little more work without parameters.

RichL

#

I've just gone through the latest code and the following are the only GCode parameters parsed:

case 'G':
case 'M';
case 'T': SET_NON_MODAL (tool_select, (uint8_t)trunc(value));
case 'F': SET_NON_MODAL (feed_rate, value);
case 'P': SET_NON_MODAL (parameter, value);
case 'S': SET_NON_MODAL (spindle_speed, value);
case 'X': SET_NON_MODAL (target[AXIS_X], value);
case 'Y': SET_NON_MODAL (target[AXIS_Y], value);
case 'Z': SET_NON_MODAL (target[AXIS_Z], value);
case 'A': SET_NON_MODAL (target[AXIS_A], value);
case 'B': SET_NON_MODAL (target[AXIS_B], value);
case 'C': SET_NON_MODAL (target[AXIS_C], value);
case 'U': SET_NON_MODAL (target[AXIS_U], value);
case 'V': SET_NON_MODAL (target[AXIS_V], value);
case 'W': SET_NON_MODAL (target[AXIS_W], value);
case 'I': SET_NON_MODAL (arc_offset[0], value);
case 'J': SET_NON_MODAL (arc_offset[1], value);
case 'K': SET_NON_MODAL (arc_offset[2], value);
case 'R': SET_NON_MODAL (arc_radius, value);
case 'N': SET_NON_MODAL (linenum,(uint32_t)value);
case 'L': break;

I couldn't find any use of the '#' user parameter and my testing of the board itself

#100 = 50
G0 X#100

Resulted in X going to 100, not 50, so it looks like # is parsed as a value, not a variable.

I'll have a look at G2Core and see if it has a better alignment with NIST GCode.

#

Just had a look at G2Core and it adds Marlin compatibility, but still no support for # user params.

#

Thanks all for your answers, that confirms that I'm not missing something.

RichL

This topic is from the original forum (August 2018). Your reply starts a new discussion linked to it.

Reply

Different problem? Ask a new question

Back to TinyG Support or latest activity.