mirror of
https://github.com/sinseman44/PyCNC.git
synced 2026-05-06 21:28:12 +00:00
auto fan turn on
This commit is contained in:
@@ -89,3 +89,6 @@ INSTANT_RUN = True
|
|||||||
# velocity would be decreased(proportional for all axises) to fit the maximum
|
# velocity would be decreased(proportional for all axises) to fit the maximum
|
||||||
# velocity.
|
# velocity.
|
||||||
AUTO_VELOCITY_ADJUSTMENT = True
|
AUTO_VELOCITY_ADJUSTMENT = True
|
||||||
|
|
||||||
|
# Automatically turn on fan when extruder is heating, boolean value.
|
||||||
|
AUTO_FAN_ON = True
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ class GMachine(object):
|
|||||||
""" Main object which control and keep state of whole machine: steppers,
|
""" Main object which control and keep state of whole machine: steppers,
|
||||||
spindle, extruder etc
|
spindle, extruder etc
|
||||||
"""
|
"""
|
||||||
|
AUTO_FAN_ON = AUTO_FAN_ON
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
""" Initialization.
|
""" Initialization.
|
||||||
"""
|
"""
|
||||||
@@ -85,6 +87,8 @@ class GMachine(object):
|
|||||||
self._heaters[heater].stop()
|
self._heaters[heater].stop()
|
||||||
del self._heaters[heater]
|
del self._heaters[heater]
|
||||||
if temperature != 0:
|
if temperature != 0:
|
||||||
|
if heater == HEATER_EXTRUDER and self.AUTO_FAN_ON:
|
||||||
|
self._fan(True)
|
||||||
self._heaters[heater] = Heater(temperature, coefficients, measure,
|
self._heaters[heater] = Heater(temperature, coefficients, measure,
|
||||||
control)
|
control)
|
||||||
if wait:
|
if wait:
|
||||||
|
|||||||
@@ -268,6 +268,15 @@ class TestGMachine(unittest.TestCase):
|
|||||||
self.assertTrue(m.fan_state())
|
self.assertTrue(m.fan_state())
|
||||||
m.do_command(GCode.parse_line("M107"))
|
m.do_command(GCode.parse_line("M107"))
|
||||||
self.assertFalse(m.fan_state())
|
self.assertFalse(m.fan_state())
|
||||||
|
# check auto fan feature
|
||||||
|
m.AUTO_FAN_ON = True
|
||||||
|
m.do_command(GCode.parse_line("M104S" + str(MIN_TEMPERATURE)))
|
||||||
|
self.assertTrue(m.fan_state())
|
||||||
|
m.do_command(GCode.parse_line("M104S0"))
|
||||||
|
self.assertTrue(m.fan_state())
|
||||||
|
m.do_command(GCode.parse_line("M107"))
|
||||||
|
self.assertFalse(m.fan_state())
|
||||||
|
m.AUTO_FAN_ON = False
|
||||||
|
|
||||||
def test_m140_m190(self):
|
def test_m140_m190(self):
|
||||||
m = GMachine()
|
m = GMachine()
|
||||||
|
|||||||
Reference in New Issue
Block a user