Erratic movement when homing

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Erratic movement when homing

Postby Jeffsg605 » Wed Apr 03, 2019 5:54 pm

I overrode the "Home Y" (original button number 108) with the following script.

MessageBox.Show("Start home Y");
exec.Code(G1 F1000);
exec.Code(G28 Y0);
MessageBox.Show("End home Y");

I know the script is working because I see the message box pop up. But sometimes the Z axis homes but the wrong direction. Sometimes the X axis homes. Sometimes the Y axis moves one direction and then back the other. Why doesn't this script simply home the Y axis only?

I'm using UC300ETH controller. Thanks in advance.

Edit: Just tried the following code and it instead homes the Z axis.
MessageBox.Show("Start home Y");
exec.Code(G1 F1000);
exec.Code(G28.1 Y);
MessageBox.Show("End home Y");
Jeffsg605
 
Posts: 16
Joined: Fri Jan 11, 2019 5:20 pm

Re: Erratic movement when homing

Postby dezsoe » Wed Apr 03, 2019 8:04 pm

This code is not OK.

Code: Select all
MessageBox.Show("Start home Y");
exec.Code("G1 F1000"); // This line makes nothing. The homing speed is set on the axis config page
exec.Code("G28.1 Y"); // You have to set a coord after the Y
MessageBox.Show("End home Y");


Try this:
Code: Select all
MessageBox.Show("Start home Y");
double currY = exec.GetYpos();
exec.Code("G28.1 Y" + currY.ToString("F6")); // Home the Y with the current coord
MessageBox.Show("End home Y");
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Erratic movement when homing

Postby Jeffsg605 » Fri Apr 05, 2019 6:41 pm

Got it, that works thank you!
Jeffsg605
 
Posts: 16
Joined: Fri Jan 11, 2019 5:20 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 12 guests