add pen (z axis) control command

This commit is contained in:
sinseman44
2020-09-13 21:57:38 +01:00
parent 3875c13356
commit a94da2de8e
7 changed files with 73 additions and 4 deletions
+20
View File
@@ -169,6 +169,9 @@ def init():
stepper_y.set_dir(stepper.STATE_DIR_INV)
stepper_y.enable()
stepper_y.debug()
# Init pen pin
gpio.init(PEN_PIN, rpgpio.GPIO.MODE_OUTPUT)
gpio.clear(PEN_PIN)
# Watchdog start
watchdog.start()
@@ -186,6 +189,22 @@ def fan_control(on_off):
"""
logging.debug("fan control not implemented")
def pen_control(up_down):
"""
Pen control.
:param on_off: boolean value if pen is up or down.
"""
if up_down:
logging.info("Pen is up ...")
pwm.add_pin(PEN_PIN, 5)
time.sleep(0.25)
pwm.add_pin(PEN_PIN, 0)
else:
logging.info("Pen is down ...")
pwm.add_pin(PEN_PIN, 12.5)
time.sleep(0.25)
pwm.add_pin(PEN_PIN, 0)
def extruder_heater_control(percent):
""" Extruder heater control.
:param percent: heater power in percent 0..100. 0 turns heater off.
@@ -346,6 +365,7 @@ def deinit():
join()
disable_steppers()
pwm.remove_all()
gpio.clear(PEN_PIN)
watchdog.stop()
def watchdog_feed():
+2 -1
View File
@@ -260,7 +260,8 @@ class DMAGPIO(DMAProto):
class DMAPWM(DMAProto):
_DMA_CONTROL_BLOCK_SIZE = 32
_DMA_DATA_OFFSET = 24
_TOTAL_NUMBER_OF_BLOCKS = 256
#_TOTAL_NUMBER_OF_BLOCKS = 256
_TOTAL_NUMBER_OF_BLOCKS = 76500
_DMA_CHANNEL = 14
def __init__(self):