It's simpler to query the "printing" status from the idle_timeout
module on an event than it is to track changes to the printing status.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce min_event_systime and rework the previous start_time,
last_event_time, and event_running flags into this one state tracking
variable.
This also makes a minor change to the behavior of the event_delay - it
is now calculated from the time the command completes execution
(instead of from when the event is first detected). This may make a
difference if there is a long running g-code command occurring during
the detection event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rather than inherit from the BaseSensor, filament sensor implementatons
may instantiate the RunoutHelper and update the filament state via its
note_filament_present method.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add support for notifying the low-level probing handlers that a
multiple probe sequence is occurring. This is in preparation for the
bltouch code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Collapse the "homing:move_begin", "homing:move_end", home_prepare(),
and home_finalize() into two new events: "homing:homing_move_begin"
and "homing:homing_move_end". This simplifies the homing code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When overriding a g-code command, allow the caller to obtain the
previous command handler. Use this feature in homing_override and
safe_z_home.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't obtain the step_distance from the config, instead obtain
step_distance from the instantiated stepper object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't obtain the step_distance from the config, instead obtain
step_distance from the instantiated stepper object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In the rare case where the step generation code finds an interval of
zero, it was possible for an integer division of a negative number to
cause an incorrect result. Fix that by using the idiv_up() and
idiv_down() helpers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There have been several reports that increasing the delay from 37us to
40us eliminates screen corruption on some clone hd44780 displays.
Increase the timeout value so that the standard code works on these
displays.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The caller can now determine which steppers are connected to cartesian
Z movement via the new stepper.is_active_axis() method. It is
therefore no longer necessary for the kinematic code to identify these
steppers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move interpolation checks to _init_mesh_params() so they can be done whle the config is being parsed. Do not allow a probe_count higher than 6 for lagrange interpolation, as this typically leads to oscillation.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Don't force probing when BED_MESH_MAP is executed, output the existing mesh. If the user wants to probe each time before a map they can do so with a gcode_macro.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Renamed some variables in set_mesh() previous called "mesh_min" and "mesh_max" to alleviate confusion with the config options.
Renamed several attributes for clarity. The "calibrate" attribute is now bmc, "probe_params" is now "mesh_params", "probed_z_table" is now "probed_matrix", "mesh_z_table" is now "mesh_matrix".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Points are now logged after the printer is ready. The formatting is improved, printing out the point index, and its corresponding automatic and manual points.
BED_MESH_OUTPUT now includes a PGP parameter, if PGP=1 the generated points are printed to the terminal.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rename min_point, max_point, and bed_radius to mesh_min, mesh_max, and mesh_radius respectively. Add "mesh_origin" option, that allows round beds to specificy the center of the mesh.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Fix typo that resulted in _get_extended_params() being called for all
commands. Allow "extended" g-code commands to contain numbers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some kinematics do not result in a constant step rate during homing
operations. Calculate the endstop checking rate using the total
distance traveled on the axis divided by the axis step distance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The STEPPER_BUZZ command needs to know if the axis is using radians
instead of millimeters so that it can move a more appropriate
distance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a mechanism for obtaining the print_time via a callback instead of
by flushing the look-ahead queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The print_time parameter of heater.set_temp() is not currently used
and it isn't necessary to flush the look-ahead queue just get the
print_time. Remove the parameter from heater.set_temp() to avoid
flushing the look-ahead queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a null move is added as the first move on the trapezoid motion
queue then it could have a very large move->move_t value. This could
cause numerical stability issues with some advanced kinematic
formulas. Place a limit on the move_t value to avoid this.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This reverts commit 1b92af6078.
The standard "uc1701" lcd_type can now be used in place of the custom
"st7567" lcd_type.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the queuelogger was holding the lock when the process is forked
then any attempt to log from the background process would result in a
deadlock. Attempt a workaround by disabling the queuelogger at the
start of the background process.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Provide a list of available heater and sensor names to
gcode macro templates through the printer.heater.available_heaters
and printer.heater.available_sensors variables
Signed-off-by: Simon Kühling <mail@simonkuehling.de>
The builtin Tn command is not sufficiently flexible to control some
multi-extruder printers. Remove the command and encourage users to
define individual gcode_macros for each Tn instance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The M206 command isn't particularly standardized and isn't issued by
default from 3rd party software in their standard configurations.
Encourage users to use the more powerful SET_GCODE_OFFSET command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Implement the pressure advance calculations while performing the
definitive integral calculations. This simplifies both the
extruder.py and kin_extruder.c code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The probe object may not have be instantiated when the
screws_tilt_adjust object is instantiated. Just remove the check.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The S parameter is not a standard and was not commonly used. The P
parameter (delay specified in milliseconds) is the commonly accepted
g-code mechanism for dwelling.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for an optional uc1701 rst_pin. Use the same reset pin
code handling with the SSD1306 code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There is concern that some lcd boards that emulate the hd44780 don't
support text updates that wrap the two text framebuffers. Update the
code to treat the two text areas as two separate framebuffers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Large increases in fan speed can suffer from acceleration lag, so this
change kick starts the fan for a change of 50% or more in the same way
that starting the fan from 0% does.
Signed-off-by: Justin Schuh <code@justinschuh.com>
If an M25 is in a gcode file that is being printed from virtual SD, it
would cause a permanent hang. Detect that case and don't wait for
those M25 commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the extruder lookahead method is no longer used it can be
removed from the toolhead and extruder classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support averaging the extruder position over a time range to "smooth
out" the velocity changes that occur during pressure advance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support calculating the definitive integral of a cartesian axis
position over a time range of the movement queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for kinematic functions that calculate step times based on
a range of the motion queue. This requires adding additional pause
times when fully flushing the motion queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for generating steps from kinematic functions that
calculate step times based on a range of the motion queue. It
requires scanning for step generation during the lead up to stepper
activity (when the stepper would nominally be idle). And it requires
scanning for step generation just after a stepper has nominally become
idle.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use sentinels to make list traversal code simpler. Also add in null
moves so that there are no time gaps in the list.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update code that modifies the low-level kinematics handlers to first
call toolhead.flush_step_generation().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't transition to the normal movement state if there aren't any
moves actually ready to be processed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the only caller to set_commanded_position() is
set_position(), remove the set_commanded_position() method and pass
the set_position() call directly to the itersolve.c code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the homing code does not call set_commanded_position(), it is
no longer necessary to save/restore the position in the bltouch code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the homing code does not use get_commanded_position(), it is
no longer necessary to alter the low-level commanded position after a
homing move.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename calc_position() to calc_tag_position() and have it calculate
the value of the position from the last stepper set_tag_position()
call. This enables the calc_tag_position() code to be more flexible
as it can be run with arbitrary positions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the tmc drivers perform automatic soft stepper enabling,
there is no need to be able to list multiple pins in the enable_pin
config setting.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Automatically detect if the stepper has a dedicated enable line. If
it does not, then automatically enable virtual enable support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the PrinterStepper and MCU_stepper classes have been merged,
there is no need for the add_to_endstop() method.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the enable line tracking out of the main stepper.py code. This
simplifies the main kinematic code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Directly disable all the stepper motors on a global motor_off() from
the StepperEnable() class in stepper_enable.py. This simplifies the
toolhead and kinematic classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Minor rework of the loop to reduce the chance that numerical stability
could cause an infinite loop.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
No longer allow the primary extruder to be named "extruder0". This
avoids internal and external confusion between the printer objects and
config section names.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Do not apply max_extrude_cross_section check, and do apply
extrude_only_xxx checks to Z only moves that also extrude. Some
printer start scripts will prime the extruder while moving the Z.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Calculate the ratio of axis distance to total move distance (axis_d /
move_d) and store in a new member variable axes_r. This avoids
needing to recalculate the value in other code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Only track a single acceleration movement in a 'struct move' instance.
Break the classic trapezoid movement (accel, cruise, decel) into three
separate movements. This simplifies the calculation logic.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Load all items from the look-ahead queue into the trapezoid velocity
queue, and then flush that queue by time. This prevents the host cpu
from being starved on very long moves (which may require a large
number of steps to be generated). It also improves the overall
performance.
With the batch flushing logic in place, it is no longer necessary to
split homing moves up.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that all callers use the trapq system to queue moves, it is no
longer necessary to individually allocate and fill a 'struct move'.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Eliminate the old gen_steps() call now that all callers have been
converted to the newer trapq based generate_steps().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that all kinematics use the trapq system, there is no need to call
into the kinematics on each g-code move.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support associating a stepper_kinematics with a trapq. Support
generating steps from a time range on the given trapq.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for building a list of moves in the trapq.c code. Update
the toolhead code so that moves generated from the look-ahead code are
added to that list.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the kinematic position calculation function had an error in it (if
it produces sudden position changes) then it could lead to an infinite
loop in itersolve_gen_steps().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Break up the connect phase into two phases - mcu_identify and connect.
The first phase will contact all the micro-controllers and obtain the
"identify" data dictionaries for them. Once all the micro-controllers
have been contacted, then they can be configured. This fixes an issue
with FIRMWARE_RESTART not working correctly on multi-mcu setups that
use restart_method=command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Wait in the M25 command handler until the work_handler() background
timer fully exits. This ensures that subsequent g-code commands (such
as M27 or M24) will correctly report a paused state.
Reported by @foosel.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The initial clock measurement wasn't properly implementing a small
delay between clock queries. Fix the pause() call so there is a small
delay between queries.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some print start scripts may extrude at a position slightly higher
than the first z layer height. Tweak the backwards z test to reduce
the chance of the tuning test ending prematurely.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
PR #1970 introduced a new parameter, controlling the default behavior of the safe_z_home-module. To avoid unexpected changes, the default of the move_to_previous is now defaulted to False.
Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
If '[stepper_x]' and/or '[stepper_y]' have a 'position_min' that is
non-zero, and '[safe_z_home] home_xy_position' is '0,0'; then the 'G28'
command will _not_ move to '0,0'; but stay at 'position_min' during the
Z endstop test.
This fix corrects this issue.
Signed-off-by: Jason S. McMullan <jason.mcmullan@gmail.com>
Below off_below the fan will be turned off. When configured correctly this
can prevent stalling, which may lead to overheating and failed fans. To
simplify calibration and use of this setting, off_below is applied in the
input duty cycle domain, prior to any scaling due to e.g. max_power.
Signed-off-by: Nicholas Seckar <nseckar@gmail.com>
When reducing the maximum speed due to the max_accel_to_decel setting,
move velocity limits must still be propagated. Otherwise, the
trapezoid move planner may produce moves with velocity jumps.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Once a hop is performed, it will only be re-issued if the z-axis has been
moved in the meantime. Usually it is only moved by a z-homing so doing so
will cause safe_z_home to do the hop on the next homing action.
When z-axis is homed, x and y positions are known. When setting this
boolean option, these are set back to their last positions.
Whenever a hop is specified it is re-issued after the Z axis has been
homed. This is especially necessary when a pressure-based probe is used.
Also, the module decides if a hop is necessary, based on either a known
Z position or a flag that is set whenever the motors are disabled.
Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
Previously, when a sercom pin specified the mcu (myname:PIN), it would result in a pin enumeration error.
Signed-off-by: John Jardine <john@gprime.net>
R Still missing, also might be somewhat dirty since code is converted
into G1 commands.
Signed-off-by: Aleksej Vasiljkovic <achmed21@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
During a "drip feed" move, both the move's maximum speed and maximum
acceleration may be limited by the kinematics.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a helper class for tracking gpio outputs that are synchronized to
bus updates on a particular command queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rework the spi_config commands so that bus configuration and shutdown
message configuration is done separately from the main "config_spi"
command. This makes the spi configuration more flexible. It's now
possible to use software spi without a CS pin. It's now possible to
define multiple SPI messages to send on a shutdown event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
use SET_GCODE_OFFSET's MOVE=1 parameter in the z offset menu.
Less confusing for people who think nothing happened.
Signed-off-by: John "Fess" Fessenden <fess@fess.org>
It's not necessary to fully build up the look-ahead queue prior to
starting a "drip move" homing operation. Instead, allow the
look-ahead queue to flush normally.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the homing move is exceptionally long, it could take a long time
for the host to process the look-ahead queue. Delay the print_time
calculation until moves are ready to be sent.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename the commands.
The main reason for this change is to force a micro-controller code
updated (due to important bugfix in 7fefe52d).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The current z_hop support did not work correctly with common slicers
that change Z height between retract and unretract, and it did not
work correctly with slicers that issue a retract at the end of a print
and then at the beginning of the next print.
The z_hop support is therefore being removed until these issues can be
fixed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't default to a Z location of 10, as that could cause damage if the
probe's z_offset is greater than 10. Instead, use the "retract
distance" method that is used for normal multi-sample probing.
Update the PROBE_ACCURACY command parameter names to use the same
parameter names as the PROBE command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that homing is implemented via "drip moves", it is no longer
necessary for the stepcompress code to have special homing logic.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that homing is implemented via "drip moves", it is no longer
necessary to move the print_time backwards.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that homing is implemented via "drip moves", it is no longer
necessary to round the homing speed and it is no longer necessary to
add a delay for cpu processing time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rework the low-level implementation of homing movement. The existing
mechanism buffers all homing movement into the micro-controller prior
to starting the home. Replace with a system that buffers all movement
into the host look-ahead buffer and then "drip feed" those moves to
the micro-controllers. Then clear the host look-ahead buffer when all
endstops trigger.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Finish Moves needs be a hard requirement for the event gcodes, as it eliminates the possiblility of an event firing while the gcode is executing.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It really helps to see a snapshot of available printer variables when building menus and macros. The list of variables always depends on what printer config you have.
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
This moves skew_correction configuration out of printer.cfg. It is now dynamically set by the SET_SKEW gcode.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add support for enabling the stepper via the communication channel.
This improves support for boards with a shared enable line.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
A print_time of zero may translate to a negative clock on a secondary
micro-controller, which would cause an internal error. Change the
code to pass a real print_time or None if it is not needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Only the tmc2208 driver needs special read register translation logic.
Rework the code so a default implementation is available for all the
other drivers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the serial command wrapper class from serialhdl.py to mcu.py.
This will allow that class to better support higher level
functionality.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce a main send_with_response() helper function and use it
during identify and the setup of clocksync.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
An extra to execute gcode when a hardware button is pressed or released. Uses the jinja2 templating system.
Inspired by pull request #545 from Miguel Moitinho miguel@moitinho.net and pull request #1098 from Paulo Drugos paulodrugos@gmail.com
Signed-off-by: Alec Plumb <alec@etherwalker.com>
Add PROBE_SPEED, SAMPLES, SAMPLE_RETRACT_DIST, SAMPLES_TOLERANCE,
SAMPLES_TOLERANCE_RETRIES, and SAMPLES_RESULT parameters to the PROBE
command (and to commands that indirectly invoke a probe).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure to configure DRVCONF with SDOFF=0 prior to writing DRVCTRL
as that field controls access to that register.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support retrying Z_TILT_ADJUST a configurable number of times
to a configurable tolerance both in the config or as parameters.
- By default keeps original behavior of no retries.
- Adds parameters RETRIES and RETRY_TOLERANCE to QUAD_GANTRY_LEVEL gcode.
- adds config options retries and retry_tolerance to uad_gantry_level]
- issues an error if we are getting worse intead of approaching tolerance
- issues an error if retries were requested but we did not reach the tolerance
in the specified number of retries
the minimum change should be a single z step for those
probing 2 points for 2 stepper motors and 3 for 3 stepper motors.
at one point it was suggested to use the amount of z adjustment instead of the
range of the probed points as a trigger for retry. I've chosen not to do this.
using z adustment in these cases means the minimum unit of change is related to
the angle created by the probed points and the distance to stepper motor and
can be more than a couple steps which is rather unintuitive.
for the case when someone is using more probed points than z steppers the
probed points range will have some fixed minimum value that can't be reduced
which is also unintuitive but that case should idealy be the rarer case, and
the user can learn to set a higher tolerance that matches their probing setup.
Signed-off-by: John "Fess" Fessenden <fess@fess.org>
Support retrying QUAD_GANTRY_LEVEL a configurable number of times
to a configurable tolerance both in the config or as parameters.
- By default keeps original behavior of no retries.
- Adds parameters RETRIES and RETRY_TOLERANCE to QUAD_GANTRY_LEVEL gcode.
- adds config options retries and retry_tolerance to `[quad_gantry_level]`
- issues an error if we are getting worse intead of approaching tolerance
- issues an error if retries were requested but we did not reach the tolerance
in the specified number of retries
Signed-off-by: John "Fess" Fessenden <fess@fess.org>
List all the configurable parameters in the tmc5160 example block and
use similar wording as the other tmc drivers.
Also, don't allow DEDGE to be configured as it would just break the
current code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce TMCMicrostepHelper and TMCStealthchopHelper helper code that
uses the mcu_tmc interface. Update the callers to use these new
helpers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Perform the register initialization directly from TMCCommandHelper and
perform it during the "connect" phase. This unifies the register
setup for the TMC2130, TMC2208, TMC2660, and TMC5160.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use a get_register() method instead of get_response(). This makes the
tmc2660 class more similar to other TMC drivers. It also enables
DUMP_TMC to dump all the readable content.
Also, use the tmc2130.get_config_microsteps() helper.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reduce the delay in send_with_response() by introducing a reactor
mutex to wake the main thread when the response is obtained.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
If commands are slowly fed to the printer it could cause the number of
queued commands to grow without bound. Be sure to pause the incoming
command stream even if the lookahead queue is empty.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
Factor out _calc_mean() and _calc_median() functions and call from
both run_probe() and cmd_PROBE_ACCURACY().
This also fixes a subtle error in the run_probe() median function - on
some kinematics the x and y position can change on a z move so the x
and y should be taken from the z probe values actually used.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This changes the config file so that the configuration of
multi-samples is now done in the [probe] (and [bltouch]) section
instead of the various delta, bed_mesh, z_tilt, etc. config sections.
With this change, PROBE and PROBE_CALIBRATE commands now also utilize
multi-sampling.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the extruder, display, heater_fan, output_pin, and servo
classes have get_status() methods, it is no longer necessary to
override them in the menu code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
These action commands prevent Octoprint from sending extra gcodes that can interfere with Klipper's pause/resume control.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
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>
Prior to the BLTouch v3, the recommended command times were 700us
(pin_down), 1200us (touch_mode), 1500us (pin_up), 1800us (self_test),
and 2200us (reset). However, the recommended Marlin timing (via servo
"angles") was 647.111, 1162.667, 1472, 1781.333, and 2193.778us.
As of the BLTouch v3, the recommended times are now 650, 1165, 1475,
1780, and 2190us. The v3 continues to recommended Marlin timings of
647.111, 1162.667, 1472, 1781.333, and 2193.778us.
Update Klipper to use the new BL-Touch v3 recommended timing. The new
timings are required for the BL-Touch v3 and they are closer to what
the Marlin firmware has historically used.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Improve the precision of soft pwm pulses by allowing the host to
directly specify the clock duration of the pulse. This improvement in
precision may be noticeable when controller servos (and bltouch).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
"The z_tilt_adjust was coded to require 3 points because the original
intent was for railcore-xl and voron. Since then, a number of users
have started using z_tilt_adjust for prusa i3 style printers with dual z
steppers. That's fine, but we just haven't gotten around to removing
the superfluous check in the code." -- Kevin O'Connor
remove that check.
Signed-off-by: John "Fess" Fessenden <fess@fess.org>
Factor out minimum required points check for ProbePointsHelper
in prep for setting different values for quad_gantry_level
and z_tilt_adjust
Signed-off-by: John "Fess" Fessenden <fess@fess.org>
"Feed Filament" menu item value was off-screen that made this item useless. So I changed its name to just "Feed". Users shall easily guess that this item is for filament feeding because this item is located in "Filament" menu.
Signed-off-by: Alexander Fadeev <alfsoft@gmail.com>
safety feature that prevents quad_gantry_level from trying to do a
correction that might break things - if your probe fires early for
whatever reason and tries to do an 8mm correction in one corner instead
we abort if a correction is over a configurable limit by default 4mm
configurable via `max_adjust` parameter in the config
Signed-off-by: John "Fess" Fessenden <fess@fess.org>
In particular trying to keep the output from a single quad_gantry_level
so that it fits in the octoprint terminal window without the need to
scroll
Signed-off-by: John "Fess" Fessenden <fess@fess.org>
Adding gcode command for setting the target temperature of temperature_fan.
Example gcode: SET_TEMPERATURE_FAN_TARGET temperature_fan=chamber target=35.0
Signed-off-by: Martin Nowroth <madnoth@gmail.com>
The parameter to the M221 command should be the ratio of the nominal to
measured filament area, rather than the ratio of the diameters. Since we
are taking the ratio, most of the area calculation cancels out.
Fixes#1535.
Signed-off-by: Len Trigg <lenbok@gmail.com>
The servo pins (P9_14/P9_16) are muxed to the SOCs hardware PWM unit
driven by a 13MHz GP timer. They have to be driven by the linux host
mcu. This commits adds hardware PWM support using the linux sysfs
user space interface.
The servo pins can be specified as "replicape:servo0" and
"replicape:servo1". Removes the "servo0_enable", "servo1_enable"
configuration parameters.
Fixes#1105.
Signed-off-by: Janne Grunau <janne-3d@jannau.net>
Due to the corexy kinematics, the individual steppers may have a
velocity of sqrt(2) times faster than the cartesian velocity _and_ can
have an acceleration of sqrt(2) times faster. Make sure to calculate
in the higher acceleration.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Adjust the HEND default, which was faulty after the the fields update, remove disallowance of setting CS
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
Allows configuration files to include other configuration files using
[include filename.cfg] syntax. Klippy loads include files in the
position of the include header; subsequent definitions override
included values. Supports wildcards (e.g. [include macros/*.cfg).
Allows included files to include other files but blocks recursion.
Signed-off-by: Greg Lauckhart <greg@lauckhart.com>
Adds parameter for bed meshes to be adjusted relative to a probed point
during calibration. This allows the probe z offset to be ignored for
probes that are not stable over time (for example, the thermal drift of
inductive probes). An endstop other than the probe is then necessary to
determine the bed-nozzle offset.
Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
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>
Now that enumerations are available, any variable named "pin" can only
be used to describe a gpio pin. Rename the end_stop_state "pin"
parameter to "pin_value". Also, rename "end_stop_query" command to
"end_stop_query_state" to notify users to upgrade both host and mcu
code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid transmitting lists of message ids for commands and responses -
gzip doesn't do a good job of compressing them.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The z_adjust offset provided to adjust_steppers is calculated given the
steppers adjust exactly according to the given x_adjust/y_adjust. As the
algorithm eliminates an offset that is common to all steppers, this offset
must be taken into account in the final correction.
Signed-off-by: Arne Jansen <arne@die-jansens.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The z_offset calculation should have been calculated from the probe
height to the measured bed position.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the field names from the trinamic specification. This makes the
field similar to all the other driver_XXX config options.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
sense_resistor is now a mandatory parameter for tmc2660 blocks. Duet2 users should use a value of 0.051
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
Don't immediately raise an error if the heating_gain check fails.
Instead, just transition to the normal max_error check. This should
make the code less likely to raise an error should the heater have a
slow approach to the target temperature.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the first check_gain_time interval to only require a
heating_gain relative to the lowest observed temperature during that
interval. This makes the code less likely to raise a spurious error
when the heater is enabled while the heater temperature is dropping.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't reset the error counter if the reported temperature is
significantly above the target temperature. This may help catch cases
where the temperature sensor reports random values.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This implementation includes a BaseSensor class that all underlying sensor implementations should subclass.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Support reading a "gcode_id" parameter from heater/sensor config
sections.
Signed-off-by: Douglas Hammond <wizhippo@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
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>
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>
The 'bed_shape' option has been removed. The user will enter a 'bed_radius' if they have a round be, otherwise they should enter 'min_point' and 'max_point'. When the bed is round the user should supply a 'round_probe_count' option, otherwise just 'probe_count'.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>