aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/gcode.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* heater: Return heaters with a gcode_id from new get_gcode_sensors()Kevin O'Connor2019-02-251-3/+3
| | | | | | | | The gcode.py code should not peek into the heater classes to obtain the gcode_id. Instead, introduce a new get_gcode_sensors() so that the gcode.py code does not need to. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: A set temperature request should use the heater name, not the gcode idKevin O'Connor2019-02-251-10/+6
| | | | | | | | When setting a temperature, lookup the heater via self.heaters.lookup_heater() and do not use the gcode ids. This fixes temperature setting when multiple extruders share the same heater. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rename self.heater to self.heatersKevin O'Connor2019-02-251-14/+12
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Raise a config error on invalid register_command()Kevin O'Connor2019-02-181-9/+12
| | | | | | | Raise a printer.config_error() on an invalid register_command() call. This error is easier to handle for the vast majority of callers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: add 'abs_extrude' to get_status() dictionaryArksine2019-02-081-0/+1
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* gcode: Return to a default gcode speed of 25mm/sKevin O'Connor2019-02-041-1/+1
| | | | | | | | Commit f4d323ad changed the handling of the self.speed variable, and it inadvertently changed the default startup speed. Return to the default of 25mm/s. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: add 'speed' parameter to dictionary returned by get_status()Arksine2019-01-281-0/+1
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* klippy: Convert printer_state("ready") to an event handlerKevin O'Connor2019-01-081-3/+2
| | | | | | | Convert all users of the printer_state("ready") handler to register a "klippy:ready" event handler instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Convert printer_state("disconnect") to an event handlerKevin O'Connor2019-01-081-2/+4
| | | | | | | Convert all users of the printer_state("disconnect") handler to register a "klippy:disconnect" event handler instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Convert printer_state("shutdown") to an event handlerKevin O'Connor2019-01-081-10/+10
| | | | | | | Convert all users of the printer_state("shutdown") handler to register a "klippy:shutdown" event handler instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* respond: An extra for sending messages to the printer host. (#1053)Alec B. Plumb2019-01-021-2/+2
| | | | | | | | | | | | I have made one change to `gcode.py` to support quoted parameter values. I have added support for the basic `M118` command (see https://reprap.org/wiki/G-code#M118:_Echo_message_on_host). I have also added a `RESPOND` command that takes extended parameters. `ECHO` might be a better name than `RESPOND` but is already defined in `gcode.py`. Signed-off-by: Alec B. Plumb <alec@etherwalker.com>
* heater: take a gcode_id when setting up a heater (#1028)john--2019-01-021-19/+16
| | | | | Allow an arbitrary gcode_id to be supplied during heater setup. This allows future extras to register additional IDs beyond B, and T#. Signed-off-by: John Jardine <john@gprime.net>
* gcode: Minor change to make M220 command take effect immediately (#1000)bondus2019-01-021-2/+2
| | | | | | This makes M220 (change print speed) command effect the next move command (G0/G1). Before it only made a differenc once a G0/G1 command with an F parameter was executed. Signed-off-by: Pontus Borg <liquidpontus@yahoo.se>
* gcode: process_batch() should execute commands atomicallyKevin O'Connor2018-10-281-13/+16
| | | | | | | Update the process_batch() method so that it will not interleave commands read from the input fd with the batched commands. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Pass printer instead of toolhead object to Homing classKevin O'Connor2018-10-161-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Report state message after any error in a STATUS responseKevin O'Connor2018-10-131-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Remove "Preparing to restart" messageKevin O'Connor2018-10-131-1/+0
| | | | | | | Now that "Klipper state" messages are proactively sent, it is redundant to send the "preparing to restart" message. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: modify get_status method to output more info (#651)Janar Sööt2018-09-171-1/+16
| | | Signed-off-by: Janar Sööt <janar.soot@gmail.com>
* gcode: Send proactive state messagesKevin O'Connor2018-09-121-4/+11
| | | | | | Send a g-code info message on printer state changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Catch errors on fd read and writeKevin O'Connor2018-09-121-6/+16
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: M117 fixArksine2018-08-221-0/+6
| | | | | | Resolves issue where M117 is not correctly executed when the message begins with numeric or special character. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* kinematics: Convert get_rails() method to get_steppers()Kevin O'Connor2018-07-161-4/+1
| | | | | | | All callers of get_rails() actually just want the steppers, so return them directly. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* query_endstops: Move QUERY_ENDSTOP command to it own extras/ moduleKevin O'Connor2018-07-161-8/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Move kinematic modules to new kinematics/ directoryKevin O'Connor2018-07-121-3/+3
| | | | | | | | Move extruder.py, cartesian.py, corexy.py, and delta.py to a new kinematics/ sub-directory. This is intended to make adding new kinematics a little easier. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: fix for GET_POSITION (#454)Eric Callahan2018-07-031-1/+4
| | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* gcode: Add run_script() method that is valid from non-command contextsKevin O'Connor2018-06-301-0/+11
| | | | | | | Add an ability to run a series of g-code commands from a reactor callback that isn't part of the normal g-code command processing. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rename run_script() to run_script_from_command()Kevin O'Connor2018-06-301-3/+3
| | | | | | | Emphasize that the run_script() method is only valid when run from a g-code command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* delta: Rename get_position() to calc_position()Kevin O'Connor2018-06-221-1/+1
| | | | | | | | Calculating the cartesian position from the stepper positions can be complex and cpu intensive, so rename it to calc_position() to be more descriptive. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Don't peak into PrinterStepper membersKevin O'Connor2018-06-221-3/+2
| | | | | | | Add additional wrapper functions so that no outside callers need to peak into the member variables of PrinterStepper. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>