aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/gcode.py
Commit message (Collapse)AuthorAgeFilesLines
* klippy: return message category in get_state_message()Arksine2020-06-241-2/+2
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* gcode: add webhooks supportArksine2020-06-241-0/+27
| | | | | | Register "gcode/script", "gcode/help", "gcode/restart", and "gcode/firmware_restart" endpoints. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* gcode: Make it clear that gcode.get_status() can be called without eventtimeKevin O'Connor2020-05-261-1/+1
| | | | | | | Make it clear that gcode.get_status() to be called without an eventtime by defaulting eventtime=None. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Move "ok" tracking to GCodeCommand classKevin O'Connor2020-05-051-27/+17
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Remove parsing helpers from main gcode classKevin O'Connor2020-05-051-16/+0
| | | | | | | | Remove the parsing helpers from the main gcode class now that all callers have been converted to use the parsing helpers in the GCodeCommand class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Use new GCodeCommand wrappers in command handlersKevin O'Connor2020-05-051-82/+80
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Create new wrapper class for gcode command parametersKevin O'Connor2020-05-051-50/+89
| | | | | | | | Instead of passing a dictionary to the command handlers, create a wrapper class and pass that class to the command handlers. This can simplify the command handler code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Only call position_with_transform() when printer is readyKevin O'Connor2020-05-021-1/+2
| | | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Move M105 command handling from gcode.py to heater.pyKevin O'Connor2020-04-251-39/+15
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rename respond() to respond_raw()Kevin O'Connor2020-04-241-6/+6
| | | | | | | | | | | Rename the method to make it more clear that it is a low-level call that should be rarely used. Also, change gcode_button.py, hall_filament_width_sensor.py, and tsl1401cl_filament_width_sensor.py to use respond_info() instead of respond_raw(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Don't export respond_error()Kevin O'Connor2020-04-241-6/+6
| | | | | | | Don't export the respond_error() method as callers should raise a gcode.error() instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Raise a gcode.error() from G20 commandKevin O'Connor2020-04-241-1/+1
| | | | | | | It's important to raise an error (instead of calling respond_error() ) so that a G20 will stop a virtual_sdcard print. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_arcs: Fix Z moves and E movesKevin O'Connor2020-04-221-1/+2
| | | | | | | | Fix Z moves so that the movement is spaced out among the arc movements. Fix extrude moves when in absolute extrude mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add a "command_error" event notifierKevin O'Connor2020-02-151-0/+1
| | | | | | | Allow other modules to be notified if there is a gcode command error detected. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Return previous handler from register_command(cmd, None)Kevin O'Connor2020-02-121-1/+2
| | | | | | | | When overriding a g-code command, allow the caller to obtain the previous command handler. Use this feature in homing_override and safe_z_home. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Fix detection of some "extended" g-code commandsKevin O'Connor2020-01-071-4/+11
| | | | | | | Fix typo that resulted in _get_extended_params() being called for all commands. Allow "extended" g-code commands to contain numbers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Move M104/M140 commands from gcode.py to extruder.pyKevin O'Connor2019-12-161-32/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater_bed: Move M140/M190 commands from gcode.py to heater_bed.pyKevin O'Connor2019-12-161-11/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rename bg_temp() to wait_for_temperature()Kevin O'Connor2019-12-161-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Use printer.command_error() instead of internal heater.error()Kevin O'Connor2019-12-161-4/+1
| | | | | | | Use the more standard command_error to report invalid temperature requests. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Remove builtin T0/T1/T2/... command supportKevin O'Connor2019-12-101-26/+1
| | | | | | | | The builtin Tn command is not sufficiently flexible to control some multi-extruder printers. Remove the command and encourage users to define individual gcode_macros for each Tn instance. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Add an ACTIVATE_EXTRUDER commandKevin O'Connor2019-12-101-0/+6
| | | | | | | Add support for an extended g-code command to change the currently active extruder. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Remove support for the M206 commandKevin O'Connor2019-12-101-9/+1
| | | | | | | | The M206 command isn't particularly standardized and isn't issued by default from 3rd party software in their standard configurations. Encourage users to use the more powerful SET_GCODE_OFFSET command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Remove support for "G4 S1" style commandsKevin O'Connor2019-12-021-4/+1
| | | | | | | | The S parameter is not a standard and was not commonly used. The P parameter (delay specified in milliseconds) is the commonly accepted g-code mechanism for dwelling. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Add get/set_tag_position() and convert calc_position()Kevin O'Connor2019-11-131-15/+15
| | | | | | | | | Rename calc_position() to calc_tag_position() and have it calculate the value of the position from the last stepper set_tag_position() call. This enables the calc_tag_position() code to be more flexible as it can be run with arbitrary positions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Move M106/M107 commands from gcode.py to fan.pyKevin O'Connor2019-11-131-17/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Remove explicit active extruder trackingKevin O'Connor2019-11-131-16/+19
| | | | | | | There's no need to have special logic in gcode.py to track the active extruder. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper_enable: Add new extras module for stepper enable line trackingKevin O'Connor2019-11-101-5/+1
| | | | | | | Move the M18/M84 command handling from gcode.py to new stepper_enable module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Consistently use "extruder" for the primary extruderKevin O'Connor2019-11-071-1/+4
| | | | | | | | No longer allow the primary extruder to be named "extruder0". This avoids internal and external confusion between the printer objects and config section names. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Allow M105 to produce output if called from a macroKevin O'Connor2019-09-181-1/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add support for stacked transformsArksine2019-06-261-2/+6
| | | | | | Add method from pull request #1243 to support stacked transforms. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* gcode: Eliminate the process_batch() methodKevin O'Connor2019-06-091-6/+2
| | | | | | | Allow the callers of process_batch() to directly inspect the gcode mutex. Those callers can then directly invoke run_script(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Convert input handling to use a reactor mutexKevin O'Connor2019-06-091-28/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: No need to re-raise an EndstopErrorKevin O'Connor2019-06-061-20/+5
| | | | | | | Now that EndstopError and gcode.error use the same underlying Exception object, it is no longer necessary to translate an error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Use the same underlying error object for homing and gcode errorsKevin O'Connor2019-06-061-23/+22
| | | | | | | Introduce a homing.CommandError and use that as the basis for both gcode and EndstopError exceptions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: "gcode_position" and toolhead "position" as get_status() named tupleKevin O'Connor2019-06-041-0/+1
| | | | | | | Add "gcode_position" named tuple to gcode.get_status(). Add a "position" named tuple to toolhead.get_status(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add action_x() callables to get_status()Kevin O'Connor2019-06-041-1/+13
| | | | | | | | | Add action_respond_info(), action_respond_error(), and action_emergency_stop() callables to the get_status() return dictionary. This allows gcode macros to directly invoke these actions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add support for SAVE_GCODE_STATE and RESTORE_GCODE_STATE commandsKevin O'Connor2019-05-311-2/+40
| | | | | | Add commands to save and restore the current g-code state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rename absolutecoord/extrude to absolute_coord/_extrudeKevin O'Connor2019-05-261-10/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Fix SET_GCODE_OFFSET MOVE_SPEED parameterKevin O'Connor2019-05-261-2/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Minor code change to M206 to make the math similar to SET_GCODE_OFFSETKevin O'Connor2019-05-261-4/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Don't apply the SET_GCODE_OFFSET to the next g-code commandKevin O'Connor2019-05-261-1/+12
| | | | | | | | | | | | The SET_GCODE_OFFSET command could cause unwanted behavior when an offset is applied to the following g-code command. (In particular, when the following command is an extrude only move - as in issue #1289.) Don't apply the offset immediately. Instead, add support for a MOVE=1 parameter which will schedule a move to apply the given offset. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Store internal speed in mm/sKevin O'Connor2019-05-241-12/+16
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add '_' prefix to internal methodsKevin O'Connor2019-05-241-39/+39
| | | | | | | Mark methods internal to gcode.py with an underscore so that it is easier to see which functions are purely helper functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* menu: Show current positions based on gcode positions (#1389)Robert Konklewski2019-03-211-2/+10
| | | | | | | | | | | | | | | menu: Show current positions based on gcode positions Added "move_[xyze]pos" properties to the "gcode" object for use in menus. The new properties track the toolhead's position in gcode coordinates, taking gcode and bed leveling offsets into account. This position is equal to the value returned by M114 gcode. Changes the move menus to show current position based on gcode position. This allows gcode offsets and bed leveling offsets to be taken into account, and prevents unexpected toolhead movements when moving it using the menu. Signed-off-by: Robert Konklewski <nythil@gmail.com>
* gcode: Change respond_info() to log by defaultKevin O'Connor2019-03-041-6/+7
| | | | | | | It makes sense to log most respond_info() content, so do that by default. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Improve handling of end of input when reading from a debug fileKevin O'Connor2019-03-011-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Wrap code to 80 columnsKevin O'Connor2019-02-271-5/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Use an event to handle restart request actionsKevin O'Connor2019-02-251-6/+1
| | | | | | | | Instead of directly turning off motors, heaters, and fans from gcode.py, raise a new event and allow the heater, fan, and toolhead to handle the event as needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: The set_temp() takes an extruder number not a heater idKevin O'Connor2019-02-251-7/+13
| | | | | | | | Commit cf6c5e6f did not fix the shared heater case - a set_temp() request takes the extruder id, not the heater id (nor the gcode sensor id). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>