Why Can Z Height Be Set in Multiple Locations?
-
I'm new to RepRap firmware so am confused about how it handles z height.
In config.g is this line which sets the machine z maximum:
M208 X203.5 Y200 Z215 S0 ; set axis maxima
And in homall.g is this line:
G92 Z215 ; set Z position to axis maximum (you may want to adjust this)
And in homez.g is the same line:
G92 Z215 ; set Z position to axis maximum (you may want to adjust this)
I have some questions.
- Why must/can z be specified in three places?
- Must z be the same in each gcode file?
- What will happen if the z were different in one or more files?
It would seem better to me to set z in only place. Why not set it in one place like Marlin?
-
1
M208 sets the machine maximum, G92 sets the current position ... two different animals.
Any new gcode overrides any previous gcodes so you can change anything on the fly (unlike Marlin)2
No, they do not have to be the same if you have a good reason for them to be different. Note that if you change an setting, it will override the previous setting once it executes.
As an example, if you set G92 z215 in your config.g file and hen you have a macro that includes the line G92 Z0 then the z position has been redefined throughout. If you never execute the macro then z would not be redefined.
If you do redefine z in a macro, you want to be certain that you reverse that change before you exit the macro unless you specifically want to reassign the z position globally.3
see 2The whole idea of RRF is that values can be assigned on the fly unlike Marlin. It is a fundamentally different (and better) approach
-
In config.g you are setting the maximum limits for your printer.
In homeall.g the position is being set for all axis, you probably see similar things for X and Y.
In homez.g you are only doing the z axis. you will see a similar thing in homex.g and homey.g
The reason it looks this way is homeall.g did not call homex, homey, homez. It contains the commands from each of those.
To get an overview of what each command does, look here,
-
I assume you are using a Z min endstop switch, not a Z probe. If the minimum allowed Z is the same as the point where the endstop triggers, then you can specify that position in the M208 command only and leave out the G92 commands.
-
Hi,
When homing an axis using an end stop sensor, a G1 command is used with the H1 parameter, as you likely know.
The result is when the end stop sensor is activated the current position for the axis is set to the axis min/max (as set in M208) depending on the end stop sensor being at the min/max end of the axis.
For the set position to be correct the end stop sensor must trigger exactly at the min/max position - which often is not the case.
Thus the use of G92 to set the actual position.
Now I personally don't like having code spread around requiring me to keep multiple files in sync.
So my homeall.g file is simply this:
M98 P"homeZ.g"
M98 P"homeY.g"
M98 P"homeX.g"Each of the axis homing files contains the code needed to home the axis AND to insure the actual "post-home" position is set correctly.
Some folks home Z using a Z probe which is a different issue.
I home Z using an end stop sensor and use a Z probe for setting the Z=0 datum and creating the mesh compensation height map.
Frederick
-
Thank you everyone for the comments. I'll need to digest everything and get it into my head. Take care.