gcode: Update gcode descriptions (#4335)

Add help description to HELP
Add help description to RESPOND
Add help description to MEASURE_AXES_NOISE, TEST_RESONANCES and SHAPER_CALIBRATE
Add help description to PAUSE, RESUME, CLEAR_PAUSE and CANCEL_PRINT
Add help description to GET_POSITION
Add help description to SET_RETRACTION and GET_RETRACTION

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2021-06-02 16:45:27 +02:00 committed by GitHub
parent 55be26097f
commit b5e4f3d204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 16 deletions

View File

@ -16,8 +16,10 @@ class FirmwareRetraction:
+ self.unretract_extra_length)
self.is_retracted = False
self.gcode = self.printer.lookup_object('gcode')
self.gcode.register_command('SET_RETRACTION', self.cmd_SET_RETRACTION)
self.gcode.register_command('GET_RETRACTION', self.cmd_GET_RETRACTION)
self.gcode.register_command('SET_RETRACTION', self.cmd_SET_RETRACTION,
desc=self.cmd_SET_RETRACTION_help)
self.gcode.register_command('GET_RETRACTION', self.cmd_GET_RETRACTION,
desc=self.cmd_GET_RETRACTION_help)
self.gcode.register_command('G10', self.cmd_G10)
self.gcode.register_command('G11', self.cmd_G11)
@ -28,7 +30,7 @@ class FirmwareRetraction:
"unretract_extra_length": self.unretract_extra_length,
"unretract_speed": self.unretract_speed,
}
cmd_SET_RETRACTION_help = ("Set firmware retraction parameters")
def cmd_SET_RETRACTION(self, gcmd):
self.retract_length = gcmd.get_float('RETRACT_LENGTH',
self.retract_length, minval=0.)
@ -41,7 +43,7 @@ class FirmwareRetraction:
self.unretract_length = (self.retract_length
+ self.unretract_extra_length)
self.is_retracted = False
cmd_GET_RETRACTION_help = ("Report firmware retraction paramters")
def cmd_GET_RETRACTION(self, gcmd):
gcmd.respond_info("RETRACT_LENGTH=%.5f RETRACT_SPEED=%.5f"
" UNRETRACT_EXTRA_LENGTH=%.5f UNRETRACT_SPEED=%.5f"

View File

@ -34,7 +34,8 @@ class GCodeMove:
gcode.register_command(cmd, func, False, desc)
gcode.register_command('G0', self.cmd_G1)
gcode.register_command('M114', self.cmd_M114, True)
gcode.register_command('GET_POSITION', self.cmd_GET_POSITION, True)
gcode.register_command('GET_POSITION', self.cmd_GET_POSITION, True,
desc=self.cmd_GET_POSITION_help)
self.Coord = gcode.Coord
# G-Code coordinate manipulation
self.absolute_coord = self.absolute_extrude = True
@ -239,6 +240,8 @@ class GCodeMove:
speed = gcmd.get_float('MOVE_SPEED', self.speed, above=0.)
self.last_position[:3] = state['last_position'][:3]
self.move_with_transform(self.last_position, speed)
cmd_GET_POSITION_help = (
"Return information on the current location of the toolhead")
def cmd_GET_POSITION(self, gcmd):
toolhead = self.printer.lookup_object('toolhead', None)
if toolhead is None:

View File

@ -15,10 +15,14 @@ class PauseResume:
self.pause_command_sent = False
self.printer.register_event_handler("klippy:connect",
self.handle_connect)
self.gcode.register_command("PAUSE", self.cmd_PAUSE)
self.gcode.register_command("RESUME", self.cmd_RESUME)
self.gcode.register_command("CLEAR_PAUSE", self.cmd_CLEAR_PAUSE)
self.gcode.register_command("CANCEL_PRINT", self.cmd_CANCEL_PRINT)
self.gcode.register_command("PAUSE", self.cmd_PAUSE,
desc=self.cmd_PAUSE_help)
self.gcode.register_command("RESUME", self.cmd_RESUME,
desc=self.cmd_RESUME_help)
self.gcode.register_command("CLEAR_PAUSE", self.cmd_CLEAR_PAUSE,
desc=self.cmd_CLEAR_PAUSE_help)
self.gcode.register_command("CANCEL_PRINT", self.cmd_CANCEL_PRINT,
desc=self.cmd_CANCEL_PRINT_help)
webhooks = self.printer.lookup_object('webhooks')
webhooks.register_endpoint("pause_resume/cancel",
self._handle_cancel_request)
@ -51,6 +55,7 @@ class PauseResume:
self.sd_paused = False
self.gcode.respond_info("action:paused")
self.pause_command_sent = True
cmd_PAUSE_help = ("Pauses the current print")
def cmd_PAUSE(self, gcmd):
if self.is_paused:
gcmd.respond_info("Print already paused")
@ -66,6 +71,7 @@ class PauseResume:
else:
self.gcode.respond_info("action:resumed")
self.pause_command_sent = False
cmd_RESUME_help = ("Resumes the print from a pause")
def cmd_RESUME(self, gcmd):
if not self.is_paused:
gcmd.respond_info("Print is not paused, resume aborted")
@ -76,8 +82,11 @@ class PauseResume:
% (velocity))
self.send_resume_command()
self.is_paused = False
cmd_CLEAR_PAUSE_help = (
"Clears the current paused state without resuming the print")
def cmd_CLEAR_PAUSE(self, gcmd):
self.is_paused = self.pause_command_sent = False
cmd_CANCEL_PRINT_help = ("Cancel the current print")
def cmd_CANCEL_PRINT(self, gcmd):
self.cmd_PAUSE(gcmd)
if not self.sd_paused:

