The tmc5160 field formatters were mostly duplicates of the tmc2130 -
add the "reset" field to tmc2130.py so both drivers have similar
reporting.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Refactor the tmc driver implementations so that there is a single
implementation of the SET_TMC_CURRENT command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Raise a printer.command_error() instead of an mcu.error() if a query
command does not succeed. That error is less likely to result in an
unhandled exception error.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
currently, if there are 2 files on the virtual sd card whose names differ only in
case (eg. MyFile.gcode vs myfile.gcode) the actual file that gets loaded is at
best unpredictable. this patch checks for an exact match before attempting a
case-insensitive one.
Signed-off-by: Andre LeBlanc <andrepleblanc@gmail.com>
The stepper positions will only be in sync after the step generation
code has been flushed. This fixes an "internal error in stepcompress"
error during a SYNC_STEPPER_TO_EXTRUDER command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This patch adds the ability to daisy-chain multiple tmc2130 and
tmc5160 drivers.
Signed-off-by: Marco D'Alessio <marco@wrecklab.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If neither rotation_distance nor step_distance is present, then
generate an error saying rotation_distance is needed (instead of an
error about step_distance).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This reverts commit ac61f8b726.
Many temperature sensors are capitalized, so don't make this chaneg to
the bme280.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some internal code treats the message ids as encoded "variable length
quantities", while other internal code assumes the message id is
always one byte long. Continue using this scheme, but convert the VLQ
users to use the name "msgtag" while the 1-byte users use "msgid".
Increase the number of available msgids from 96 to 127 - the higher
values get encoded as negative "msgtags".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update callers to only use exported methods of the msgproto objects.
This makes it easier to make internal changes to the code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some communication protocols are more efficient if fewer write() calls
are invoked. If multiple message blocks can be sent at the same time
then batch them into a single write() call.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If any callback is invoked from the pollreactor then obtain a new
eventtime before calculating a sleep duration. This improves the
timing of events.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 73b78af6 inadvertently removed the check for a successful gcc
compilation. Add the check back in.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Initial commit of code to support 1-wire (Dallas) sensors such
as the DS18B20. Requires Linux kernel drivers to create a file
in /sysfs which is read by this module, and temperature
typically returned to a temperature_fan.
Signed-off-by: Alan Lord <alanslists@gmail.com>
Signed-off-by: Josh Headapohl <joshhead@gmail.com>
Call mcu_adc.setup_minmax() even in debug output mode so that the
debugging output contains a more accurate configuration.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make available the parsed value (or default value) for config options
to command templates and to the api server.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a get_status() method returns a mutable object (such as a list or
dict) then it would be possible for a gcode command template to
incorrectly alter the program's internal state. Perform a deepcopy()
operation on all get_status() return results to avoid that.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Since Python 2.6, the BaseException.message attribute is deprecated (PEP-352[1])
in favor of e.args[0] or str(e). This commit replaces e.message with str(e).
[1] https://www.python.org/dev/peps/pep-0352/
Signed-off-by: Maël Kerbiriou <m431.kerbiriou@gmail.com>
Commit ea85d419 moved CommandError from homing.py to gcode.py, but
failed to fix the references to CommandError within homing.py. Fix
that.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Calculate the get_status() axis_minimum and axis_maximum fields in
advance so that they don't need to be calculated on each get_status()
call.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Improved algorithm to choose the 'optimal' shaper frequency taking
shaper smoothing into account. This may choose a frequency with
slightly more vibrations but less smoothing. Also allow users to
limit the maximum input shaper smoothing.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Add support for automatically calculating the internal step_distance
from new config parameters - rotation_distance, microsteps,
full_steps_per_rotation, and gear_ratio.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The previous init sequence relied on the display ignoring commands if
they are sent faster than 40us. Some displays may not have this
limit.
Rework the init to make it more robust to command transmission times.
The new init should still transition the display into 4-bit mode even
if the display processes commands faster than 40us.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The digital output commands implement a subset of the software pwm
commands. Change the host code to just use the software pwm commands
and simplify the micro-controller code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
- remove lot of helper methods
- differentiate class instantiate from config or directly
- don't use 'enable' template rendering when static value is used.
- new element 'disabled'
- other internal adjustments
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
Don't use the reactor eventtime to schedule micro-controller commands
as that time may have low accuracy.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't use the reactor eventtime to schedule micro-controller commands
as that time may have low accuracy.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Writes to the max31856 chip use "burst mode", so only one address
during the initialization sequence can be sent. This fixes erroneous
"Cold Junction Fault" errors.
Reported by @NBouquain.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add an 'mcu' option to the board_pins config and use that to specify
the name of the mcu to apply the aliases to. Support applying the
aliases to multiple mcus.
Add support for any number of options starting with an "aliases_"
prefix.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move all the config reference information from files in the config/
directory to a new Config_Reference.md document.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Queue updates so that delays between updates are properly applied.
This fixes macros that would blink LEDs by pausing between update
commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Users may use this action to call methods registered by a webhooks client from a command template.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The previous code calculates each step time via an "exponential
search" followed by a "false position with Illinois algorithm" search.
Replace with a "secant method" with "bounds check" search. This
simplifies the code, improves the performance, and does a better job
of finding steps near a direction change.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When in debug output mode, make sure to register the fd correctly.
Otherwise, the poll() call will use the 0 fd which could cause random
results.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the mcu config section is omitted, it leads to confusing error
messages. Don't default the serial config option to /dev/ttyS0 to
improve the error reporting.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It is only valid to call raise_probe() when the toolhead is not
moving. Make sure to call sync_print_time() from multi_probe_end() to
ensure that. This fixes a bug that could cause the Z axis steppers to
lose their position when "stow_on_each_sample=False".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid using the absolute E position when calculating pressure advance
as that position can grow arbitrarily large, which can result in
"numerical stability" problems. That instability could eventually
lead to internal errors during step compression.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some RPi0 users were reporting "timer too close" errors due to pwm pin
resets - increase the time the host has to complete the startup to
avoid this.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
On a reset, the mcu.py code may have sent an initialization message to
the bltouch, which needs time to complete. Add additional time during
the bltouch setup to avoid a race with these two times. This avoids
some "timer too close" errors that users of fast host machines were
reporting.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The M117 command parser discards the last character of the message
whenever the M117 command does not begin the line and there is no *xx
checksum, e.g.
N0 M117 Look at me
causes the banner area of the printer screen to display "Look at m".
This patch only trims the checksum when one is found to trim.
Signed-Off-By: Jonathan Pickard <jhp@adjustablelabs.info>
Add support for performing Python gc work only from the main reactor
thread and only when it appears the main thread is idle.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Explicitly run the python garbage collector on a restart. This cleans
up memory from the previous session.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure to terminate any greenlets that are in a pause() state.
This is necessary to ensure the reactor can be deallocated.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The existence of a __del__() method prevents deallocation on python2
if there are circular references. Replace the __del__() method with a
new finalize() call and arrange for it to be called when the main
reactor is released.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>