aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/gcode.py
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* stepper: Add a get_name() method to PrinterStepperKevin O'Connor2018-06-221-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Return an error code if batch input results in an errorKevin O'Connor2018-06-161-1/+3
| | | | | | | When reading from a debug input file, propagate any errors to the program return status. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: mux command is already registered error print fixedcruwaller2018-06-011-1/+1
| | | | Signed-off-by: Petri Honkala <cruwaller@gmail.com>
* gcode: Apply SET_GCODE_OFFSET to next move commandKevin O'Connor2018-05-291-1/+3
| | | | | | | | Apply the changes made by a SET_GCODE_OFFSET command to the next move, even if the move is relative to the last movement. This allows the command to implement "babystepping" requests. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Reset extrude_factor and extruder position on a tool changeKevin O'Connor2018-05-201-0/+2
| | | | | | | The extrude_factor and extruder position are specific to the current extruder, so reset them to default values on a Tn command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Raise an error if a duplicate command is registeredKevin O'Connor2018-05-201-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add ability to register a "mux" commandKevin O'Connor2018-05-201-0/+23
| | | | | | | | | | It's common to add commands that dispatch to a particular object instance depending on the value of a command parameter. (For example, the command "SET_SERVO SERVO=xyz" wants to be handled by the particular "xyz" servo instance.) Add a register_mux_command() helper to gcode.py make it easier to do this. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add minval/maxval/above/below options to get_X parsersKevin O'Connor2018-04-201-29/+40
| | | | | | Add value checking to gcode parameter parsing code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add a SET_GCODE_OFFSET commandKevin O'Connor2018-04-201-1/+14
| | | | | | | | The M206 command is confusing (it uses negative offsets) and isn't very flexible. Add a new SET_GCODE_OFFSET command to make it easier to add virtual offsets to gcode commands. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rename homing_add to homing_offsetKevin O'Connor2018-04-201-17/+17
| | | | | | | | | The M206 command is confusing as positive values in that command result in negative offsets to future g-code commands. Perform the parameter negation in the M206 command instead of storing it that way internally. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pid_calibrate: Move PID calibration logic from heater.py to new fileKevin O'Connor2018-03-181-13/+1
| | | | | | | | Drop support for M303 and PID_TUNE, and replace it with a new PID_CALIBRATE command. Move the logic for this command from heater.py to a new pid_calibrate.py file in the extras/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Position returned by M114 should be relative to last G92Kevin O'Connor2018-03-151-13/+40
| | | | | | | | It looks like OctoPrint is expecting the result from M114 to be relative to the last G92 command. Also, introduce GET_POSITION to report the actual location that the printer is at. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: On a multi-line error message, report the first line twiceKevin O'Connor2018-03-121-2/+2
| | | | | | | | Report the first line of a multi-line error message twice - once as part of the informational content, and once with the "!!" error prefix. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* display: Add initial support for LCD screens attached to an MCUKevin O'Connor2018-03-061-0/+3
| | | | | | | | Add support for displaying basic status information on ST7920 and HD44780 based LCDs that are attached directly to a micro-controller. Signed-off-by: Marcio Teixeira <marcio@alephobjects.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* virtual_sdcard: Initial support for virtual sdcardKevin O'Connor2018-02-111-1/+12
| | | | | | | | Add support for directly printing from a local file on the host. This may be useful if the host cpu is not fast enough to run OctoPrint well. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>