This gives it parity with heater_fan. Also change the default speed from
max_power to 1.0, since it is already scaled by max_power in set_speed.
Signed-off-by: Adrian Keet <arkeet@gmail.com>
round to only 6 decimal places of precision. prevents doing extra retry
from small variations due to floating point math.
Signed-off-by: John "Fess" Fessenden <fess@fess.org>
Always disable the PWM after each command sent. Automatically trim
the command duration so the PWM disable doesn't increase the total
pulse time (when the duration is 200ms or greater).
Track the ideal command end time separately from the pwm transmit time
and only delay toolhead moves to this ideal time.
Update verify_state() to automatically schedule the check using the
time of the last sent command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename try_load_module() so that it uses consistent naming for
"printer objects". Change the function to raise an error by default
if the specified module does not exist.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of passing a dictionary to the command handlers, create a
wrapper class and pass that class to the command handlers. This can
simplify the command handler code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The beagleboard TI kernel 4.14 and 4.19 contain a commit which change
the device names ("pwm: Create device class for pwm channels") from
pwmN to pwm-${chip}:N. This commit was never merged into the upstream
kernel.
Decrease the number of pwm channels to a more reasonable 16. Increase
the number of pwm chips to 8 since the replicape servo pwm outputs are
on pwmchip4.
Update replicape code to detect appropriate channel.
Signed-off-by: Janne Grunau <janne-gh@jannau.net>
The heater logic is an independent module that does not need to be
treated as part of the "core" klipper code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's no longer necessary to queue gcode scripts - gcode.run_script()
now does that automatically.
Also, make release_gcode config optional.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The probe_finalize() name is used for callbacks in both the
PrinterProbe and ProbePointsHelper classes. Rename the PrinterProbe
callback to avoid confusion.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename the method to make it more clear that it is a low-level call
that should be rarely used.
Also, change gcode_button.py, hall_filament_width_sensor.py, and
tsl1401cl_filament_width_sensor.py to use respond_info() instead of
respond_raw().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Report low-level disk errors via the log and use the normal sdcard
mechanism to report end of sdcard print to gcode users.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
No need to check for '#original' in params - it's always there.
Properly handle a lower case m118 command. Don't register a help text
for the legacy M118 g-code command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Raising an error (instead of reporting an error) is important as only
a raised error will stop a print from virtual_sdcard.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 402110f6 didn't actually fix absolute extrude mode. For now,
report an error if an extrude move is requested in absolute extrude
mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Fix linear_travel optimization. Use "2*pi" instead of "radians(360)".
Always emit at least one segment and always end at the final target
coordinates.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Fix Z moves so that the movement is spaced out among the arc movements.
Fix extrude moves when in absolute extrude mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the normal gcode.get_float() mechanism for extracting parameters
from the g-code command.
Don't register descriptions for the G2/G3 commands as the convention
is to only use descriptions for "extended g-code commands".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This reverts commit 5c8d15bbee.
The lower_probe() code was already manually optimizing the timing of
the pwm disable, and that conflicted with the optimization in commit
5c8d15bb.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some clones don't raise the pin on a reset and the ANTClabs BL-Touch
sometimes doesn't raise the pin either.
Rework the (infrequently called) sensor test code to always issue a
pin_up command before the touch command. Also, perform a reset and
retry if the sensor test fails.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Be sure to fully raise the probe prior to starting any future toolhead
movements in the multi_probe_end() case.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If an error is found during the pin_up_not_triggered check, then apply
the reset command for a full second (instead of just 100ms). This
gives the bltouch more time to check its internal state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Return the triggered state from verify_state() and update the callers
to raise the error (if needed).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It is likely only developers will be interested in testing the menu
system, so no need to have it in the default menu.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Disable support for customizing the main lcd display content via the
menu system. Advise users to use the new display_data config sections
as a replacement.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce a new config based system for specifying the on-screen
contents of an lcd screen. The default screen configuration (found in
klippy/extras/display/display.cfg) is the same as the previous
hard-coded display, so this should not change behavior for existing
users.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use new mcu.lookup_query_command() for all commands that query
information from the micro-controller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert standard queries to use the acknowledgments of the sent
command to determine if the response was received or not. This also
controls command retransmissions (should the response have been lost).
The tmc_uart.py will continue to use the old mechanism as the tmcuart
responses are not sent synchronously with the query command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's not valid to set the TPWMTHRS in a "klippy:connect" event handler
because the TMCVirtualPinHelper and TMCCommandHelper classes were
expecting that field to be set during the config reading phase.
Revert "tmc: Fix typo preventing stealthchop threshold from being set"
This reverts commit 7d76067ff9.
Revert "tmc: Query the stepper step_distance from the stepper object"
This reverts commit 67b2852249.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change home_wait() to return if the homing operation completed
succesfully or not. This simplifies the callers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update the endstop code to return its trigger completion object during
home_start(). Update the toolhead class to take a completion object
(instead of creating its own). This reduces the number of
intermediate callbacks needed during a homing operation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>