Touch off having a hard time with HAL side

More
18 Jun 2024 12:13 #303254 by sajurcaju
I have figured out making a touchoff button on my Pyvcp panel. What I'm not sure about (despite hours of reading examples and looking at the 2.8 documentation) is how to make it actually do anything, which I think is a HAL question (let me know if I'm in the wrong place).

I'm using LinuxCNC/AXIS version 2.8.4-76 etc.
In Stepconf, there is a page for custom HAL commands, where I have entered (as the first and only MDI command):
   MDI_COMMAND = o<z_touch>call

1. How does HAL know where to find the subroutine, i.e. the path to the gcode z_touch?

Here is the xml corresponding to the touch off button:
        <button>
          <font>("Helvetica",14)</font>
          <width>3</width>
          <halpin>"z-zero"</halpin>
          <text>"Z"</text>
        </button>
I need to connect the 'z-zero' button to my touch off subroutine. I think I need a line like this:
net do-z-touchoff halui.mdi-command-00 <= pyvcp.z-zero

2. Does this go in custom_postgui.hal ?
3. Is that all I need?

I also want to use a spinbox to input the touch plate thickness, but I'll leave that question for the next round.

Thank you,
Steve
 

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

More
18 Jun 2024 13:28 #303260 by Aciera

1. How does HAL know where to find the subroutine, i.e. the path to the gcode z_touch?

in the [RS274NGC] section of your ini file add the location of your subroutines to the entry 'SUBROUTINE_PATH ='
linuxcnc.org/docs/html/config/ini-config.html

2. Does this go in custom_postgui.hal ?

Since the hal pins related to the button are created with the gui you need to add the corresponding HAL lines to the 'POSTGUI_HALFILE'

That should be all.

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

More
18 Jun 2024 17:16 #303285 by sajurcaju
I get an error from Axis:
Unknown word where unary operation could be. Position: Relative Actual

Searching took me to a page that said this certainly came from gcode interpretation. I have reduced my sub to just start and end statements:
o<z_touch> sub
o<z_touch> endsub
and still get the same error.

Nowhere in the various config files is the subroutine file name used, only the directory. Is this correct?

Thanks

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

More
18 Jun 2024 17:30 #303286 by Aciera

Nowhere in the various config files is the subroutine file name used, only the directory. Is this correct?

That is correct, the interpreter will search for the subroutine in the paths declared.

If you change this:
MDI_COMMAND = o<z_touch>call

to
MDI_COMMAND = (debug,MDI button pressed)

And you press the button, do you get a message like this:
 
 
Attachments:

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

More
18 Jun 2024 17:38 #303287 by Aciera
The error 'Unknown word where unary operation could be.' points to a syntax error in Gcode.

If the interpreter was unable to find the subroutine then you would get error like
'seeking o-word: o<z_touch> from line .. '.
So there is something else going on.
The following user(s) said Thank You: sajurcaju

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

More
18 Jun 2024 17:39 #303288 by sajurcaju
I made your change, saved and restarted Axis. Same error message.

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

More
18 Jun 2024 17:47 #303289 by sajurcaju
Here are my various mods:

.ini file
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
SUBROUTINE_PATH = ncsubroutines:/home/steve/linuxcnc/subroutines

HAL
HALUI = halui

[HALUI]
# add halui MDI commands here (max 64)
MDI_COMMAND = MDI_COMMAND = (debug,MDI button pressed)

postgui_call_list.hal
# touch off Z
net ztouchoff halui.mdi-command-00 <= pyvcp.z-zero

custompanel.xml
<button>
<font>("Helvetica",14)</font>
<width>3</width>
<halpin>"z-zero"</halpin>
<text>"Z"</text>
</button>

There are other mods, the jog button pyvcp example. They work fine until I try my added touchoff Z button, when I get the error and the jog buttons no longer work. So I think it's the Z button section in error, rather than some other part.

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

More
18 Jun 2024 18:09 #303291 by Aciera

MDI_COMMAND = MDI_COMMAND = (debug,MDI button pressed)

Well this would explain the error you got. This line should be:
MDI_COMMAND = (debug,MDI button pressed)

 

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

More
18 Jun 2024 19:01 #303295 by sajurcaju
Well that was a silly mistake. Thank you very much!

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

Time to create page: 0.290 seconds
Powered by Kunena Forum