Page 1 of 1

unwanted rotary axis movement

PostPosted: Wed Sep 29, 2021 7:59 am
by girogiri
hello,
we have a machine with a router and two tangential blades. AXBB + expansion board. Latest beta UCCNC (14).
To deal with the two blades, having UCCNC only one rotary axis output, we enable or disable the correct tangential blade driver and change the setup of the A axis ( the rotary one) with a macro that can be called before or during the execution of a Gcode.
To deal with different blade lenght we also change the retract height parameter in the A axis page.
The problem we are encountering is that randomly, after a pulloff due to the "retract at angle" setting, the Z axis dive down into the material at a lower Z value, crashing the blade onto the machine plane.
Any help would be appreciated.
thanks

Giorgio

Re: unwanted rotary axis movement

PostPosted: Fri Oct 01, 2021 2:45 pm
by girogiri
Hello,
I'm attaching the M6 macro thah gives the unwanted movement.
This is only part of the whole macro. This machine has a creaser, a router and a tangential blade.
In this macro we select the creaser, apply the appropriate Z offset and then an XY offset ( from the webcam) as we make the Zero with awebcam.
The movement happens at the very end of the macro: the machine moves in X and Y at full speed and cannot be stopped in any way (just resetting works)
I fount the only way to avoid this movement is to open a message box at th end of the macro.

Thanks for the help

Re: unwanted rotary axis movement

PostPosted: Mon Oct 25, 2021 5:27 pm
by dezsoe
The unwanted movements are probably caused by changing the settings during a cycle run. If you cannot avoid changing the settings then here are some advices:

- You don't need apply and save: save will first apply.

- Save the current cycle start state then stop cycle if it's running. Do your changes, apply or save the settings then restart cycle if it was running. (The macro can be called from MDI and from a g-code file, so you have to know if you need to restart.)
Code: Select all
  wasCycleRunning = exec.GetLED(54);

  if (wasCycleRunning)
  {
    exec.Stop();
    while (exec.IsMoving()) ;
    exec.Codesync("");                                                          // Clear Ismacrostopped
    while (exec.IsMoving()) ;
  }
// ...code...
  if (wasCycleRunning) exec.Callbutton(128);                                    // Cycle start if it was started

- exec.Wait is not a good way to wait for apply/save to finish. When you call the Callbutton then check the state of the button and wait for it to turn off.
Code: Select all
  exec.Callbutton(btnSaveSettings);
  while (AS3.Getbuttonstate(btnSaveSettings));

- As I wrote in the other thread: use exec.Codesync instead of exec.Code. (Or exec.Codelist if you have more g-codes to execute.) Also, after every call you should check for exec.Ismacrostopped() to handle a stop (and reset) condition. (Reset also calls stop.) The easy way is to move your whole macro to a bool function after #Events and return true only if everything is finished. Then you can decide in one place to continue the execution or abort the whole macro and also the cycle.