def setup_fan(name, thread): setSig = hal.newsig('%s-set' % name, hal.HAL_FLOAT) pwmSig = hal.newsig('%s-pwm' % name, hal.HAL_FLOAT) enable = hal.newsig('%s-enable' % name, hal.HAL_BIT) # reset fan when estop is cleared reset = rt.newinst('reset', 'reset.%s-set' % name) hal.addf(reset.name, thread) reset.pin('reset-float').set(0.0) reset.pin('out-float').link(setSig) reset.pin('rising').set(True) reset.pin('falling').set(False) reset.pin('trigger').link('estop-reset') scale = rt.newinst('scale', 'scale.%s' % name) hal.addf(scale.name, thread) scale.pin('in').link(setSig) scale.pin('out').link(pwmSig) scale.pin('gain').set(1.0 / 255.0) # 255 steps from motion setSig.set(0.0) enable.set(True) rcomps.create_fan_rcomp(name) motion.setup_fan_io(name)
def setup_fan(name, thread): setSig = hal.newsig('%s-set' % name, hal.HAL_FLOAT) pwmSig = hal.newsig('%s-pwm' % name, hal.HAL_FLOAT) enable = hal.newsig('%s-enable' % name, hal.HAL_BIT) scale = rt.newinst('scale', 'scale.%s' % name) hal.addf(scale.name, thread) scale.pin('in').link(setSig) scale.pin('out').link(pwmSig) scale.pin('gain').set(1.0 / 255.0) # 255 steps from motion setSig.set(0.0) enable.set(True) rcomps.create_fan_rcomp(name) motion.setup_fan_io(name)