Enable/disable run button

More
08 Mar 2014 18:58 #44564 by keyson
Hi all, and thank's for all effort to make Linuxcnc better and better.

As the topic say, I would like to disable and enable the run button in Axis on an external signal.
Searched the forums and studied manuals but have not come up with an answer.

I have retrofitted two Denford triac vmc (mod 94) for educational purpose.
They have a 'door' (hatch) that have a sensor (guard contact) that i would like to run trough
a and gate, to make it impossible to run the program if the door is open.
But the jogging would run, so hook it to the enable or e-stop is not an option.

Regards
Kjell

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

More
08 Mar 2014 20:04 - 08 Mar 2014 21:08 #44565 by ArcEye
Replied by ArcEye on topic Enable/disable run button
Hi

You can achieve this quite simply by a short hack of Axis

After line 2071 in the master (search for def task_run(*event): )
insert
if comp['run-disable']  : return

ie
def task_run(*event):
        if comp['run-disable']  : return  ## inserted line
        if run_warn(): return

        global program_start_line, program_start_line_last
        program_start_line_last = program_start_line;
        ensure_mode(linuxcnc.MODE_AUTO)
        c.auto(linuxcnc.AUTO_RUN, program_start_line)
        program_start_line = 0
        t.tag_remove("ignored", "0.0", "end")
        o.set_highlight_line(None)

Then at line 3243 in the master ( search for comp.newpin("notifications-clear-error",hal.HAL_BIT,hal.HAL_IN))
insert
comp.newpin("run-disable",hal.HAL_BIT, hal.HAL_IN)

ie
if hal_present == 1 :
    comp = hal.component("axisui")
    comp.newpin("jog.x", hal.HAL_BIT, hal.HAL_OUT)
    comp.newpin("jog.y", hal.HAL_BIT, hal.HAL_OUT)
    comp.newpin("jog.z", hal.HAL_BIT, hal.HAL_OUT)
    comp.newpin("jog.a", hal.HAL_BIT, hal.HAL_OUT)
    comp.newpin("jog.b", hal.HAL_BIT, hal.HAL_OUT)
    comp.newpin("jog.c", hal.HAL_BIT, hal.HAL_OUT)
    comp.newpin("jog.u", hal.HAL_BIT, hal.HAL_OUT)
    comp.newpin("jog.v", hal.HAL_BIT, hal.HAL_OUT)
    comp.newpin("jog.w", hal.HAL_BIT, hal.HAL_OUT)
    comp.newpin("jog.increment", hal.HAL_FLOAT, hal.HAL_OUT)
    comp.newpin("notifications-clear",hal.HAL_BIT,hal.HAL_IN)
    comp.newpin("notifications-clear-info",hal.HAL_BIT,hal.HAL_IN)
    comp.newpin("notifications-clear-error",hal.HAL_BIT,hal.HAL_IN)
    comp.newpin("run-disable",hal.HAL_BIT, hal.HAL_IN)                    ## inserted line
    vars.has_ladder.set(hal.component_exists('classicladder_rt'))

You will now have a pin called axisui.run-disable

If that is set to TRUE (1) it will not be possible to run a program as the function will return

regards
Last edit: 08 Mar 2014 21:08 by ArcEye. Reason: make [ ] brackets visible

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

More
08 Mar 2014 20:18 #44566 by keyson
Replied by keyson on topic Enable/disable run button
That was fast ArcEye,

Nice fix.

Thank's
/Kjell

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

Time to create page: 0.105 seconds
Powered by Kunena Forum