Skip to content

Commit

Permalink
删除gcode macro渲染后的空行
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoGeTiertime committed Nov 11, 2024
1 parent 5cc0011 commit 4c45d55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion klippy/extras/gcode_macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ def cmd_SHOW_MACRO(self, gcmd):
kwparams['params'] = gcmd.get_command_parameters()
kwparams['rawparams'] = gcmd.get_raw_command_parameters()
renderstring = self.template.render(kwparams)
self.gcode.respond_info("after render: %s" %(renderstring,))
# 去除空行
result = "\n".join(filter(lambda line: line.strip(), renderstring.split("\n")))
self.gcode.respond_info("after render:\n %s" %(result,))

def cmd(self, gcmd):
if self.in_script:
Expand Down

0 comments on commit 4c45d55

Please sign in to comment.