Move the pseudo-tty IO handling from the main gcode class to a new
gcode_io class. This simplifies the main gcode class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If there isn't a reader of the output pipe it can lead to the
generation of a large number of errors. Only attempt to write if it
appears the pipe is active.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
SDCARD_PRINT_FILE allows Klipper to load and start the print for any
gcode file within the virtual_sdcard path, including subdirectories.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
In it's current behavior, safe_z_home will attempt to home Z if it thinks the toolhead is above the z endstop even if the motors have since been disabled and the toolhead was moved to another position
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
This streamlines the BedMeshCalibrate class, making it only resposible for configuring and executing the calibration procedure.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Using the setup_start_value() method avoids the PWM output line
transitioning to an intermediate state prior to setting the initial
value.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This makes sure output pins are reset to their defaults when the host
is restarted and the micro-controller is not.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new "on_restart" parameter to mcu.add_config_cmd() and only send
those commands on a host restart that does not involve a
micro-controller restart.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add user-configurable contrast, vcomh (affects "smearing"), and invert options for SSD1306/SH1106 type OLED displays.
Signed-off-by: James Esau <james_esau@hotmail.com>
For example, Raspbian GNU/Linux 8 (jessie) uses an old GCC version 4.9.2
which uses -std=gnu90 by default.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Changing this check from debugoutput to debuginput allows remote applications to perform tests against Klippy without an MCU connected.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Input shaping can help to reduce printer vibrations due to resonances
and eliminate or reduce ghosting in prints.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Register API endpoints for "pause_resume/pause", "pause_resume/resume" and "pause_resume/cancel".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If a shutdown occurs during a PID_CALIBRATE command (eg, due to a
heater problem) then exit cleanly instead of throwing an internal
error.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change write_graphics() from taking one pixel row of n characters to
taking all the rows and columns for one character cell.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit allows to modify the icons (or glyphs) in the displays that
support it. Existing icons can be modified and new icons can be added via
a [display_glyph] section in the config.
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
Rework extruder.get_trapq() into extruder.sync_stepper() so that
extruder_stepper.py does not need to directly access the extruder
internals.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Option for using the current diameter instead of nominal while the first measurement isn't in place
Signed-off-by: Matthias Pabel <matthias.pabel@hs-augsburg.de>
This reverts commit 43fa41c1af.
The above commit disabled absolute extrude moves because it was
unclear if the code would work properly when an M221 extrude factor or
G92 offset was in use. However, since the calculation is done
relative to the raw E position and is sent as a raw E position to
gcode.cmd_G1() these modes should not matter.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If self.kin_flush_delay changes after a G4 dwell command (or other
non-kinematic time update) then it could lead to "internal step
compression" errors. Make sure to handle this case in
flush_step_generation().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make it clear that gcode.get_status() to be called without an
eventtime by defaulting eventtime=None.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Store a reference to the gcode class in self.code. Obtain the
z_offset once and use for both the oldval and newval calculation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 9530373c introduced a minimum value of zero for the g-code z
position. Unfortunately, that would likely cause the tuning tower to
not emit a command at the start of a test because the initial dummy z
position is set to a negative value. The minimum bound should not be
needed so remove it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Commit c3899cef inadvertently broke the error check for unused config
options. Add a new note_valid parameter to the config access wrappers
and use that in get_status() to fix the check.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Remove the parsing helpers from the main gcode class now that all
callers have been converted to use the parsing helpers in the
GCodeCommand class.
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>
Avoid using doubles as flags when generating steps during "lead up to
stepper activity". Instead, explicitly track how many inactive move
entries are skipped and only generate steps for those entries.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't assume the times passed to itersolve_gen_steps_range() are
contained within the move. It's possible the checks in
itersolve_generate_steps() may round to different values when
converting the times to a relative move time.
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>
Add a 50ms delay from the initial clock measurement to the first
get_clock query. Disable the prediction_variance filter on each
get_clock query so that none of those measurements are ignored.
Signed-off-by: Kevin O'Connor <kevin@koconnor.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>
It's important to raise an error (instead of calling respond_error() )
so that a G20 will stop a virtual_sdcard print.
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>
Fysetc Cheetah v1.2 boards require a special sequence to reset reliably.
This sequence works for me in all cases. Simpler sequences without
double reset did not work correctly. This is likely because of a weird
stateful circuitry for toggling the bootloader state.
Cheetah boards use RTS to configure bootloader triggering. By default,
pySerial sets RTS on connect, which unfortunately configures the board
to start the bootloader on reset.
Add a toggle for the RTS state to allow users to workaround. The RTS state
is set before the serial connection is opened, so there are no glitches.
Addresses #2026.
Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
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>
Some stepper motor drivers do not respond well to rapid "step +
direction change + step" events. In particular, it is believed this
can cause "over current" events on the tmc2208 drivers when they are
in "stealthchop" mode. Detect these events and remove them from the
generated step times.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>