Probing bug with XHC-HB04 Pendant

If you think you've found a bug post it here.

Probing bug with XHC-HB04 Pendant

Postby Magnum » Sat Jan 21, 2017 10:43 pm

Hello,
I have a problem with the XHC-HB04 pendant plugin. When the MPG mode is selected, the probing doesn't work all times. UCCNC thinks the probe was activated when it wasn't and gives a error message.
To get the probing working I edited the probing makro M31 and switch to Continuous mode before probing and back to MPG mode at the end.
Now I want to use the autolever plugin, and I always have to manually switch to Continuous mode or it won't work.
When I forget to switch to Continuous Mode before starting the autolever code and get the error message, I have to shut down and restart UCCNC.
If it is not possible to find the problem with the XHC-HB04 pendant plugin, is there a way to run a makro before the G-Code is executed (after pressing Cycle Start or Run at the pendant)? I only found makro M30 which runs after the G-Code was executed.
Many Thanks,
Magnus
Magnum
 
Posts: 3
Joined: Fri Oct 21, 2016 4:31 am

Re: Probing bug with XHC-HB04 Pendant

Postby cncdrive » Sun Jan 22, 2017 7:35 pm

Thanks for the information about the issue.
We will check this issue out on our side soon.
cncdrive
Site Admin
 
Posts: 1860
Joined: Tue Aug 12, 2014 11:17 pm

Re: Probing bug with XHC-HB04 Pendant

Postby svse » Thu Feb 02, 2017 9:23 am

Hello,

are there some news about this bug? I have the same problems. I`m using UCCNC 1.2031 with the 2017 screen.
Sometimes probing works and then there comes the error message "probe already activated". From then it comes everytime and i need to reboot uccnc.
I will try the fix from magnum.

@ magnum: have you tried the mpg multi and mpg single mode? Is it working? For me it does not work. Only "mpg continues"

Thanks alot,

Sven
svse
 
Posts: 11
Joined: Fri Jan 20, 2017 9:33 am

Re: Probing bug with XHC-HB04 Pendant

Postby Magnum » Thu Feb 02, 2017 9:52 am

svse wrote:Hello,

are there some news about this bug? I have the same problems. I`m using UCCNC 1.2031 with the 2017 screen.
Sometimes probing works and then there comes the error message "probe already activated". From then it comes everytime and i need to reboot uccnc.
I will try the fix from magnum.

@ magnum: have you tried the mpg multi and mpg single mode? Is it working? For me it does not work. Only "mpg continues"

Thanks alot,

Sven


Hello Sven,

Mpg Multi and Single Mode don't work for me either, but I don't know what they do and what I can use them for.
I wrote a macro to toggle the pendant on and off (faster then switching through the modes):

if(exec.GetLED(145))
{
exec.Callbutton(226);
}
else
{
exec.Callbutton(161);
}


And here the changes for the probing macro:
Insert this at the beginning:

bool MPG = false;
if(!exec.GetLED(145))
{
exec.Callbutton(161);
MPG = true;
}


And this at the end:

if(MPG)
{
exec.Callbutton(226);
}
Magnum
 
Posts: 3
Joined: Fri Oct 21, 2016 4:31 am

Re: Probing bug with XHC-HB04 Pendant

Postby svse » Thu Feb 02, 2017 10:12 am

Hello Magnum,

thanks alot for your answer. I will try your fixes in the evening.

Kind regards,

Sven
svse
 
Posts: 11
Joined: Fri Jan 20, 2017 9:33 am

Re: Probing bug with XHC-HB04 Pendant

Postby X3msnake » Thu Mar 15, 2018 11:16 pm

Just for Future Refence

This works.

I'm using it with my SegMag, I wrote a function that can be called at the macro start and end here's the code

Code: Select all

/*
Change the mode from MPG to Continuous programatically

By X3msnake 180309

Buttons By Number Reference
226         MPGcontmodeselect         Selects the continous jog mode for the MPG.
227         MPGsinglemodeselect         Selects the single step  jog mode for the MPG.
228       MPGmultimodeselect         Selects the multi step jog mode for the MPG.
161         Jogmodecont               Sets the jog mode to continous.
162         Jogmodestep               Sets the jog mode to stepping.

LEDs by number
152         MPGmodecont               On when the MPG continous mode is selected.
153         MPGmodesingle            On when the MPG single mode is selected.
154         MPGmodemulti            On when the MPG multi mode is selected.
145         Jogmodecontinous         On when the continous jog mode is selected.
146         Jogmodestep               On when the step jog mode is selected.

The #Events block must be the last thing in the end of your macro file
Usage: on the macro sections above #Events call anytime MPGsetMode(1); to enable MPG continuous and MPGsetMode(0); to disable


*/

