It isn't necessary to use the st7920's xor capabilities when drawing
the bed heating animations. This makes it easier to use the icons for
other displays.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a command that will turn off all heaters in the printer. Run this
command in the default idle_timeout action.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If an arm is nearly parallel to the bed then that tower's carriage may
have a velocity up to 3 times greater than the toolhead's maximum
velocity (relative to the print). Take that into account when
calculating the stepper's maximum halt velocity.
This fixes some rare "No next step" shutdowns on delta printers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 4573932f allowed move.end_pos to differ from the requested end
position - the toolhead class should use the updated position when
storing its commanded position.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's possible that a g-code transform class may make an extrude only
move appear as a kinematic move due to limitations of double precision
math. Handle this by checking for an inconsequential move distance
instead of checking for a move distance of exactly zero.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Log the details of the MCU prior to attempting to configure the MCU.
This way, the log contains the MCU information even if a configuration
error occurs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the name of the config registration method and pass an explicit
reference to the callback to the new method. This makes the
relationship between mcu registration and build_config() more clear in
the calling code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The gcode.run_script() code can pause which can result in the menu
code being called reentrant - avoid that by queuing the gcode commands
within the menu code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Call lift-z prior to the first move. This prevents the nozzle from hitting the build surface in situations that home the nozzle off and below the bed.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rework the code to use set_register() with the string name of the
desired register to set. Add a get_register() method.
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>
Only check the probe's z_offset against the stepper_z endstop position if the probe is used as a virtual endstop.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This can be flashed to e.g. the duet wifi using bossac. It requires a
later version as is currently included in the klipper repo (1.8
vs. 1.2). Comms are currently via UART0 only, USB serial is still TBD
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
Periodically check if other events need to run - this prevents the
virtual_sdcard processing from starving other events.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add initial support for commands that will forcibly move a stepper
(without updating the kinematic classes with the new position).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't pass pin_type to lookup_pin() - instead, if a pin can be
inverted or can have a pullup, then the caller must explicitly specify
that when calling lookup_pin(). This simplifies the code for the
cases where it is not valid to invert or pullup.
Explicitly pass the pin_type to setup_pin() and have ppins.setup_pin()
apply default pullup and invert flags.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure to use is_init=True when sending query_thermocouple -
otherwise, the config CRC is likely to mismatch on every connection.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Raising an error from the background message reception thread isn't
well defined. Instead, on a temperature fault, invoke a printer
shutdown.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Those chips that require an spi init sequence can generate the message
directly in the chip specific class.
Also, don't send an spi init message for chips that are read-only.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The MAX6675 chip has a different read sequence than the MAX31855 chip.
Signed-off-by: Ricardo Amézquita <ramezquitao@cihologramas.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the "motor_off_timeout" tracking to a new module in the extras/
directory. This makes it easier to customize the idle timeout
behavior.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The junction_deviation configuration parameter has a number of quirks
that make it difficult to configure. Replace it with a
"square_corner_velocity" configuration parameter.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's rare to have all the Z stepper locations directly under the
printable surface, so using z_positions for points is not a good
default.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allocate the stepper_kinematics directly in mcu.py - that way the
kinematic classes don't have to interact with the chelper code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Don't issue a get_config command after building the config as the
built config may contain time sensitive initialization commands.
Instead, send the config and init commands immediately after invoking
the build_config() callbacks. This avoids some rare "timer too close"
errors during configuration.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Switch the host code from the CLOCK_MONOTONIC clock to the Linux
specific CLOCK_MONOTONIC_RAW clock. It's common for ntp to slew the
CLOCK_MONOTONIC clock to account for drift, and that can break the
host's ability to make accurate predictions of the micro-controller
clock. This could lead to "move queue empty" errors. The
CLOCK_MONOTONIC_RAW clock is not slewed and thus should not have this
problem.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add M117 and M73 to the list of supported G-Codes.
Also, remove M117 from the list of commands reported by the HELP
command as that command is typically only used to list "extended
g-code" commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add generic temperature smoothing to the Heater class. This is useful
to avoid min_extrude_temp and verify_heater errors due to measurement
noise.
Rename the pid_deriv_time config option to smooth_time so that the
smoothing amount need only be specified once.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Extend the ADC out of range check so that it is possible to sample
multiple times before going into a shutdown state. This reduces the
chance that measurement noise will cause an error. In an actual over
temperature (or under temperature event) it is expected that the
sensor will consistently report the problem, so extra checks for an
additional second or two should not substantially increase risk.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add mcu support for periodically polling for a button press. Add host
code support for registering buttons and invoking callbacks for them.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add the ability to register callbacks - both asynchronous (ie, from
another thread) and synchronous.
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>
Font from fntcol16.zip package:
ftp://ftp.simtel.net/pub/simtelnet/msdos/screen/fntcol16.zip
(c) Joseph Gil
Font is public domain
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Update the target temperature during the pid calibration. This gives
additional feedback to the user and it makes it less likely that a
verify_heater error will be raised during calibration.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the display code into its own directory. This is in preparation
for splitting it up into its own modules.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When M117 is followed by an empty string, the display will reset to
Klipper's default.
Internal modules may look up the display and directly call
set_message(), with a timeout if desired.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
- Add M73 support for HD44780
- Include HD44780 USB and SD glyphs to differentiate progress type
- Fix bug that prevented M73 from updated when virtual_sd is enabled
- Add 5 second timeout to reset display when not Printing
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It appears the st7920 requires a longer delay when switching from
command to data mode (and vice-versa). Slower MCUs don't show a
problem because the klipper command processing time results in a
sufficient delay. However, some of the faster MCUs can process
klipper commands fast enough that the next st7920 transfer is sent too
fast. Add an additional delay to account for this.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The different uses of get_position() can be confusing, so choose a
different name for the ProbePointsHelper callback.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the trilateration algorithm to mathutil.py. It may be useful
outside of delta kinematics, and it complicates the delta code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for an itersolve_set_position() function that sets a
stepper position from a cartesian coordinate. This eliminates the
need for both the python and C code to be able to translate from a
cartesian coordinate to a stepper position.
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>
After a probe operation, homing_move() will already have recalculated
the toolhead position. The get_position() method can be slow, so use
the already calculated position.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update the code to use the term "rail" when dealing with a motor
controlled "axis". A rail has a series of steppers and endstops that
control that motor controlled "axis".
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>
All the kinematic code now uses the iterative solver to generate
steps. Remove the old stepcompress_push_const() mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the -fwhole-program option when compiling the host C code. This
makes it easier to support inlining across C files.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This change will make the "PROBE" command actually reply with the
z-position where the probe triggers. As this command is called
internally for the BED_TILT_CALIBRATE and Z_TILT_ADJUST those commands
will also give a response while probing, which I see as advantage over
the silent operation.
This change also lets one define some gcode for a repeatable probing
test to meassure the quality of the sensor and overall probing accuracy.
Signed-off-by: Hans Raaf <hr-klipper@oderwat.de>
Added a config parameter to define the homing override axes. This way
one can still home x and y axis without the z-probe cycle coming in the
way.
Signed-off-by: Hans Raaf <hr-klipper@oderwat.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Disable the verify_heater checks when debugging, as otherwise it can
cause failures when processing files in batch mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In some rare circumstances it was possible for the host software to
become so busy that it does not transmit a get_clock request for
several seconds. (In particular, this could occur with some complex
calls to coordinate_descent.) If that happened, it was possible for
the code to incorrectly report a "Timeout with MCU" error. Rework the
is_active() check to prevent that.
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>
Change the get_status command to get_clock. Don't report the shutdown
status in the new get_clock command.
The primary purpose of this change is to force the host code to report
a firmware version mismatch with older firmwares as recent changes
(namely the ordering of message block acks) have subtle
incompatibilities if different host/mcu code is used.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Normally, the MCU is restarted on a config change. However, that
should not be done automatically if the MCU is in a shutdown state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the mcu is using a traditional serial port, then only send a new
message block if there is space available in the mcu receive buffer.
This should make it significantly less likely that high load on the
mcu will result in retransmits.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Send the ack after processing commands - this gives the host code more
information on serial buffer utilization.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a section name had mixed case it would cause an incorrect error
during the section/option config checking.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add the ability to add a custom g-code command that in turn executes
one or more configured g-code commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The recommended TOFF time in "standalone mode" according to the
tmc2130 is 4, so use that as the default.
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>
Use the new gcode.register_mux_command() so that SET_PRESSURE_ADVANCE
works correctly with multiple extruders.
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>
Move the common config reading and probe object lookup from the
bed_tilt.py and delta_calibrate.py code into the ProbePointsHelper
class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Raise an error during config parsing if the position_endstop is not
between the position_min and position_max. This avoids a confusing
error message during homing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
For some reason, Linux creates the pseudo tty with group writable
permissions, but not group readable. Use chmod to allow the device to
also be group readable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The step speed rounding and the cpu delay must be run after running
the endstop specific preparation code. Otherwise, a delay in the
home_prepare() code could undo those calculations. Specifically, this
could lead to errors on a multi-mcu setup when the Z is homed using a
virtual_z_offset and there is a delay in the activate_gcode section.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't return early on a command error - continue to process remaining
commands and pop commands from the queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the generic spi send/receive code on Linux. Update the replicape
code to use the updated command format.
Also, update the replicape code to turn off the stepper motors on a
shutdown event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Improve the SPI message transmit system. Add support for bus speed
and bus mode. Add support for sending SPI messages on shutdown.
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
Signed-off-by: Douglas Hammond <wizhippo@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In order to properly delay BACKGROUND_PRIORITY_CLOCK messages, they
must be 5ms beyond the minimum defined by MIN_REQTIME_DELTA. So, add
both MIN_REQTIME_DELTA and MIN_BACKGROUND_DELTA to the timing of these
messages.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the clock querying messages occur at a similar frequency to other
events on the micro-controller or host, then it's possible for the
load created by those other events to skew the clock synchronization.
In particular, the 500ms lcd screen update could resonate with the 1
second clock query. Use an unusual clock querying frequency to avoid
this issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the C code out of the main klippy/ directory and into its own
directory. This reduces the clutter in the main klippy directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>