Dezsoe ..... forget my previous message: it's not clear
we changed most of the exec.codesync into exec.codelist and we check for stop everywhere, well some g-codes in the codelist are skipped and I don't understand why. ( the macro was not stopped during execution)
here is a function inside a macro, in this case G31 is non executed at all and after the very first g53 in the codelist, the machines moves in x/y with "FeedrateFast":
- Code: Select all
public double Probing(int mode, double x_offset = 0, double y_offset = 0){
if (mode == (int)Probe_type.FIXED){
if(!exec.Ismacrostopped()){
exec.Codesync("G53 G0 Z"+ safeZ);
while(exec.IsMoving()){}
}
if(!MoveRak((ushort)Command_rak.OPEN)){
return probe_alarm_num;
}
code.Clear();
code.Add("G53 G0 X" + Convert.ToString(cones[0,0] + x_offset) + "Y" + Convert.ToString(cones[0,1]+ y_offset));
code.Add("G31 Z" + Zmin + "F" + FeedrateFast); // Do the Z probing with Fast feedrate first
code.Add("G91 G0 Z" + Retract_for_second_measurement);
code.Add("G90");
// Second touch
code.Add("G31 Z" + Zmin + "F" + FeedrateSlow); // Do the Z probing again with Slow Feedrate to get a more accurate reading
exec.Codelist(code);
while(exec.IsMoving()){}
double Z = exec.GetZmachpos();
if(!exec.Ismacrostopped()){
exec.Codesync("G53 G0 Z"+ safeZ);
while(exec.IsMoving()){}
}
if(exec.Ismacrostopped()){
return probe_alarm_num;
}
return Z;
}
return probe_alarm_num;
}
.....
....
#Events
...
List <String> code = new List <String>();
...
Then we went for a SUPERconservative way, in this case it almost works, the problem is that the second G31 sometimes is not executed at "FeedrateSlow" but at "FeedrateFast"
- Code: Select all
public double Probing(int mode, double x_offset = 0, double y_offset = 0){
if (mode == (int)Probe_type.FIXED){
if(!exec.Ismacrostopped()){
exec.Codesync("G53 G0 Z"+ safeZ);
while(exec.IsMoving()){}
}
if(!MoveRak((ushort)Command_rak.OPEN)){
return probe_alarm_num;
}
if(!exec.Ismacrostopped()){
exec.Codesync("G53 G0 X" + Convert.ToString(cones[0,0] + x_offset) + "Y" + Convert.ToString(cones[0,1]+ y_offset));
while(exec.IsMoving()){}
}
if(!exec.Ismacrostopped()){
exec.Codesync("G31 Z" + Zmin + "F" + FeedrateFast); // Do the Z probing with Fast feedrate first
while(exec.IsMoving()){}
}
if(!exec.Ismacrostopped()){
exec.Codesync("G91 G0 Z" + Retract_for_second_measurement);
while(exec.IsMoving()){}
}
if(!exec.Ismacrostopped()){
exec.Codesync("G90");
}
// Second touch
if(!exec.Ismacrostopped()){
exec.Codesync("G31 Z" + Zmin + "F" + FeedrateSlow); // Do the Z probing again with Slow Feedrate to get a more accurate reading
while(exec.IsMoving()){}
}
double Z = exec.GetZmachpos();
if(!exec.Ismacrostopped()){
exec.Codesync("G53 G0 Z"+ safeZ);
while(exec.IsMoving()){}
}
if(exec.Ismacrostopped()){
return probe_alarm_num;
}
return Z;
}
return probe_alarm_num;
}
Can you please tell what's wrong?
Last but not least, would you please explain in terms of thread execution the differences between code/codesync/codelist?
thanks Giorgio