I think you are using recent master.

If so this python program should give you what you want.

name it metric_status and put it in your $PATH as per:

http://linuxcnc.org/docs/devel/html/hal/halmodule.html

Creating Userspace Python Components - 
LinuxCNC.org<http://linuxcnc.org/docs/devel/html/hal/halmodule.html>
linuxcnc.org
A userspace component begins by creating its pins and parameters, then enters a 
loop which will periodically drive all the outputs from the inputs.




#!/usr/bin/env python
import hal
from hal_glib import GStat
import gobject
GSTAT = GStat()

def mode_changed(obj, data):
        h['g20'] = not data
        h['g21'] = data

h = hal.component("metric_status")
h.newpin("g20", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("g21", hal.HAL_BIT, hal.HAL_OUT)
h.ready()

GSTAT.connect("metric-mode-changed",mode_changed)
# work around forced merge error
GSTAT.merge()
metric_new = GSTAT.old['metric']
GSTAT.emit('metric_mode_changed',metric_new)


try:
        gobject.MainLoop().run()
except KeyboardInterrupt:
    raise SystemExit


________________________________
From: Gene Heskett <[email protected]>
Sent: April 16, 2017 12:56 AM
To: [email protected]
Subject: Re: [Emc-developers] view and mm/inches switching.

On Saturday 15 April 2017 19:58:22 andy pugh wrote:

> On 16 April 2017 at 00:43, Gene Heskett <[email protected]> wrote:
> > Its a last ditch thought, but not as dynamic as I'd like. I'd like
> > very much if it was real time as I have used that switch in the
> > middle of a gcode program more than once.
>
> Do you often care about jog step sizes in the middle of the execution
> of a g-code program?

Perhaps .1% of the time, most often when there is a tool change or 5 in
the code.

> And do you really want the display switching units when you call a
> mm-coded subroutine? I think that would actually just be annoying.

Since we can't trace the subroutine at all, and any errors are blamed on
the parent call, at least the display changing modes could tell us the
subroutine is running.  Its a nearly vanishingly thin excuse to be sure
though. :(

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)
Genes Web page <http://geneslinuxbox.net:6309/gene>
[http://geneslinuxbox.net:6309/gene/pix/EasterSundayCropped2004-1.jpg]<http://geneslinuxbox.net:6309/gene>

Gene's Web pages<http://geneslinuxbox.net:6309/gene>
geneslinuxbox.net
Welcome to Gene's web pages. Here you will find some of the things that make me 
tick, and that help keep me out of the bars. That is me & the missus, Dee 
(Elladene) I ...



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers
Emc-developers Info Page - 
SourceForge<https://lists.sourceforge.net/lists/listinfo/emc-developers>
lists.sourceforge.net
The Enhanced Machine Controller (EMC) is a CNC machine controller that runs on 
Linux and is available under the terms of the GNU General Public License.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to