On Monday 17 April 2017 14:50:41 Chris Morley wrote: > I think you are using recent master. > Yes Chris, and thank you. For G20-G21, this looks promising.
> 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 > 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> ------------------------------------------------------------------------------ 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
