Home all - then occasional safe Z warning.

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

Home all - then occasional safe Z warning.

Postby ian8555 » Tue Apr 22, 2025 6:05 pm

I have a fault that happens occasionally,

I power up the system, home all, then when I press safe Z, Uccnc will display an error about soft limits in Z being triggered.

At this point my homing is done and the MC is 0, the safe z in the settings is also 0.

I think it may be some error in the math that happens within the M216 here:

Code: Select all
// Go to safeZ

exec.Getactualoffset();

double safeZ = exec.mainform.UCsetup.UCset.Generalsettings.SafeZ;
double Softlimitsrelative = exec.mainform.UCsetup.UCset.Axis[2].UC100axis.SoftLimitP - exec.ofc.Wzval - exec.ofc.TOZval - exec.ofc.G92zval;

if (exec.mainform.UCsetup.UCset.Generalsettings.Enablesoftlimits)
{
  if (safeZ > Softlimitsrelative)
  {
    safeZ = Softlimitsrelative;
   
    DialogResult result = MessageBox.Show(exec.mainform.MSG.Message[45], "Confirmation", MessageBoxButtons.YesNo);
    if (result == DialogResult.No)
    {
      return;
    }
  }
}


Is there any chance that the homing sequence or this code is rounding to zero causing the error?
ian8555
 
Posts: 9
Joined: Tue Feb 22, 2022 1:38 pm

Re: Home all - then occasional safe Z warning.

Postby rvalotta » Tue Apr 22, 2025 8:48 pm

Not sure if its related but I had a experience recently where when i tried to move to 0 on a axis i received the soft limit error... It seems that UCCNC doesn't do a <= or >= type condition so 0 will fault it.. The suggestion made to me was to fudge the axis numbers so they are 0.0001 bigger then what uccnc things they are
rvalotta
 
Posts: 9
Joined: Sun May 12, 2024 3:25 am

Re: Home all - then occasional safe Z warning.

Postby ger21 » Wed Apr 23, 2025 1:38 pm

The problem is that Safe Z is in work coordinates, so it's actual position can and will change depending on where you set Z zero at.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2794
Joined: Sat Sep 03, 2016 2:17 am


Return to Macros

Who is online

Users browsing this forum: No registered users and 2 guests