#Events

void MPGsetMode(int MPGmode){
   if (MPGmode == 0){
      exec.Callbutton(161);
      exec.Wait(200);
   }
   else{
      exec.Callbutton(226);
      exec.Wait(200);
   }
}

Last edited by X3msnake on Thu Mar 15, 2018 11:23 pm, edited 1 time in total.
X3msnake
 
Posts: 20
Joined: Mon Dec 18, 2017 4:31 pm

Re: Probing bug with XHC-HB04 Pendant

Postby X3msnake » Thu Mar 15, 2018 11:18 pm

And here's the macros where i'm using this

Code: Select all
//M31 probing macro

MPGsetMode(0);

double Zmin = -100; //Max.Z depth
double FeedrateFast = 300; //Feedrate for probing
double FeedrateSlow = 40; //Feedrate for probing
double safeZ = exec.mainform.UCsetup.UCset.Generalsettings.SafeZ; //Get machine set safe Z
double Softlimitsrelative = exec.mainform.UCsetup.UCset.Axis[2].UC100axis.SoftLimitP - exec.ofc.Wzval - exec.ofc.TOZval - exec.ofc.G92zval; //Get Machine Bounds Z
double retractheight = 10; //The retract height
double retractforsecondmeasurement = 2;
double newZ = 10.03; //The new Z DRO value after probing 


bool dodualcycle = true; //Do probing from 2 cycles, first with Fast and second with Slow feedrates

if(!exec.GetLED(56)||!exec.GetLED(57)||!exec.GetLED(58)) // If machine was not homed then it is unsafe to move in machine coordinates, stop here...
{
  MessageBox.Show("You need to home the machine first!");
  exec.Stop();
  return;
}

while(exec.IsMoving()){}
exec.Wait(200);


if(dodualcycle)
{
  exec.Code("G31 Z" + Zmin + "F" + FeedrateFast); // Do the Z probing with Fast feedrate first
  while(exec.IsMoving()){}
 
  int originaldistancemode = exec.actualdistmode; // remember the distance mode
 
  exec.Code("G91 G0 Z" + retractforsecondmeasurement);
  exec.Wait(200);
 
  exec.Code("G" + originaldistancemode); // Set system back to the original distance mode
}

exec.Code("G31 Z" + Zmin + "F" + FeedrateSlow); // Do the Z probing again with Slow Feedrate to get a more accurate reading
while(exec.IsMoving()){}
exec.Wait(200);

exec.ChangeaxisDROvalue(2, newZ.ToString()); //Change the DRO value
exec.Wait(200);  //Safety wait for the UC100 syncronisation

exec.Code("G00 Z"+ safeZ); // Move Z to safe

MPGsetMode(1);

/*

Change the mode from MPG to Continuous programatically

By X3msnake 180309

Buttons By Number Reference
226         MPGcontmodeselect         Selects the continous jog mode for the MPG.
227         MPGsinglemodeselect         Selects the single step  jog mode for the MPG.
228       MPGmultimodeselect         Selects the multi step jog mode for the MPG.
161         Jogmodecont               Sets the jog mode to continous.
162         Jogmodestep               Sets the jog mode to stepping.

LEDs by number
152         MPGmodecont               On when the MPG continous mode is selected.
153         MPGmodesingle            On when the MPG single mode is selected.
154         MPGmodemulti            On when the MPG multi mode is selected.
145         Jogmodecontinous         On when the continous jog mode is selected.
146         Jogmodestep               On when the step jog mode is selected.

Usage: call MPGsetMode(1); to enable MPG continuous and MPGsetMode(0); to disable

*/

#Events

void MPGsetMode(int MPGmode){
   if (MPGmode == 0){
      exec.Callbutton(161);
      exec.Wait(200);
   }
   else{
      exec.Callbutton(226);
      exec.Wait(200);
   }
}


