MIgration from RRF2 to RRF3 problem commands
-
Hi, after resolved the wifi connection, I've upgrade the firmware from the last 2.x to the last stable RRF3 (firmware 3.4.5, DWC 3.4.5), but I've some trouble with the config.g file.
I've create a new custom configuration with the online configurator, and now I trying to edit for my printer.
Here the old config.g (for RRF2):
; Configuration file for Duet WiFi (firmware version 1.21) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v2.0.0 on Sun Sep 01 2019 14:49:44 GMT+0200 (Ora legale dell’Europa centrale) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"M3D400" ; set printer name M667 S1 ; select CoreXY mode ; automatic saving on power loss is not configured ; Drives M569 P5 S1 T3:3:3:3 ; Driver X M569 P6 S1 T3:3:3:3 ; Driver Y M569 P2 S0 ; Driver Z M569 P3 S0 ; Driver U M569 P4 S1 ; physical drive 4 goes forwards M584 X5 Y6 Z2:3 U1 E4:1 ; set drive mapping M350 Z16 U16 E32:32 I1 ; configure microstepping without interpolation M92 X200 Y200 Z640 U640 E294:294 ; set steps per mm M566 X1000 Y1000 Z12 E120:120 ; set maximum instantaneous speed changes (mm/min) M203 X24000 Y24000 Z600 E1200:1200 ; set maximum speeds (mm/min) M201 X1000 Y1000 Z20 E250:250 ; set accelerations (mm/s^2) M906 Z800 E800:800 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits M208 X0 Y0 Z0 U0 S1 ; set axis minima M208 X390 Y340 Z398 U398 S0 ; set axis maxima ; Endstops M574 X1 Y1 S1 ; set active high endstops and at max M574 Z1 U1 S1 ; set active high endstops and at max ; Z-Probe M558 P1 I0 H5 T6000 R0.8 F420 ; digital mode, NO/NC, delay, speed, not used as axis endstop G31 X0 Y0 Z-0.031 P547 ; X Y Z offsets. P=debounce interval (The debounce interval in ms smoothes the signal) M557 X15:375 Y20:320 S60 ; define mesh grid ; Heaters M305 P0 T100000 B4138 R4700 ; set thermistor + ADC parameters for heater 0 M143 H0 S120 ; set temperature limit for heater 0 to 120C M305 P1 T100000 B4138 R4700 ; set thermistor + ADC parameters for heater 1 M143 H1 S270 ; set temperature limit for heater 1 to 280C M305 P2 T100000 B4138 R4700 ; set thermistor + ADC parameters for heater 2 M143 H2 S270 ; set temperature limit for heater 2 to 280C M307 H2 A440.1 C102.9 D7.9 S0.80 V24.1 B0 ;set PID parameters extruder 2 M307 H0 A123.0 C732.0 D2.4 S1 ;set PID parameters bed ; Fans M106 P0 S0 I0 F500 H0 X0.3 T45 ; set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned on M106 P1 S1 I0 F500 H1 X0.3 T45 ; set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned on M106 P0 X0.3 H1 T45 ; set fan 2 value, PWM signal inversion and frequency. Thermostatic control is turned on ; Tools M563 P0 S"Principal" D0 H2 F2 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C ;M563 P1 S"DX nozzle" D1 H1 ; define tool 1 ;G10 P1 X14 Y0 Z0 ; set tool 1 axis offsets ;G10 P1 R0 S0 ; set initial tool 1 active and standby temperatures to 0C ; Network M552 S1 ; enable network M586 P0 S1 ; enable HTTP M586 P1 S0 ; disable FTP M586 P2 S0 ; disable Telnet ; Custom settings are not defined
And here the new one (RRF3):
; Configuration file for Duet WiFi (firmware version 3.3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"M3D400 - RRF3" ; set printer name M669 K1 ; select CoreXY mode ; Network M552 S1 ; enable network M586 P0 S1 ; enable HTTP M586 P1 S0 ; disable FTP M586 P2 S0 ; disable Telnet ; Drives M569 P5 S0 ; Driver X M569.1 P5 T2 C200 ; Driver X M569 P6 S0 ; Driver Y M569.1 P6 T2 C200 ; Driver Y M569 P2 S0 ; Driver Z M569 P3 S0 ; Driver U M569 P4 S1 ; Extruder 1 M569 P1 S1 ; Extruder 2 M584 X5 Y6 Z2:3 E1:4 ; set drive mapping M350 Z16 U16 E32:32 I1 ; configure microstepping with interpolation M92 X200 Y200 Z640 U640 E394:394 ; set steps per mm M566 X1000 Y1000 Z12 E120:120 ; set maximum instantaneous speed changes (mm/min) M203 X24000 Y24000 Z600 E1200:1200 ; set maximum speeds (mm/min) M201 X1000 Y1000 Z20 E250:250 ; set accelerations (mm/s^2) M906 Z800 E800:800 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits M208 X0 Y0 Z0 S1 ; set axis minima M208 X390 Y340 Z398 U398 S0 ; set axis maxima ; Endstops M574 X1 S1 P"xstop" ; endstop X M574 Y1 S1 P"ystop" ; endstop Y M574 Z1 S1 P"zstop" ; endstop Z M574 U1 S1 P"e0stop" ; endstop U ; Z-Probe M558 P5 C"^zprobe.in" H5 F420 T6000 ; set Z probe type to switch and the dive height + speeds G31 P500 X0 Y0 Z-0.031 ; set Z probe trigger value, offset and trigger height M557 X15:375 Y20:320 S60 ; define mesh grid ; Heaters M308 S0 P"bedtemp" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin bedtemp M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0 M307 H0 B1 S1.00 ; enable bang-bang mode for the bed heater and set PWM limit M140 H0 ; map heated bed to heater 0 M143 H0 S120 ; set temperature limit for heater 0 to 120C M308 S1 P"e1temp" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin e0temp M950 H1 C"e1heat" T1 ; create nozzle heater output on e0heat and map it to sensor 1 M307 H1 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit M143 H1 S270 ; set temperature limit for heater 1 to 270C M308 S2 P"e0temp" Y"thermistor" T100000 B4138 ; configure sensor 2 as thermistor on pin e0temp M950 H2 C"e0heat" T2 ; create nozzle heater output on e1heat and map it to sensor 2 M307 H2 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit M143 H2 S270 ; set temperature limit for heater 2 to 270C ; Fans M950 F0 C"fan0" Q500 ; create fan 0 on pin fan0 and set its frequency M106 P0 S0 H0 T45 ; set fan 0 value. Thermostatic control is turned on M950 F1 C"fan1" Q500 ; create fan 1 on pin fan1 and set its frequency M106 P1 S1 H1 T45 ; set fan 1 value. Thermostatic control is turned on ; Tools M563 P0 S"Principale" D0 H1 F0 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C M563 P1 S"Supporto" D1 H2 F0 ; define tool 1 G10 P1 X14 Y0 Z0 ; set tool 1 axis offsets G10 P1 R0 S0 ; set initial tool 1 active and standby temperatures to 0C ; Custom settings are not defined
as you can say it's a big 3d cartesian printer.
The first problem is with motors map: for example when I try to home the X axes, the bed go to home (the bed has two different motors with two different endstop). Why?
In order to clarify the map: I've a duet 2 wifi with the expasion board. Two motors (X and Y) are two clearpath connected to driver 5 and 6, while the two Z motoros are connected on 2 and 3 outpout and the two extruder are connected on 1 and 4 drivers.
The second is with the tools and heater. I've configurated the "Principale" with principal, but the temperature sensos is on the second (I've two extruder, only one is wired for now)..
Thanks,
Andrea
-
@alil2096 The first issue I can see is that M569.1 (and all the other M569 commands that are related to closed loop) is only supported on the Duet 3 1HCL closed loop board. It is not supported by other external closed loop drivers. So your config needs to look more like your old config for drivers 5 and 6. You should be able to configure an alarm for lost steps, and control the action to take on that alarm, though.
If that doesn't help, please post your homing macros.
For the tool, if you want heater 1 controlled by the temperature sensor connected to the second toolhead, you need to define the temperature sensor first, then map it to the heater, eg:
M308 S2 P"e0temp" Y"thermistor" T100000 B4138 M950 H1 C"e1heat" T2
It may help if you send
M98 P"config.g"
which will report any errors in your config.g in the console.Ian
-
@droftarts Thanks for the info, I diden't know the M98 .
Here the report:
M98 P"config.g" HTTP is enabled on port 80 FTP is disabled TELNET is disabled Error: Bad ccr for driver 5 Error: Bad ccr for driver 6 Endstop configuration: X: low end switch connected to pin xstop Y: low end switch connected to pin ystop Z: low end switch connected to pin zstop
What's mean "Bad ccr .."
-
@alil2096 it means you have a M569 command with a C parameter. You should not have that. All the M569 commands in your RRF3 config.g should be exactly the same as you had for RRF2.
The fact that RRF is reporting your endstop configuration indicates that you have a M574 command in in config.g that is not valid. I believe this is because you have a M574 command to declare a U endstop, but you have not created the U axis in M584.
-
@dc42 Ok, thanks. Now my configuration is yhis:
; Drives M569 P5 S0 T3:3:3:3 ; Driver X M569 P6 S0 T3:3:3:3 ; Driver Y M569 P2 S0 ; Driver Z M569 P3 S0 ; Driver U M569 P4 S1 ; Extruder 1 M569 P1 S1 ; Extruder 2 M584 X5 Y6 Z2:3 E1:4 ; set drive mapping M350 Z16 U16 E32:32 I1 ; configure microstepping with interpolation M92 X200 Y200 Z640 U640 E394:394 ; set steps per mm M566 X1000 Y1000 Z12 E120:120 ; set maximum instantaneous speed changes (mm/min) M203 X24000 Y24000 Z600 E1200:1200 ; set maximum speeds (mm/min) M201 X1000 Y1000 Z20 E250:250 ; set accelerations (mm/s^2) M906 Z800 E800:800 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout
But When I click on "Home Y" in DWC, the motoro moved is one of Z. With RRF2, with the configuration posted above, all worked perfectly.
Here my "homey.g"
; homey.g ; called to home the Y axis ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) G91 ; relative positioning G1 H2 Z5 F6000 ; lift Z relative to current position G1 H1 Y345 F1800 ; move quickly to Y axis endstop and stop there (first pass) G1 Y-5 F6000 ; go back a few mm G1 H1 Y345 F360 ; move slowly to Y axis endstop once more (second pass) G1 H2 Z-5 F6000 ; lower Z again G90 ; absolute positioning
Another strange things is that when i click on "Home X", the carello go to home, but the bed doesn't move (and in homex.g, the same that homey but with X coordinate, there is the movement for bed during home, and also only one pass id done, and non two with different speed)
-
@alil2096 your homey.g file is written to raise Z by 5mm before homing Y. Perhaps that is the Z movement you are seeing?
Does the Y motor move if you send G91 followed by e.g. G1 H2 Y10 to move the Y axis +10mm, or G1 H2 Y-10 to move it -10mm ?
-
Ok, maybe the movement is Z+5, but the Y axes doesn't move when I try to home Y
For the second point, If I send G91 and then G1 2 Y5 (safety first) I see an inclinated movement of axes, because only one motor of my Corexy is moving.
But both motors working because if I send the command for homing X, both motor work and the carell go correctly to home.
-
@alil2096 perhaps RRF is seeing the Y axis as already at the home position. I suggest you start the Object Model Browser plugin in DWC, then expand the sensors.endstops part to check and test the status of the X and Y homing switches.
-
@dc42 Yes, that's the problem!! Endstop Y is "trigged=true".
Wiring is ok, How I can invert the logic? Because if I change the S1 in S0 or S2, then I have "1=null" in Object Model Browser..
-
@alil2096 does it go to "not triggered" when you press it? If it doesn't, then you have a wiring issue.
-
@dc42 yes, it does
-
@alil2096 in that case, assuming your M574 commands in config.g are still as you posted earlier, your endstop switch is wired as normally-open, which is odd because your RRF2 config was for normally closed. Did you change the connections to the endstop switch? We recommend normally-closed.
-
@dc42 Absolutly no change of wirings.. and yes, all my endstops are in NC mode..
When I push the micro, the status change from "trigged=true" to "trigged=false"
-
@alil2096 please post your config.g file exactly as it is now.
-
@dc42 Here you are:
; Configuration file for Duet WiFi (firmware version 3.3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"M3D400 - RRF3" ; set printer name M669 K1 ; select CoreXY mode ; Network M552 S1 ; enable network M586 P0 S1 ; enable HTTP M586 P1 S0 ; disable FTP M586 P2 S0 ; disable Telnet ; Drives M569 P5 S0 T3:3:3:3 ; Driver X M569 P6 S0 T3:3:3:3 ; Driver Y M569 P2 S0 ; Driver Z M569 P3 S0 ; Driver U M569 P4 S1 ; Extruder 1 M569 P1 S1 ; Extruder 2 M584 X5 Y6 Z2:3 E1:4 ; set drive mapping M350 Z16 U16 E32:32 I1 ; configure microstepping with interpolation M92 X200 Y200 Z640 U640 E394:394 ; set steps per mm M566 X1000 Y1000 Z12 E120:120 ; set maximum instantaneous speed changes (mm/min) M203 X24000 Y24000 Z600 E1200:1200 ; set maximum speeds (mm/min) M201 X1000 Y1000 Z20 E250:250 ; set accelerations (mm/s^2) M906 Z800 E800:800 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits M208 X0 Y0 Z0 S1 ; set axis minima M208 X390 Y340 Z398 U398 S0 ; set axis maxima ; Endstops M574 X1 S1 P"xstop" ; endstop X M574 Y1 S1 P"ystop" ; endstop Y M574 Z1 S1 P"zstop" ; endstop Z M574 U1 S1 P"e0stop" ; endstop U ; Z-Probe M558 P5 C"^zprobe.in" H5 F420 T6000 ; set Z probe type to switch and the dive height + speeds G31 P500 X0 Y0 Z-0.031 ; set Z probe trigger value, offset and trigger height M557 X15:375 Y20:320 S60 ; define mesh grid ; Heaters M308 S0 P"bedtemp" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin bedtemp M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0 M307 H0 B1 S1.00 ; enable bang-bang mode for the bed heater and set PWM limit M140 H0 ; map heated bed to heater 0 M143 H0 S120 ; set temperature limit for heater 0 to 120C M308 S1 P"e1temp" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin e0temp M950 H1 C"e1heat" T1 ; create nozzle heater output on e0heat and map it to sensor 1 M307 H1 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit M143 H1 S270 ; set temperature limit for heater 1 to 270C M308 S2 P"e0temp" Y"thermistor" T100000 B4138 ; configure sensor 2 as thermistor on pin e0temp M950 H2 C"e0heat" T2 ; create nozzle heater output on e1heat and map it to sensor 2 M307 H2 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit M143 H2 S270 ; set temperature limit for heater 2 to 270C ; Fans M950 F0 C"fan0" Q500 ; create fan 0 on pin fan0 and set its frequency M106 P0 S0 H0 T45 ; set fan 0 value. Thermostatic control is turned on M950 F1 C"fan1" Q500 ; create fan 1 on pin fan1 and set its frequency M106 P1 S1 H1 T45 ; set fan 1 value. Thermostatic control is turned on ; Tools M563 P0 S"Principale" D0 H1 F0 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C M563 P1 S"Supporto" D1 H2 F0 ; define tool 1 G10 P1 X14 Y0 Z0 ; set tool 1 axis offsets G10 P1 R0 S0 ; set initial tool 1 active and standby temperatures to 0C ; Custom settings are not defined
What is not clear to me is why with the same configuration (same parameters), with RRF2 everything worked fine and with RRF3 the axes of the motors are reversed and the Y endstop is not recognised and the mdriver map is wrong.
Could there be some sort of cache to clear?
-
@alil2096 your M569 commands for X and Y have different S parameter values in your RRF 2 config. Change them in the RRF 3 config.
I think your y homing macro is wrong. You have all endstops set at the minimum end, but the Y move is to the maximum:
G1 H1 Y345 F1800 ; move quickly to Y axis endstop and stop there (first pass)
You haven’t posted your homeall to compare it with.
You can invert endstop logic using
!
in pin name, egM574 Y1 S1 P"!ystop"
. Though I think there is a wiring problem causing the inverted behaviour. The firmware does not invert just the Y axis by default!Ian
-
**I think your y homing macro is wrong**
THATS'S RIGHT!!!
With the new RRF3 the macro is that of the configurator, which was different from my RRF2.
Now I've modify the macros and X and Y work fine!!! I've copied the old macro in the RRF3. Easy.
Now for Z axes: I've two motor, this is the old configuration (RRF2):
; homez.g ; called to home the Z axis G91 ; relative positioning G1 H2 Z-1 F250 ; lift Z relative to current position ; split Z motor control to Z and U ; for it to work we have to show U (param P4) in the UI M584 Z2 U3 P4 ; show U dirver G1 H1 Z410 U410 F500 ; move Z down until the endstop is triggered M584 Z2:3 P3 ; hide U driver G92 Z410 ; set Z position to axis minimum (you may want to adjust this)
And now is the new (RRF3):
; homez.g ; called to home the Z axis ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) G91 ; relative positioning G1 H1 Z-1 F6000 ; lift Z relative to current position G1 H1 Z410 F1800 ; move Z up until the endstop is triggered G92 Z410 ; set Z position to axis maximum (you may want to adjust this) ; Uncomment the following lines to lift Z after probing ;G91 ; relative positioning ;G1 Z5 F100 ; lift Z relative to current position ;G90 ; absolute positioning
I've read that in RRF3 is no longer necessary to split the motor, that's right?
EDIT:
resolved also the Z axes. I've follow this guide:
https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors#Section_In_RepRapFirmware_Num_3(in the bottom of page), and now my zhome.g is:
; homez.g ; called to home the Z axis ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) G91 ; relative positioning G1 H1 Z-1 F6000 ; lift Z relative to current position G1 H1 Z-410 F1800 ; move Z up until the endstop is triggered G92 Z-410 ; set Z position to axis maximum (you may want to adjust this) ; Uncomment the following lines to lift Z after probing ;G91 ; relative positioning ;G1 Z5 F100 ; lift Z relative to current position ;G90 ; absolute positioning
-
@alil2096 you seem to have a Z probe configured, so you can use that for Z homing rather than endstops. You could move the endstops to the maximum end of the Z axis, so that the printer can recover in the event of a power loss, without having to home the bed in a way that may cause the hot end to hit the print.
You can use the Z probe to level the bed, rather than the endstops; see higher up the page you linked.
Ian
-
Another problem with homing...
When I use the "Home All" command, i've the error "G28 Error: G0/G1: insufficient axes homed", while if I use the single home buttons, I don't have this error.
Therefore, when a try to lunch a job with the start G-code only "G28", the print fails because I0ve se same error..
Here my HomeAll code:
; homeall.g ; called to home all axes ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) G91 ; relative positioning ;G1 H2 Z5 F6000 ; lift Z relative to current position G1 H1 X-395 Y-345 F3000 ; move quickly to X or Y endstop and stop there (first pass) G1 X5 Y5 F1800 ; go back a few mm G1 H1 X-10 Y-10 F360 ; move slowly to X axis endstop once more (second pass) G1 H1 Z410 F1800 ; move Z up until the endstop is triggered G92 Z410 ; set Z position to axis maximum (you may want to adjust this) G90 ; absolute position
Home X:
; homex.g ; called to home the X axis ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) G91 ; relative positioning ;G1 H2 Z5 F6000 ; lift Z relative to current position G1 H1 X-395 F3000 ; move quickly to X axis endstop and stop there (first pass) G1 X5 F1800 ; go back a few mm G1 H1 X-395 F360 ; move slowly to X axis endstop once more (second pass) ;G1 H2 Z-5 F6000 ; lower Z again G90 ; absolute positioning
Home Y:
; homey.g ; called to home the Y axis ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) G91 ; relative positioning ;G1 H2 Z5 F6000 ; lift Z relative to current position G1 H1 Y-345 F1800 ; move quickly to Y axis endstop and stop there (first pass) G1 Y5 F6000 ; go back a few mm G1 H1 Y-345 F360 ; move slowly to Y axis endstop once more (second pass) ;G1 H2 Z-5 F6000 ; lower Z again G90 ; absolute positioning
Home Z:
; homez.g ; called to home the Z axis ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) G91 ; relative positioning G1 H1 Z410 F1800 ; move Z up until the endstop is triggered G92 Z410 ; set Z position to axis maximum (you may want to adjust this) G90 ; absolute position
Any ideas?
Andrea
-
It's a corexy so your homing file needs a slight modification to work correctly. Right now you're moving both X and Y at the same time to the endstop, and when the first one strikes, it stops both. Then you ask it to back off both, but one of them won't have been homed yet.
Try this
; homeall.g ; called to home all axes ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale) G91 ; relative positioning ;G1 H2 Z5 F6000 ; lift Z relative to current position G1 H1 X-395 Y-345 F3000 ; move quickly to X or Y endstop and stop there (first pass) G1 H1 X-395 ; make sure both are homed G1 H1 Y-345 G1 X5 Y5 F1800 ; go back a few mm G1 H1 X-10 F360 ; home again G1 H1 Y-10 G1 H1 Z410 F1800 ; move Z up until the endstop is triggered G92 Z410 ; set Z position to axis maximum (you may want to adjust this) G90 ; absolute position