M7x restore_settings failed

More
01 Jul 2021 23:32 - 01 Jul 2021 23:39 #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
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
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?
Last edit: 01 Jul 2021 23:39 by rajewski.

Please Log in or Create an account to join the conversation.

More
26 Feb 2023 22:44 - 26 Feb 2023 22:52 #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
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:
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

 
 
Attachments:
Last edit: 26 Feb 2023 22:52 by dinodf.

Please Log in or Create an account to join the conversation.

More
26 Feb 2023 23:01 #265449 by tommylight
M7x is not a valid M code, probably inside the "touch_plate" file?

Please Log in or Create an account to join the conversation.

More
27 Feb 2023 00:43 #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 or Create an account to join the conversation.

More
27 Feb 2023 00:48 - 27 Feb 2023 00:49 #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.
Last edit: 27 Feb 2023 00:49 by andypugh.

Please Log in or Create an account to join the conversation.

More
27 Feb 2023 00:59 #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 or Create an account to join the conversation.

More
27 Feb 2023 01:05 #265465 by andypugh
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
27 Feb 2023 01:49 #265466 by tommylight
Yes it is, thank you.

Please Log in or Create an account to join the conversation.

More
27 Feb 2023 16:00 - 27 Feb 2023 16:00 #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.

 
Attachments:
Last edit: 27 Feb 2023 16:00 by RobC.

Please Log in or Create an account to join the conversation.

More
28 Feb 2023 21:57 #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...
	    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 or Create an account to join the conversation.

Time to create page: 0.326 seconds
Powered by Kunena Forum