When we introduce the host-side status check,
it will be synchronous.
There would be no sense in having an asynchronous call.
Preliminary migrate callers to synchronous call.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
- Allow selection of 64KiB bootloader offset for MACH_N32G45x in Kconfig
Signed-off-by: Lev Voronov <minicx@disroot.org>
Co-authored-by: Alexander Simonov <me@darksimpson.com>
Fixes PA0 (GPIO 0) incorrectly mapping to ADC1_IN0 due to
collision with placeholder zeros.
Signed-off-by: Lev Voronov <minicx@disroot.org>
Co-authored-by: Alexander Simonov <me@darksimpson.com>
Commit 0f94f6c8 decreased the MAX_HEAT_TIME from 5 seconds to 3
seconds. However, that also decreased the amount of tolerance for
lost temperature updates from 1.25 seconds to 0.75 seconds. With the
default temperature update every 300ms, only 2 consecutive missing
temperature updates could lead to a fault.
Tweak the internal "next_pwm_time" setting so that it is more tolerant
of two consecutive lost temperature updates.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 9399e738 changed the manual_stepper class to no longer
explicitly flush all steps after each move. As a result, calls to
self.rail.get_commanded_position() may no longer reflect the last
requested position. This discrepancy could result in "internal
stepcompress" errors.
Change the manual_stepper code to internally track the last requested
position and use that when scheduling moves. This allows the
manual_stepper code to utilize the standard "lazy" step flushing
mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The "relative_reference_index" was deprecated on 20230619 and removed
on 20240215. So, remove the last references from the documentation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support storing a reference to 'struct stepper_kinematics' in 'struct
stepcompress' and support globally generating steps via the
steppersync mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the existing register_flush_callback() system to implement motor
activity checking. This simplifies the generate_steps() code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move code from flush_steppersync() to existing flush_motion_queues()
and clean_motion_queues() functions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't implement history expiration from the main steppersync_flush()
code. Instead, have callers directly invoke
steppersync_history_expire().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allocate the low-level C stepcompress object in the motion_queuing
module. This simplifies the mcu.py code as it no longer needs to
track the stepqueues for the steppersync object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add an allocate_trapq() helper function to facilitate the creation of
a low-level C trapq object. Track all trapq objects and clear history
on them globally when the main motion queues are flushed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a new module to assist with host management of motion queues.
Register all MCU_stepper objects with this module and use the module
for step generation.
All steppers will now automatically generate steps whenever
toolhead._advance_flush_time() is invoked. It is no longer necessary
for callers to individually call stepper.generate_steps().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change note_mcu_movequeue_activity() to default to setting the
step_gen_time (instead of the previous default to not set it).
Most users of the mcu "move queue" will be for stepper activity.
There is also little harm in incrementing the tracking of the last
possible step generation time, but accidentally generating a step
without incrementing the tracking can lead to very hard to debug
failures.
The two cases (output_pin.py and pwm_tool.py) where
note_mcu_movequeue_activity() is called and definitely not related to
step generation can explicitly pass 'is_step_gen=False'.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the g-code command handlers to a new class. This reduces the
size of the main Toolhead() class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Python 2.7 does not allow loading the cffi lib
inside the thread, but function calls are allowed
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
enable long file support, needed for boards using swspi and long filenames for firmware like mks robin 1.1/1.2
added MKS robin nano 1.2 board with description what and why
Signed-off-by: Leszek Zajac <zajc3w@gmail.com>
If switching a pin from output low to input with pullup, there is an
intermediate state of either driven high or high impedance without a
pullup. Similarly, when switching from output high to input without a
pullup, there is an intermediate state of either driven low or high
impedence with a pullup. In both cases it is preferable for the
latter transition.
Also, calculate the final setting prior to making any changes to
reduce the time in that intermediate state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't leave the wires in a high output state during setup - leave them
in a high-impedance with pullup state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The get_temp() code will stop reporting the last temperature of the
heater if there hasn't been any recent temperature updates. However,
on a full mcu communication loss this can cause the verify_heater code
to report a heating error prior to the mcu code reporting the
communication failure. Increase the heater timeout from 5 to 7
seconds to make it more likely the mcu failure is reported first.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
SHT3x would return a read NACK on host retries.
When the MCU receives the I2C CMD, it reads out data.
SHT3x clears the data buffer.
The MCU fails to deliver a response to the host.
The host retries, the device returns NACK,
then the MCU goes into the shutdown state.
Make sure there is at least 0.5s between retries.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Some devices can return a read NACK on host retries.
When the MCU receives the I2C CMD, reads out data,
but fails to deliver a response to the host.
The host retries, the device returns NACK,
and the MCU goes into the shutdown state.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Avoid using the name "config" as a local register storage variable as
it can be confused with the common "config" configfile reference.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit d120a313b incorrectly removed an assignment to self.config - in
this instance the reference was to a local variable not related to the
global configfile storage.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The more.musl.cc site is blocking downloads from all github actions,
which makes it difficult to use that site for the ar100 cross build
toolchain. Convert to the openrisc or1k-elf toolchain as a
replacement.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update Code_Overview.md to note that the config object should not be
stored after the "config loading phase".
Remove a few inadvertent cases where a 'config' object was stored
in module member variables.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The rp2040 uses a pll vco divider of 6. Prefer setting postdiv1=6 and
postdiv2=1 (instead of the previous postdiv1=3 and postdiv2=2).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a benchmark for the rp2350 device when running via CAN bus.
Remove the old stm32f042 CAN bus benchmark as that test predates a
number of importnat CAN bus code changes and is likely no longer
accurate.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Completely filling the spi transmit fifo could lead to a situation
where the rx fifo overflows. Make sure not to write past the rx fifo
size.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Completely filling the spi transmit fifo could lead to a situation
where the rx fifo overflows. Make sure not to write past the rx fifo
size.
Also, be sure to wait for the transmission to fully complete before
exiting spi_transfer().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid unnecessary (HAVE_STM32_CANBUS && MACH_STM32xx) checks in
Kconfig. The HAVE_STM32_CANBUS is a helper symbol for all the chips
that support canbus, there's no need to mix it with a check for a chip
that is already known to have canbus.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Validate host provided index prior to accessing memory using that
index.
Also, consistently use a uint8_t for max_sections (to account for
integer overflow issues).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a filter workbench Jupiter notebook to help printer developers tune filters based on probing data
Signed-off-by: Gareth Farrington <gareth@waves.ky>
Initial setup of Load Cell Probing. This implementation supports triggering from the Load Cell Probe on the MCU. It also supports, optiopnal, filtering of the force signal by sos filter to eliminate drift caused by bowden tubes or other mechanical causes.
Signed-off-by: Gareth Farrington <gareth@waves.ky>
As probes stop supporting `probe:z_virtual_endstop` this class will give users a polite and specific configuration error.
Signed-off-by: Gareth Farrington <gareth@waves.ky>
This is an implementation of the SOS fliltering algorithm that runs on the MCU.
The filter opperates on data in fixed point format to avoid use of the FPU as klipper does not support FPU usage.
This host object handles duties of initalizing and resetting the filter so client dont have to declare their own commands for these opperations. Clients can select how many integer bits they want to use for both the filter coefficients and the filters output value. An arbitrary number of filter sections can be configured. Filters can be designed on the fly with the SciPy library or loaded from another source.
Signed-off-by: Gareth Farrington <gareth@waves.ky>
There have been several optimization to the usb to canbus bridge code
since that statement and it is likely many setups can run a
SHAPER_CALIBRATE with all activity on a single 1mbit canbus.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Added a paragraph about flash loop protection on some motherboards. It has been noted that not all people know about the need to change the bin filename on some stock boards or other methods that may hinder progress.
Signed-off-by: James Hartley <james@hartleyns.com>
The docs aren't particularly clear that if you generate a mesh in our start g-code, you can just use it without additional commands. This is causing issues with support on r/klippers
Signed-off-by: Rowland Straylight <rowlandstraylight@gmail.com>
Add a new G-Code command that can register a manual_stepper as an
additional axis on standard G-Code G1 commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new add_extra_axes() to support adding additional axes. Once
called, toolhead.get_position() will return a list object with more
than 4 items, and toolhead.move() requires the same size list.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's not valid to alter the extruder position from a call to
set_position(), so don't allow callers to attempt that.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make it more clear that stepper_load_next() has three separate code
paths - one for each of the optimized stepper_event_X() functions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In practice the host will not schedule any steps immediately after a
direction change (due to acceleration limits and the host
"step+dir+step filter"). However, there is also no harm in enforcing
a minimum duration in the mcu.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 8faed8d9 made it possible to utilize stepper_event_full() while
utilizing tmc "step on both edges" optimation. That commit would
ensure a minimum step pulse duration, but it did not ensure a minimum
duration between step pin and dir pin changes. Commits 0d27195f and
554ae78d optimized the gpio handling on stm32h7 chips, which could
potentially cause a very small amount of time between step pin and dir
pin changes.
Enforce a minimum time after a step pin update before updating the dir
pin.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move up the freeing of the stepper_move struct and setting of
s->position in stepper_load_next(). This simplifies the code and
will make it easier to add more logic to this function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
As per #6923 this PR adds the fact that this config works for the late revision CR-ERA_V1.1.0.3 board as well.
Signed-off-by: James Hartley <james@hartleyns.com>
It has been noted that there are 3 possible boards with 2 possible configs, which we have both of, but this one does not state that it is for the 4.5.2 early kickstarter version. Which was causing some confusion.
Signed-off-by: James Hartley <james@hartleyns.com>
* tests: Added a regression test for generic_cartesian kinematics
* kinematics: An intial implementation of generic_cartesian kinematics
* generic_cartesian: Refactored kinematics configuration API
* generic_cartesian: Use stepper instead of kinematic_stepper in configs
* generic_cartesian: Added SET_STEPPER_KINEMATICS command
* generic_cartesian: Fixed parsing of section names
* docs: Generic Caretsian kinematics documentation and config samples
* generic_cartesian: Implemented multi-mcu homing validation
* generic_cartesian: Fixed typos in docs, minor fixes
* generic_cartesian: Renamed `kinematics` option to `carriages`
* generic_cartesian: Moved kinematic_stepper.py file
* idex_modes: Internal refactoring of handling dual carriages
* stepper: Refactored the code to not store a reference to config object
* config: Updated example-generic-cartesian config
* generic_cartesian: Restricted SET_STEPPER_CARRIAGES and exported status
* idex_modes: Fixed handling stepper kinematics with input shaper enabled
* config: Updated configs and tests for SET_DUAL_CARRIAGE new params
* generic_cartesian: Avoid inheritance in the added classes
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Increase the internal nominal clock from 8Mhz to 12Mhz - this improves
support for higher chip frequencies.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The rp2040 operates at a fast internal clock with a relatively slow
external timer and dividing down could result in a too small delay.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There is no reason to use a higher internal PLL frequency. This
change also makes it possible to enable higher clock frequencies on
the stm32h723.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the helper functions to enable the peripheral clock instead of
directly manipulating the clock enable bits.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Increase the confirmation rate of heater enable settings. This allows
the mcu to utilize faster internal speeds.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a function that returns the minimum amount of time the host needs
to reserve for messages to be sent from host to micro-controller.
Add a function that returns the maximum amount of time (in seconds)
that all micro-controllers should be able to schedule future timers
at.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add optimized gpio functions for stm32h7 - caching the ODR register
can notably improve the performance of the gpio_out_toggle() code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Separate homing operations (as called from probe:z_virtual_endstop)
from the normal probe command handling.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the normal probe_session_start(), run_probe(),
pull_probed_results(), and end_probe_session() API from
ProbeSessionHelper. This removes the custom probing_move() callback.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the HomingViaProbeHelper() instance from ProbeSessionHelper to a
new ProbeEndstopSessionHelper class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Currently, `MANUAL_STEPPER STOP_ON_ENDSTOP=1` type commands will move
until hitting the endstop, but it will still always consume the total
amount of move time. That is, following moves can't be started until
the total possible time of the homing move is completed.
Implement "drip moves" so that the code only schedules the movement in
small segments. This allows following movements to be scheduled
without a significant delay.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Implement move checking and trapq loading directly from drip_move().
This simplifies the interactions between these components.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid lookahead.flush() calling back into toolhead._process_moves().
Instead, rename toolhead._process_moves() to
toolhead._process_lookahead(), have it call lookahead.flush(), and
consistently use it when flushing the lookahead queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
`hall_filament_width_sensor` contains a runout sensor object internally.
This exposes those values in the API status result.
```
SEND: {"id":123,"method":"objects/query","params":{"objects":{"hall_filament_width_sensor":["enabled","filament_detected","is_active","Diameter","Raw"]}}}
GOT: b'{"id":123,"result":{"eventtime":199567.823596603,"status":{"hall_filament_width_sensor":{"enabled":true,"filament_detected":true,"is_active":true,"Diameter":1.9499999999999986,"Raw":6113}}}}'
```
The duplication of `is_active` and `enabled` seems confusing, but both
of these can be independently manipulated by GCode:
```
SEND: {"id":123,"method":"gcode/script","params":{"script":"DISABLE_FILAMENT_WIDTH_SENSOR"}}
GOT: b'{"id":123,"result":{}}'
SEND: {"id":123,"method":"objects/query","params":{"objects":{"hall_filament_width_sensor":["enabled","is_active"]}}}
GOT: b'{"id":123,"result":{"eventtime":199770.446013297,"status":{"hall_filament_width_sensor":{"enabled":true,"is_active":false}}}}'
SEND: {"id":123,"method":"gcode/script","params":{"script":"SET_FILAMENT_SENSOR SENSOR=hall_filament_width_sensor ENABLE=0"}}
GOT: b'{"id":123,"result":{}}'
SEND: {"id":123,"method":"objects/query","params":{"objects":{"hall_filament_width_sensor":["enabled","is_active"]}}}
GOT: b'{"id":123,"result":{"eventtime":199847.927726196,"status":{"hall_filament_width_sensor":{"enabled":false,"is_active":false}}}}'
```
Signed-off-by: Russell Cloran <rcloran@gmail.com>
gpio reset calls are heavy.
gpio state are persistent between calls.
Drop useless calls.
Avoid calls if SDA does not changed.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
On fast MCU software spi may violate maximally supported by TMC driver rate.
Add dynamic limits to overcome that.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Support setting individual options instead of one global option (
WANT_BUTTONS, WANT_TMCUART, WANT_NEOPIXEL, WANT_PULSE_COUNTER,
WANT_HX71X).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This option seems to be confusing ld's region usage checks (builds
that could fit in small chips are being reported as not fitting). The
option was disabled back in commit 4e8674d5 because it showed worse
results. However, recent versions of gcc seem to produce the same
results even if this option is enabled, so change the build to avoid
disabling that option on newer versions of gcc (those that have the
-ffat-lto-objects option - which is needed to ensure
compile_time_requests sections can be extracted with objcopy).
The PRU build is dependent on -fuse-linker-plugin, so enable that
option explicitly in its build.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't build the pru binaries directly in the build test cases, instead
use the upstream binaries provided.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 70838797 added support for clearing the homing state in
SET_KINEMATIC_POSITION commands. However, it can be difficult to use
that support as the default for SET_KINEMATIC_POSITION is to set all
axes as homed.
Add a new SET_HOMED parameter to allow one to explicitly request which
axes to consider in a homed state.
Also introduce a CLEAR_HOMED parameter and prefer that to the existing
CLEAR parameter.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The i2c_delay() function did not properly handle counter rollovers.
It also performed an expensive run-time divide.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
A security vulnerability was found in Jinja 3.1.5 . The software is
not impacted by this vulnerability, but there is no harm in updating
to the fixed version.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The output_pin template code has a cache to speed up duplicate
rendering of templates. However, this cache doesn't work if one of
the parameters is a Python list or dictionary. Just disable the cache
in this case.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It seems both ERRIE and LECIE must be enabled to get hardware error
interrupts. Without this, the rx_error and tx_error reports are
likely to always be zero.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new "low level option" to allow users to configure if they want
to optimize for Trinamic drivers or traditional stepper motor drivers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for "step on both edges" to the main stepper_event_full()
code. This makes that mode of operation available even when the
micro-controller is not compiled for "optimized step on both edges".
It also enables the custom pulse duration support (step_pulse_ticks)
when in "step on both edges" mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Add gram scale features to load_cell
* Convert sensor counts to grams and make this available via unix socket and object status
* Basic GCodes for tearing and reading the load cell
* Guided Calibration
* Diagnostic gcode to check the health of the load cell
* Update load_cell Documentation
* Add API server load_cell/dump_force endpoint
* Update [load_cell] config with calibration fields
* Add G-Code commands for working with load cells
* Add status reference for load_cell objects
Signed-off-by: Gareth Farrington <gareth@waves.ky>
Restores the behavior before #6739 since people seemed to rely on it,
even if the math is not exact.
Signed-off-by: Philippe Daouadi <philippe@ud2.org>
STM32F401 has USART6 on PA12/PA11 and PC7/PC6 with alternate
function mapping AF08. This can be used, for example, to connect
to the Elegoo Neptune 3, where PA12/PA11 are wired to an RJ10 plug
going to the stock screen.
Signed-off-by: Marius Petcu <marius@petcu.me>
The Linux kernel reports a canbus message as transmitted when it gets
the echo frame back. Processing the message prior to sending the echo
frame can lead to odd looking debugging logs (as the response messages
may appear to predate the request messages). This doesn't impact the
Klipper code, but it does make analyzing logs harder. Fix by sending
the echo frame prior to processing the frame.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't limit the canbus_notify_tx() wakeup to cases where notify_local
is set - perform the wakeup whenever the host_status field indicates
the main task has work pending.
This fixes a small race condition where the main task could block
sending a usb echo frame, and the canbus_send() code gets called as
the usb bandwidth becomes available but before a usb wakeup
notification is sent. In that situation, the usb code may not issue a
wake event and the echo frames may be delayed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
With the introduction of "scanning" probes it has
become common for configurations to generate a large
number of points. This can overwhelm both the log and
the pty when new points are generated.
This patch limits the initial points logged to 50. In
addition points are no longer logged or pushed over
the pty when the mesh configuration changes.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It seems the Linux kernel will consider a maximum size usb packet to
be a transaction that will continue into the next usb packet. It will
thus hold on to the traffic from the first packet until it gets the
next packet. However, if the mcu has no further data to send after
the first packet then the data could get delayed for an extended
period of time.
To avoid this, check for transmissions that could end on a maximum
sized packet and send that data in two packets instead. This avoids
this unusual corner case.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the definition of the usb endpoint sizes from usb_cdc.h to
usb_cdc_ep.h . This allows individual boards to override the default
endpoint sizes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Addition to the board_defs file for the BTT Octopus Max EZ, written and confirmed by discord user Nikki @winningfaith81
Signed-off-by: James Hartley <james@hartleyns.com>
The python-can v3.3.4 package requires setuptools to be an explicit
dependency when run on python v3.12, but there is no single version of
setuptools that runs on all supported versions of python. So, tie
setuptools to python versions 3.12 or later.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It appears there was a security vulnerability in Jinja v3.1.4 . The
Klipper docs are not impacted by this vulnerability, but it's simple
enough to increment the version to avoid warnings.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the low-level canbus stops working then it could become impossible
to send messages to and from the canbus bridge node itself. This can
make it difficult to diagnose canbus problems.
Change the canbus bridge code to detect if message transmits become
stalled for 50+ milliseconds and go into a "discarding" state. In
this discarding state, messages destined for the canbus will be
discarded until the canbus becomes active again. In this discarding
state it will therefore be possible to transmit messages to and from
the canbus bridge node.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for a new get_canbus_status command to canserial.c .
Add new canbus_stats.py module that will periodically query canbus
mcus for connection status information.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This significantly reduces the amount of data in the generation 2 garbage collection bucket from the initial startup of klipper.
Signed-off-by: Branden Cash <203336+ammmze@users.noreply.github.com>
Added a temperature sensor configuration for ADS1103, ADS1104, ADS1105, ADS1113, ADS1114 and ADS1115 chips that can be used to add Analog to Digital Conversion capability to machines that don't have that on their own. Like Raspberry Pi's or if more analog input pins are needed than the chip provides like for RP2040. Generally they can be used for any analog input, but the typical use case is for temperature measurement. This code also has been written with temperature measurement in mind and not as a general ADC.
Signed-off-by: Konstantin Koch <korsarnek@gmail.com>
Signed-off-by: Jack Wakefield <jackwakefield@protonmail.com>
Pass a string such as "xyz" to kin.clear_homing_state(). This makes
the parameter a little less cryptic.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use strings such as "xyz" to specify which axes are to be considered
homing during a set_position() call. This makes the parameter a
little less cryptic.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Call clear_homing_state() on each motor off event. This simplifies
the kinematic classes as they no longer need to register and handle
the motor_off event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update the heating code to periodically check that the main thread is
operating properly. This is a mitigation for some rare cases where
the main thread may lockup while the background heater updating code
continues to run. The goal is to detect these rare failures and
disable future heater updates.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
`CLEAR` clears the homing status (resets the axis limits) without turning off
the motors. This is particularly useful when implementing safe Z homing in
`[homing_override]` on printers with multiple independent Z steppers (where
`FORCE_MOVE` can't be used).
Signed-off-by: Dennis Marttinen <twelho@welho.tech>
Use WANT_ADXL345 and WANT_MPU9250 instead of WANT_SENSOR_ADXL345 and
WANT_SENSOR_MPU9250. This makes these definitions similar to the
other accelerometer defintions.
Order menu so accelerometers are close to each other in the menu.
Simplify Makefile as Kconfig already assures a symbol will only be
defined if its dependencies are met.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This adds a new resonance test method that can help if a user has some mechanical problems with the printer.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
The M23 command has similar requirements for extracting the full
parameter string that M117/M118 have. Use the same code for those
fixups.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Alter gcmd._command in cmd_default if the special M117/M118 handling
is detected. This avoids having to recheck for this condition in
get_raw_command_parameters().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The g-code command parser did not allow three characters to be passed
as parameters to commands (asterisk, semicolon, pound sign). Rework
the parsing code to better leverage the python shlex package so that
these characters can be supported.
In particular, this should allow better support for printing g-code
files that have unusual characters in the filename.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't silently drop leading numbers and unusual characters at the
start of a command - for example, don't interpret '99M88' as 'M88'.
Don't silently drop spaces in a command - for example, don't interpret
"M 101" as the command "M101". Doing so will cause other parts of the
code (such as get_raw_command_parameters() ) to not work properly.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Extended g-code command names may only contain A-Z, 0-9, and
underscore, and the first two characters may not be digits.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When calculating the junction speed between two moves the code checked
for angles greater than 0.999999 or less than -0.999999 to avoid math
issues (sqrt of a negative number and/or divide by zero). However,
these arbitrary constants could unnecessarily pessimize junction
speeds when angles are close to 180 or 0 degrees.
Change the code to explicitly check for negative numbers during sqrt
and to explicilty check for zero values prior to division. This
simplifies the code and avoids unnecessarily reducing some junction
speeds.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
As a minor math optimization, it's possible to calculate:
.5 * self.move_d * self.accel * tan_theta_d2
using:
self.delta_v2 * .25 * tan_theta_d2
because self.delta_v2 is "2. * self.move_d * self.accel".
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The Fysetc PITB V2 board uses a spi bus config that is supported by the
RP2040 chip, but not klipper, so this adds the relevant config to the file
to allow you to run the tmc5160's on the board via hardware SPI. This
resolves the issue of software spi not working on this board, which I
was unable to fully understand.
I have also seen other users encounter similar bus config issues with
the rp2040 setting up things like accelerometers and such with this
pin layout.
As requested, this also uses the new convention for spi bus naming, while
maintaining the old bus names for compatibility.
Signed-off-by: Jessica Hunt <hunt.jessica@proton.me>
Rewrite chipid.c so that it contains just the USB and canbus id
manipulation code. Move the low-level chipid reading to bootrom.c.
Also, introduce a new bootrom_reboot_usb_bootloader() function in
bootrom.c so that the main.c code does not need to know the specifics
of rebooting into the bootrom.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The rp2350 chip requires a higher internal frequency, so choose a
value that works for both rp2040 and rp2350.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some versions of the system memcpy() may make unaligned memory
accesses, which can result in a bus fault when accessing the usb dpram
device memory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Recent versions of the rp2040 sdk no longer contain the elf2uf2 tool.
So, move that code to a new dedicated directory. This is in
preparation for updating the rp2040 sdk version.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Return an empty list instead of an emptry string if no command found.
This improves compatibility within console.py on python3.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit adds automatic calculation support for compensating X and Y axis twist in the axis_twist_compensation module.
Signed-off-by: Jorge Apaza Merma <yochiwarez@gmail.com>
This commit implements support for the Y-axis in the axis_twist_compensation
module. This update enables the module to handle corrections for printers
with a twisted Y rail.
Signed-off-by: Jorge Apaza Merma <yochiwarez@gmail.com>
Commit 9d4ab862 broke support for '#' style comments on the same line
as [include] config directives. Fix by adding back in the check for
comments in _parse_config().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Corrected issue where accelerometer names were incorrectly prefixed
with "adxl345", preventing the selection of other chip types when running TEST_RESONANCES.
Implemented support for selecting the `accel_per_hz` parameter when running TEST_RESONANCES.
docs: Update TEST_RESONANCES + SHAPER_CALIBRATE with missing parameters and bracket corrections
Signed-off-by: Maksim Bolgov <maksim8024@gmail.com>
Don't look for includes in autosave data nor from the internal menu,
display, and temperature configs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Separate out the low-level parsing code to a new ConfigFileReader()
class.
Separate out the auto-save handling code to a new ConfigAutoSave()
class.
This simplifies the main PrinterConfig() class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid referring to particular board manufacturers in "make
menuconfig". This information becomes rapidly outdated and is
sometimes viewed by competing manufacturers as being unfair.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It has been noted over the last six to eight months that some versions of Numpy have issues with the klipper python environment on some machines. This PR introduces a fixed version that is known to work and a small test for people to do to make sure there are no output issues from the get go. These have been pulled from the pinned posts in the discord, from a time when 1.26 was causing issue, and now it seems v2 is also having some issues, hence the change.
Signed-off-by: James Hartley <james@hartleyns.com>
After a probe attempt the toolhead position needs to be recalculated
to the position that the toolhead ultimately halted at. Check that
the position setting wouldn't actually change the internal view of the
stepper motor and log a warning if any skew is detected.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Disable irqs within trsync_do_trigger().
This fixes a bug in ldc1612 - as that code was calling
trsync_do_trigger() without first disabling irqs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename sched_tasks_busy() to sched_check_set_tasks_busy() and change
it to only return true if tasks are active (running or requested) for
two consecutive calls. This makes it less likely that timers will
yield to tasks except when tasks really are notably backlogged.
This also makes it less likely that multiple steppers controlling the
same rail will be interrupted by tasks mid-step. This should slightly
improve the timing, and make it less likely that a halt during
homing/probing will occur with these steppers taking a different
number of total steps.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Added wrapper around sw/hw bus API,
pins.py code will ensure that pins will not mix
between HW/SW buses.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* fix type comparison bug that stopped the sensor from initializing
* correct mismatch between docs and code for `sample_rate` (fixed to work same as hx71x)
* add input_mux, pga_bypass and vref options
* update configuration reference & fix typo
Signed-off-by: Gareth Farrington <gareth@waves.ky>
The change in parameter order introduced in commit f4143af4 failed to
update the call _handle_request_restart() code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This solves an issue where the USB directory could exist, but the busnum
file itself may not exist immediately. This was encountered when
flashing a Pico connected to a Raspberry Pi 5.
Signed-off-by: Jack Wakefield <jackwakefield@protonmail.com>
This is similar to 7940a6a7, but using gcrq.send_async_request() for
requests that could be asynchronous.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If there is a duplicate request it is not necessary to add a 100ms
delay to the next update. Rework the callback signaling to better
report these duplicate updates.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This reverts commit 7940a6a728.
Queing of fan updates via GCodeRequestQueue is only valid if updates
originate from gcode commands. The heater_fan, controller_fan, and
temperature_fan modules could send updates asynchronously. Revert the
fan queuing changes until this issue can be resolved.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add flashsd configuration for Tronxy x5sa and other printers based on
Chitu v6 board.
These boards should support sdio (this is what the schematic details),
however I couldn't get this working from a quick try.
Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
Check for overflows in the timer handler instead of checking the
elapsed query time. This should be a better check as it also accounts
for task delays that occur before the query starts.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
As the input values are uint8_t types, any shift may result in value loss.
Explicit promotion to the output type (uint32_t) keeps things safe.
Have also changed the int32_t in ads1220_read_adc to uint32_t, type
promotion and bit manipulation are a bit 'weird' on signed integers, so
keep it as an unsigned to align with following function call parameter type.
Have retained the prior explicit sign extension logic however.
Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
Chopping lines from arc can take significant time.
Merge cycles to make the event loop progress and optimize performance.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* Fix getting wrong ADC value on PA0
* Fix invalid/unused pin being used as adc channel on STM32H7/G431/L4
Signed-off-by: Nicholas Huskie <huskie@idealfuture.org.cn>
Added links for Fluidd/Mainsail/Octoprint
Added references to overview.md and mkdocs.yml and spelling errors.
Signed-off-by: James Hartley <james@hartleyns.com>
This change follows the same approach as implemented for fan control.
The change removes the move queue flushing when changing servo position,
which does not appear to be necessary. This can be beneficial, for
example, for WS7040-based cooling on IDEX setups where the servo can
be used to control the air flow between the toolheads, with this change
eliminating micro-stutters of the toolhead on servo position adjustment.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Previous implementation could crash the idex carriages into each other.
The new code moves the idex carriages together, eliminating this risk
and decreasing the time needed to restore the carriages positions.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* Create the load_cell host module skeleton to create the sensors and start taking samples.
* Add support for the HX717 and HX711 ADC sensors.
Signed-off-by: Gareth Farrington <gareth@waves.ky>
- Removed stealth from Extruder to stop under extrusion issues
- Changed Bed sensor to correct one for Ender 3
* Update generic-bigtreetech-skr-mini-e3-v3.0.cfg
Signed-off-by: Miles Pawar <slab.paged-0p@icloud.com>
Add temperature sensor with thermal drift calibration.
Currently only Eddy Current based probes support
calibration.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rename this method so that it is more distinct from the the common
temperature setup_minmax() method.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a new module to help format verbose mcu error messages. Move
the shutdown message formatting to this module. This moves the error
formatting out of the background thread and out of the critical
shutdown code path.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The scan modes provide kinematic XYZ coordinates in the
probe results. These positions may deviate from the requested
positions, which can introduce errors in mesh generation when
transposing the result into the Z matrix.
Rely on the coordinates generated by bed mesh to transpose
the matrix, presuming that points at the same index in the
list match.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Returns current mesh configuration and state. Includes probed and
mesh matrices, saved profiles, current points, and travel paths.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This adds supplemental path generation that implements
"overshoot" when a change of direction is performed
during a rapid scan. This overshoot reduces measurement
error at the extremes of the mesh along the X axis.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It seems recent arm gcc versions no longer build correctly using the
"--specs=nano.specs --specs=nosys.specs" linker flags. Replace those
linker flags with "-nostdlib -lgcc -lc_nano".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When probing in "scan" mode, the toolhead will pause at each position,
but does not descend. This can notably reduce the total probing time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support calculating the low-level kinematic toolhead position while
calculating the probed frequency.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Calculate the average frequency from a set of samples, and then
calculate the estimated Z height from that frequency. This may
improve accuracy, as the frequency to Z height is not linear and
averaging after the non-linear transform could bias the results.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Split the sample gathering code out of EddyEndstopWrapper class and
into a new EddyGatherSamples class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change run_probe() to gather the results locally, and introduce a new
pull_probed_results() method that returns the previously probed
results. This is in preparation for future probing code that benefits
from batching probe results.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Store the results of each probe attempt in a local "results" variable
(instead of a class variable) when performing "automatic" probes.
This is in preparation for gathering the results in the probing
implementation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow command ids, response ids, and output ids to be either 1 or 2
bytes long. This increases the total number of message types from 128
to 16384.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reduce the maximum data size from 52 bytes to 51 bytes. This will
enable support for 2-byte response ids.
This change would alter the behavior of the ldc1612 sensor support.
Force an ldc1612 command name change so that users are alerted that
they must rebuild the micro-controller code upon update of the host
code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update the msgproto.py code so that it can support message ids that
are larger than a single byte. (The host C code in
klippy/chelper/msgblock.c already supports multi-byte ids.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of directly calling axis_twist_compensation, send an event
that can perform the necessary updates.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rework ProbeSessionHelper's multi_probe_start() and multi_probe_end()
to start_probe_session() and end_probe_session(). Ensure all external
callers always invoke these methods prior to running run_probe().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a get_print_params() method that can extract all the common
probing parameters. Replace get_lift_speed() with this more general
function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the PROBE and QUERY_PROBE commands from ProbeSessionHelper class
to new ProbeCommandHelper class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Correct the name of "cs_actual" and correct the size on tmc5160.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Raise a printer.command_error exception if a home_wait() call fails.
This makes it easier to support future types of homing errors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It is not clear if DRDY is cleared during a STATUS read (which could
occur from command_query_ldc1612_status() ). So, just check the
"unread conversion" bit when reading data.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
A 40um distance is more likely to be a full step distance on common Z
leadscrews (which often use a rotation distance of 8mm).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Setting of microsteps in the stepper config section has been required
since commit eea0137b. Remove the no longer needed compatibility
code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure thigh is set to zero during sensorless homing, as it would
not make sense for it to be enabled.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
idex_mode would swap the X and dual-carriage rail in some cases
(homing), but not in others. As such, the position calculation was
correct while homing, but incorrect for the second carriage during
normal moves. This commit fixes homing to work without swapped rails,
removes the swapping of rails while homing, and removes the ability to
swap rails (as it is now no longer used). Fix has been tested in a
Hybrid_CoreXY IDEX printer (Voron Double Dragon). Hybrid_CoreXZ has
identical changes and is similar enough that I am confident it will work
as intended. Changes to cartesion seem simple enough, but would benefit
from someone running a couple of tests.
Signed-off-by: Frans-Willem Hardijzer <fw@hardijzer.nl>
Round beds require an odd number of probe points in
order to prevent erroneously truncating the mesh.
The adaptive mesh algorithm did not consider that and
as a result, it was possible to generate adaptive
meshes with even number of probe points.
This change fixes this by increasing the probe point
count by 1 in cases where the adaptive probe points
are even.
Signed-off-by: Mitko Haralanov <voidtrance@gmail.com>
Update the jinja2 version to suppress security warnings. Klipper is
not impacted by the vulnerability, but it is harmless to update the
version.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some of the alternate pins defined are routed to FDCAN2 instead of
FDCAN1, this commit uses the correct IRQ register and peripheral
clock enable bit to enable FDCAN on those pins.
Signed-off-by: Amr Elsayed from Dropeffect GmbH <code@dropeffect.com>
The Creality CR-6 SE has a strain gauge on its hotend used for z-probing and homing. Currently, running G28 to home all axes puts the hotend just outside of the print bed and thus assumes a wrong homing point for the Z axis.
This change aims to address this issue by setting a safe Z-homing point (in the middle of the print bed) into the Creality CR-6 SE 2020 and 2021-revision config files.
Signed-off-by: Stéphane Lepin <stephane.lepin@gmail.com>
Current command, using the *, results in bad chart output when more than one .csv file exists in the tmp folder. This isn't obvious for people who may not know that the * is a wildcard character.
Signed-off-by: Jonathan Williams <jcw122@gmail.com>
Commit 3f845019 unified the reading of the axes_map configuration
variable, but broke the per-sensor scaling capabilities. Pass the
scale parameters to read_axes_map() so that it can be implemented
per-sensor.
Reported by @Neko-vecter.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Extends the BMxx80 category with support for the BMP388 sensor,
providing temperature and pressure output similar to the existing BMxx80 class of sensors.
Signed-off-by: 林玮 (Jade Lin) <linw1995@icloud.com>
Rename pull_samples() to pull_queue() and rename clear_sample() to
clear_queue(). This avoids confusion between the queue of response
messages and the larger list of samples stored within those messages.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the sensor_bulk_data message queuing into the class, and then
rename that class. This simplifies the users of the code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new extract_samples() method to the ChipClockUpdater class that
calculates the sample timestamp for each sample in a list of bulk
sensor reports.
Update the adxl345 code to use that extract_samples() code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Provide some background information on the Linux can interface
txqueuelen parameter, errors that it can cause, and considerations
when configuring it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some Linux systems do not install ifconfig, while ip should always be
available. So, update the canbus documentation to recommend that.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This reverts commit b029d04668.
The MCU_Stepper class does not have a is_motor_enabled() method, so
the change above results in an internal exception.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Calculate the sensor Z position after the probe halts and return that
as the "probed position". This sensor position provides a more
accurate measurement.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Adding position and enabled in manual_stepper status. Enabled is already available through stepper_enable object. But this makes it more straightforward to access it.
Signed-off-by: Viesturs Zarins <viesturz@gmail.com>
Not all systems (i.e. Nix) repect the standard Linux filesystem hierarchy,
instead relative paths should be used and allowing GCC to rely on it's
builtin search paths.
Signed-off-by: Michael 'ASAP' Weinrich <michael@a5ap.net>
The -iquote tells GCC to only search that path when resolving a quoted
"include" (vs <angle brackets>) which by convention imples a include from
the projects own soruce tree. This prevents a conflict between Klippers
"sched.h" and "gpio.h" and <linux/gpio.h> and glibc <sched.h>.
Signed-off-by: Michael 'ASAP' Weinrich <michael@a5ap.net>
Commit 600e89ae fixed unicode handling on Python3, but broke Python2
support. Use an alternate implementation that should work for both
Python3 and Python2.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The default minimum_cruise_ratio setting does not get populated to the
printer.configfile.settings information due to the way the
max_accel_to_decel backwards compatibility support was implemented.
Slightly rework the config reading so that the default for
minimum_cruise_ratio is populated there.
Reported by @ReXT3D.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When querying the stepper motion queue, the resulting "interval",
"count", and "add" are already normalized to the correct direction.
That is, the "count" field will be positive if moving in a positive
axis direction and negative if moving in the reverse direction. So,
negating the step_distance field just complicates the readers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Similar to commit df79893, this allows klipper to use up to
/dev/i2c-14. Similar to before, this limit is arbitrary.
This is required for some other SoCs, which have even
more i2c buses available, e.g. the rk3399:
$ ls -1 /dev/i2c-*
/dev/i2c-0
/dev/i2c-3
/dev/i2c-7
Signed-off-by: Carl Richard Theodor Schneider <dev.github@crtified.me>
Add a new runtime_warning() method that will add a 'runtime_warning'
type message to the printer.configfile.warnings object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The pid logic can continue after a shutdown, even though the pin
commands sent to the mcu are ignored. However, this behavior can
result in confusing "stats" messages in the log. Explicitly disable
updates after a shutdown event so that the log statistics are more
clear.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The user facing max_accel_to_decel setting is complicated and
confusing. Replace it with a new minimum_cruise_ratio parameter.
Internally this user-facing parameter will calculate the existing
low-level "accel_to_decel" mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Fixed crashes due to wrong parameter passed to the shaper selection function
and when the custom FREQ_END is specified.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
The added parameters include square_corner_velocity, shaper frequencies
to optimize, input shapers to test, input shaper damping ratio and
damping ratios to test. All these options can be useful for fine-tuning
the input shapers when the default suggestions generated by the tuning
script are not optimal.
Also the `SHAPER_CALIBRATE` command was modified to pass some of these
parameters to the shaper tuning routine. Specifically, square corner
velocity and the maximum tested frequency are used to adjust shaper
tuning and maximum acceleration recommendations.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Remove the deprecated SET_EXTRUDER_STEP_DISTANCE and
SYNC_STEPPER_TO_EXTRUDER commands. Remove the deprecated
shared_heater config option.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When a ZFADE value is passed to BED_MESH_OFFSET it is used
to adjust how fade is applied. This resolves issues with
fade when SET_GCODE_OFFSET is used during a tool change.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Adaptive meshing avoids saving the mesh after calibration to prevent
users from inadvertently overwriting an existing profile with an
adaptive mesh. This introduced a change in behavior of how
get_status() reports the profile_name, as it can now be an empty
string when a mesh is active.
This patch assigns adaptive meshes a name with a unique postfix.
In addition, it moves profile name tracking from the profile manager
to the ZMesh class.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Do not generate points for the zero_reference_position or faulty_regions
when manual probing is requested.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Adaptive bed mesh allows the bed mesh algorithm
to probe only the area of the bed that is being
used by the current print.
It uses [exclude_objects] to get a list of the
printed objects and their area on the bed. It,
then, modifies the bed mesh parameters so only
the area used by the objects is measured.
Adaptive bed mesh works on both cartesian and
delta kinematics printers. On Delta printers,
the algorithm, adjusts the origin point and
radius in order to translate the area of the
bed being probe.
Signed-off-by: Mitko Haralanov <voidtrance@gmail.com>
Signed-off-by: Kyle Hansen <kyleisah@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure to disable/enable the peripheral to ensure the clock
polarity is properly set prior to a change in CS.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Load the interrupt vector table into ram at startup. This reduces the
chance of a flash cache access causing timing instability.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Place all normal code into ram. This reduces the chance that rp2040
instruction cache misses could cause subtle timing issues.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid calling memset() and memcpy() prior to copying the ram and
clearing the bss. Also, place both ResetHandler() and
reset_handler_stage_two() in an explicit ".text.armcm_boot" linker
section. These changes make it easier to support targets that want to
run all code in ram.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Remove support for changing the cycle time of pwm pins from the
output_pin module. Use a new pwm_cycle_time module that supports
setting dynamic cycle times. This simplifies the output_pin code and
low-level pin update code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Advise users to configure a pwm_tool config section if checking for
maximum mcu duration is required.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update static_digital_output.py to directly configure static digital
pins. There are no other users of "static" pins, so remove that
support from mcu.py, replicape.py, and sx1509.py. This simplifies the
low-level pin handling code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Remove support for configuring "static" pins in output_pin module. A
"static" pin only saves a few bytes of memory in the micro-controller.
The savings does not justify the increased code complexity.
Deprecate the static_value parameter to warn users. In the interim, a
static_value parameter will set both value and shutdown_value
parameters.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Refactor the low-level "bulk sensor" management code in the mcu. This
updates the sensor_adxl345.c, sensor_mpu9250.c, sensor_lis2dw.c, and
sensor_angle.c code to use the same "bulk sensor" messages. All of
these sensors will now send "sensor_bulk_data" and
"sensor_bulk_status" messages.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There is a jinja2 security advisory on the current Jinja2 version.
Klipper is not impacted by this advisory (as it does not run jinja2 on
any untrusted data), but there is no harm in updating.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 3d3b87f9 incorrectly removed the call to
note_kinematic_activity(). A call to toolhead.dwell() is not
sufficient to wake up the mcu move queue flushing. The call to
note_kinematic_activity() is needed for that.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Creality released the Ender 5 S1 model in November of 2022. It
has enough hardware differences from the previous models that
that the existing Ender 5 configs are not compatible. This
configuration is based on one provided by Creality that was then
tweaked and modified. I have been using these values (plus some
additional entries) for about 6 months with no issues.
Signed-off-by: Brian Greenberg <grnbrg@grnbrg.org>
There is no harm in enabling flushing for a little longer than
necessary. In contrast, a slight rounding issue causing a message to
not get flushed properly could result in an error. So, extend the
flushing time slightly to avoid potential issues.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit b7b13588 made it possible that the kinematic code could be
restarted after a flush_step_generation() call without a sufficient
delay.
Rename last_sg_flush_time to min_restart_time and use that to ensure
_calc_print_time() always pauses kin_flush_delay time since the last
flush_step_generation() call.
Also, update force_move to invoke flush_step_generation() after any
movements. This is needed to ensure there is a sufficient delay
should force_move be called on a stepper motor that is part of the
toolhead kinematics and is using a step generation "scan time".
This fixes possible "internal error in stepcompress" reports when
using FORCE_MOVE.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The current code has the mcu report a trsync_state message every 10ms
and expects a time extension within 25ms. However, this means that if
a single mcu->host report is lost then 20ms would elapse until the
next report, which would allow for only a 5ms round-trip time before a
timeout error is reported.
Increase the trsync_state timing so that a message is sent every
7.5ms. This increases the total number of messages per second sent
from mcu to host to 133 (from 100). With this change, a single lost
message would still allow for up to a 10ms round-trip time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When multiple MCUs are involved in homing, stagger the scheduling of
the trsync_state report messages from each mcu. Staggering helps
spread the bandwidth, helps reduce locking contention in the host, and
reduces the chance that intermittent latency could result in a
communication timeout.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move overflow detection from mp9250_stop() to
command_query_mpu9250_status(). Currently the host ignores any
contents returned from a stop request, so overflow reporting at that
point has limited utility.
In practice, this change will result in one additional i2c transaction
to the mpu9250 device every 100ms.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The mpu9250 code always reads from the sensor in 48 byte chunks and
always sends an mpu9250_data message immediately after that. Make
that more clear in the querying code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 80a7744b optimized the fifo tracking code. However, it
introduced an error in the time tracking in
command_query_mpu9250_status(). The purpose of that function is to
provide a precise timestamp of the total number of messages produced
at the time of that call. Thus, the returned fifo value needs to be
the fifo level in the chip at the time of the call (not the value read
during previous checks).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It is not valid to call time.sleep() in the host python code (it could
causes glitches in other processing, and it does not ensure there is a
pause between operations on the mcu).
Use minclock instead of time.sleep() to ensure there is a sufficient
pause during chip startup.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Invoke button callbacks directly from the background thread. This
ensures that button notifications are delivered and delivered in the
correct order. Previously, if a callback blocked, it was possible a
new update could start before the previous update was completed, which
could lead to lost events or out of order events.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When in debugging "batch mode", use the existing method of keeping the
last 30 seconds of history from the furthest planned move time. This
avoids keeping all moves in memory during a batch test.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move calculation of clear_history_time to the callers of
_advance_flush_time() as a minor processing optimization.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Previously, the BatchBulkHelper class was designed primarily to
register webhook clients, and internal clients used a wrapper class
that emulated a webhooks client.
Change BatchBulkHelper to support regular internal callbacks, and
introduce a new BatchWebhooksClient class that can translate these
internal callback to webhooks client messages.
This makes it easier to register internal clients that can process the
bulk messages every batch interval.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The APIDumpHelper class is mainly intended to help process messages in
batches. Rework the class methods to make that more clear.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The APIDumpHelper class already ensures that the start/stop callbacks
will only be called when needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
All the accelerometers use a standard response for their query_status
messages. Create a common helper class to process those responses.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit b7b13588 changed the internal flush time tracking, but
introduced the possibility of motion restart occurring too close to
the last motion end in some rare cases. This could result in
internal stepcompress errors.
Track the last step generation flush time (last_sg_flush_time) and use
when recalculating the next print_time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
At least STM32G4 requires four ADC clock cycles between hardware
clearing ADCCAL and setting ADEN or the write disappears. Make a
tenacious write attempt.
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
Add support for maximum filament diameter to hall filament width sensor.
If the diameter of the filament diameter is larger than the limit, the
virtual runout sensor will trigger. The default value is set to maximum
flow adjustment threshold to prevent oversized filament from clogging.
Signed-off-by: Sami Haahtinen <ressu@ressukka.net>
Introduce a new step_gen_time variable for flush_step_generation().
This allows need_flush_time to be set to future times without
interfering with flush_step_generation().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Call toolhead.note_kinematic_activity() on each pin update to ensure
that those updates will be flushed properly.
This fixes "Timer too close" errors on SET_PIN commands that are
issued when the toolhead is idle.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Track a "NeedPrime" queue state instead of the "Flushed" state, and
continue running the background flushing timer as long as there may be
data in any of the move queues.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename last_kin_move_time to need_flush_time and rename
force_flush_time to last_flush_time to improve variable name clarity.
Move low-level flushing to new _advance_flush_time() so that it is
possible to flush the queues without needing to advance print_time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Simplify the code by introducing a separate lookahead priming flush
timer. After this change, the flush_timer is not active in any of the
special queuing states.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Clarify the internal naming to make a more clear distinction between
"stalling" (input not coming fast enough) and "pausing" (the need to
hold up reading of input to avoid buffering too far into the future).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
These internal low-level config parameters were never documented.
Going forward, developers may modify them by altering the internal
settings in toolhead.py.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Note that the max_accel parameter is the actual acceleration used in
most movements.
Note that the accel/velocity limits can be changed using the
SET_VELOCITY_LIMIT command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The set_register() code may block, and it therefore may be possible
that the loop in _init_registers() could occur in parallel with other
updates. That could result in a "OrderedDict mutated during
iteration" error.
Avoid the error by querying the latest value during each iteration of
the loop.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's possible to build and configure tmc5160 drivers with external
mosfets that support more than 3 amps. The actual maximum for tmc5160
drivers is dependent on how the board is wired and the mosfets used.
Increase the error check to 10 amps. This error checking is primarily
intended to catch "obvious misconfigurations" (eg, specifying
milli-amps instead of amps), and the new value of 10 amps should
suffice for this task.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
In testing with a user on Discord we discovered the sensorless homing thresholds were out of line with what Sovol ships with Marlin. This aligns with their settings.
Signed-off-by: Herb McNew <herb.mcnew@gmail.com>
New configuration for the Sovol SV06 Plus
Initial pass at adding a printer configuration for the Sovol SV06
Plus based on the existing Sovol SV06 config. Updated for the larger
build volume, added filament runout sensor, and removed any references
to the LCD screen since the stock screen doesn't work with Klipper.
Signed-off-by: Herb McNew <herb.mcnew@gmail.com>
Try to make it more clear that Discord is not Discourse, as the two
similarly sounding services are often confused by users unfamiliar
with them.
The Klipper Discourse and Klipper Discord are available for many
topics related to Klipper - reword some sections to make their use
more open.
Avoid referring to the Klipper github repo in this Contact document as
we no longer use Klipper github issues at all.
Remove the table of contents as it is largely redundant for the
document.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use two different files for the Octopus Pro and Octopus (non-Pro).
The configs are the same in practice, but the difference in version
and naming can lead to confusion.
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>
In the "Verify endstops" section there is an example of adding an
exclamation point to the pin definition to invert its logic. I
believe the intention in the example is to keep the hardware pull-up
^ and follow it with ! to invert the pin logic, but the ! is missing.
Signed-off-by: Tom Dunn <thomas.dunn@gmail.com>
The atsam USB hardware only requires that the ACM endpoint be endpoint
3. As of commit 11828387 the atsam chips can therefore use the
default USB endpoints.
This will allow CAN bridge support for the SAME70 to function
(upstream host driver has hardcoded endpoints).
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
Recently tested on my ender 5 pro that came from creality with a v1.1.5 board. Works. Tested all endstops, motors, and heaters.
Signed-off-by: Jake Aronleigh <jakestar98@outlook.com>
Wait for two tx packets before startup, and make sure one of those
packets is acked before sending a third tx packet.
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>
Commit cd8d57c2 added USB double buffering mode on transmits.
However, when enabling double buffering mode, the hardware seems to
always send at least two packets. Spurious transmissions could cause
the Linux gs_usb driver to get confused, which could lead to the can0
device becoming unavailable on restarts. Fix by waiting for two USB
packets to be available before enabling the endpoint.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The bulk out endpoint should not be enabled in tx mode, and the bulk
in endpoint should not be enabled in rx mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Prioritize sending responses back to the host over transmitting new
messages from the host. Otherwise, the gs_usb host usb
acknowledgments could saturate the usb bandwidth for extended periods.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Read USB messages arriving from the host into a queue. This makes it
less likely that USB "bulk out" packets will be NAK'ed on the USB bus,
which improves USB bus utilization.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Copy the code for these two functions to their respective callers.
This is in preparation for double buffer support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add helper functions for manipulating the buffer memory and packet
control registers. This is in preparation for double buffer support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Implement the usbfs fast buffer switching mechanism on the "bulk in"
endpoint. This can improve the overall USB throughput and bus
utilization.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Implement the usbfs fast buffer switching mechanism on the "bulk out"
endpoint. This can improve the overall USB throughput and bus
utilization.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The usbfs device supports two buffers for each endpoint - typically
one for rx and one for tx. Add support for explicit handling of both
buffers. This is in preparation for improved "double buffering"
support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Replace the set_stat_x_bits() functions with a single calc_epr_bits()
function. This new function supports setting bits other than the stat
field in the epr register.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for can2040_stop()
Add data_state_go_error() helper
Add new can2040_get_statistics() API function
Call report_note_discarding() after setting MS_DISCARD state
Convert report_is_rx_eof_pending() to report_is_not_in_tx()
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>
PR to add the newer version of the Ender 2 Pro with the CR-FDM-v2.5.54.170 motherboard with the HC3232F460 chip.
Confirmed as working with discord member NyftHeart and using configs from Steve Gotthardt, with his permission to use and submit.
Signed-off-by: James Hartley <james@hartleyns.com>
Commit 594c0243 updated the workflows from actions/stale@v3 to
actions/stale@v8, but did not make the corresponding updates to the
config parameters. This resulted in the closing of some PRs. Update
the config parameters to avoid this regression.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
I am endeavoring to rewrite some of the docs to be more front end agnostic to reflect the different front ends available since these docs were written. I am starting with this one, as it quite often used.
Signed-off-by: James Hartley <james@hartleyns.com>
image->num_blocks is of type unsigned size_t thus unsigned int
or unsigned long int.
%lu specifies a type of long unsigned int. Thus resulting in compiler warning about type mismatch on some systems.
Fix this by printing the value with length modified z.
Signed-off-by: Martin Botka <martin.botka@somainline.org>
- Open log files in text mode,
- Normalize the encoding of tmcuart messages,
- Fix a bug where StatsStream.get_lines() would return None timestamps for lines
before the first Stats line. Timestamps are now back-propagated.
Signed-off-by: Maël Kerbiriou <m431kerbiriou@gmail.com>
It has been discovered on the discord by the user Pizn that the blouch pins are swapped in this config and don't include the ^ pull on the sensor pin.
This has been tested and confirmed by the user.
Signed-off-by: James Hartley <james@hartleyns.com>
Existing `mesh_min` values start probing too far away from the edge.
Additionally `mesh_max` Y value of 197 is out of bed movement range (197 + `bltouch.y_offset` = 237.5) and causes Y stepper to overhit, which can potentially damage the printer in the long run.
Signed-off-by: Aleksandr Ivanov <aux@hexmode.org>
Adds the new BTT SKRat V1.0 controller board to the board_defs for the flash-sdcard.sh tool.
The new board definition was tested by me without any errors.
Signed-off-by: Dennis Kuehn <denniskuehn@online.de>
The reference to `my_nozzle_fan` in these configs could be confusing and misleading, leading users to think it is the parts/print cooling fan, changed to heatbreak_cooling_fan as used in other configs.
Signed-off-by: James Hartley <james@hartleyns.com>
The reference to my_nozzle_fan is misleading and could cause people to skip over the [fan] definition and assume this is the parts/print cooling fan. Alias changed to reflect heatbreak_cooling_fan as used in most configs that have a controllable hotend fan.
Signed-off-by: James Hartley <james@hartleyns.com>
Clarifying the ADXL345 on pi instructions. Previously, the instructions on installing the linux klipper instance were in a confusing place.
Signed-off-by: Adam Kramer <akramer@gmail.com>
This change is required to sucessfully use PA13/PA14 for UART. Otherwise
they function as SWDIO/SWCLK.
Relevant excerpt from the reference manual (translated):
The initial state of PA13, PA14, PA15, PB3, and PB4 ports is that the
JTAG/SWD function is valid after reset. When configuring FSEL[5:0] to
select the function, you need to write 0 to the corresponding bit of the
register PSPCR to invalidate the JTAG/SWD function.
Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de>
This fixes serial communication when selecting the PH2/PB10 pins.
The chip datasheet (not reference manual) assigns pins to one of two
communication function groups (`Func_Grp1/2`). Pins in group 1 have
access to USART1/2 while group 2 has access to USART3/4. PH2/PB10 belong
to group 2 so we now correctly use USART3 for them.
Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de>
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>
This PR is to remove `move_to_previous: true` from the ender 3 S1 and S1 plus configs. This is a confusing option, it is not really useful on these type of printers and can cause issue to the end user
Signed_off_by; James Hartley <james@hartleyns.com>
Add a new HAVE_LIMITED_CODE_SIZE symbol that enables a menu to select
optional features. This symbol is enabled on chips with small build
sizes.
Replace the HAVE_GPIO_BITBANGING with four new symbols:
WANT_GPIO_BITBANGING, WANT_DISPLAYS, WANT_SENSORS, WANT_SOFTWARE_SPI,
and WANT_SOFTWARE_I2C. This allows users a little more flexibility
when selecting features they need.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add clock speed selection
Add Flash App Address selection
Add alternate serial connection and remove company specific names
Signed-off-by: Steven Gotthardt <gotthardt@gmail.com>
The header documentation currently shows the year the Creality Ender 3 V2 Neo as being the 2020 model. This is likely a copy/paste error from the header of the original Creality Ender 3 V2 config. The year the Creality Ender 3 V2 Neo came out was in 2022 as indicated by the name of this config file. This patch fixes the copy/paste typo by updating the year in the header documentation from 2020 to 2022.
Signed-off-by: Jason W. Thompson <jason@jasonthompson.dev>
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>
Change the default CANbus frequency from 500000 to 1000000. A higher
frequency allows for greater data transfer rates, lower latency of
messages, and should overall be more robust.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Recommend USB to CAN adapter and no longer recommend using the
waveshare rpi hat.
Recommend using allow-hotplug for all USB adapters.
Note bandwidth limitations when using USB to CAN bridge mode.
Note that a USB to CAN mcu is not a USB serial device.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Disable tx state machine before resetting it
Check for rx message with same id as tx but different payload
Do not use canrx line to alter bit timing of cantx line
Improve bit time synchronization with slow transmitters
Implement tx synchronization to faster transmitters
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
New printer : Longer LK4X configuration
This configuration is based on the one provided by Longer with some tweaks.
Signed-off-by: Thomas Lété <bistory@gmail.com>
On a USB bus reset the controller address needs to be reset to zero.
Otherwise, the device becomes unresponsive after a USB reset and will
remain unresponsive until a power cycle. This often shows up in the
Linux system logs as "device descriptor read/64, error -32" messages.
Make sure USB_INTE_BUS_RESET_BITS is enabled and clear the USB address
on a bus reset.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There is no need to heavily prioritize the sending of canbus packets
over USB. A single check to flush the incoming canbus packets is
sufficient.
Also, be sure to wake up canserial_notify_tx() even if canhw_send()
blocks.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The canserial code already advertizes a receive window, so the host
should never flood the canserial code. Remove the extra scheduling
checks to simplify the usb_canbus code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
A buffer of only 8 canbus packets is only 64 bytes of data, which
could be exceeded if the usb-to-canbus mcu gets busy doing other work.
Increase the buffer to 32 packets.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The DAINTMSK prevents irqs but does not prevent the status reporting
in the GINTSTS and DAINT fields. Thus, the mask bits should be
checked prior to sending a wakeup notification.
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>
Correction for table "Recommended connection scheme for I2C (i2c0a) on the RP2040", line 160, to match the correct writing in the Fritzing image shown above, RP2040 pin 36 in place of 39;
Correction of typo in line 346, "pins" in place of "pin"
Signed-off-by: Adrian Rose <adrian@crazyroses.net>
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>
Avoid some gcc warnings by using uint32_t for iterators
Better document the fallthough case statement in crc_bytes()
Fix txpending race from report_line_ackdone()
Make can2040_transmit() multi-cpu atomic
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
As found on the discord by user Qtin, this board now ships with one of STM32H743 or STM32H723
Example config updated to reflect this. This has been tested on the users board. To note, the H743
bin will flash to the H723 chip, but will not work.
Signed-off-by: James Hartley <james@hartleyns.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>
This adds support for the stock configuration of the V-Minion printer from Ratrig, based on the Octopus v1.1 (STM32F446)
Signed-off-by: Benjamin Lesher <bbro44@protonmail.com>
Realtime programming best practice is to lock realtime code
memory to prevent paging which will lead to unbounded latencies. The
Linux MCU process has well bounded memory and small RAM footprint
so locking the entire process' RAM has no downsides and will improve
behavior when the system comes under memory pressure.
(See bootlin training and Linux Foundation documentation linked below.)
RT process priority ranges from 0-99 (although POSIX only requires 32),
boost MCU process priority to half the max/2 to improve robustness when
the system comes under pressure from other RT Kernel or user processes.
Reference links:
bootlin: https://bootlin.com/doc/training/preempt-rt/preempt-rt-slides.pdf
Linux Foundation: https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/application_base#howto_build_a_simple_rt_application
Signed-off-by: Matthew Swabey <matthew@swabey.org>
Having the controller fan PA14 in the config is important for the stepper drivers not to overheat and skip steps.
Signed-off-by: Robert Lilienthal <13837429+RobLil@users.noreply.github.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>
Add the default base config for the Ender 3 v2 Neo (as released 2022).
This config also works with the newer D32F303 based 4.2.2 boards.
Signed-off-by: Sam McLeod <sammcj@users.noreply.github.com>
Reading an I2C device from the Linux MCU used a separate write(2)
to select the target register & read(2) to get the value(s). This
implementation uses ioctl(file, I2C_RDWR, ...) to skip a large bus idle
period and extra process sleep by combining them like the stm32.
I2C_RDRW requires I2C_FUNC_I2C flag in the I2C driver. I2C_FUNC_I2C
is defined in:
BCM2835: Pi 1 Models A, A+, B, B+, the Raspberry Pi Zero, the
Raspberry Pi Zero W, and the Raspberry Pi Compute Module 1
BCM2836: Pi 2 Model B
Identical to BCM2835 except Cortex
BCM2837: Pi 3 Model B, later models of the Raspberry Pi 2 Model B,
and the Raspberry Pi Compute Module 3
BCM2837B0: Pi 3 Models A+, B+, and the Raspberry Pi Compute Module 3+
BCM2711: Pi 4 Model B, the Raspberry Pi 400, and the Raspberry Pi
Compute Module 4
RK3xxx: Rockchips SoCs NanoPi, RockPi, Tinker, etc.
SUNXI: H2, H3, etc. Orange Pi
AMLOGIC: S905x, Banana Pi, Odroid, etc.
TEGRA: NVidia Jetson etc.
MediaTek: Several SBCs in other ranges
Signed-off-by: Matthew Swabey <matthew@swabey.org>
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>
Fix filament sensor and remove unneeded config changes in extruder
The filament sensor on the printer used for initial testing had been removed prior to flashing klipper to it. Only a basic test to see it if triggered or not was preformed. It was discovered by someone else doing some testing on another printer that it would frequently pause. This was a simple oversight, assuming it was a runout switch.
Removed section of config related to filament runout switch and replaced with basic config for filament motion so they printer will simply pause when no more motion is detected. Also notated to add CLEAR_PAUSE to start gcode if using this sensor as it will trigger a paused state when loading or unloading filament. If printer is in a paused state at the start of the print, the attempt to pause will cause the printer to rapidly pause and unpause itself.
Removed min_extruder_temp and max_extrude_only_distance from the extruder section, as they were there only for macros on a test system that is not put into this sample config
Signed-off-by: Zachary Welvaert <zwelvaert@gmail.com>
The actual board name is EZBoard V2 without the lite. Renaming the file and correcting the intro text to reflect the actual board name.
Signed-off-by: Anthony Dellett <anthony.dellett@gmail.com>
This is an update to the script that looks for the new systemd service and restarts it if appropriate.
Signed-off-by: James Hartley <james@hartleyns.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>
Adds sdio support for the stm32f4 to allow for SD card flash updates
without power cycling some boards, e.g. BTT Octopus Pro.
Signed-off-by: H. Gregor Molter <gregor.molter@secretlab.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The recent PR to change this to say `#!/usr/bin/env python` instead of `#!/usr/bin/env python2` can cause issues on non rpi based OS's where `python` is not mapped to `python3`.
`#!/usr/bin/env python3` should work in both situations.
Signed-off-by: James Hartley <james@hartleyns.com>
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>
Config file contains pin mappings to suit Lulzbot Mini 2 using Lulzbot SingleExtruder(0.5mm) and Lulzbot flexible magnetic bed.
Mini 2 uses Einsy Retro mainboard.
Signed-off-by: Trent Sheather <trent.sheather@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>
Using the CAN2 interface still requires that CAN1 be enabled, and the
filtering hardware is always on the CAN1 hardware block.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The existing sample times are not long enough to reliably sample the
internal temperature sensor. Longer sample times should also improve
results with temperature sensors that have a higher inductance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Prefer explicitly setting the CR hardware register to defined values
during initialization.
Also, prefer "#if CONFIG_MACH_STM32H7" over bit definitions to make it
clear that the code applies only on stm32h7.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The stm32l412 doesn't have a PLLSAI1 clock and therefore the CKMODE
should not be set to zero.
The stm32h7 chips run the adc at 25mhz, so BOOST should be set to
0b10.
Improve timing comments.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the common lookup_clock_line() code to lookup the adc clock lines.
This also enables resets on the adc1/adc2 hardware block.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Not all chips implement hardware oversampling. The software already
implements oversampling, and additional hardware oversampling is
unlikely to improve results. Remove the hardware oversampling to
simplify the code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
On all chips, the JQDIS bit is set and the CONT, RES, ALIGN bits are
clear after a reset. There is no need to program the OVRMOD bit. Use
the same logic across chips to help unify the adc implementation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Not all chips have the LDORDY flag, while all chips will stabilize in
10us. There is no need for two different implementations as it is
safe to wait 20us on all chips.
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>
Later addition of a F429 variant SKR2 was released. Changed btt-skr2 to btt-skr-2-f407 and added a new alias for btt-skr-2-f429
Signed-off-by: James Hartley <james@hartleyns.com>
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>
As discussed with user HiitsameAsh on discord, he has confirmed this addition will flash a Fysetc Cheetah V2
Signed-off-by: James Hartley <james@hartleyns.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>
Check for the build symbol prior to calling bootloader_request().
Enable the build symbol on rp2040, atsam, and atsamd chips.
This also enables serial bootloader requsts on rp2040, atsam, and
atsamd.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename the build symbol. This is in preparation for enabling
HAVE_BOOTLOADER_REQUEST on usb and canbus.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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 a check to the start of initial_pins_setup() to make it easier for
gcc to optimize the code if it is not in use.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename canserial_send() to canbus_send() and canserial_set_filter() to
canbus_set_filter(). This makes it more clear where the code should
reside.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename canbus_send() to canhw_send() and rename canbus_set_filter() to
canhw_set_filter(). This makes it more clear where the code should
reside.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Improve handling of race conditions with hardware updates. This is
the same changes applied to stm32f0_adc.c in commit 88325b6c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Minor fix. The screw labels "back left" and "back right"
where swapped in [screws_tilt_adjust] section.
Signed-off-by: Frank Roth <developer@freakydu.de>
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>
Fix PIO "sync" register overflow check
Reduce latency of tx scheduling
Clear ackdone irq from report_note_eof_success()
Defer ack inject until after rx fifo drained
Improve passive/dominant bit conflict check on tx reschedule
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Minor comment change to unstuf_pull_bits()
Introduce unstuf_get_raw() helper function
Move crc stuffed bit calculation to data_state_go_crc()
Restore stuffed_bits state on missing ack
Use a single pio_irq_set() function
Reschedule tx if previous tx unexpectedly finished transmit
Simplify report_state handling
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The rp2040 watchdog does not actually reset anything by default. The
psm_hw->wdsel field must be programmed to actually get a reset on a
watchdog failure. Program that field so the watchdog is usable.
Also, disable the watchdog before attempting a reboot into the
bootloader. Otherwise the machine may just reboot a second time due
to a missed watchdog event in the bootloader.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Remove the custom.md github issue template so that github only shows
the choices listed in the config.yml file.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Specify the arm architecture flash bootup address for each chip type
in Kconfig using a new FLASH_BOOT_ADDRESS setting.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
The stm32h7 uses similar usart hardware as the stm32f0 and stm32g0
chips. Use the same code implementation for all these chips.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If an USART RX overrun happened on a stm32g0/f0/h7, the ORE flag
would get set by hardware. This flag would also trigger an interrupt.
The problem was that this flag was never cleared on these 3 mcu families
since the ORE flag clear sequence is different to all of the older
chips.
Since the ORE flag is not used in any meaningful way anyway, it was
disabled during the init sequence.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
According to ADXL345/ADXL343 datasheets, at 3.3V supply voltage,
which is most frequent in the various boards, the sensitivity of
X and Y axes changes to 265 LSB/g from 256 LSB/g at 2.5V.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Works for unmodified stock Artillery Sidewinder X2,
year 2022 with Artillery Ruby v1.2 mainboard.
All by default connected things are working fine.
Build firmware with architecture STM32F401 with "No bootloader".
Other settings keep ther defaults
Signed-off-by: Frank Roth <developer@freakydu.de>
If a maximum acceleration is changed between two consecutive moves,
this allows to correctly compute the junction velocity between them.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
it seems I made an error with my code for the SKR 3, and I copied the code from the wrong host , this PR fixes that. I have just retested with the right code and works as expected, this is confirmed by @adelyser who brought the issue to my attention.
Signed-off-by: James Hartley <james@hartleyns.com>
Fix gpio function selection for PIO1 usage.
Minor variable name changes.
Allow scheduling tx "matched" event after a crc match.
Allow for up to 5 passive bits after unstuf_clear_state().
Pause PIO "rx" bit reception after 10 passive bits.
Signal the CPU to process data every 10 read bits.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Corrected the build instructions for the TH3D EZBoard V2 to include the command to convert Klipper.elf to a SREC bin format named firmware.bin. The SREC format is required for the bootloader installed on the board.
Signed-off-by: Anthony Dellett <anthony.dellett@gmail.com>
As discussed with Arksine, he has created new working settings for the Creality 4.2.x boards as the original 4.2.7 entry did not work, plus addition of SKR2 and SKR3. Tested on 4.2.2 and SKR2 and SKR3EZ.
These are using the new skip_verify functionality that was recently merged due to them using SDIO
Also removed a double definition for `monster8` it was in main definitions and aliased.
Signed-off-by: James Hartley <james@hartleyns.com>
This adds a gcode command that can be used insight the slicer to pass the total layer count and current layer information.
Signed-off-by: Stefan Dej <meteyou@gmail.com>
M105 expects get_temp method. Module crashes when gcode_id parameter
is set and M105 called. Add methods as hotfix.
Signed-off-by: Robert Pazdzior <robertp@norbital.com>
Introduce a new handle_fault() method to handle processing of sensor
faults. This simplifies the calc_temp() methods.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Send the fault information explicitly in the query_thermocouple fault
field for max6675, max31855, and max31865.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Update printer-anycubic-vyper-2021.cfg
better pause and end print, beeper support, mroe accurate value.
* Update printer-anycubic-vyper-2021.cfg
* Update printer-anycubic-vyper-2021.cfg
* Update printer-anycubic-vyper-2021.cfg
* Update printer-anycubic-vyper-2021.cfg
delete unnecessary gcode
* Update printer-anycubic-vyper-2021.cfg
remove unneccessary part.
* Update printer-anycubic-vyper-2021.cfg
* Update printer-anycubic-vyper-2021.cfg
according to https://www.klipper3d.org/Example_Configs.html point 7f
delete field values that are set to their default value
* Update printer-anycubic-vyper-2021.cfg
small change
* Update printer-anycubic-vyper-2021.cfg
If a tmc driver can't find the stepper config section it reports a
"missing microsteps" error which can be confusing. Provide a more
explicit error message.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
As found on discord bt user David Carey.
uart_address for y and z are swapped. Discovered while setting up sensorless homing.
Signed off by: James Hartley <james@hartleyns.com>
Added a SET_DIGIPOT command to the mcp4018 implementation.
Previously the mcp4018 was read only, and set at the time of
configuration. This allows you to change the value during a
print, which is needed for some older printers that need to
lower the stepper current during preheating.
Signed-off-by: Jake Bordens <jake@allaboutjake.com>
Also added status report for extruder_stepper objects with the
current pressure advance parameters values.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Uses existing common code for STM32. Adds a table for device-
specific PWM mappings. Adds support for enabling all TIM timer
devices. Makes it a runtime error to enable devices the code
doesn't know how to enable.
I have verified performance of the fan pins (PC6, PC7, PB15)
on the SKR Mini E3 V3.
Signed-off-by: Ben Jackson <ben@ben.com>
Removes a call to gcmd.respond_info which writes 'VARIABLE SAVED' to the
console every time the SAVE_VARIABLE command is called.
Signed-off-by: Andre LeBlanc <mapleleafmakers@gmail.com>
Raised from issue #5645, UTF-8 encoded symbols or other unexpected symbols on the UART raise an exception which causes klipper to stop. This change support UTF-8 encoded characters (from file names) as well as ignoring unexpected bytes.
Signed-off-by: Clifford Roche <clifford.roche@gmail.com>
This is a working config with full LCD and stepper settings (only thing missing is the kill switch, which did not appear to work)
Signed-off-by: Rui Carmo <rui.carmo@gmail.com>
Introduce a CONFIG_USB build symbol that is set whenever
CONFIG_USBSERIAL or CONFIG_USBCANBUS is set. Use that symbol during
setup so that the USB controller is properly initialized for both usb
serial and usb canbus bridge configurations.
This fixes the clock configuration for usb canbus bridge mode on
stm32f446.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This is a working config with full LCD and stepper settings (only thing missing is the kill switch, which did not appear to work)
Signed-off-by: Rui Carmo <rui.carmo@gmail.com>
An mcu device acting as an "mcu bridge" should only be reset after
other normal devices are reset - otherwise the bridge wont be able to
pass along the reset message to the downstream mcus.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use bootloader_request() instead of try_request_canboot(). This
allows the bootloader machanism to work for more bootloaders.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename this board API function to a more generic name. This is in
preparation for calling the function from the canbus code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Starting with nodeid 4 instead of nodeid 0 can reduce bitstuffing of
the id field in common configurations.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The stm32g0 specification states that it is required to wait for the
CCRDY flag to be raised after changing the channel configuration.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This PR serves to fix a longstanding misnomer in some config files. Many configs state a nozzle_cooling_fan alias for what is usually a "hotend cooling fan". This causes ambiguity and confusion with the parts fan. I have identified all 24 files with this and changed them here.
Signed-off-by: James Hartley <james@hartleyns.com>
A new release of markdown (v3.4.1) breaks the website deployment
scripts. Force the existing version.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename to "match" state machine instead of "ack".
Minor simplification to tx_note_crc_start().
Call pio_match_clear() from report functions.
Add pio_match_calc_key() helper function.
Raise irq after 6 passive eof bits for faster rx message notification.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support a USB interface that shows up as a canbus adapter to linux.
Route both local and real canbus packets over that interface.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename the canbus.c code to canserial.c and introduce new wrapper
functions in canbus.c that connect the low-level canbus hardware code
to the high-level canserial.c code.
This is in preparation for adding "usb to canbus bridge mode".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The `logging.basicConfig` does not reconfigure default logger.
This results in printing only warnings/errors to stderr
instead of also info (or debug).
This fixes the issue by setting log level on root logger.
Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
Calling python functions can have high overhead. Inline the
twos_complement code in the _extract_samples() inner loop.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The MPU9250CommandHelper() class is nearly a duplicate of
ADXL345CommandHelper(). Rename ADXL345QueryHelper() to
AccelCommandHelper and remove user facing references to "adxl345". Use
it directly from mpu9250.py .
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The mpu9250.ClockSyncRegression() class is a duplicate of
adxl345.ClockSyncRegression(). Remove the duplicate copy and use the
code from adxl345.py .
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The MPU9250QueryHelper() class is a duplicate of ADXL345QueryHelper().
Rename ADXL345QueryHelper() to AccelQueryHelper() and use it directly
from mpu9250.py .
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Adds a save_config_pending_items to the status reported by
configfile reflecting the items and values that a future
SAVE_CONFIG would actually persist.
Signed-off-by: Kurt Haenen <kurt.haenen@gmail.com>
Move the uuid hash calculation to canbus.c and call canbus_set_uuid()
from src/stm32/chipid.c . This simplifies the low-level canbus
hardware code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Previously the code had canbus_read() which was called from task
context (for admin messages), and canbus_process_data() which was
called from irq context (used for data messages). Change that to a
single canbus_process_data() function that is called from irq context
(used for all messages). This simplifies the low-level hardware
specific canbus code and should make it easier to support other
hardware implementations.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a single CanData global variable to track the canbus state.
ARM micro-controllers generally produce better code when global
variables are in a struct.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use a USB hex id to indicate that the device is already in bootloader
mode. This makes the rp2040 flashing code similar to the other
boards.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce support for the stock Creality CR10 v3 printer, including the filament runout sensor. It also supports the optional BLTouch.
Signed-off-by: Luís Palma Nunes Mendes <luis.p.mendes@gmail.com>
The rp2040 USB may not connect after a reset. Implementation the
recommended workaround.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The CanBoot bootloader can often fit in 4KiB and that may be useful
for some devices with small flash sizes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Just log an error on a fault.
Remove the host check for min/max temperature as the micro-controller
code already implements that check.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allows a limited number of DS18B20 read failures
before stopping the printer. This is designed to
tolerate spurious read errors, while still stopping
for serious issues.
The printer will stop when the sensor
fails to report a value five times in a row.
Implementation works as follows:
The MCU reports any read errors using a new "fault"
parameter in its answers.
The Python code tracks the number of errors
and triggers the shutdown. This paves the way for
more sophisticated error handling in the future,
as well as an example for other sensors to follow.
Signed-off-by: Lorenzo Pfeifer <Lorenzo.Pfeifer+github@googlemail.com>
When CanBoot is detected set its bypass signature when a
reset is requested.
Add a "try_request_canboot()" method that may be called
from from USB and Canbus bootloader requests.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Adding Klipper functionality to support cancelling objects while
printing.
This module keeps track of motion in and out of objects and adjusts
movements as needed. It also tracks object status and provides that to
clients.
The Klipper module is relatively simple, and only provides one piece of
the workflow. Moonraker already supports processing uploaded files to
insert the required gcode markers for cancelling objects, using
https://github.com/kageurufu/cancelobject-preprocessor. This library is
also available as an executable for use in slicers, and pip
installations also include the script as a callable.
Mainsail has integrated support, and code changes for Fluidd are
available. Support in other interfaces is planned, and we've spoken to
several other developers about integrating frontend support in their
projects.
Signed-off-by: Troy Jacobson <troy.d.jacobson@gmail.com>
Co-authored-by: Franklyn Tackitt <git@frank.af>
Co-authored-by: Eric Callahan <arksine.code@gmail.com>
The latest text of the GNU GPLv3 license updates the web references to
https (instead of the older http). Update to that latest text.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add PROBE and CHIP to TEST_RESONANCES
Since it's possible to specify more than one chip
in TEST_RESONANCES the CHIP parameter has been
renamed to CHIPS
Signed-off-by: Mikkel Schmidt <mikkel.schmidt@gmail.com>
Create configuration file for Fly-Gemini-v1 motherboard
Add stm32f405 and generic-mellow-fly-gemini-v1.cfg to test cases
Signed-off-by: Xiaokui Zhao <xiaok@zxkxz.cn>
It's more likely that python3 will be installed than python2 on a
typical modern Linux distribution, so use python3 by default.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This adds a command which allows an external script to broadcast a
bootloader request, using a supplied UUID to match the request.
Included is a method to process requests to enter the canboot
bootloader.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Make sure whitespace isn't in the pin description. Also make sure an
alias doesn't map to an invalid pin.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Minor indentation and variable name changes.
Don't remove linebreaks from message_protocol_error lines.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The MCU protocol error message often confuses users, especially after getting bombarded with the config format error line. This PR tries to improve it and has the following goals:
- Put the technical error at the end to prevent confusion and avoid the immediate jump to help channels instead of continuing to read
- Inform the user first what the type of error is (In this case: MCU Protocol error) and not at the end of the long error message
- Give the users a clear instruction what to do (pretty much unchanged), but possibly more approachable because the user is not confused by the technical error anymore
- Shows the version numbers of Klipper separate from all MCU version numbers so that it is more obvious that this is the version of Klipper
- Separates the version numbers between outdated MCUs and up-to-date MCUs, so that it becomes obvious if a MCU flash failed because the MCU doesn't disappear from the outdated list
- Previously, when viewing the errors in a web frontend, additional line breaks made it extremely hard to read the message, sometimes with as little as one word on one line. The error messages are now formatted to not have rogue line breaks, improving readability.
Signed-off-by: Felicia Alexa Hummel <felicia@drachenkatze.org>
There is concern that some users are interpreting the benchmark table
in Features.md as a list of "supported boards" or possibly
"recommended boards". This was not the intent.
Remove the board names from the list to make it more clear the intent
is only to describe the benchmarks.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This is needed for the Creality Ender 3 S1 with the STM32F401 chips to enable a 64kib bootloader offset
Signed-off-by: James Hartley <james@hartleyns.com>
If the final update in a series of SET_LED update commands didn't
alter a color than the transmit would not occur - even if prior
commands did make color changes. Refactor the update code and fix.
Reported by @mstansberry.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Update and rename printer-twotrees-sapphire-pro-2020.cfg to printer-twotrees-sapphire-pro-sp-3.cfg
I renamed the file since the printer name now changed and is sold with this name, there is only one version so year can be removed.
-Added detailed instructions for flashing in the header.
-Corrected rotation distances for axes, it was wrong.
-Added gear ratio for extruder that is useful for future changes.
-Added heater fan to HE1 pins for automatic shutdown with temp.
-Reduced speed and accel for Z since a 2mm screw is used.
* Create printer-twotrees-sapphire-plus-sp-5-v1.1.cfg
I created the file since the printer name now changed and is sold with this name, there are 2 main versions (V1 and V1.1) so I will make 2 different configs for them since there are some hardware change and people are confused in what to change.
The difference with V1 is that all 2225 drivers are now used, since microsteps tables change for these drivers and by factory all jumpers are in the microstep setting is 32, people don't know this and will have half movement with the v1 config, there is a lot of confusion in communities so I think adding another file is the best option.
Signed-off-by: Lorenzo Cascone <laurienzudesign@gmail.com>
The reference to the linux mcu was helpful to understand what a linux mcu was but didn't help with understanding the technical reasons why it's not supported.
Signed-off-by: Karl Bowden <karl@bearded.sexy>
Support for language translations on the klipper3d.org site was
disabled in commit c067d4df. Fully remove the support in this commit.
This is in preparation for an alternate implementation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Accidentally introduced in 8049243221,
renders the AFE non-functional on SAME70. Should have had little impact
on SAM4E.
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
Previously the section for stepper_bed was intertwined with printer. This commit makes it match (../config/example-polar.cfg).
Signed-off-by: Charles Pickering <me@charlespick.xyz>
This file includes the build instructions and generic configuration for the TH3D EZBoard Lite v2.0 3d printer control board.
Signed-off-by: Anthony Dellett <anthony.dellett@gmail.com>
Added PCA9632 LED module support using software I2C from MCP4018
modulo drive the LED strip of a FlashForge Dreamer 3D printer.
Based on the PCA9533 module.
Signed-off-by: Ricardo Alcantara <ricardo@vulcanolabs.xyz>
Similarly to commit 8cf1b512 for SPI, the Rpi4 has more i2c busses to offer
This change allows klipper to use up to I2c bus 6
/boot/configtxt
dtparam=i2c_arm=on
dtoverlay=i2c6
and
pi@fluiddpi:~ $ ls -1 /dev/i2c*
/dev/i2c-1
/dev/i2c-6
Signed-off-by: Sylvain Dansereau <brutus_dansereau@hotmail.com>
Temporarily disable support for multiple languages on the main
klipper3d.org site. The search functionality isn't working correctly
with translations.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Check that a SET_PRESSURE_ADVANCE without an explicit EXTRUDER
parameter isn't done after the user disables or reassociates the
extruder stepper motor (via SYNC_EXTRUDER_MOTION). Otherwise, it
could lead to very confusing results.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
With recent changes, the extruder_stepper may be used for new
purposes, and synchronizing to the "extruder" motion queue at startup
may become a confusing default.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The serial device needs to be enabled before setting the DLAB bit.
This prevented UART3 from working.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Document that spaces and special characters should not be in the
config filename.
Remove reference to step_distance and pin_map deprecated features, as
those features are now fully removed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change from the "material translate icon" to the "material language
icon" for the language selection icon. (The "material language icon"
is an alias for the "material web icon" and it seems we can't use the
alias, so we directly set the icon to "material/web".)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Lines 94 and 97. Fan speed should be 1 and not 0.5
removed lines to use default settings.
[heater_fan hotend_fan]
pin: PG14
[fan]
pin: PG13
Signed-off-by: Scott Schering <sschering@gmail.com>
The stm32 specs indicate that the SPE bit must be cleared before
changing the CPHA or CPOL bits.
Reported by @cbc02009 and @bigtreetech.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's possible for the SCLK pin to still be updating even after the
last byte of data has been read from the receive pin. (In particular
in spi mode 0 and 1.) Exiting early from spi_transfer() in this case
could result in the CS pin being raised before the final updates to
SCLK pin.
Add an additional wait at the end of spi_transfer() to avoid this
issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Deprecate SET_EXTRUDER_STEP_DISTANCE and SYNC_STEPPER_TO_EXTRUDER.
Recommend using SET_EXTRUDER_ROTATION_DISTANCE and
SYNC_EXTRUDER_MOTION.
Deprecate the extruder "shared_heater" option and reocmmend using
extruder_stepper config sections to obtain the same functionality.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This command is a rename of SYNC_STEPPER_TO_EXTRUDER. This change is
in preparation for the removal of SYNC_STEPPER_TO_EXTRUDER.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support altering the extruder distance using the higher-level
rotation_distance. This is in preparation for removal of the
SET_EXTRUDER_STEP_DISTANCE command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Separate out message parsing into individual classes. This should
make the code a little eaiser to understand.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Running "make" directly after a "make distclean" can lead to a corrupt
out/board symbolic link. Rework the make rules so that the board
symbolic link is created in a new make instance that has the updated
definition of CONFIG_BOARD_DIRECTORY.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Break listing up by module name. Provide links to "extended"
commands. Sort reference by module name.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's no longer necessary to update the printer.cfg file to alter the
max_accel and square_corner_velocity parameters. Update the
Resonance_Compensation.md document to reflect this.
Also, recommend using STEP_DELTA in the TUNING_TOWER commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The rp2040 can be flashed without sudo when using udev rules to give the
user permission, but in a standard configuration sudo is required.
Here we make it possible for flash_usb to use sudo for the rp2040
target, and make it the default when using `make flash` for the rp2040.
As for other targets, one can set `NOSUDO=1` to not call through sudo.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Wraps lines to 80 columns. Only use triple backticks on multi-line
code excerpts. Add backticks around "sudo raspi-config". Move
"Enabling SPI" section to be near pwm and gpio configuration.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The G2 / G3 command might be renamed using `gcode_macro` + `rename_existing`. This change allow detecting clockwise / anti-clockwise moves when the command gets renamed.
Signed-off-by: Nick Douma <n.douma@nekoconeko.nl>
Commit 7ef7bf60 broke the special handling for M117 commands that
start with a number or special character. Fix that support and extend
to M118 as well.
Also improve handling of commands not separated by a space (eg,
"M117HELLO").
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Refactor the extruder_stepper support so that it uses the
ExtruderStepper class defined in extruder.py.
Support the SYNC_STEPPER_TO_EXTRUDER command on steppers defined in
either extruder_stepper or extruder config sections.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Store the pressure_advance value in "struct extruder_stepper" instead
of in the trapq's "struct move". This makes it possible for multiple
stepper motors to have different pressure advance values while still
using the same trapq.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It is preferable to program the tmc drivers with an irun (or cs)
setting near 31, as otherwise the driver may have reduced microstep
precision. It was possible for the driver to be programmed with
irun=16 or irun=17 when it could have been configured with irun=31
with vsense=1 instead. This would occur on tmc2130/tmc2208/tmc2209
drivers for values around 0.900 to 1.000 amps (when using a typical
sense_resistor settings of 0.110 Ohms).
Change the code to prefer using vsense=1 to avoid this issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The fan pin PA0 is not correct for the 2021 revision of the CR-6 SE using the
4.5.3 revision of the Creality board. Changed the pin to PB15 in order to
get it working
Signed-off-by: Filip Trplan <filip@trplan.si>
Previously accidentally used 'default' state name instead of the
stated one ('PAUSE_STATE'). This might collide with user usage of the
SAVE_GCODE_STATE macro.
Signed-off-by: David Grundberg <individ@acc.umu.se>
This implements I2C for the rp2040 target. All output groupings of both
I2C blocks are available for use.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
TMC2130/5160 can make use of `spi3`, which is operated on the software SPI pins in the current configuration. The supplied defaults for software SPI do not currently work.
Heater0 pin was marked incorrectly, should be `PB0`
Signed-Off-By: Wijnand Modderman-Lenstra <maze@maze.io>
Many non-English speaking countries use a comma as a decimal separator for printed numbers. This can create some confusion in documentation and config files when not surrounded by contextual clues like parenthesis. Improve documentation by adding spaces to coordinates.
Signed-off-by: Paul McGowan <mental450@gmail.com>
This adds `make flash` support for the rp2040 target. Flashing is
performed using a custom `rp2040_flash` tool that uses the PICOBOOT
protocol. Root is not required.
The user specifies the serial device of the rp2040 they wish to flash as
the device. This device is reset into bootsel mode and `rp2040_flash`
is invoked on the original USB device path.
If the device is already in bootloader mode, the user can specify
'first' as `FLASH_DEVICE` which will simply invoke `rp2040_flash` with
no bus/address options.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Unify the handling of the enable_pclock() and is_enabled_pclock() code
across all stm32 chips. All chips will now perform a peripheral reset
on enable_pclock() (this is a change for stm32f0 and stm32h7). The
enable_pclock() code will now also disable irqs during the enable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid read-modify-write operations where possible. The register
values are in a known state so prefer absolute writes.
Improve handling of race conditions with hardware updates.
Remove the adc reference from "struct gpio_adc" as it is a constant.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use a fixed layout for the USB transfer memory and remove the ep_mem
struct definition.
This is in preparation for stm32g0 support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The gpio_peripheral() code is the same in stm32f0.c, stm32f4.c, and
stm32h7.c. Move that function to a new gpioperiph.c file to avoid
code duplication.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There is no reason to explicitly set the interpolate flag to true in
the example configs as that is already the default.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the documentation recommends that hold_current not be set,
update the example config files to not specify a hold_current.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Changing motor current may itself introduce unwanted motor movement.
As such, document that specifying a hold_current is not recommended.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some links are pointing to a beta bl (v0.5-beta) instead of the newest release (v0.7).
Raspberry Pi documentation had changed to adocs
Signed-off-by: Yifei Ding <yifeiding@protonmail.com>
Commit 689231df changed the default step_pulse_duration to 100ns for
TMC drivers that are configured in UART/SPI mode, but it failed to
document that change in Config_Changes.md and Config_Reference.md.
Update those documents to reflect that change.
Update the code so that a user may specify a custom
step_pulse_duration even on TMC drivers that are configured in
UART/SPI mode. This may be useful for drivers that use a level
shifter on the step pin that requires more than a ~300ns to detect a
level change.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new automation to lock closed issues with no recent updates.
This is intended to reduce updates to old tickets that few people will
see.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The mcu can only enforce the max duration if the start value is the
same as the shutdown value, so verify that before configuing the mcu.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Updates for generic-bigtreetech-skr-2.cfg to include comment on newly shipped board with STM32F429 instead of the original STM32F407
Signed-off-by: James Hartley <james@hartleyns.com>
Don't go above 400Mhz as otherwise it causes 32bit rollover issues.
(Parts of the code expect a rollover will not occur faster than 10
seconds.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Multiplying the desired bitrate by 4 results in half the
desired period and thus twice the desired bitrate.
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
This clock is only needed for low-power operation mode,
and wasn't correctly configured anyway (should be 48MHz).
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
Create a copy of the dictionary prior to updating the the variable field.
This fixes an issue where webhooks holds a reference to the variables
dict returned by get_status().
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The `<!-- {% raw %} -->` tags are no longer needed now that the Jekyll
package is no longer used to process the markdown documentation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It seems the common "beta 3950" thermistors generally follow a
temperature table defined by the new "Generic 3950" definition. Using
a table that actually follows the "beta 3950" temperature curve is
generally less accurate. Deprecate the existing "NTC 100K beta 3950"
definition to avoid this common issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the definitions of the default thermistors from thermistors.py to
the temperature_sensors.cfg file.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the default list of sensor modules from heaters.py to a new
temperature_sensors.cfg config file.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 9ecddd1b fixed a serious error (introduced in 7d95a004). Force
a protocol version change so users are aware of the need to update the
mcu code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 7d95a004 introduced a defect - if the cached timer pointed to
by last_insert did not reschedule itself then the cache would not be
in a valid state and other active timers may not get properly
rescheduled.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add an optimized step function for drivers that support stepping on
both rising and falling edges of the step pin. Enable this
optimization on 32bit ARM micro-controllers. Automatically detect
this capability in the host code and enable on TMC drivers running in
SPI/UART mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Remove the STEP_DELAY Kconfig option and replace it with a per-stepper
step_pulse_duration printer.cfg config option.
The AVR code will continue to have optimized code to step and "unstep"
in the same function (which is automatically activated when the step
delay is 40 ticks or less). This change removes the Kconfig option
for single function step/unstep on 32bit processors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Remove support for default_parameter_xxx config options. Remove
support for direct access to command parameters.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid using unicode() types on Python2 as it can lead to subtle
errors.
Also, accept utf8 on gcode input (instead of just ascii).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The floating point unit must be enabled in order to use it and Klipper
does not currently implement that. Newer versions of gcc may spill
registers to the floating point unit causing failures.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The floating point unit must be enabled in order to use it and Klipper
does not currently implement that. Newer versions of gcc may spill
registers to the floating point unit causing failures.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The floating point unit must be enabled in order to use it and Klipper
does not currently implement that. Newer versions of gcc may spill
registers to the floating point unit causing failures.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This resolves an issue where the timer can get stuck
in an attempt to transition from Ready to Idle if
the printer is shutdown.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Tracking of the last reset is no longer needed after commit 8f76e53c.
Remove the code tracking that status and remove the flag definition.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some architectures do better if the global variables accessed from the
timer dispatch code are in a struct.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The code automatically reduces the hold_current so that it is no
greater than the run_current. However, this could lead to confusing
behavior if one reduced and then increased the run_current via
SET_TMC_CURRENT commands. To avoid that, this change adds support for
tracking the requested hold_current - thus changes to run_current
don't subtly alter the hold_current.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some versions of gcc, in some cases, decide that it is OK to move the
read to `INTR` to right after clearing the `SETUP_REC` bit of
`SIE_STATUS`, instead of after the `memcpy`.
The rp2040 datasheet doesn't appear to say anything about how quickly
the `SETUP_REC` bit will be cleared in `INTR`, but regardless the
compiler should not be re-ordering the read like this.
Here we force the correct ordering using a memory barrier.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Example default config for Tronxy XY-2 Pro.
It is default config for printer Tronxy XY-2 Pro (mainboard Chitu V6). This config based on config for Tronxy X5SA with mainboard Chitu V6.
Signed-off-by: Konstantin Bazhenin <kby@list.ru>
Copy the parameters of calls to console_sendf() on pru1 to pru0 and
then call that function on pru0. Although copying the parameters is a
"hack", the code size reduction is notable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update mkdocs to v1.2.3 to avoid a github "dependabot" warning for
CVE-2021-40978. (The CVE doesn't impact the klipper3d.org site, but
no harm in updating.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Klipper with Fluid complains about `position_endstop` line if `endstop_pin:
probe:z_virtual_endstop` used
Signed-off-by: Ilia Rebane <Agilatosay@gmail.com>
The F042 and F072 chips are in the same series and the code should be
nearly identical for these chips. Implement the alias and enable USB
for the F072 chips.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The previous OSPEEDR value of 0x2 was copied from the stm32f4.c code,
but the stm32f0 interprets that value the same as 0x0 - which is "low"
speed. Change the OSPEEDR value to "medium" speed so that it matches
the configuration of stm32f1 chips.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This change has been expanded to include all STM32F4 processors, since they share a common TIMER mapping with some processors just not having all of the timers and pins.
Signed-off-by: Jerome Helbert <jerome@helbert.net>
This commit contains a configuration for the Anycubic Vyper printer from 2021.
It uses a clone of the STM32F103 chip named GD32F103.
There are 2 Mainboard versions out there v0.0.5 and v0.0.6, this config has
been tested with the v0.0.6 only. It should probably work for v0.0.5 as well
since there are no different changes in the Anycubic Marlin firmware.
The LCD is not supported yet (might work, but didn't try yet).
Signed-off-by: Marc Neuhaus <marc@neuhaus.nrw>
Signed-off-by: Manuel Fichtner <manuel.fichtner@me.com>
Scale the max_z_velocity limit by the amount of movement in the Z.
This should improve bed_mesh and vase mode prints on delta printers.
Reported by @hywelmartin and @dalegaard.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The backport of Python3's configparser causes issues when there is
unicode characters in the config file. To avoid introducing new
errors, go back to using the Python2 version of ConfigParser when
running on Python2.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Explicitly specify the comment_prefixes as regular Python2 strings -
otherwise the configparser wont ignore non-ascii characters in
comments.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The F405, F407, and F429 chips are in the same series and almost all
code definitions should apply to all chips in that series. Implement
the alias and fix defintions in adc.c and Kconfig that were only
applying to a subset of that series.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Newer versions of configparser no longer default to ignoring trailing
comments that start with a semicolon. Add that setting explicitly to
avoid breaking existing config files.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a test case to verify that every optional module successfully
loads on both Python2 and Python3. This is intended to catch syntax
and module imports that are not compatible between Python versions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The error checking is not complete in this change - the code should
handle the case where an input string is not valid utf8.
The code will continue to run on Python2 after this change, however
the execution time on Python2 is measurably slower after making this
change.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.