From: Dewey G. <gi...@gi...> - 2011-12-31 11:39:31
|
simulate_probe: new script http://git.linuxcnc.org/?p=emc2.git;a=commitdiff;h=b842d05 --- scripts/simulate_probe | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile | 1 + 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/scripts/simulate_probe b/scripts/simulate_probe new file mode 100755 index 0000000..8068c90 --- /dev/null +++ b/scripts/simulate_probe @@ -0,0 +1,49 @@ +#!/usr/bin/wish + +# simulate a probe +# You must disconnect hal connections to motion.probe-input + +set this [file tail $::argv0] + +if [catch {exec halcmd setp motion.probe-input 0} msg] { + if {[string last connected $msg] >= 0} { + puts "\nThe pin motion.probe-input is currently connected to a signal" + puts "Remove the connection to use $this\n" + exit + } else { + puts "\nIs EMC running? <$msg>" + puts "Start EMC before starting $this\n" + } + exit +} + +pack [label .l -width 20 -height 10 -bg lightgray -fg black \ + -text "Push to simulate\nProbe touch"] \ + -fill both -expand 1 +bind .l <ButtonPress-1> probetouch +bind .l <ButtonRelease-1> proberelease + +set ::pulse 0 +pack [checkbutton .c -text Pulse -variable ::pulse] \ + -fill x -expand 0 + +proc probetouch {} { + .l configure -bg red -fg white -text ProbeON + if [catch {exec halcmd setp motion.probe-input 1} msg] { + puts stderr "Is EMC running? <$msg>" + return + } + if $::pulse { + after 100 proberelease + if [catch {exec halcmd setp motion.probe-input 0} msg] { + puts stderr "Is EMC running? <$msg>" + return + } + } +} +proc proberelease {} { + .l configure -bg lightgray -fg black -text ProbeOFF + if [catch {exec halcmd setp motion.probe-input 0} msg] { + puts stderr "Is EMC running? <$msg>" + } +} diff --git a/src/Makefile b/src/Makefile index 842133b..65bc3be 100644 --- a/src/Makefile +++ b/src/Makefile @@ -500,6 +500,7 @@ install-kernel-indep: install-dirs $(EXE) ../scripts/realtime $(DESTDIR)$(initd_dir) $(EXE) ../scripts/halrun $(DESTDIR)$(bindir) $(EXE) ../scripts/haltcl $(DESTDIR)$(bindir) + $(EXE) ../scripts/simulate_probe $(DESTDIR)$(bindir) $(FILE) ../docs/UPDATING $(DESTDIR)$(docsdir)/UPDATING $(FILE) ../*.png ../*.gif $(DESTDIR)$(datadir)/emc |