Help choosing the good way for save/restore modal state

More
17 Jan 2021 23:16 - 17 Jan 2021 23:48 #195720 by alkabal
Hi

Can you help choosing the good way ?

I'm in the process of trying to find a workaround for modal value, if i remember correctly M73 M72 is not the most clean way to do this but i'm really unsure about what is the best practice ?

Playing with some macro using many modal value i try to use my own system in a all in one solution but this need to be saved at startup.

So i have do a hal link
net machine.is-on => halui.mdi-command-39
and ini config
MDI_COMMAND= o<backup_status> call   #command 39
ON_ABORT_COMMAND=o<backup_restore> call

At the start of each macro
o<backup_status> call
At the end of each macro
o<backup_restore> call
At each error detected in macro
o<backup_restore> call


First what did you think of this attempt ? or what is for you the best and clean way for that ?

Second it is needed to invalide M71 in all macro ? (did you think is needed to add this in the backup_status.ngc/backup_restore)

Third i fail trying to read this ini value
if [#<_ini[DISPLAY]LATHE> EQ 1]
if you have any idea.

Br
Attachments:
Last edit: 17 Jan 2021 23:48 by alkabal.

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

More
17 Jan 2021 23:51 - 18 Jan 2021 00:20 #195724 by alkabal
Well at the end i have found the first issue, i can't move from limit sensor using "limit override" button due to the use of MDI_command with machine.is-on

So for the moment i think the only way is to keep the more regular way using the same fixed value from ini in the ocode "RS274NGC_STARTUP_CODE"
ON_ABORT_COMMAND=o<reset_state> call

edit :

I see that now :
if [EXISTS[#<_global>]]

So i have do a check if _backup_var exist use the backup value, else use fixed value for now that seem to work fine.

I all way i like to know some opinion and some answear for that if possible :

First what did you think of this attempt ? or what is for you the best and clean way for that ?

Second it is needed to invalide M71 in all macro ? (did you think is needed to add this in the backup_status.ngc/backup_restore)

Third i fail trying to read this ini value
if [#<_ini[DISPLAY]LATHE> EQ 1]
if you have any idea.

Last edit: 18 Jan 2021 00:20 by alkabal.

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

More
19 Jan 2021 01:50 #195856 by andypugh
I think that M73 is the only way to save state, unless you want to explicitly save / restore only those things that you will change in the sub.

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

More
19 Jan 2021 02:53 #195864 by alkabal
Many thanks for reply

I have found the full saved list :
current G20/G21 settings (imperial/metric)
selected plane (G17/G18/G19 G17.1,G18.1,G19.1)
status of cutter compensation (G40,G41,G42,G41.1,G42,1)
distance mode - relative/absolute (G90/G91)
feed mode (G93/G94,G95)
current coordinate system (G54-G59.3)
tool length compensation status (G43,G43.1,G49)
retract mode (G98,G99)
spindle mode (G96-css or G97-RPM)
arc distance mode (G90.1, G91.1)
lathe radius/diameter mode (G7,G8)
path control mode (G61, G61.1, G64)
current feed and speed (F and S values)
spindle status (M3,M4,M5) - on/off and direction
mist (M7) and flood (M8) status
speed override (M51) and feed override (M50) settings
adaptive feed setting (M52)
feed hold setting (M53)


So if i understand if for any reason this list is not what i want i need to use other solution.

For what i have tested using the same macro for ON_ABORT_COMMAND and save/restore for ocode seem to do the job better than using fixed value from ON_ABORT_COMMAND

The problem is i'm always afraid about choosing the wrong way.


Thanks

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

Time to create page: 0.084 seconds
Powered by Kunena Forum