Extends the BMxx80 category with support for the older BMP180 sensor, providing temperature and humidity output.
Signed-off-by: VAXXi Popescu <github@vaxxi.net>
The output_pin module is only capable of updating an output pin at
most once every 100ms. Add a new pwm_tool module that is capable of
queuing updates in the micro-controller and thus allowing for much
higher update rates.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This reverts commit 6749985302.
A defect was found in the above commit (the input shaper code calls
note_step_generateion_scan_time() for many steppers, so the
input_shaper class can't be used as the index).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Klipper logs an error on a failed CANbus write. Unfortunately, if the
bus becomes permanently disabled (eg, due to a user removing power to
devices on the CANbus) then it can result in the logs filling with
error messages.
Permanently disable the low-level processing of messages if CANbus
writes continually fail for at least 10 seconds. This avoids filling
the log with redundant messages.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Previous version of the code assumed that dual carriages home away
from each other, which is not true on some machines, which have the
second dual carriage homing on the first carriage. The new code
correctly identifies the relative order of the carriages now.
This fixes discrepancies between the documentation and the actual
implementation of the carriages kinematic ranges calculation.
Notes about dual_carriage homing and proximity checks changes
Fixed clearing of homing state after homing in certain modes
In case of multi-MCU homing it is possible that the carriage position
will end up outside of the allowed motion range due to latencies in data
transmission between MCUs. Selecting certain modes after homing could
result in home state clearing instead of blocking the motion of the
active carriage. This commit fixes this undesired behavior.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
The RetryAsyncCommand code needs to ensure that any response messages
are not from a previous (unrelated) query. To do that it compares the
'#sent_time' from potential responses to ensure they are not from a
previous session. However, if there are any low-level serial
retransmits then the low-level code sets the '#sent_time' to zero (to
indicate that the query send time is not strictly known). That could
result in a valid response not being accepted by RetryAsyncCommand.
If a low-level connection is experiencing a small amount of periodic
retransmits it could result in multiple high-level retry attempts
failing to the point that there is a user-facing error. This could
result in "Timeout on wait for 'tmcuart_response' response" errors.
Fix by accepting responses even if there is a low-level retransmit
once the code can confirm that there can be no previous query still in
progress.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Limit the maximum temperature in MAX31865.calc_adc() to the melting
point of platinum. Above this temperature the Callendar-Van Dusem
formula does not make sense. The default value for max_temp is
99999999.9 and at this temperature the result of this formula is
negative. This sets max_sample_value to 0 which causes the mcu
to shutdown.
Set max adc value to (1<<15)-1 . This is needed because the max value of the adc register
of the MAX31865 is 0b1111 1111 1111 1110 which represents
32767 and not 32768.
Signed-off-by: David van 't Wout <github@yoctobyte.nl>
Implements AxisTwistCompensation, and Calibrater
Supports calibration of z-offsets caused by x gantry twist
Modify PrinterProbe._probe function to check if the probed z value should be adjusted
based on axis_twist_compensation's configuration
Add documentation for [axis_twist_compensation] module
Signed-off-by: Jeremy Tan <jeremytkw98@gmail.com>
COPY and MIRROR mode implementation
Correctly apply input shaper params to new dual_carriage
Added SAVE_/RESTORE_IDEX_STATE commands
Documentation updates for the new IDEX modes
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
The relative_reference_index will now refer to a coordinate that is
static and cannot be changed at runtime. If new mesh parameters
are specifed and the reference lies outside of the mesh then the
reference location will be probed.
Additionally this introduces a 'zero_reference_position' option which
accepts a specific X/Y coordinate. This may be used in place of the
relative_reference_index.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
When mesh parameters change the substituted indices need to be
updated, even when using the default point set. Always generate
new points to perform this update rather than cache
the "orig_points".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It seems opening the canbus socket can sometimes throw an os.error (in
addition to can.CanError). Catch that error to avoid Klipper
reporting an internal error.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the stepper already executed some steps with the basic
stepper_kinematics, subsequent creation of a new one for input_shaper
would result in stepcompress errors unless position and time tracking
flags are also copied over.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Sample the BME680 every .8 seconds, matching that of the
BME280. This resolves an issue where `get_report_time_delta()`
returns a value that doesn't match the actual delta.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
In hybrid_corexy and hybrid_corexz, the update_limits function is (only) called by the DualCarriage implementation, whenever the carriage changes.
Unfortunately, these limits also keep track of homing status, when they're unhomed they are set to 1 to -1 (invalid range).
As a fix, if the limit was set to "unhomed", we keep it that way, and only update it with the new rail limits if it was already properly homed before.
Signed-off-by: Frans-willem Hardijzer <fw@hardijzer.nl>
Check for untracked files in the klippy/extras/ and klippy/kinematics/
directories and report those files in the log. This helps identify
code modifications when inspecting a log.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The control bytes for the AHT20 and AHT21 are identical to the AHT10, but I had not been able to test just yet to ensure the sensor code supported the other sensors. I've wrapped up testing and updated the comments/docs to reflect this additional support.
Signed-off-by: Scott Mudge <mail@scottmudge.com>
Fixes common MPU-9250 accelerometer issues for RPi Linux MCU and
improves reliability on all other architectures by adjusting the MPU-*
reading algorithm to only read whole Klipper messages' worth of
data from MPU-* and eliminating many unnecessary checks of the MPU FIFO
fill-level that consumed bus bandwidth needed for data transfer. Fixes
intermittent "Lost communication with MCU 'rpi'" due to "Timer too
close" and transposed / corrupted data due to FIFO overrun/data loss
when using MPU-* accelerometers. In addition FIFO overrun checks are
performed by testing the MPU interrupt flag vs. inferring from the FIFO
fill level.
Stress tested for 13hrs with two MPU-6500 attached to one I2C bus on RPi
and one on a PR2040
Stress tested for 23hrs with two MPU-6500 attached to one I2C bus on RPi
and one on a ATmega328P (Seeduino Nano)
Signed-off-by: Matthew Swabey <matthew@swabey.org>
In some condition ,“drvstrength 2” does not work. According to page 17, some mosfets need “drvstrength” set to 0 .
From datasheet rev1.15, the DRVSTRENGTH reset default is 0 . (instead of 2)
Signed-off-by: Albert Lin <vcore85@gmail.com>
The stalled_bytes counter refers to the number of bytes that are not
yet eligible for transmission. However, the naming leads to confusion
as it could be interpretted as an inability to transmit data. Rename
to upcoming_bytes to try to avoid that confusion.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit adds support for the I2C-based AHT10 ambient temperature sensor. The sensor comes pre-calibrated and has a fairly simple command interface, so the interface class is in-turn relatively simple. So far this has been tested on a BTT GTR 1.0 MCU board (STM32F4), and seems to work fine.
Signed-off-by: Scott Mudge <mail@scottmudge.com>
Add an optional REGISTER parameter to DUMP_TMC so that the output is more filtered/cleaner for manual TMC calibration.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Ability to specify `VELOCITY` as a parameter for SET_TMC_FIELD. Useful for configuring at runtime the TSTEP based fields of the driver.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Implement a helper for calculating velocity based thresholds for tmc drivers. This code was written in such a way that it can be used with more fields than just tpwmthrs.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
If tcoolthrs is configured (not the default 0), then do not force
the value of tcoolthrs=0xfffff during homing. This way, tcoolthrs
can be set to a custom value during homing.
`tpwmthrs` and `en_pwm_mode`/`en_spreadcycle` are now also
correctly restored if they were changed after startup.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
`multistep_filt` was not configured at all on tmc2240 and tmc5160. As such, it would default to the value of 0 when the GCONF field was sent to the driver. However, that field has a default value of 1 in the driver, so klipper was overriding the defaults by accident.
This field improves the stability of velocity based thresholds (it's effectively TSTEP filtering) and it also improves the current regulation stability in stealthchop2 (according to the datasheet).
This field was already set to 1 correctly in the tmc2208/tmc2209 driver code.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Purely esthetic. Make all tmc driver init code similar to one another. The various fields were grouped based on the register which they affect or the function they perform.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Previously, the globalscaler was calculated during the config parsing and set to a fixed value. If the current was changed for any reason after the initialization, only IRUN and IHOLD would be changed. This however caused issues:
- If the new current was lower, then the resolution of the possible current values would be low since there are only 32 IRUN/IHOLD steps.
- If the new current was higher, it wouldn't actually work since IRUN and IHOLD are capped at 31, so it wouldn't be possible to increase the current without increasing globalscaler.
With this commit, the globalscaler is recalculated whenever necessary in order to ensure the correct range of IRUN/IHOLD is used.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Use mcu.lookup_command().get_command_tag() instead of
mcu.lookup_command_tag(). This improves error reporting on a protocol
mismatch. It also enables support for a msgtag that is negative.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some users may not desire this behavior and others
may wish to initialize to a profile not named default.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The pca9685_pwm set_pwm() code can be called from a background thread
(when the pin controls a heater). Propagate updates to the main
thread for enable tracking.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Sort using comparison on only first item in list to avoid greater/less
than comparison of stepper objects (which causes an error on Python3).
Reported by discourse user salbang.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If note_kinematic_activity() has a time far in the future it could
result in a single flush attempt of that time range. Be sure to break
up that range into small chunks using the normal _update_move_time()
mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It was possible a note_kinematic_activity() call could increase
last_kin_move_time, but _process_moves() could reset it. Fix by
making sure _process_moves() only ever increases last_kin_move_time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Issue specific to Python 3, NoneType is being used to compare heartbeat time (actually caused by invalid condition operator), and by returning NoneType in timer functions.
Signed-off-by: Clifford Roche <clifford.roche@gmail.com>
Existing code uses very restrictive build volume constraint checking
with just narrow cone on top of fully cylinder for delta printers.
Code here implements more permissive and still safe build volume
constraint checks.
Signed-off-by: Jan Herich <jan.herich@gmail.com>
Make all the microstep lookup table registers configurable via the
config file. It also loads the default values.
TMC220x and TMC2660 do not support this feature.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Current Z_OFFSET_APPLY_ENDSTOP command only works for printers
with cartesian architecture which have separate Z axis defined.
But this functionality (persisting Z babystep value to endstops)
is exactly as convinient for delta printers, therefore this
PR implements it.
Signed-off-by: Jan Herich <jan.herich@gmail.com>
add G17, G18 and G19 commands to select arc planes
enhance G2/G3 to support arc moves in XY, XZ and YZ planes
Signed-off-by: Andrew Mirsky <andrew@mirsky.net>
After a G28 z-axis homing, there is a final z hop.
It was hoping to height z_hop as an absolute z height rather than relative.
If the z-axis home leaves the head at a z height higher than z_hop,
e.g. because you were using a probe to do z homing,
this meant that it was z hopping in the negative z direction, which
could result in crashing the toolhead.
Signed-off-by: Joshua Redstone <redstone@gmail.com>
This will hide features in the Klipper Display menu that isn't applicable
for the machine, therefore we can add extra alignment tools in the Control
menu as well.
Also conditionally displays Setup/Calibration options.
Signed-off-by: Nickolas Grigoriadis <nagrigoriadis@gmail.com>