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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
A larger smooth_time results in a slower reaction time for the PID.
This increased delay can cause temperature oscillations with high
power heaters. Many boards produce good results without any
smoothing. So, it seems a smooth_time of 1 second is a better
default.
Reported by @ReXT3D.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When adding steppers to a `PrinterRail`, detect duplicated `endstop_pin`
settings and add them to the already-registered endstop.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Transmit data from mcu to host using 5 bytes per sample and up to 10
samples per message block. This improves bandwidth efficiency.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Query the adxl345 message counter every 100ms so that accurate timing
can be obtained during measurements. This allows the adxl345 data to
be exported with timestamps while captures are running.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce a new start_internal_client() function and change all client
code to use that instead of manually calling start_measurements() and
finish_measurements().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Separate out the G-Code command handlers to a new ADXLCommandHelper()
class. This helps separate the sensing code from the user interface
code.
Deprecate the RATE parameter of the ACCELEROMETER_MEASURE command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support endstops and probes attached to a different micro-controller
than their associated steppers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's possible for the original homing move of an axis to alter the
position of other axes. Make sure those other axes are not requested
to move on a subsequent second home retract move, as that could cause
an error if those other axes have not been homed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 3814a132 added code to homing.py to call calc_position() - add
that function to manual_stepper.py .
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the choice mapping uses integer keys then lookup the config option
using self.getint(). This simplifies the callers and improves the
encoding of the printer.configfile.settings export.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert stepper.get_past_commanded_position() to the more general
stepper.mcu_to_commanded_position().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Calculate the "homing position" using the endstop trigger time instead
of the position of the steppers.
This is in preparation for multi-mcu homing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Added optional PROFILE parameter to allow bed_mesh_calibrate to
save the mesh directly into the provided profile name instead of
default. If omitted, it will be stored in default.
Signed-off-by: Randell L Hodges <rhodges@taxfodder.com>
Changed the bed_screws_adjust command so that it finishes after 4
consecutive accepts. Before if you had 4 screws and adjusted the
first one you had to accept 7 times to finish the bed_screws_adjust.
Signed-off-by: Christian Enderle <mail@chrenderle.de>
The atmega328pb has officially named these pins as PE2 and PE3, so use
that naming scheme instead of the previous Klipper invented names.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Track the offset between driver phase and mcu position. This offset
should be constant as long as neither the driver nor the mcu is reset.
If the offset ever changes, log a warning.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Try to keep the host mcu_position synchronized with the
micro-controller by querying during startup and after every homing
event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The Trinamic specs aren't consistent with upper vs lower case, which
can be confusing. Improve clarity by using lower case names
consistently in the code. Register names will continue to use all
upper case naming in the code.
Update the SET_TMC_FIELD command to automatically convert field names
to lower case.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a shutdown occurs during homing, make sure any follow up errors are
clear that the cause of the error is the shutdown. This suppresses
the confusing "Unable to obtain 'trsync_state' response" messages.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>