m84 real implementation, refactoring: mostly line width

This commit is contained in:
Nikolay Khabarov committed 2017-07-09 04:12:31 +03:00
1 parent 129d26ed5e
commit f549801bdd
12 files changed
+72 -34

No files matched your search

+14
View File
@@ -35,10 +35,12 @@ def init():
gpio.init(FAN_PIN, rpgpio.GPIO.MODE_OUTPUT)
gpio.init(EXTRUDER_HEATER_PIN, rpgpio.GPIO.MODE_OUTPUT)
gpio.init(BED_HEATER_PIN, rpgpio.GPIO.MODE_OUTPUT)
gpio.init(STEPPERS_ENABLE_PIN, rpgpio.GPIO.MODE_OUTPUT)
gpio.clear(SPINDLE_PWM_PIN)
gpio.clear(FAN_PIN)
gpio.clear(EXTRUDER_HEATER_PIN)
gpio.clear(BED_HEATER_PIN)
gpio.clear(STEPPERS_ENABLE_PIN)
def spindle_control(percent):
@@ -99,6 +101,13 @@ def get_bed_temperature():
return thermistor.get_temperature(BED_TEMPERATURE_SENSOR_CHANNEL)
def disable_steppers():
""" Disable all steppers until any movement occurs.
"""
logging.info("disable steppers")
gpio.set(STEPPERS_ENABLE_PIN)
def __calibrate_private(x, y, z, invert):
if invert:
stepper_inverted_x = not STEPPER_INVERTED_X
@@ -190,6 +199,8 @@ def calibrate(x, y, z):
:param z: boolean, True to calibrate Z axis.
:return: boolean, True if all specified end stops were triggered.
"""
# enable steppers
gpio.clear(STEPPERS_ENABLE_PIN)
logging.info("hal calibrate, x={}, y={}, z={}".format(x, y, z))
if not __calibrate_private(x, y, z, True): # move from endstop switch
return False
@@ -206,6 +217,8 @@ def move(generator):
# moving. In this case machine would safely paused between commands until
# calculation is done.
# enable steppers
gpio.clear(STEPPERS_ENABLE_PIN)
# 4 control blocks per 32 bytes
bytes_per_iter = 4 * dma.control_block_size()
# prepare and run dma
@@ -309,6 +322,7 @@ def deinit():
""" De-initialize hardware.
"""
join()
disable_steppers()
pwm.remove_all()
gpio.clear(SPINDLE_PWM_PIN)
gpio.clear(FAN_PIN)