gcode: Add support for M400 command
Add ability to fully stall the input until all moves are complete. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
f2b406fc5e
commit
2e03d84755
|
@ -44,7 +44,8 @@ class GCodeParser:
|
||||||
self.fan = self.printer.objects.get('fan')
|
self.fan = self.printer.objects.get('fan')
|
||||||
def build_handlers(self):
|
def build_handlers(self):
|
||||||
handlers = ['G1', 'G4', 'G20', 'G21', 'G28', 'G90', 'G91', 'G92',
|
handlers = ['G1', 'G4', 'G20', 'G21', 'G28', 'G90', 'G91', 'G92',
|
||||||
'M18', 'M82', 'M83', 'M105', 'M110', 'M112', 'M114', 'M206',
|
'M18', 'M82', 'M83', 'M105', 'M110', 'M112', 'M114',
|
||||||
|
'M206', 'M400',
|
||||||
'HELP', 'QUERY_ENDSTOPS', 'RESTART', 'CLEAR_SHUTDOWN',
|
'HELP', 'QUERY_ENDSTOPS', 'RESTART', 'CLEAR_SHUTDOWN',
|
||||||
'STATUS']
|
'STATUS']
|
||||||
if self.heater_nozzle is not None:
|
if self.heater_nozzle is not None:
|
||||||
|
@ -323,6 +324,9 @@ class GCodeParser:
|
||||||
v = float(params[a])
|
v = float(params[a])
|
||||||
self.base_position[p] += self.homing_add[p] - v
|
self.base_position[p] += self.homing_add[p] - v
|
||||||
self.homing_add[p] = v
|
self.homing_add[p] = v
|
||||||
|
def cmd_M400(self, params):
|
||||||
|
# Wait for current moves to finish
|
||||||
|
self.toolhead.wait_moves()
|
||||||
cmd_QUERY_ENDSTOPS_help = "Report on the status of each endstop"
|
cmd_QUERY_ENDSTOPS_help = "Report on the status of each endstop"
|
||||||
cmd_QUERY_ENDSTOPS_aliases = ["M119"]
|
cmd_QUERY_ENDSTOPS_aliases = ["M119"]
|
||||||
def cmd_QUERY_ENDSTOPS(self, params):
|
def cmd_QUERY_ENDSTOPS(self, params):
|
||||||
|
|
|
@ -287,6 +287,11 @@ class ToolHead:
|
||||||
self.extruder.motor_off(last_move_time)
|
self.extruder.motor_off(last_move_time)
|
||||||
self.dwell(STALL_TIME)
|
self.dwell(STALL_TIME)
|
||||||
logging.debug('; Max time of %f' % (last_move_time,))
|
logging.debug('; Max time of %f' % (last_move_time,))
|
||||||
|
def wait_moves(self):
|
||||||
|
self.move_queue.flush()
|
||||||
|
eventtime = time.time()
|
||||||
|
while self.print_time:
|
||||||
|
eventtime = self.reactor.pause(eventtime + 0.100)
|
||||||
def query_endstops(self):
|
def query_endstops(self):
|
||||||
last_move_time = self.get_last_move_time()
|
last_move_time = self.get_last_move_time()
|
||||||
return self.kin.query_endstops(last_move_time)
|
return self.kin.query_endstops(last_move_time)
|
||||||
|
|
Loading…
Reference in New Issue