MCPcopy Create free account
hub / github.com/Klipper3d/klipper / cmd_default

Method cmd_default

klippy/gcode.py:272–305  ·  view source on GitHub ↗
(self, gcmd)

Source from the content-addressed store, hash-verified

270 return gcmd
271 # G-Code special command handlers
272 def cmd_default(self, gcmd):
273 cmd = gcmd.get_command()
274 if cmd == 'M105':
275 # Don't warn about temperature requests when not ready
276 gcmd.ack("T:0")
277 return
278 if cmd == 'M21':
279 # Don't warn about sd card init when not ready
280 return
281 if not self.is_printer_ready:
282 raise gcmd.error(self.printer.get_state_message()[0])
283 return
284 if not cmd:
285 cmdline = gcmd.get_commandline()
286 if cmdline:
287 logging.debug(cmdline)
288 return
289 if ' ' in cmd:
290 # Handle M117/M118 gcode with numeric and special characters
291 realcmd = cmd.split()[0]
292 if realcmd in ["M117", "M118", "M23"]:
293 handler = self.gcode_handlers.get(realcmd, None)
294 if handler is not None:
295 gcmd._command = realcmd
296 handler(gcmd)
297 return
298 elif cmd in ['M140', 'M104'] and not gcmd.get_float('S', 0.):
299 # Don't warn about requests to turn off heaters when not present
300 return
301 elif cmd == 'M107' or (cmd == 'M106' and (
302 not gcmd.get_float('S', 1.) or self.is_fileinput)):
303 # Don't warn about requests to turn off fan when fan not present
304 return
305 gcmd.respond_info('Unknown command:"%s"' % (cmd,))
306 def _cmd_mux(self, command, gcmd):
307 key, values = self.mux_commands[command]
308 if None in values:

Callers

nothing calls this directly

Calls 9

get_commandMethod · 0.80
ackMethod · 0.80
errorMethod · 0.80
get_state_messageMethod · 0.80
get_commandlineMethod · 0.80
splitMethod · 0.80
respond_infoMethod · 0.80
getMethod · 0.45
get_floatMethod · 0.45

Tested by

no test coverage detected