On Wednesday 13 November 2019 06:43:36 andy pugh wrote:

> On Wed, 13 Nov 2019 at 11:27, Gene Heskett <[email protected]> 
wrote:
> > Reading the man pages for master as I just built on the rpi4, I
> > still can't find a pin on "motion" that tallies its g20/g21 state.
>
> I don't think motion knows. Motion lives in an entirely metric world.
> G20 / G21 is almost like a preprocessor macro for the interpreter, and
> the G20/G21 status only has any meaning inside the interpreter.
>
> So, it's a G-code status not a machine status.
>
> It wouldn't be hard to make a Python HAL component that gives you the
> units: (Note that this is entirely untested, and written in a Gmail
> window, so the tab-stops should not be trusted either. And I don't
> even know if I have G20 and G21 the right way round,
>
With both present, who cares, I'll just use the right one.  And this 
looks to be read-only which is also good since we sure wouldn't want a 
potential short to be able to muck with it. 

Put this in the same git clone directory as pyvcp.py? & rerun debuild?
thats emc/src/hal/user_comps in my build tree here. 

But I probably should do a fresh git clone first, this pull is near 3 
weeks old.

> #!/usr/bin/env python
> import hal, time, linuxcnc
> h = hal.component("units")
> h.newpin("G21", hal.HAL_BIT, hal.HAL_OUT)
> h.newpin("G20", hal.HAL_BIT, hal.HAL_OUT)
> h.ready()
> s = linuxcnc.stat()
> try:
>     while 1:
>         time.sleep(1)
>         s.poll()
>         if s,program_units() == 1:
>               h['G21'] = 0
>               h['G20'] = 1
>         else:
>               h['G21'] = 1
>               h['G20'] = 0
> except KeyboardInterrupt:
>     raise SystemExit

Thanks Andy.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to