I have used the attached file yonks ago, worked fine, used to determine which mode, inch or mm the machine is in. But now halcompile will not build it. I've tried all the options to halcompile, but nothing works.
It seems all roads lead to the same exit:
gene@GO704:~/linuxcnc/configs/go704-xyza$ halcompile --compile units.comp
Traceback (most recent call last):
  File "/usr/bin/halcompile", line 1558, in <module>
    main()
  File "/usr/bin/halcompile", line 1528, in main
    process(f, mode, outfile)
  File "/usr/bin/halcompile", line 1366, in process
    a, b = parse(filename)
  File "/usr/bin/halcompile", line 441, in parse
    a, b = f.split("\n;;\n", 1)
ValueError: not enough values to unpack (expected 2, got 1)

It is older code from 2017, by Kurt Jacobsen

Can anyone advise?

Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
#!/usr/bin/python

#  Author: Kurt Jacobson
#    Date: 04/15/17
#   Email: kurtjacob...@bellsouth.net
# License: GPL 

import hal, time
import linuxcnc

stat = linuxcnc.stat()

h = hal.component("units")
h.newpin("prog_in", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("prog_mm", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("update_rate", hal.HAL_FLOAT, hal.HAL_IN)

h.ready()

# Set default update rate to 50ms
h.update_rate = .05

try:
    while 1:
        time.sleep(h.update_rate)
        stat.poll()
        prog_units = stat.program_units
        if prog_units == 1: # Inch
            h.prog_in = 1
            h.prog_mm = 0
        elif prog_units == 2: # Metric
            h.prog_in = 0
            h.prog_mm = 1
except KeyboardInterrupt:
    raise SystemExit
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to