mirror of
https://github.com/sinseman44/PyCNC.git
synced 2026-07-16 08:37:09 +00:00
add pen (z axis) control command
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user