Код: Выделить всё
work_thread = 1.
import emc, time
import hal
h = hal.component("state")
h.newpin("enable", hal.HAL_BIT, hal.HAL_IN)
h.newpin("G92", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("G54", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("G55", hal.HAL_BIT, hal.HAL_OUT)
# ok, lets we are ready, lets go
h.ready()
s = emc.stat(); s.poll()
#main cicle
print s.gcodes
try:
while True :
time.sleep(work_thread)
s.poll()
h['G54'] == 540 in s.gcodes
h['G92'] == 920 in s.gcodes
h['G55'] == 550 in s.gcodes
except KeyboardInterrupt:
raise SystemExit