I am trying to create an m-code, M41, for my lathe using remapping. This
is with LinuxCNC 2.6, but I'm posting here because there are remapping
experts here (maybe?).
Currently, I have an M10x.ngc file which is a shell script something like:
M102
~~~~~~~~~~~~~
#!/bin/bash
# Sets spindle clutches to Low
halcmd setp parport.0.pin-05-out False
halcmd setp parport.0.pin-06-out True
exit 0
~~~~~~~~~~~~~
So it is invoked in g-code with "M102".
What I would like to do is use M41. To do this, I edited my .ini file:
lathe.ini
~~~~~~~~~~~~~
...
[RS274NGC]
REMAP=M41 modalgroup=10 py=m41
...
[PYTHON]
TOPLEVEL=/home/kwallace/linuxcnc-dev/configs/python/toplevel.py
PATH_APPEND=/home/kwallace/linuxcnc-dev/configs/python
...
~~~~~~~~~~~~~
toplevel.py (just the one line)
~~~~~~~~~~~~~
import remap
~~~~~~~~~~~~~
remap.py
~~~~~~~~~~~~~
def m41(self, **words):
...
I would like a command that does what halcmd did in the shell
script above
...
return
~~~~~~~~~~~~~
I can invoke g-code commands with 'execute()', or emccanon to invoke
canon commands, but neither of these allow setting a HAL signal or pin,
as for as I know. Also, I would prefer to not set the parport pin but
connect it in the .ini file to a HAL signal, such as spindleLow, then
set the signal in remap.py , similar to the built-in signal for coolant.
Any comments are welcome. Thank you.
--
Kirk Wallace
http://www.wallacecompany.com/machine_shop/
http://www.wallacecompany.com/E45/