Difference between G28 and M98"homeall.g"?
-
Hi guys,
I've mentioned an issue with my hash printers homing sequence, but got almost no attention.
I can't be sure if it's DWC related or a problem with the STM branch of RRF3.3.(0_6) so I put it here:Q: Is there a difference in sending G28 from the console or starting the homeall.g macro directly?
Background: I don't specify the endstops in config.g but in the macros, because of my special homing sequence where one endstop is used to home two axes and the output also needs to be inverted in between for the fine/slow homing move.
Homing each axis individually works fine, only g28 throws an error. (please follow the above link for details) -
@o_lampe When you are comparing G28 with G98 p"homeall.g" are you testing with the system in exactly the same state (so from a hard reset and with the machine in exactly the same position/state)? It would probably help to see exactly which home request and gcode line is throwing the error, maybe running with gcode debug enabled using m111 would help (you may need to do this from a USB console, I can't remember if the output goes to other consoles or not). It might also help to see your config.g file.
-
@gloomyandy I have to take care of the axes' position before hitting home button because homing to the center requires the axis to be on the right side of the endstop.
So, yes the single homing macros take care of parking the tool at the right place. EG. I can hit homeX button several times without an error.
But calling 4 homing macros in consecutive order like 'G28' does, throws an error. It goes through the macros without problem, but at the end the error message pops up. I can still work with the printer, so I asked more out of curiosity what's the difference between G28 and M98...
My vague idea is, that G28 checks for endstop definitions and enables their input ports, but there are no endstops defined until it runs the first homeX.g macro. -
M574 U2 S1 P"Nil" ; delete endstop
Maybe it's this line that doesn't work as expected? I have to unassign the endstop to make it available for the other axis. (X/U and Y/V share one endstop)
-
@o_lampe Sorry I'm still not sure what exactly it is you are doing. So for instance if you do the following...
- Power off the machine
- Position the head into a known good position
- Power on the machine
Now run M98 "homeall.g"
Then repeat but run G28
Do you get different results?I still think it is worth running with debug enabled (run m111 to get the options and then enable gcode debugging) and from a USB console (I find that DWC can do funky things with messages). Also is this a WiFi or SBC setup? If SBC maybe DSF is doing something odd?
I can't answer your question at the moment (G28 v M98 P"homeall.g"), but I'll take a look at the G28 code later (I have a feeling that it may clear the homed state of the machine, but I'm not sure), I'll also have a look to see what generates that error message.
-
@gloomyandy I've cleared the workplace for building the Z-axis frame. I can try it later with debug.
I already did what you proposed (with emergency button, not power off)
I posted the result in the other thread. (I'd post it here again, but I'm on the wrong computer) -
FWIW here's the config.g
config_backup.txt; Configuration file for Fly-F407ZG (firmware version 3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.3.0-LPC-STM32+01 on Wed Aug 25 2021 14:38:45 GMT+0200 (Mitteleuropäische Sommerzeit) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"HashPrinter" ; set printer name ; Network M552 S1 ; enable network ; Drives ; ; X | V ;---|--- ; Y | U ; M569 P0 S1 ; physical drive 0 goes forwards using default driver timings M569 P1 S0 ; physical drive 1 goes forwards using default driver timings M569 P2 S1 ; physical drive 2 goes forwards using default driver timings M569 P3 S0 ; physical drive 3 goes forwards using default driver timings M569 P4 S1 M569 P5 S1 M584 X0 Y1 Z2 U3 V4 E5 ; set drive mapping M350 X16 Y16 Z16 U16 V16 E16 I1 ; configure microstepping with interpolation M92 X200 Y100 Z100 U100 V100 E420 ; set steps per mm M566 X900 Y900 Z60 U900 V900 E120 ; set maximum instantaneous speed changes (mm/min) M203 X18000 Y18000 Z180 U18000 V18000 E12 ; set maximum speeds (mm/min) M201 X5000 Y5000 Z20 U5000 V5000 E250 ; set accelerations (mm/s^2) M906 X1200 Y1200 Z800 U1200 V900 E800 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S10 ; Set idle timeout ; Axis Limits M208 X-185 Y-174 U-100 V-125 Z0 S1 ; set axis minima M208 X100 Y90 Z200 U185 V170 S0 ; set axis maxima ; Endstops defined in homing macros ;M574 X2 S1 P"xmax" ; configure active-high endstop for high end on X via pin xstop ;M574 Y2 S1 P"ymax" ; configure active-high endstop for high end on Y via pin ystop ; Z-Probe M558 P0 H5 F120 T6000 ; disable Z probe but set dive height, probe speed and travel speed M557 X-130:130 Y-130:130 S20 ; define mesh grid ; Heaters M308 S0 P"bedtemp" Y"thermistor" T100000 B4100; configure sensor 0 as thermistor on pin bedtemp M950 H0 C"bed" T0 ; create bed heater output on bed 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 M143 H0 S120 ; set temperature limit for heater 0 to 120C M308 S1 P"e0temp" Y"thermistor" T100000 B4100 ; configure sensor 1 as thermistor on pin e0temp M950 H1 C"e0heat" 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 S280 ; set temperature limit for heater 1 to 280C ; Fans M950 F0 C"fan0" Q500 ; create fan 0 on pin fan0 and set its frequency M106 P0 S0 H-1 T65 ; set fan 0 value. Thermostatic control is turned on ; Tools ; ; 1 | 2 ;---|--- ; 0 | 3 ; M563 P0 D0 H1 S"XY" X0 Y1 F0 ; define tool 0 in bottom left corner G10 P0 X18.4 Y18.4 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C M563 P1 D0 H1 S"XV" X0 Y4 F0 ; define tool 1 in top left corner G10 P1 X18.4 V-18.4 Z0 ; set tool 1 axis offsets G10 P1 R0 S0 ; set initial tool 1 active and standby temperatures to 0C M563 P2 D0 H1 S"UV" X3 Y4 F0 ; define tool 2 in top right corner G10 P2 U-18.4 V-18.4 Z0 ; set tool 2 axis offsets G10 P2 R0 S0 ; set initial tool 2 active and standby temperatures to 0C M563 P3 D0 H1 S"UY" X3 Y1 F0 ; define tool 3 in bottom right corner G10 P3 U-18.4 Y18.4 Z0 ; set tool 3 axis offsets G10 P3 R0 S0 ; set initial tool 3 active and standby temperatures to 0C ; Custom settings are not defined
-
@o_lampe So the error message you are getting is generated when you perform a G1 move with a H1 parameter set (a homing move), but the endstop for that axis has not been set.
I'm not sure that what you are doing to clear an endstop is correct. It looks like:
M574 U0
Which sets the endstop for that axis to none, may be the correct way to do this.
No idea why you get different results depending upon how the commands are run though. Does running the command from a USB terminal make any difference, maybe the error message is not making it through DWC?
-
@o_lampe One other thought adding a few M574 commands (with no parameters) which outputs what endstops are set, may provide more idea as to what is going on!
-
@o_lampe said in Difference between G28 and M98"homeall.g"?:
Q: Is there a difference in sending G28 from the console or starting the homeall.g macro directly?
One significant difference is that G28 marks the axis/axes as un-homed before executing the code associated with the given axis/axes.
This can cause code that works with M98 to fail with G28 if the code is trying to move an un-homed axis.
Frederick
-
@gloomyandy said in Difference between G28 and M98"homeall.g"?:
I'm not sure that what you are doing to clear an endstop is correct. It looks like:
M574 U0Which sets the endstop for that axis to none, may be the correct way to do this.
I think you are right, I'll test it first thing. I thought I had to free the formerly used pin.
PS: do you know if someone published a mounting case (for 2020 extrusion) for the F407ZG? I couldn't find a drawing which shows the mounting hole pattern...
-
@o_lampe
PSS: Where can I find more info on the "Z3" endstop, how to attach three switches and such? -
@o_lampe Sorry no idea about a case (i just have mine on my test bench!), @jay_s_uk may have some suggestions.
Freeing things in RRF is a bit messy. This example in the gcode listing:
M574 Z0 P"nil" ; no Z endstop switch, free up Z endstop input
seems to show that both the type 0 and nil pin are required, but looking at the code I'm not sure that is the case. I'd try just setting it to type 0 and see if that does what you want (I need to check again but I seem to remember that a P parameter may take it down a different code path!).
-
@o_lampe I didn't know there was a Z3 option, are you sure that is correct, there is the option to specify multiple endstops to match multiple Z motors via separate pins with something like:
M574 Z1 S1 P"io2.in+io3.in" ; Z axis with two motors, individual min endstops, active high
That is covered a little in the RRF GCode docs.
-
@gloomyandy Hmm, there's Zmin, Zmax and Z3, maybe I have to use them all in the way you described.
-
@o_lampe Where have you seen a reference to Z3? I don't see one in the gcode guide and the source code does not seem to have any idea of it, it only has...
noEndStop = 0, lowEndStop = 1, highEndStop = 2,
-
@gloomyandy said in Difference between G28 and M98"homeall.g"?:
Where have you seen a reference to Z3?
That's weird,
- I saw it mentioned on mellow fly aliexpress page
- there's a Z3 socket onboard
- teamgloomys github page mentions it on the pin names page
Supports dual Z-axis printers and three Z-axis printers (the motherboard has a dedicated Z3 limit switch interface).
-
...back to subject. I found out what caused the error message when calling G28 alone:
-
G28 automatically tries to home X,Y and Z even when homeZ is not mentioned in homeall.g.
I currently have no Z axis, so there's no endstop defined for Z...
I could probably delete or move homez.g or add M574 Z0 in config.g to supress the error message -
deleting an endstop only works with e.g. M574 X0.
Adding P"nil" is wrong
-
-
@o_lampe said in Difference between G28 and M98"homeall.g"?:
I could probably delete or move homez.g or add M574 Z0 in config.g to supress the error message
removing/renaming homeZ only led to another error: can't find homeZ.g
So I wrote homeZ with these lines:M574 Z0 G92 Z0
and no error popped up
Thanks all who tried to help
-
This post is deleted!