M7x restore_settings failed

More
5 years 3 months ago #213464 by rajewski
I'm trying to write a macro that will measure all my tool lengths and update the tool table but I've run into an issue.

I have a main subroutine that does the tool changes and calls another sub to do the actual measurements. The first measurement goes well but the second throws the error "M7x: restore_settings failed executing: ' F1200.0': Unknown oword number"

I'm running the master branch (from build-bot) so this may be a bug.

The main looping macro
Code:
o<measure_tool_lengths> sub #<start> = #1 #<end> = #2 #<idx> = #<start> #<x>=#<_x> (save current x position with current offset) #<y>=#<_y> (save current y position with current offset) G90 G0 G53 Z0 (move to safe Z) G0 G53 X#<_ini[toolsensor]x> Y#<_ini[toolsensor]y> o100 while [#<idx> LE #<end>]     T#<idx> M6     o<measure_tool_length> call     #<idx> = [#<idx> + 1] o100 endwhile G0 G53 Z0 G0 X#<x> Y#<y> o<measure_tool_lengths> endsub M2

The measurement macro
Code:
O<measure_tool_length> sub M70 (Save modal states) G61 (exact path mode to prevent collisions) G92.2 (Remove G92 if set) #<x>=#<_x> (save current x position with current offset) #<y>=#<_y> (save current y position with current offset) G90 G0 G53 Z0 (move to safe Z) G0 G53 X#<_ini[toolsensor]x> Y#<_ini[toolsensor]y> G49 G59.3 G10 L2 P0 Z0 (remove offsets) G0 G53 Z#<_ini[toolsensor]z> M64 P2 (Enable probe) F#<_ini[toolsensor]search_feed> G91 G38.2 Z#<_ini[toolsensor]maxprobe> G1 Z1.0 F#<_ini[toolsensor]probe_feed> G4 P0.5 G38.2 Z-2.0 M65 P2 (Disable probe) G90 (back to start point) M72 (restore state) G0 G53 Z0 G0 X#<x> Y#<y> (write the value to the tool table) G10 L1 P#5400 Z[#5063 - #<_ini[toolsensor]offset>] O<measure_tool_length> endsub M2

EDIT: After messing with it more it turns out the error only was thrown after an actual tool change. It seems the M73 I was using in my tool change made the tool measurement macro fail. If I replace this with an M70/M72 pair it works. Seems like a bug in the master branch?

Please Log in to join the conversation.

More
3 years 8 months ago #265446 by dinodf
Replied by dinodf on topic M7x restore_settings failed
Hi,
this problem is not resolved yet?
I have tested and have the same problem on LinuxCNC 2.8.4 :-(

EDIT: I have this error using a subroutine to call the change tool and probe length, if I do it in a normal GCode file it do all correctly.
With
Code:
O <touch_plate> sub  M6T1 O<set_tool_length> call M6T2 O<set_tool_length> call M6T3 O<set_tool_length> call M6T4 O<set_tool_length> call M6T5 O<set_tool_length> call M6T6 O<set_tool_length> call M6T7 O<set_tool_length> call M6T8 O<set_tool_length> call M6T9 O<set_tool_length> call O <touch_plate> endsub M2
 
it fail with error, but if I do it in a normal .ngc file:
Code:
M6T1 O<set_tool_length> call M6T2 O<set_tool_length> call M6T3 O<set_tool_length> call M6T4 O<set_tool_length> call M6T5 O<set_tool_length> call M6T6 O<set_tool_length> call M6T7 O<set_tool_length> call M6T8 O<set_tool_length> call M6T9 O<set_tool_length> call M2
 
LinuxCNC do all correctly

 

Attachment not found


 

Please Log in to join the conversation.

More
3 years 8 months ago #265449 by tommylight
M7x is not a valid M code, probably inside the "touch_plate" file?

Please Log in to join the conversation.

More
3 years 8 months ago #265462 by andypugh

M7x is not a valid M code, probably inside the "touch_plate" file?
He is just using a shortcut to mean M70 and M72. 

 

Please Log in to join the conversation.

More
3 years 8 months ago #265463 by andypugh
Do you have any idea which line is triggering the error? It seems to be saying it is an "F0 G64" but then "unknown O-word number" makes no sense.

Please Log in to join the conversation.

More
3 years 8 months ago #265464 by tommylight

M7x is not a valid M code, probably inside the "touch_plate" file? 
He is just using a shortcut to mean M70 and M72. 
Screenshot, bottom right side, error ?
Or is that used also for error reporting?

Please Log in to join the conversation.

More
3 years 8 months ago #265465 by andypugh

Please Log in to join the conversation.

More
3 years 8 months ago #265466 by tommylight
Yes it is, thank you.

Please Log in to join the conversation.

More
3 years 8 months ago #265503 by RobC
Replied by RobC on topic M7x restore_settings failed
There's a chance it's the M2 at the end of the O subroutine. I have 2 nearly identical files - one on left works as Osub and one on right works as standalone gcode file. The only differences are the removal of % from start and end of file, and M2 removal from end.

 

Attachment not found

Please Log in to join the conversation.

More
3 years 8 months ago #265619 by dinodf
Replied by dinodf on topic M7x restore_settings failed
I think that is not a problem made by M2 :-(

The error occurs only when executing the procedure with no tool, if before run the procedure I do T2 M6 the procedure don't fail!
So I think there is some variables not initialized at startup and when LinuxCNC try to restore global settings it fails with an error...
Code:
if (status != INTERP_OK) { char currentError[LINELEN+1]; rtapi_strxcpy(currentError,getSavedError()); CHKS(status, _("M7x: restore_settings failed executing: '%s': %s"), s, currentError); }

A workaround is do an unnecessary tool change before starting the procedure to set all the variables used.

Please Log in to join the conversation.

Time to create page: 0.102 seconds
Powered by Kunena Forum