I noticed Octoprint was disconnecting after a while, and after reading the logs, I came across this error:
```
Unhandled exception during run
Traceback (most recent call last):
File "/home/pi/klipper/klippy/klippy.py", line 171, in run
self.reactor.run()
File "/home/pi/klipper/klippy/reactor.py", line 176, in run
g_next.switch()
File "/home/pi/klipper/klippy/reactor.py", line 203, in _dispatch_loop
timeout = self._check_timers(eventtime)
File "/home/pi/klipper/klippy/reactor.py", line 82, in _check_timers
t.waketime = t.callback(eventtime)
File "/home/pi/klipper/klippy/extras/idle_timeout.py", line 62, in timeout_handler
return self.check_idle_timeout(eventtime)
File "/home/pi/klipper/klippy/extras/idle_timeout.py", line 59, in check_idle_timeout
return self.transition_idle_state(eventtime)
File "/home/pi/klipper/klippy/extras/idle_timeout.py", line 35, in transition_idle_state
logging.exception("idle timeout gcode execution")
NameError: global name 'logging' is not defined
```
I therefore added the missing import.
Signed-off-by: Samori Gorse <samori.gorse+github@gmail.com>
This module adds PAUSE and RESUME gcodes that can programatically determine if the gcode is printing from virtual sd or over the serial connection. It also captures the current toolhead position and gcode feedrate on pause, and recovers that position and feedrate on resume.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
- Add is_active() member function to return the active printing status of the virtual sdcard
- M27 now reports current file position when file has been opened. See http://marlinfw.org/docs/gcode/M027.html
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add support for performing linear interpolation between a set of
measured temperature/resistance pairs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the low-level PrinterADCtoTemperature() class from thermistor.py
to adc_temperature.py and use it from the Linear() class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
We want the duration of each command to be an exact multiple of
SIGNAL_PERIOD. The durations might not be exact if the bltouch is on
a secondary mcu. Account for this in send_cmd().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rework the undocumented test_sensor_pin config option into a
pin_up_touch_mode_reports_triggered option and document it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Query the bltouch state during the pin_up command to try and verify
that the probe does actually retract. This may be useful to detect if
the bltouch enters into an "error" state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The BLTouch is more accurate when probing in "pin_down" mode than
"touch_mode" (at least on some hardware). Rework the code to use that
mode.
When probing in pin_down mode, the BLTouch can go into an error state
if a pin_up is not sent immediately after a touch signal. Rework the
pin_up code to reduce the time it takes to transmit the command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce a sync_print_time() method and update send_cmd() to track
the duration of bltouch commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Verify that there is always some movement during a probing operation.
This is normally done by the homing.py code (via its verify_movement
check), but that check may not be enabled when z_virtual_endstop is
used. So, always enable the check in the bltouch.py code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Separate the thermistor math from the heater temperature callback
system. This may make it easier for debugging.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Only update the status message with the first error report.
Subsequent errors are often the result of the first error and
reporting the last error can be misleading.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure to not query the given endstop until after the start of the
requested operation. This ensures that the operation has started
prior to querying the status of that operation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure the endstop checking is started prior to any movement. This
helps ensure the verify_movement check is accurate.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Whenever a stepper driver or a heater becomes active, it is desirable to turn on a fan cooling the associated parts on the controller board. This module implements such a fan that turns on whenever a stepper or specified heater turns on, decelerates to a configurable speed when all of the watched parts turn off, and returns to an off-speed, when a user-defined timeout is met.
Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
Convert all users of the printer_state("connect") handler to register
a "klippy:connect" event handler instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert all users of the printer_state("ready") handler to register a
"klippy:ready" event handler instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert all users of the printer_state("disconnect") handler to
register a "klippy:disconnect" event handler instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert all users of the printer_state("shutdown") handler to register
a "klippy:shutdown" event handler instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
- changes that make easier to use menu as module UI
- new helper method for delayed callbacks
- method for getting the menu instance from display
- new action for sending menu:action events
- allow_without_selection option for cards
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
- long press with timer (button release is not needed anymore)
- initial support for edit mode long press gcode
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
The sam3 i2c code and the linux code use a 7-bit i2c address, while
the avr, lpc176x, and samd21 i2c code uses an 8-bit address with the
least significant bit always zero. A similar issue occurred in the
host code (sx1509.py and replicape.py use 7-bit addresses while
uc1701.py and mcp4451.py use 8-bit addresses).
Consistently use 7-bit addresses in all the code. This breaks
compatibility between host and mcu software, so make a change to the
config_i2c command to force users to synchronize software updates.
This also breaks common Smoothieboard configs, so update the mcp4451
code to validate the i2c_address.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
As discussed in #1057, the default loading- and unloading procedure does
not behave as expected. Setting the extruder to relative mode fixes this.
Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
If an SPI device is shared among many devices, then all the device's
CS pins should be set high prior to setting up the clk pin.
(Otherwise, there's a chance a device could interpret the clk pin
setup as part of a transmission.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Limit speed and acceleration of extrude only moves to just the
max_extrude_only_velocity and max_extrude_only_accel config settings.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a requested value is higher than the configured maximum, then just
limit the value to the configured maximum instead of raising an error.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
I have made one change to `gcode.py` to support quoted parameter
values.
I have added support for the basic `M118` command (see
https://reprap.org/wiki/G-code#M118:_Echo_message_on_host). I have
also added a `RESPOND` command that takes extended parameters.
`ECHO` might be a better name than `RESPOND` but is already defined
in `gcode.py`.
Signed-off-by: Alec B. Plumb <alec@etherwalker.com>
Allow an arbitrary gcode_id to be supplied during heater setup. This allows future extras to register additional IDs beyond B, and T#.
Signed-off-by: John Jardine <john@gprime.net>
This makes M220 (change print speed) command effect the next move command (G0/G1).
Before it only made a differenc once a G0/G1 command with an F parameter was executed.
Signed-off-by: Pontus Borg <liquidpontus@yahoo.se>
It appears some bltouch "clones" do not report the probe as triggered
when put in "touch mode" while the pin is raised. Add a config option
to allow users to disable the test.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some of the bltouch implementations may only respond to a probe event
with a 5ms pulse. Make sure to check the signal pin at least every
millisecond to ensure no signal is lost.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
To deal potential z scaling when fade is enabled, a fade_target option has been introduced. This option may either be set to 0.0 or any z position within the range of the mesh. A value of 0.0 will result in previous behavior, where z adjustment phases out until no further adjustment is added. A non-zero value will phase out adjustment until the target has been reached, after which the rest of the print will be offset along the z axis by the fade_target. By default the fade_target will be calculated as an average of the mesh.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Due to various potential issues with fading out z-adjustment, it is better to disable by default and allow users to opt-in.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add a self.all_framebuffers variable and change self.vram to only
contain the new display data. This allows the main code to access the
self.vram member variable without the need to index for current/old
data. (It also updates the code to match the latest st7920 and
hd44780 code.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Cheap mechanical servos have small flickering. When this servo stay on one position, this flickering slowly destroy internal potentiometer and make servo unusable. Many mechanisms need servo only to change position. Therefore I create this minor path to enable/disable servo. It stop pulses for this servo, that's all.
Corresponding G-code is:
SET_SERVO SERVO=config_name [WIDTH=] [ENABLE=<0|1>]
SET_SERVO SERVO=config_name [ANGLE=] [ENABLE=<0|1>]
For example:
SET_SERVO SERVO=touch ANGLE=80 ENABLE=1 ; enable servo and set position
G4 P200 ; wait 200ms
SET_SERVO SERVO=touch ENABLE=0 ; disable servo
This patch add one option to servo configuration:
enable: <False/True> # default True
It not have impact to user code existing already because it is optional parameter and default value is same as original behavior.
Signed-off-by: Jiri Dobry <jdobry@centrum.cz>
This allows SX1509 pins to be used as temperature fans and heater fans. Heaters are still disallowed.
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
The atmega328p is basically the same as the atmega328 - add explicit
support for it so that avrdude doesn't complain while flashing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update the process_batch() method so that it will not interleave
commands read from the input fd with the batched commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 459e5219 added a special case to the boundary checks to permit
homing moves. In some cases, the second home retract could also be
outside the normal boundary checks - extend the special case to also
permit that move.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The gitdir previously could be absent and produce a version of "" in
spite of checks for it. Fixed.
Parent directories with shlex-interpreted characters in their names
could be misinterpreted. Removed shlex parsing.
Packagers may want to remove the git history to slim down the package
size, so add an option for using a file 'version' in the klippy
directory to set version without using git.
Signed-Off-By: Lucas Fink <software@lfcode.ca>
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>