View File

@ -97,11 +97,14 @@ class ResonanceTester:
self.gcode = self.printer.lookup_object('gcode')
self.gcode.register_command("MEASURE_AXES_NOISE",
self.cmd_MEASURE_AXES_NOISE)
self.cmd_MEASURE_AXES_NOISE,
desc=self.cmd_MEASURE_AXES_NOISE_help)
self.gcode.register_command("TEST_RESONANCES",
self.cmd_TEST_RESONANCES)
self.cmd_TEST_RESONANCES,
desc=self.cmd_TEST_RESONANCES_help)
self.gcode.register_command("SHAPER_CALIBRATE",
self.cmd_SHAPER_CALIBRATE)
self.cmd_SHAPER_CALIBRATE,
desc=self.cmd_SHAPER_CALIBRATE_help)
self.printer.register_event_handler("klippy:connect", self.connect)
def connect(self):
@ -159,7 +162,7 @@ class ResonanceTester:
else:
calibration_data[axis].add_data(new_data)
return calibration_data
cmd_TEST_RESONANCES_help = ("Runs the resonance test for a specifed axis")
def cmd_TEST_RESONANCES(self, gcmd):
# Parse parameters
if len(self.test.get_supported_axes()) > 1:
@ -197,7 +200,8 @@ class ResonanceTester:
helper, axis, data)
gcmd.respond_info(
"Resonances data written to %s file" % (csv_name,))
cmd_SHAPER_CALIBRATE_help = (
"Simular to TEST_RESONANCES but suggest input shaper config")
def cmd_SHAPER_CALIBRATE(self, gcmd):
# Parse parameters
axis = gcmd.get("AXIS", None)
@ -241,7 +245,8 @@ class ResonanceTester:
gcmd.respond_info(
"The SAVE_CONFIG command will update the printer config file\n"
"with these parameters and restart the printer.")
cmd_MEASURE_AXES_NOISE_help = (
"Measures noise of all enabled accelerometer chips")
def cmd_MEASURE_AXES_NOISE(self, gcmd):
meas_time = gcmd.get_float("MEAS_TIME", 2.)
for _, chip in self.accel_chips:

View File

@ -19,7 +19,8 @@ class HostResponder:
self.default_prefix = config.get('default_prefix', self.default_prefix)
gcode = self.printer.lookup_object('gcode')
gcode.register_command('M118', self.cmd_M118, True)
gcode.register_command('RESPOND', self.cmd_RESPOND, True)
gcode.register_command('RESPOND', self.cmd_RESPOND, True,
desc=self.cmd_RESPOND_help)
def cmd_M118(self, gcmd):
msg = gcmd.get_commandline()
umsg = msg.upper()
@ -33,6 +34,7 @@ class HostResponder:
else:
msg = ''
gcmd.respond_raw("%s %s" % (self.default_prefix, msg))
cmd_RESPOND_help = ("Echo the message prepended with a prefix")
def cmd_RESPOND(self, gcmd):
respond_type = gcmd.get('TYPE', None)
prefix = self.default_prefix

View File

@ -325,6 +325,7 @@ class GCodeDispatch:
msg = self.printer.get_state_message()[0]
msg = msg.rstrip() + "\nKlipper state: Not ready"
raise gcmd.error(msg)
cmd_HELP_help = "Report the list of available extended G-Code commands"
def cmd_HELP(self, gcmd):
cmdhelp = []
if not self.is_printer_ready: