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>
Use the field helper to simplify the bit manipulation in the driver.
This also enables the extended DUMP_TMC output.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Raise a printer.config_error() on an invalid register_command() call.
This error is easier to handle for the vast majority of callers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Implementation of "PROBE_ACCURACY" to measure the maximum, minimum,
average and standard deviation of a probe.
Signed-off-by: Rui Caridade <rui.mcbc@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support added for filament diameter sensor. Sample configuration parameters added to example-extras.cfg.
Signed-off-by: Mustafa YILDIZ <mydiz@hotmail.com>
Adds the ability to register a custom/generic heater through a new extra called heater_generic.
This takes a gcode_id that is reported by M105. Adds a new command to set the temperature for any heater using the syntax:
SET_HEATER_TEMPERATURE HEATER=<heater_name> TARGET=<target_temp>
Signed-off-by: John Jardine <john@gprime.net>
- When using absolute extrusion the gcode position e-axis position is now captured on PAUSE and restored in RESUME with a call to the G92 handler.
- Add a get_status() function that returns a dictionary with an 'is_paused' key.
- Do not allow consective calls to PAUSE or RESUME to exectue. Also do not allow a RESUME to executed without a previous PAUSE.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Commit f4d323ad changed the handling of the self.speed variable, and
it inadvertently changed the default startup speed. Return to the
default of 25mm/s.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In the normal case, a regular pin_up command should be sufficient to
raise the probe. (Should the regular pin_up fail, the code can issue
a "reset" command during the retry.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit c3efcd9c moved the config_spi setup to a build_config callback.
It's also necessary to move the config_thermocouple to a build_config
callback as well.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add helper function for reading current, microsteps, and stealthchop
settings from the config file. Use these helpers in both the tmc2130
and tmc2208 modules.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move these helper functions to the FieldHelper class so that they can
be used by other Trinamic drivers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Report values of TMC2208 register fields in DUMP_TMC command to help in
tuning and diagnostics.
This also adds functions to refer to register fields by name for TMC drivers
and register mappings for TMC2208.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Dmitry Frolov <dmitry.frolov@gmail.com>
Stopping the connect sequence can make it difficult to get the bltouch
out of an error state. Allow the connect to proceed, ideally if the
bltouch stays in an error state it will be detected during the first
probe attempt.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>