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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Instead of using the toolhead class to determine if stats should be
reported, allow every printer object with a stats() callback to
determine if stats are needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
OctoPrint (and other software) will sometimes send additional commands
even if the previous command has not yet responded with an "ok".
Change the g-code input reading code to keep reading input so that an
M112 can be detected (and processed out-of-order). To avoid the
extreme case where one writes an entire g-code file to the input
without any pacing, disable the input reading if more than 20 commands
are pending.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the script being run raises an error, then stop running that script
and return the error to the caller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of hardcoding which objects are called on state transitions,
allow any "printer object" to be invoked if it has a printer_state()
method. Convert connect, ready, shutdown, and disconnect callbacks to
this mechanism.
Similarly, allow all printer objects to provide a stats() callback.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add get_reactor(), lookup_object(), lookup_module_objects(), and
set_rollover_info() to the main Printer class so that callers do not
need to peek into the class' members. Similarly, add get_printer()
and get_name() methods to the ConfigWrapper class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If register_command() is passed None as the function to call, then
treat it as an unregister command request.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the existing reset_last_position() code in cmd_G28() instead of
manually implementing the logic.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>