def test_check_net_args(): try: hal.net() except TypeError: pass try: hal.net(None, "c1.s32out") except TypeError: pass try: hal.net("c1.s32out") # TypeError: net: 'c1.s32out' is a pin - first argument must be a signal name except TypeError: pass assert "noexiste" not in hal.signals hal.net("noexiste", "c1.s32out") assert "noexiste" in hal.signals ne = hal.signals["noexiste"] assert ne.writers == 1 assert ne.readers == 0 assert ne.bidirs == 0 try: hal.net("floatsig1", "c1.s32out") raise "should not happen" except RuntimeError: pass
def test_net_pin2pin(): try: hal.net("c1.s32out", "c2.s32out") # TypeError: net: 'c1.s32out' is a pin - first argument must be a signal name raise "should not happen" except TypeError: pass
def test_net_pin2pin(): try: hal.net("c1.s32out", "c2.s32out") #TypeError: net: 'c1.s32out' is a pin - first argument must be a signal name raise "should not happen" except TypeError: pass
def test_net_match_nonexistant_signals(): l.log() try: hal.net("nosuchsig", "c1.s32out", "c2.s32out") raise "should not happen" except TypeError: pass
def test_net_existing_signal_with_bad_type(): hal.newsig("f", hal.HAL_FLOAT) try: hal.net("f", "c1.s32out") raise "should not happen" except TypeError: pass del hal.signals["f"]
def test_net_existing_signal(): hal.newsig("s32", hal.HAL_S32) assert hal.pins["c1.s32out"].linked == False hal.net("s32", "c1.s32out") assert hal.pins["c1.s32out"].linked == True hal.newsig("s32too", hal.HAL_S32) try: hal.net("s32too", "c1.s32out") raise "should not happen" except RuntimeError: pass del hal.signals["s32"]
def test_net_existing_signal(self): l.log() hal.newsig("s32", hal.HAL_S32) assert hal.pins["c1.s32out"].linked is False hal.net("s32", "c1.s32out") assert hal.pins["c1.s32out"].linked is True hal.newsig("s32too", hal.HAL_S32) try: hal.net("s32too", "c1.s32out") raise "should not happen" except RuntimeError: pass del hal.signals["s32"] assert 's32' not in hal.signals
def setup_stepper(stepgenIndex, section, axisIndex=None, stepgenType='hpg.stepgen', gantry=False, gantryJoint=0, velocitySignal=None, thread=None): stepgen = '%s.%01i' % (stepgenType, stepgenIndex) if axisIndex is not None: axis = 'axis.%i' % axisIndex hasMotionAxis = (axisIndex is not None) and (not gantry or gantryJoint == 0) velocityControlled = velocitySignal is not None # axis enable chain enableIndex = axisIndex if axisIndex is None: enableIndex = 0 # use motor enable signal enable = hal.Signal('emcmot-%i-enable' % enableIndex, hal.HAL_BIT) if hasMotionAxis: enable.link('%s.amp-enable-out' % axis) enable.link('%s.enable' % stepgen) # expose timing parameters so we can multiplex them later sigBase = 'stepgen.%i' % stepgenIndex assign_param(sigBase, "position-scale", c.find(section, 'SCALE')) assign_param(sigBase, "maxaccel", c.find(section, 'STEPGEN_MAXACC')) #assign_param(sigBase,"maxvel",c.find("ABP", 'STEPGEN_MAXVEL')) # position command and feedback limitHome = hal.newsig('limit-%i-home' % axisIndex, hal.HAL_BIT) limitMin = hal.newsig('limit-%i-min' % axisIndex, hal.HAL_BIT) limitMax = hal.newsig('limit-%i-max' % axisIndex, hal.HAL_BIT) limitHome.link('%s.home-sw-in' % axis) limitMin.link('%s.neg-lim-sw-in' % axis) limitMax.link('%s.pos-lim-sw-in' % axis) if velocityControlled: hal.net(velocitySignal, '%s.velocity-cmd' % stepgen)
def setup_enable_chain(): """ Create enable and enable_inv signal for the system """ main_enable = hal.net('main-enable', 'axis.0.amp-enable-out') n = rtapi.newinst('not', 'main-enable.not') hal.addf(n.name, SERVO_THREAD) main_enable_inv = hal.newsig('main-enable-inv', hal.HAL_BIT) n.pin('in').link('main-enable') n.pin('out').link('main-enable-inv') return (main_enable, main_enable_inv)
def test_net_pin2pin(): l.log() # out to in is okay hal.net("c1.s32out", "c2.s32in") assert hal.pins["c1.s32out"].linked is True assert hal.pins["c2.s32in"].linked is True assert 'c1-s32out' in hal.signals # cleanup hal.pins["c1.s32out"].unlink() hal.pins["c2.s32in"].unlink() del hal.signals['c1-s32out'] assert 'c1-s32out' not in hal.signals try: hal.net("c2.s32out", "c1.s32out") # TypeError: net: signal 'c2-s32out' can not add writer pin 'c1.s32out', it already has HAL_OUT pin 'c2.s32out except TypeError: pass # cleanup hal.pins["c2.s32out"].unlink() del hal.signals['c2-s32out'] assert 'c2-s32out' not in hal.signals
def setup_tool_loopback(): # create signals for tool loading loopback hal.net('iocontrol.0.tool-prepare', 'iocontrol.0.tool-prepared') hal.net('iocontrol.0.tool-change', 'iocontrol.0.tool-changed')
def test_net(self): hal.net("square-wave", "charge-pump.out", "ringwrite.write")
sig_joint.link('%s.stepgen.0%s.position-cmd' % (card,i) ) # some more BBB cramps specific if hardware == 'bbb-cramps': hal.Pin('%s.stepgen.00.steppin' % card).set(813) hal.Pin('%s.stepgen.00.dirpin' % card).set(812) hal.Pin('%s.stepgen.01.steppin' % card).set(815) hal.Pin('%s.stepgen.01.dirpin' % card).set(814) hal.Pin('%s.stepgen.02.steppin' % card).set(819) hal.Pin('%s.stepgen.02.dirpin' % card).set(818) hal.Pin('%s.stepgen.03.steppin' % card).set(916) hal.Pin('%s.stepgen.03.dirpin' % card).set(912) hal.Pin('%s.stepgen.04.steppin' % card).set(917) hal.Pin('%s.stepgen.04.dirpin' % card).set(918) # Machine power (enale stepper drivers) hal.net('emcmot.00.enable', 'bb_gpio.p9.out-23') # Tie machine power signal to the CRAMPS LED hal.net('emcmot.00.enable', 'bb_gpio.p9.out-25') # set some better steps for video for i in range(0, 4): hal.Pin('%s.stepgen.0%s.position-scale' % (card, i)).set(4000) if hardware == 'bbb-bebopr++': hal.Pin('%s.stepgen.00.steppin' % card).set(812) hal.Pin('%s.stepgen.00.dirpin' % card).set(811) hal.Pin('%s.stepgen.01.steppin' % card).set(816) hal.Pin('%s.stepgen.01.dirpin' % card).set(815) hal.Pin('%s.stepgen.02.steppin' % card).set(915) hal.Pin('%s.stepgen.02.dirpin' % card).set(923) hal.Pin('%s.stepgen.03.steppin' % card).set(922) hal.Pin('%s.stepgen.03.dirpin' % card).set(921)
def setup_tool_loopback(): hal.net('iocontrol.0.tool-prepare', 'iocontrol.0.tool-prepared') hal.net('iocontrol.0.tool-change', 'iocontrol.0.tool-changed')
sig_joint.link('%s.stepgen.0%s.position-cmd' % (card, i)) # some more BBB cramps specific if hardware == 'bbb-cramps': hal.Pin('%s.stepgen.00.steppin' % card).set(813) hal.Pin('%s.stepgen.00.dirpin' % card).set(812) hal.Pin('%s.stepgen.01.steppin' % card).set(815) hal.Pin('%s.stepgen.01.dirpin' % card).set(814) hal.Pin('%s.stepgen.02.steppin' % card).set(819) hal.Pin('%s.stepgen.02.dirpin' % card).set(818) hal.Pin('%s.stepgen.03.steppin' % card).set(916) hal.Pin('%s.stepgen.03.dirpin' % card).set(912) hal.Pin('%s.stepgen.04.steppin' % card).set(917) hal.Pin('%s.stepgen.04.dirpin' % card).set(918) # Machine power (enale stepper drivers) hal.net('emcmot.00.enable', 'bb_gpio.p9.out-23') # Tie machine power signal to the CRAMPS LED hal.net('emcmot.00.enable', 'bb_gpio.p9.out-25') # set some better steps for video for i in range(0, 4): hal.Pin('%s.stepgen.0%s.position-scale' % (card, i)).set(4000) if hardware == 'bbb-bebopr++': hal.Pin('%s.stepgen.00.steppin' % card).set(812) hal.Pin('%s.stepgen.00.dirpin' % card).set(811) hal.Pin('%s.stepgen.01.steppin' % card).set(816) hal.Pin('%s.stepgen.01.dirpin' % card).set(815) hal.Pin('%s.stepgen.02.steppin' % card).set(915) hal.Pin('%s.stepgen.02.dirpin' % card).set(923) hal.Pin('%s.stepgen.03.steppin' % card).set(922) hal.Pin('%s.stepgen.03.dirpin' % card).set(921)
(lambda s=__import__('signal'): s.signal(s.SIGTERM, s.SIG_IGN))() setup_module() cfg = ConfigParser.ConfigParser() cfg.read(os.getenv("MACHINEKIT_INI")) uuid = cfg.get("MACHINEKIT", "MKUUID") rt = rtapi.RTAPIcommand(uuid=uuid) rt.loadrt("lutn"); rt.newinst("lutn","or2.0", "inputs=2", "function=0xe" ) rt.newinst("lutn","and2.0", "inputs=2", "function=0x8" ) hal.net("in0","and2.0.in0","or2.0.in0") hal.net("in1","and2.0.in1","or2.0.in1") in0 = hal.signals["in0"] in1 = hal.signals["in1"] rt.newthread("fast",1000000, use_fp=True) hal.addf("or2.0.funct","fast") hal.addf("and2.0.funct","fast") hal.start_threads() time.sleep(0.1) a = hal.pins["and2.0.out"] o = hal.pins["or2.0.out"] assert o.get() == 0
(lambda s=__import__('signal'): s.signal(s.SIGTERM, s.SIG_IGN))() setup_module() cfg = configparser.ConfigParser() cfg.read(os.getenv("MACHINEKIT_INI")) uuid = cfg.get("MACHINEKIT", "MKUUID") rt = rtapi.RTAPIcommand(uuid=uuid) rt.loadrt("lutn"); rt.newinst("lutn","or2.0", "inputs=2", "function=0xe" ) rt.newinst("lutn","and2.0", "inputs=2", "function=0x8" ) hal.net("in0","and2.0.in0","or2.0.in0") hal.net("in1","and2.0.in1","or2.0.in1") in0 = hal.signals["in0"] in1 = hal.signals["in1"] rt.newthread("fast",1000000, use_fp=True) hal.addf("or2.0.funct","fast") hal.addf("and2.0.funct","fast") hal.start_threads() time.sleep(0.1) a = hal.pins["and2.0.out"] o = hal.pins["or2.0.out"] assert o.get() == 0
def test_check_net_args(): l.log() try: hal.net() except TypeError: pass assert 'c1-s32out' not in hal.signals try: hal.net(None, "c1.s32out") except TypeError: pass assert 'c1-s32out' not in hal.signals # single pin argument assert hal.pins["c1.s32out"].linked is False try: hal.net("c1.s32out") # RuntimeError: net: at least one pin name expected except RuntimeError: pass # XXX die beiden gehen daneben: # der pin wird trotz runtime error gelinkt und das signal erzeugt: # offensichtlich hal_net.pyx:39 vor dem test in hal_net.pyx:60 assert hal.pins["c1.s32out"].linked is False assert 'c1-s32out' not in hal.signals # single signal argument try: hal.net("noexiste") # RuntimeError: net: at least one pin name expected except RuntimeError: pass # two signals hal.newsig('sig1', hal.HAL_FLOAT) hal.newsig('sig2', hal.HAL_FLOAT) try: hal.net('sig1', 'sig2') # NameError: no such pin: sig2 except NameError: pass assert "noexiste" not in hal.signals hal.net("noexiste", "c1.s32out") assert "noexiste" in hal.signals ne = hal.signals["noexiste"] assert ne.writers == 1 assert ne.readers == 0 assert ne.bidirs == 0 try: hal.net("floatsig1", "c1.s32out") raise "should not happen" except RuntimeError: pass
def test_net(): hal.net("square-wave","charge-pump.out","ringwrite.write")
def setup_stepper(stepgenIndex, section, axisIndex=None, stepgenType='hpg.stepgen', gantry=False, gantryJoint=0, velocitySignal=None, thread=None): stepgen = '%s.%02i' % (stepgenType, stepgenIndex) if axisIndex is not None: axis = 'axis.%i' % axisIndex hasMotionAxis = (axisIndex is not None) and (not gantry or gantryJoint == 0) velocityControlled = velocitySignal is not None # axis enable chain enableIndex = axisIndex if axisIndex is None: enableIndex = 0 # use motor enable signal enable = hal.Signal('emcmot-%i-enable' % enableIndex, hal.HAL_BIT) if hasMotionAxis: enable.link('%s.amp-enable-out' % axis) enable.link('%s.enable' % stepgen) # expose timing parameters so we can multiplex them later sigBase = 'stepgen-%i' % stepgenIndex dirsetup = hal.newsig('%s-dirsetup' % sigBase, hal.HAL_U32) dirhold = hal.newsig('%s-dirhold' % sigBase, hal.HAL_U32) steplen = hal.newsig('%s-steplen' % sigBase, hal.HAL_U32) stepspace = hal.newsig('%s-stepspace' % sigBase, hal.HAL_U32) scale = hal.newsig('%s-scale' % sigBase, hal.HAL_FLOAT) maxVel = hal.newsig('%s-max-vel' % sigBase, hal.HAL_FLOAT) maxAcc = hal.newsig('%s-max-acc' % sigBase, hal.HAL_FLOAT) controlType = hal.newsig('%s-control-type' % sigBase, hal.HAL_BIT) hal.Pin('%s.dirsetup' % stepgen).link(dirsetup) hal.Pin('%s.dirhold' % stepgen).link(dirhold) dirsetup.set(c.find(section, 'DIRSETUP')) dirhold.set(c.find(section, 'DIRHOLD')) hal.Pin('%s.steplen' % stepgen).link(steplen) hal.Pin('%s.stepspace' % stepgen).link(stepspace) steplen.set(c.find(section, 'STEPLEN')) stepspace.set(c.find(section, 'STEPSPACE')) hal.Pin('%s.position-scale' % stepgen).link(scale) scale.set(c.find(section, 'SCALE')) hal.Pin('%s.maxvel' % stepgen).link(maxVel) hal.Pin('%s.maxaccel' % stepgen).link(maxAcc) maxVel.set(c.find(section, 'STEPGEN_MAX_VEL')) maxAcc.set(c.find(section, 'STEPGEN_MAX_ACC')) hal.Pin('%s.control-type' % stepgen).link(controlType) # position command and feedback if not velocityControlled: if hasMotionAxis: # per axis fb and cmd posCmd = hal.newsig('emcmot-%i-pos-cmd' % axisIndex, hal.HAL_FLOAT) posCmd.link('%s.motor-pos-cmd' % axis) if not gantry: posCmd.link('%s.position-cmd' % stepgen) else: posCmd.link('gantry.%i.position-cmd' % axisIndex) posFb = hal.newsig('emcmot-%i-pos-fb' % axisIndex, hal.HAL_FLOAT) posFb.link('%s.motor-pos-fb' % axis) if not gantry: posFb.link('%s.position-fb' % stepgen) else: posFb.link('gantry.%i.position-fb' % axisIndex) if gantry: # per joint fb and cmd posCmd = hal.newsig( 'emcmot-%i-%i-pos-cmd' % (axisIndex, gantryJoint), hal.HAL_FLOAT) posCmd.link('gantry.%i.joint.%02i.pos-cmd' % (axisIndex, gantryJoint)) posCmd.link('%s.position-cmd' % stepgen) posFb = hal.newsig( 'emcmot-%i-%i-pos-fb' % (axisIndex, gantryJoint), hal.HAL_FLOAT) posFb.link('%s.position-fb' % stepgen) posFb.link('gantry.%i.joint.%02i.pos-fb' % (axisIndex, gantryJoint)) else: # velocity control hal.net(velocitySignal, '%s.velocity-cmd' % stepgen) controlType.set(1) # enable velocity control # limits if hasMotionAxis: limitHome = hal.newsig('limit-%i-home' % axisIndex, hal.HAL_BIT) limitMin = hal.newsig('limit-%i-min' % axisIndex, hal.HAL_BIT) limitMax = hal.newsig('limit-%i-max' % axisIndex, hal.HAL_BIT) limitHome.link('%s.home-sw-in' % axis) limitMin.link('%s.neg-lim-sw-in' % axis) limitMax.link('%s.pos-lim-sw-in' % axis) if gantry: if gantryJoint == 0: axisHoming = hal.newsig('emcmot-%i-homing' % axisIndex, hal.HAL_BIT) axisHoming.link('%s.homing' % axis) hal.Pin('gantry.%i.search-vel' % axisIndex).set( c.find(section, 'HOME_SEARCH_VEL')) hal.Pin('gantry.%i.homing' % axisIndex).link(axisHoming) hal.Pin('gantry.%i.home' % axisIndex).link(limitHome) or2 = rt.newinst('or2', 'or2.limit-%i-min' % axisIndex) hal.addf(or2.name, thread) or2.pin('out').link(limitMin) or2 = rt.newinst('or2', 'or2.limit-%i-max' % axisIndex) hal.addf(or2.name, thread) or2.pin('out').link(limitMax) limitHome = hal.newsig('limit-%i-%i-home' % (axisIndex, gantryJoint), hal.HAL_BIT) limitMin = hal.newsig('limit-%i-%i-min' % (axisIndex, gantryJoint), hal.HAL_BIT) limitMax = hal.newsig('limit-%i-%i-max' % (axisIndex, gantryJoint), hal.HAL_BIT) homeOffset = hal.Signal('home-offset-%i-%i' % (axisIndex, gantryJoint), hal.HAL_FLOAT) limitHome.link('gantry.%i.joint.%02i.home' % (axisIndex, gantryJoint)) limitMin.link('or2.limit-%i-min.in%i' % (axisIndex, gantryJoint)) limitMax.link('or2.limit-%i-max.in%i' % (axisIndex, gantryJoint)) homeOffset.link('gantry.%i.joint.%02i.home-offset' % (axisIndex, gantryJoint)) storage.setup_gantry_storage(axisIndex, gantryJoint)
def setup_estop_loopback(): # create signal for estop loopback hal.net('iocontrol.0.user-enable-out', 'iocontrol.0.emc-enable-in')
base.setup_stepper(section='AXIS_2', axisIndex=2, stepgenIndex=3, gantry=True, gantryJoint=1) # Extruder, velocity controlled base.setup_stepper(section='EXTRUDER_0', stepgenIndex=4, velocitySignal='ve-extrude-vel') # Extruder Multiplexer base.setup_extruder_multiplexer(extruders=(numExtruders + int(withAbp)), thread='servo-thread') # Stepper Multiplexer multiplexSections = [] for i in range(0, numExtruders): multiplexSections.append('EXTRUDER_%i' % i) if withAbp: # not a very good solution multiplexSections.append('ABP') multiplexSections.append('ABP') # no this is no mistake, we need an additional section hal.Pin('motion.digital-out-io-20').link('stepgen-4-control-type') hal.net('stepgen-4-pos-cmd', 'motion.analog-out-io-50', 'hpg.stepgen.04.position-cmd') hal.net('stepgen-4-pos-fb', 'motion.analog-in-50', 'hpg.stepgen.04.position-fb') base.setup_stepper_multiplexer(stepgenIndex=4, sections=multiplexSections, selSignal='extruder-sel', thread='servo-thread') # Fans for i in range(0, numFans): base.setup_fan('f%i' % i, thread='servo-thread') for i in range(0, numExtruders): hardware.setup_exp('exp%i' % i) # Temperature Signals base.create_temperature_control(name='hbp', section='HBP', hardwareOkSignal='temp-hw-ok', thread='servo-thread') for i in range(0, numExtruders):
def setup_stepper(stepgenIndex, section, axisIndex=None, stepgenType='hpg.stepgen', gantry=False, gantryJoint=0, velocitySignal=None, thread=None): stepgen = '%s.%02i' % (stepgenType, stepgenIndex) if axisIndex is not None: axis = 'axis.%i' % axisIndex hasMotionAxis = (axisIndex is not None) and (not gantry or gantryJoint == 0) velocityControlled = velocitySignal is not None # axis enable chain enableIndex = axisIndex if axisIndex is None: enableIndex = 0 # use motor enable signal enable = hal.Signal('emcmot-%i-enable' % enableIndex, hal.HAL_BIT) if hasMotionAxis: enable.link('%s.amp-enable-out' % axis) enable.link('%s.enable' % stepgen) # expose timing parameters so we can multiplex them later sigBase = 'stepgen-%i' % stepgenIndex dirsetup = hal.newsig('%s-dirsetup' % sigBase, hal.HAL_U32) dirhold = hal.newsig('%s-dirhold' % sigBase, hal.HAL_U32) steplen = hal.newsig('%s-steplen' % sigBase, hal.HAL_U32) stepspace = hal.newsig('%s-stepspace' % sigBase, hal.HAL_U32) scale = hal.newsig('%s-scale' % sigBase, hal.HAL_FLOAT) maxVel = hal.newsig('%s-max-vel' % sigBase, hal.HAL_FLOAT) maxAcc = hal.newsig('%s-max-acc' % sigBase, hal.HAL_FLOAT) controlType = hal.newsig('%s-control-type' % sigBase, hal.HAL_BIT) hal.Pin('%s.dirsetup' % stepgen).link(dirsetup) hal.Pin('%s.dirhold' % stepgen).link(dirhold) dirsetup.set(c.find(section, 'DIRSETUP')) dirhold.set(c.find(section, 'DIRHOLD')) hal.Pin('%s.steplen' % stepgen).link(steplen) hal.Pin('%s.stepspace' % stepgen).link(stepspace) steplen.set(c.find(section, 'STEPLEN')) stepspace.set(c.find(section, 'STEPSPACE')) hal.Pin('%s.position-scale' % stepgen).link(scale) scale.set(c.find(section, 'SCALE')) hal.Pin('%s.maxvel' % stepgen).link(maxVel) hal.Pin('%s.maxaccel' % stepgen).link(maxAcc) maxVel.set(c.find(section, 'STEPGEN_MAX_VEL')) maxAcc.set(c.find(section, 'STEPGEN_MAX_ACC')) hal.Pin('%s.control-type' % stepgen).link(controlType) # position command and feedback if not velocityControlled: if hasMotionAxis: # per axis fb and cmd posCmd = hal.newsig('emcmot-%i-pos-cmd' % axisIndex, hal.HAL_FLOAT) posCmd.link('%s.motor-pos-cmd' % axis) if not gantry: posCmd.link('%s.position-cmd' % stepgen) else: posCmd.link('gantry.%i.position-cmd' % axisIndex) posFb = hal.newsig('emcmot-%i-pos-fb' % axisIndex, hal.HAL_FLOAT) posFb.link('%s.motor-pos-fb' % axis) if not gantry: posFb.link('%s.position-fb' % stepgen) else: posFb.link('gantry.%i.position-fb' % axisIndex) if gantry: # per joint fb and cmd posCmd = hal.newsig('emcmot-%i-%i-pos-cmd' % (axisIndex, gantryJoint), hal.HAL_FLOAT) posCmd.link('gantry.%i.joint.%02i.pos-cmd' % (axisIndex, gantryJoint)) posCmd.link('%s.position-cmd' % stepgen) posFb = hal.newsig('emcmot-%i-%i-pos-fb' % (axisIndex, gantryJoint), hal.HAL_FLOAT) posFb.link('%s.position-fb' % stepgen) posFb.link('gantry.%i.joint.%02i.pos-fb' % (axisIndex, gantryJoint)) else: # velocity control hal.net(velocitySignal, '%s.velocity-cmd' % stepgen) controlType.set(1) # enable velocity control # limits if hasMotionAxis: limitHome = hal.newsig('limit-%i-home' % axisIndex, hal.HAL_BIT) limitMin = hal.newsig('limit-%i-min' % axisIndex, hal.HAL_BIT) limitMax = hal.newsig('limit-%i-max' % axisIndex, hal.HAL_BIT) limitHome.link('%s.home-sw-in' % axis) limitMin.link('%s.neg-lim-sw-in' % axis) limitMax.link('%s.pos-lim-sw-in' % axis) if gantry: if gantryJoint == 0: axisHoming = hal.newsig('emcmot-%i-homing' % axisIndex, hal.HAL_BIT) axisHoming.link('%s.homing' % axis) hal.Pin('gantry.%i.search-vel' % axisIndex).set(c.find(section, 'HOME_SEARCH_VEL')) hal.Pin('gantry.%i.homing' % axisIndex).link(axisHoming) hal.Pin('gantry.%i.home' % axisIndex).link(limitHome) or2 = rt.newinst('or2', 'or2.limit-%i-min' % axisIndex) hal.addf(or2.name, thread) or2.pin('out').link(limitMin) or2 = rt.newinst('or2', 'or2.limit-%i-max' % axisIndex) hal.addf(or2.name, thread) or2.pin('out').link(limitMax) limitHome = hal.newsig('limit-%i-%i-home' % (axisIndex, gantryJoint), hal.HAL_BIT) limitMin = hal.newsig('limit-%i-%i-min' % (axisIndex, gantryJoint), hal.HAL_BIT) limitMax = hal.newsig('limit-%i-%i-max' % (axisIndex, gantryJoint), hal.HAL_BIT) homeOffset = hal.Signal('home-offset-%i-%i' % (axisIndex, gantryJoint), hal.HAL_FLOAT) limitHome.link('gantry.%i.joint.%02i.home' % (axisIndex, gantryJoint)) limitMin.link('or2.limit-%i-min.in%i' % (axisIndex, gantryJoint)) limitMax.link('or2.limit-%i-max.in%i' % (axisIndex, gantryJoint)) homeOffset.link('gantry.%i.joint.%02i.home-offset' % (axisIndex, gantryJoint)) storage.setup_gantry_storage(axisIndex, gantryJoint)