Code: Select all
// M204 - Go to Zero with safeZ option


if(exec.GetXpos()==0 && exec.GetYpos()==0 && exec.GetZpos()==0 && exec.GetApos()==0 && exec.GetBpos()==0 && exec.GetCpos()==0)
{
  return; // if all position DROs are already zero then return
}

MPGsetMode(0);

exec.Getactualoffset();

double safeZ = exec.mainform.UCsetup.UCset.Generalsettings.SafeZ;
double clearance = safeZ + 5;
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;
    if(exec.GetXpos()!=0 || exec.GetYpos()!=0 || exec.GetApos()!=0 || exec.GetBpos()!=0 || exec.GetCpos()!=0)
    {
      DialogResult result = MessageBox.Show(exec.mainform.MSG.Message[45], "Confirmation", MessageBoxButtons.YesNo);
      if(result ==  DialogResult.No)
      {
        return;
      }
    }
  }
}

  while(exec.IsMoving()){}
  int originaldistancemode = exec.actualdistmode; // remember the distance mode
  int originalmodalmode = exec.actualmodal; // remember the modal mode
  exec.Code("G90"); // Set system to absolute distance mode
  exec.Wait(100);

  if(exec.GetXpos()!=0 || exec.GetYpos()!=0 || exec.GetApos()!=0 || exec.GetBpos()!=0 || exec.GetCpos()!=0)
  {
    if(exec.GetZpos() < safeZ) //Move Z only if the Z coordinate is lower than the safeZ
    {
      exec.Code("G00 Z" + clearance); // Move Z up to safeZ defined by user, above the zero plane
      while(exec.IsMoving()){}
    }
    exec.Code("G00 X0 Y0 A0 B0 C0"); // Move XYABC to Zero
    while(exec.IsMoving()){}

    exec.Code("G00 Z"+ clearance); // Move Z to safe
    while(exec.IsMoving()){}
  }
  else
  {
    exec.Code("G00 Z"+ clearance); // Move Z to safe
    while(exec.IsMoving()){}
  }
 
   // by x3msnake 180309 - adds the possibility of keeping the
   // tool on a safe z and just go to origin xy to avoid plunging
   // the endmill into the material if the Z part zero is set on the table
 
double currentZ = exec.GetZpos();   

  if(currentZ != 0)
    {
      //MessageBox.Show("this" + currentZ + clearance);
      DialogResult result = MessageBox.Show("lower tool to Z zero?", "Confirmation", MessageBoxButtons.YesNo);
      if(result == DialogResult.Yes)
      {
        exec.Code("G00 Z0"); // Move Z to set zero
        while(exec.IsMoving()){}
     }
    } 
   
  exec.Code("G" + originaldistancemode); // Set system back to the original distance mode
  exec.Code("G" + originalmodalmode); // Set system back to the original modal mode

  MPGsetMode(1); // Set MPG back to continuous
 
  /*

Change the mode from MPG to Continuous programatically

By X3msnake 180309

Buttons By Number Reference
226         MPGcontmodeselect         Selects the continous jog mode for the MPG.
227         MPGsinglemodeselect         Selects the single step  jog mode for the MPG.
228       MPGmultimodeselect         Selects the multi step jog mode for the MPG.
161         Jogmodecont               Sets the jog mode to continous.
162         Jogmodestep               Sets the jog mode to stepping.

LEDs by number
152         MPGmodecont               On when the MPG continous mode is selected.
153         MPGmodesingle            On when the MPG single mode is selected.
154         MPGmodemulti            On when the MPG multi mode is selected.
145         Jogmodecontinous         On when the continous jog mode is selected.
146         Jogmodestep               On when the step jog mode is selected.

Usage: call MPGsetMode(1); to enable MPG continuous and MPGsetMode(0); to disable

*/

#Events

void MPGsetMode(int MPGmode){
   if (MPGmode == 0){
      exec.Callbutton(161);
      exec.Wait(200);
   }
   else{
      exec.Callbutton(226);
      exec.Wait(200);
   }
}
X3msnake
 
Posts: 20
Joined: Mon Dec 18, 2017 4:31 pm


Return to Report a bug

Who is online

Users browsing this forum: No registered users and 2 guests