mirror of
https://github.com/QIDITECH/klipper.git
synced 2026-01-30 15:38:42 +03:00
V4.4.21 Update
This commit is contained in:
@@ -197,38 +197,39 @@ class GCodeDispatch:
|
||||
else:
|
||||
self.break_flag = False
|
||||
self.printer.lookup_object("heaters").break_flag = False
|
||||
while priority_queue:
|
||||
priority_command = priority_queue.pop(0)
|
||||
# self.respond_info("priority: {}".format(priority_command))
|
||||
cpos = priority_command.find(';')
|
||||
if cpos >= 0:
|
||||
priority_command = priority_command[:cpos]
|
||||
parts = self.args_r.split(priority_command.upper())
|
||||
numparts = len(parts)
|
||||
cmd = ""
|
||||
if numparts >= 3 and parts[1] != 'N':
|
||||
cmd = parts[1] + parts[2].strip()
|
||||
elif numparts >= 5 and parts[1] == 'N':
|
||||
cmd = parts[3] + parts[4].strip()
|
||||
params = { parts[i]: parts[i+1].strip()
|
||||
for i in range(1, numparts, 2) }
|
||||
gcmd = GCodeCommand(self, cmd, priority_command, params, need_ack)
|
||||
handler = self.gcode_handlers.get(cmd, self.cmd_default)
|
||||
try:
|
||||
handler(gcmd)
|
||||
except self.error as e:
|
||||
self._respond_error(str(e))
|
||||
self.printer.send_event("gcode:command_error")
|
||||
if not need_ack:
|
||||
raise
|
||||
except:
|
||||
msg = 'Internal error on command:"%s"' % (cmd,)
|
||||
logging.exception(msg)
|
||||
self.printer.invoke_shutdown(msg)
|
||||
self._respond_error(msg)
|
||||
if not need_ack:
|
||||
raise
|
||||
gcmd.ack()
|
||||
# # Priority queue
|
||||
# while priority_queue:
|
||||
# priority_command = priority_queue.pop(0)
|
||||
# # self.respond_info("priority: {}".format(priority_command))
|
||||
# cpos = priority_command.find(';')
|
||||
# if cpos >= 0:
|
||||
# priority_command = priority_command[:cpos]
|
||||
# parts = self.args_r.split(priority_command.upper())
|
||||
# numparts = len(parts)
|
||||
# cmd = ""
|
||||
# if numparts >= 3 and parts[1] != 'N':
|
||||
# cmd = parts[1] + parts[2].strip()
|
||||
# elif numparts >= 5 and parts[1] == 'N':
|
||||
# cmd = parts[3] + parts[4].strip()
|
||||
# params = { parts[i]: parts[i+1].strip()
|
||||
# for i in range(1, numparts, 2) }
|
||||
# gcmd = GCodeCommand(self, cmd, priority_command, params, need_ack)
|
||||
# handler = self.gcode_handlers.get(cmd, self.cmd_default)
|
||||
# try:
|
||||
# handler(gcmd)
|
||||
# except self.error as e:
|
||||
# self._respond_error(str(e))
|
||||
# self.printer.send_event("gcode:command_error")
|
||||
# if not need_ack:
|
||||
# raise
|
||||
# except:
|
||||
# msg = 'Internal error on command:"%s"' % (cmd,)
|
||||
# logging.exception(msg)
|
||||
# self.printer.invoke_shutdown(msg)
|
||||
# self._respond_error(msg)
|
||||
# if not need_ack:
|
||||
# raise
|
||||
# gcmd.ack()
|
||||
cpos = line.find(';')
|
||||
if cpos >= 0:
|
||||
line = line[:cpos]
|
||||
@@ -265,16 +266,18 @@ class GCodeDispatch:
|
||||
def run_script_from_command(self, script):
|
||||
self._process_commands(script.split('\n'), need_ack=False)
|
||||
def run_script(self, script):
|
||||
lines = script.split('\n')
|
||||
temp_lines = []
|
||||
for line in lines:
|
||||
if set_gcode_offset_r.match(line) is not None:
|
||||
priority_queue.append(line)
|
||||
else:
|
||||
temp_lines.append(line)
|
||||
lines = temp_lines
|
||||
# lines = script.split('\n')
|
||||
# temp_lines = []
|
||||
# for line in lines:
|
||||
# if set_gcode_offset_r.match(line) is not None:
|
||||
# priority_queue.append(line)
|
||||
# else:
|
||||
# temp_lines.append(line)
|
||||
# lines = temp_lines
|
||||
# with self.mutex:
|
||||
# self._process_commands(lines, need_ack=False)
|
||||
with self.mutex:
|
||||
self._process_commands(lines, need_ack=False)
|
||||
self._process_commands(script.split('\n'), need_ack=False)
|
||||
def get_mutex(self):
|
||||
return self.mutex
|
||||
def create_gcode_command(self, command, commandline, params):
|
||||
|
||||
@@ -224,7 +224,7 @@ class ToolHead:
|
||||
self.buffer_time_low = config.getfloat(
|
||||
'buffer_time_low', 1.000, above=0.)
|
||||
self.buffer_time_high = config.getfloat(
|
||||
'buffer_time_high', 10.000, above=self.buffer_time_low)
|
||||
'buffer_time_high', 2.000, above=self.buffer_time_low)
|
||||
self.buffer_time_start = config.getfloat(
|
||||
'buffer_time_start', 0.250, above=0.)
|
||||
self.move_flush_time = config.getfloat(
|
||||
|
||||
Reference in New Issue
Block a user