Some users increase max_extrude_cross_section to avoid issues with
some slicers. However, increasing that value also increases the
defaults for the max_extrude_only parameters which is not obvious.
Base the max_extrude_only defaults only on the configured nozzle
diameter.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The Trinamic stepper motor drivers are capable of reporting the
stepper phase - add support for using that capability to the
enddstop_phases module.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The Python 2.x ConfigParser doesn't support stripping of trailing '#'
style comments. Do that manually before parsing the config.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Only clear the internal sync_print_time flag if the code performs a
regular "lazy" flush of the look-ahead queue. This helps build the
look-ahead queue even when running internal scripts.
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>
When a delta printer has different arm lengths or different endstop
positions then the homing position falls outside of the normal
printable area. Add a special check to the range checking code to
permit this move instead of homing to a position near the actual
homing position.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the logic for performing the second home from the kinematics
classes to the generic homing code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit b0d859f2 introduced a second_homing_speed parameter, and it
also changed the retract speed. Revert the retract speed change (use
homing_speed when the head retracts).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit b0d859f2 introduced a second_homing_speed parameter; that
parameter needs to also be constrained to the max_z_velocity.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the xor capability of the display to animate the glyphs, which
reduces the number of glyphs needed from 4 to 2. This should make it
easier to add future animations if desired.
Suggested by @marcio-ao.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Based on replies from Issue 652 (https://github.com/KevinOConnor/klipper/issues/652) only Extruder, Bed and Fan icons are changed. Feedrate icon stays untouched.
Signed-off-by: Alexander Fadeev <alfsoft@gmail.com>
The max_accel_to_decel variable must not be greater than the max_accel
variable. Make sure to check this when M204 changes max_accel.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't require (or permit) the user to specify a stepper_z
position_endstop when using the probe:z_virtual_offset mechanism. In
that case the position_endstop should always equal the probe's
z_offset - so no need to have the user specify it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Remove the code to calculate and track the z_offset via
position_endstop updates. It's simpler to always save and restore the
calculated z_adjust.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't require the config file to specify manual probing. Instead,
allow the user to select manual probing on each ProbePointsHelper
invocation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that all the callers of ProbePointsHelper take a cartesian
coordinate for the probe locations, it's possible to perform averaging
of multi-sample probes within the class. This simplifies the callers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Only call cmd_NEXT() for manual probing. This simplifies the code as
the automatic probing and manual probing have slightly different
probing mechanisms.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that all users of ProbePointsHelper use the same
get_probed_position() code, it is possible to implement that locally
within the ProbePointsHelper class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's possible (and a little simpler) to use cartesian coordinates when
calculating a stable position.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Configure the tmc2208 during the 'connect' phase so that a problem
during configuration is properly raised as a config error. Catch
errors during DUMP_TMC and raise them as g-code errors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't log a heater verification error if that error is due to the
printer being shutdown for some other reason. Those spurious error
reports can be confusing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
No need to report an error if the M73 is not between 0 and 100 - just
display the nearest valid value.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support using SAVE_CONFIG to store the results of DELTA_CALIBRATE to
the printer config file. Store the low level probe measurements in
the config as well.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the "stable position" logic from the delta.py kinematics code to
the delta_calibrate.py calibration code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for writing back the main printer config file with
additional calibration data stored in it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add write_glyph() support to hd44780.py. Update uc1701.py and
st7920.py to support writing single character glyphs via
write_glyph().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the st7920 icon rendering optimizations from display.py to
st7920.py. This simplifies the code for other displays.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>