Reload Program Through Pin
All the experts say to use a M-Code to do a axis-remote --reload. However, when we all try that, we get errors. Then we ask why, and they say you can't do that while running a m-code????
I have searched the internet for many days on how to solve this simple problem, and it seems that lots of people have given advise, but never really tried it themselves. Zero working examples!
Andy once put it;
Re: [Emc-users] axis-remote in M-call problems
From: andy pugh <bodgesoc@gm...> - 2013-04-09 20:52:52
On 9 April 2013 19:54, Henrik Munktell <henrik.munktell@...> wrote:
> I have a probe function that probes towards the work piece, on contact, I
> set Z pos with "G10 L20". When I do that, the preview plot in axis does not
> update and represent the correct Z height. So I want to do a "axis-remote
> --reload" in the probe routine to refresh the plot
Refreshing the plot is a perfectly natural thing to want to do.
Wanting to reload a _running_program_ is just asking for trouble.
I wish I knew enough Python / tcl to know if it was trivial to add a
"refresh" command to Axis.
strykerg wrote: is it possible to reload the current program through a hal pin?
i'm building a sort of pendant which includes a button for touching off the current axis. the touch-off works however unless the program is reloaded the backplot does not reflect the offset properly. and the only solution I found is to reload program .
Starting over, when you press the touch off button on your pendant what is it doing exactly? I assume your not in the middle of a program or are you?
You know that Strykerg posted this 4 years ago right? I was reviving the thread.
Delron wrote: I just don't understand. We are all simply trying to touch-off to a work piece by pressing a button on our pendents. When we do that, we a mostly triggering a sub routine to probe down, and set the working offset. However, Linuxcnc will not refresh the new offset plot in this manner, so we must reload the program.
Please note that it is not LinuxCNC that is not refreshing the backplot it is Axis that does not know what you do with MDI commands that are run via your pendant. If you don't tell Axis how is it supposed to know?
LinuxCNC has the Python Interface and that is one of the many things that you can do with it.
My CNC is just an extension on my woodworking hobby. (Hobby!) I unfortunate do not have time to learn new programming skills, especially just for one simple plot refresh.
I was really hoping to find someone that may have done something to deal with this already and borrow from their work. Make no mistake, I do not "Expect" anyone to hand over their hard work, but some are willing to help others in need sometimes.
7.4. Better support for GUI updates, like update messages
It would be nice if linuxcnc had a better system for updating GUI information, such as when to reload the plot, when to update offset display pages, when the user system changes etc
For instance right now if you offset the origin you must explicitly reload the HAL_gremlin graphics plot. That means if we ever have a different plotter it will be broken until one updates the program to reload the new plotter. It would be much better if linuxcnc sent a 'update plot' message every time it moves the origin
Another one is the fact you must switch from MDI to manual to MDI again to get linuxcnc to re-synch the var file.
#!/usr/bin/python import linuxcnc, hal import os h = hal.component("update") h.newpin("trigger",hal.HAL_BIT, hal.HAL_IN) c = linuxcnc.command() h.ready try: while 1: if h.trigger and not old_trigger: os.system("axis-remote --reload ") old_trigger = h.trigger except KeyboardInterrupt: pass
But I am not sure if that does what you want. Clearly reloading a program while it is running has to be a very bad idea.
The backplot display is created by a "dry run" of the G-code through the actual interpreter. It can't do that while the interpreter is busy with a running program.