Add additional wrapper functions so that no outside callers need to
peak into the member variables of PrinterStepper.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
All the kinematic code now uses the iterative solver to generate
steps. Remove the old stepcompress_push_const() mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the -fwhole-program option when compiling the host C code. This
makes it easier to support inlining across C files.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This change will make the "PROBE" command actually reply with the
z-position where the probe triggers. As this command is called
internally for the BED_TILT_CALIBRATE and Z_TILT_ADJUST those commands
will also give a response while probing, which I see as advantage over
the silent operation.
This change also lets one define some gcode for a repeatable probing
test to meassure the quality of the sensor and overall probing accuracy.
Signed-off-by: Hans Raaf <hr-klipper@oderwat.de>
Added a config parameter to define the homing override axes. This way
one can still home x and y axis without the z-probe cycle coming in the
way.
Signed-off-by: Hans Raaf <hr-klipper@oderwat.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Disable the verify_heater checks when debugging, as otherwise it can
cause failures when processing files in batch mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In some rare circumstances it was possible for the host software to
become so busy that it does not transmit a get_clock request for
several seconds. (In particular, this could occur with some complex
calls to coordinate_descent.) If that happened, it was possible for
the code to incorrectly report a "Timeout with MCU" error. Rework the
is_active() check to prevent that.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Apply the changes made by a SET_GCODE_OFFSET command to the next move,
even if the move is relative to the last movement. This allows the
command to implement "babystepping" requests.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the get_status command to get_clock. Don't report the shutdown
status in the new get_clock command.
The primary purpose of this change is to force the host code to report
a firmware version mismatch with older firmwares as recent changes
(namely the ordering of message block acks) have subtle
incompatibilities if different host/mcu code is used.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Normally, the MCU is restarted on a config change. However, that
should not be done automatically if the MCU is in a shutdown state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the mcu is using a traditional serial port, then only send a new
message block if there is space available in the mcu receive buffer.
This should make it significantly less likely that high load on the
mcu will result in retransmits.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Send the ack after processing commands - this gives the host code more
information on serial buffer utilization.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a section name had mixed case it would cause an incorrect error
during the section/option config checking.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add the ability to add a custom g-code command that in turn executes
one or more configured g-code commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The recommended TOFF time in "standalone mode" according to the
tmc2130 is 4, so use that as the default.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The extrude_factor and extruder position are specific to the current
extruder, so reset them to default values on a Tn command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the new gcode.register_mux_command() so that SET_PRESSURE_ADVANCE
works correctly with multiple extruders.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's common to add commands that dispatch to a particular object
instance depending on the value of a command parameter. (For example,
the command "SET_SERVO SERVO=xyz" wants to be handled by the
particular "xyz" servo instance.) Add a register_mux_command() helper
to gcode.py make it easier to do this.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the common config reading and probe object lookup from the
bed_tilt.py and delta_calibrate.py code into the ProbePointsHelper
class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Raise an error during config parsing if the position_endstop is not
between the position_min and position_max. This avoids a confusing
error message during homing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
For some reason, Linux creates the pseudo tty with group writable
permissions, but not group readable. Use chmod to allow the device to
also be group readable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The step speed rounding and the cpu delay must be run after running
the endstop specific preparation code. Otherwise, a delay in the
home_prepare() code could undo those calculations. Specifically, this
could lead to errors on a multi-mcu setup when the Z is homed using a
virtual_z_offset and there is a delay in the activate_gcode section.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't return early on a command error - continue to process remaining
commands and pop commands from the queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the generic spi send/receive code on Linux. Update the replicape
code to use the updated command format.
Also, update the replicape code to turn off the stepper motors on a
shutdown event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Improve the SPI message transmit system. Add support for bus speed
and bus mode. Add support for sending SPI messages on shutdown.
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
Signed-off-by: Douglas Hammond <wizhippo@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In order to properly delay BACKGROUND_PRIORITY_CLOCK messages, they
must be 5ms beyond the minimum defined by MIN_REQTIME_DELTA. So, add
both MIN_REQTIME_DELTA and MIN_BACKGROUND_DELTA to the timing of these
messages.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the clock querying messages occur at a similar frequency to other
events on the micro-controller or host, then it's possible for the
load created by those other events to skew the clock synchronization.
In particular, the 500ms lcd screen update could resonate with the 1
second clock query. Use an unusual clock querying frequency to avoid
this issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the C code out of the main klippy/ directory and into its own
directory. This reduces the clutter in the main klippy directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a set_shutdown_speed() method so that the heater_fan code does not
need to peek into the fan object's internal members.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The M206 command is confusing (it uses negative offsets) and isn't
very flexible. Add a new SET_GCODE_OFFSET command to make it easier
to add virtual offsets to gcode commands.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The M206 command is confusing as positive values in that command
result in negative offsets to future g-code commands. Perform the
parameter negation in the M206 command instead of storing it that way
internally.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When using an automatic probe, limit the Z lift speed to be no greater
than the Z probing speed. This can reduce Z jerks during probing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the fan's max power is limited by the config, then scale speed
requests between 0 and max_power. This makes more sense for typical
g-code fan speeds.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If max_accel_to_decel is greater than max_accel in the config, then
just internally limit max_accel_to_decel to max_accel. This makes it
easier to completely disable the max_accel_to_decel feature (as it can
just be set to a high value in the config).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a fully functional STM32F1 port, currently mostly targeting STM32F103
microcontrollers. This requires an 8 MHz XTAL. The maximum possible step rate
is around 282K steps per second.
This uses stm32flash to burn the firmware. The bootloader needs to be started
by setting BOOT0 to 1 and resetting the MCU. There is no automatic bootloader,
unlike on Arduino.
Signed-off-by: Grigori Goronzy <greg@kinoho.net>
Instead of supporting a single linear range for the temperature
lookup, allow multiple ranges to be defined. This makes the lookup
more accurate when a full lookup table is available.
Update the AD595 sensor to use the full table defined in its spec.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the c3 coefficient is negative it can cause the adc calculations to
fail. The c3 shouldn't be negative in practice, so fallback to a
simple beta calculation in that case.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the Thermistor code to a new thermistor.py module. Move the
Linear code to a new adc_temperature.py module. This simplifies the
heater.py code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The Thermistor (and Linear) class should handle all the details of
reading the ADC values and converting them to temperatures. So, move
that logic out of the Heater() class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a PrinterHeaters class that can stores references to available
temperature sensors and stores references to instantiated heaters.
Add a extras/heater_bed.py file and delay instantiation of the
heater_bed object. This allows the heater.py module to be imported
earlier during the setup phase, and allows the PrinterHeaters class to
be available for registering sensors and heaters.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Most callers did a lookup of the pins module via
printer.lookup_object("pins"). Use that as the standard method and
remove these less frequently used methods.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The existing junction algorithm limits the speed between two moves by
determining the maximum speed an arc between those two moves would
have if the cetripetal acceleration of that arc did not exceed the
printer's maximum acceleration.
However, should the slicer send an actual arc to the printer, then the
existing junction algorithm would not impose any significant limit on
the travel speed of that arc. This would permit the head to travel in
a circle at high velocity and with a greater centripetal acceleration
than the printer's maximum acceleration. To avoid this, impose a
limit on the junction velocity of short moves so that an approximate
centripetal acceleration of that move does not exceed the move's
acceleration limit.
Suggested by Michael Barbour.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Apply the bed tilt settings immediately after finding them. This
makes it easier for users to perform automatic tilt calibration at the
start of every print.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Automatically clear the information printed at the start of each log
file rollover on a klippy internal restart.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Drop support for M303 and PID_TUNE, and replace it with a new
PID_CALIBRATE command. Move the logic for this command from heater.py
to a new pid_calibrate.py file in the extras/ directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the probe_z_offset parameter from delta_calibrate and
bed_tilt_calibrate to a z_offset parameter within the probe config
section. It's easier to understand the z offset setting when it is in
the probe config section.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a z_virtual_endstop is in use, then record the last XY position
that is used when the Z is homed. Use that XY position to report what
change is needed to the z position_endstop.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename the digital_output, pwm_output, and static_pwm_output config
sections to output_pin and move to a new module in the extras/
directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the code for the static_digital_output config section from
chipmisc.py to a new file in the extras/ directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It looks like OctoPrint is expecting the result from M114 to be
relative to the last G92 command. Also, introduce GET_POSITION to
report the actual location that the printer is at.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 9bc4239e now emphasizes the first line of a multi-line error
message, so rework startup_message to conform to that.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Report the first line of a multi-line error message twice - once as
part of the informational content, and once with the "!!" error
prefix.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a heater falls out of the target range, accumulate the temperature
differences to determine if an error should be raised. This should
make it less likely to report an error for heaters that drift slightly
out of range, and it should make error reporting faster for heaters
that rapidly fall out of range.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
A default of 4 degrees and 10 seconds may be too aggressive - change
the default to 10 degrees and 15 seconds.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for additional carriages on cartesian printers. This is
used by some printers to handle multiple extruders.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Separate out the hd44780 screen drawing from the st7920 code. Use a
layout that takes advantage of the 20 columns. Add custom hd44780
fonts.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for displaying basic status information on ST7920 and
HD44780 based LCDs that are attached directly to a micro-controller.
Signed-off-by: Marcio Teixeira <marcio@alephobjects.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support low-priority message transmits. This may be useful for bulk
commands that should be delayed util the comms are otherwise idle.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a lookup_command() method to the SerialReader class that provides
a wrapper that stores the serial and commandqueue references. This
makes it easier to run the send() method.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add --always flag to "git describe" command to get a build identifier
even if one checks out the repo with a depth parameter that prunes out
the last tagged version.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The multi-mcu clock syncing code relies on the ability to periodically
update the mcu clock adjustments. If a series of very long moves are
submitted then it is possible the adjustments could become unstable.
For example, if an adjustment is made to reduce a clock error over the
next couple of seconds, but it is applied to a longer period because
the next move lasts many seconds, then this would result in a bigger
adjustment for the following move, which would result in an even
bigger error when that move lasts many seconds. This can repeat until
the system destabilizes.
Check for cases where the print_time is far in the future of the
current estimated print time and average over a longer period in that
case. That should reduce the possibility of the adjustment code
becoming unstable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for directly printing from a local file on the host. This
may be useful if the host cpu is not fast enough to run OctoPrint
well.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The bed_tilt_calibrate command determines the tilt of the bed.
However, we need to report the tilt compensation which is the negative
of the bed tilt.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of using the toolhead class to determine if stats should be
reported, allow every printer object with a stats() callback to
determine if stats are needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Average clock sync times over approximately 30 seconds instead of 120
seconds so that the clock prediction responds to changes faster.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use both load_config() and load_config_prefix() functions when
dynamically loading a module from the extras directory - if the config
section name has parameters in it then use load_config_prefix().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
OctoPrint (and other software) will sometimes send additional commands
even if the previous command has not yet responded with an "ok".
Change the g-code input reading code to keep reading input so that an
M112 can be detected (and processed out-of-order). To avoid the
extreme case where one writes an entire g-code file to the input
without any pacing, disable the input reading if more than 20 commands
are pending.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the script being run raises an error, then stop running that script
and return the error to the caller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Specify hardware pwm cycle times using the same method as software pwm
(in seconds, not clock ticks). Allow the fan code to be configured
with an explicit cycle time even when using software pwm.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the mcu supports command restarts and it does not appear to use a
real serial port, then default the restart method to 'command'. This
is a better default on boards with native USB support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Report the current temperature, current pwm setting, and target
temperature as statistics in the log.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for disabling homing checks via the homing_override
mechanism. This may be useful to move an axis prior to homing it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a virtual pin that may be used as the z endstop pin on
cartesian printers that use the probe in place of a z endstop.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow a set of g-code scripts to be run on each probe invocation.
This may be useful for probes that need to be setup before they are
useful (eg, with servo actuated probes).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow users to override the behavior of G28 using a new
"homing_override" config section. This may be used on printers that
require specific steps during the homing process.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The print cooling fan and printer heater_fan are independent modules
that can reside in the extras directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Check if a config section matches a python filename in the
klippy/extras/ directory. If it does, load that python code to handle
the config section.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of hardcoding which objects are called on state transitions,
allow any "printer object" to be invoked if it has a printer_state()
method. Convert connect, ready, shutdown, and disconnect callbacks to
this mechanism.
Similarly, allow all printer objects to provide a stats() callback.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add get_reactor(), lookup_object(), lookup_module_objects(), and
set_rollover_info() to the main Printer class so that callers do not
need to peek into the class' members. Similarly, add get_printer()
and get_name() methods to the ConfigWrapper class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If register_command() is passed None as the function to call, then
treat it as an unregister command request.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the existing reset_last_position() code in cmd_G28() instead of
manually implementing the logic.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The previous code increases print_stall if a move is proactively
flushed due to buffer_time_low and a follow up move is ready to send
before the existing moves are fully retired. However, this would not
track the case where a move is proactively flushed and it takes an
extended amount of time to get sufficient moves to refill the queue.
Change the code so that print_stall increases anytime a new move is
queued after a proactive flush and there are existing moves not yet
fully retired.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Determine the median period from the pin tuning tests and use that to
recommend a set of PID parameters. Report the results over the g-code
terminal.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Enable all the steppers via the shift registers when the first stepper
is enabled, and disable all the steppers once all steppers are
disabled. This avoids having to enable all the steppers all of the
time. Note that, this support is independent from the current control
for each stepper, which is still done individually.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The enable lines are not one per stepper - instead there are 5
distinct enable settings. Handle them properly.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the update_command() call to use a new PinResolver class. In
that new class, verify that the same pin isn't referenced in two
different parts of the config using different aliases for the pin.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's common for multiple steppers to use the same stepper enable
line. Detect this and only create a single digital_out oid on the
micro-controller.
Also, prohibit any other pin from being used multiple times in the
config file.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Always set the pin_params['type'] field on a pin lookup. Rename
parse_pin_desc() to lookup_pin() to make the change more clear.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The extruder check_move() code will permit moves with huge extrusion
ratios if the amount extruded is tiny. (Some slicers emit these silly
moves - they are allowed because they are harmless.) Unfortunately,
the pressure advance code did not handle the huge extrusion ratios -
it would result in a massive, near instantaneous, extruder move in an
attempt to build pressure in the extruder. Catch this case and limit
the impact to the pressure advance code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Added the pwm_cycle_time option for heater config sections. Defaults
to previous value of 0.100 seconds, but may be reduced to shorter times
at the expense of MCU workload and possible MOSFET heating, depending on
controller design. Some printers that need bed PID to be enabled,
notably the Felixprinters series, are known to benefit from shorter
cycle times, as the default 10hz rate results in excessive voltage
supply droop.
While this option can be used on extruder heaters as well, there
is not expected to be any particular benefit from doing so unless
the extruder heater presents a particularly large load.
Signed-off-by: Andy Silverman <andrewsi@outlook.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add PID_SETTLE_DELTA and PID_SETTLE_SLOPE constants to the code to try
and make it a little more clear how the wait for temperature code
works.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Group commands by category instead of listing them in numerical
order. This is just code movement; no code changes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Store the gcc and binutils versions used in the compilation of the
firmware in the firmware data dictionary. Forward that information to
the log so it is available during debugging.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 002dc0df added rounding to the homing speed, but it did not
work if the configured homing speed was less than the printer's
maximum velocity. Move the speed rounding from stepper.py to
homing.py and make sure the rounded speed is less than the maximum
speed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add the ability to alias multiple output pins from a single pin alias.
This makes it possible to support some cases where a single logical
output is driven by multiple output pins.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add the ability to define output pins that may be set at runtime with
a new SET_PIN extended g-code command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The atmega168 and atmega328 need to define PE0 and PE1 in order to
support the 2 extra analog pins.
Also, support the arduino mappings for the atmega328.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the config file so that the delta arm length is specified
per-tower. This makes it possible to support advanced calibration.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the formulas for trilateration (instead of the circumcenter
formulas) when calculating the position of the nozzle from the
position of the carriages. The trilateration formula is more general
and it allows each tower to have a different arm length.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's valid to consider the stepper at a position that is not on a step
interval - only the "mcu position" needs to be an integer.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new config option 'homing_endstop_align_zero' to enable the
alignment of the endstop to a stepper full step. It's possible one
may wish to specify a homing_endstop_phase while not aligning the
endstop.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the homing logic out of toolhead.py and into homing.py. This
simplifies the toolhead logic and centralizes the homing code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reset the last step clock during the init phase and after each home -
this simplifies the runtime code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure to always call MCU_endstop.home_wait() if
MCU_endstop.home_start() is invoked. Rename
MCU_stepper.note_homing_triggered() to note_homing_end() and make sure
it is always called if MCU_stepper.note_homing_start() is invoked.
With these changes, MCU_endstop.home_finalize() is no longer needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The homing code wants the list of endstops to enable during a homing
operation - it's confusing to pass the steppers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that commands can be registered dynamically, move the code for
SET_SERVO from gcode.py to the PrinterServo() class in chipmisc.py.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Translate caught exceptions into a gcode.error() exception. This way
there is one standard place to invoke respond_error(). Also, always
reset the last_position on a handled error.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit e05c6354 changed the internal step compress queue from 64bit
integers to 32bit integers. However, that commit broke the proactive
flushing of moves that could produce more than 64K steps. This could
lead to large memory allocations and cpu slow downs on printers that
had a very large Z axis - possibly leading to a "Timer too close" mcu
shutdown. Correct the code so that it properly generates a 64bit
flush clock.
Also, be sure to only expand / memmove the queue when there is no room
for a new element at the end.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of adding 250ms to each homing operation add a time relative
to the number of estimated steps that are to be generated. This
scales the delay to really large axes without adding a delay for
normal users.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow multiple steppers to be defined for a single cartesian axis.
This adds support for dual-z setups.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add wrappers around mcu_endstop and mcu_stepper so that the kinematic
classes do not need to directly access these low-level classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If an MCU signals a shutdown from the background thread, notify the
main thread and handle the shutdown there. Dispatch shutdown handling
from the main Printer() class instead of from the Toolhead class.
This simplifies the shutdown logic.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the start value to be different from the default/shutdown value
for the pin. This will be useful for "heater fans" that should
startup in the off state, and transition to full on in a shutdown
state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Continue to sample the ADC input pins even if the MCU goes into a
shutdown state. This enables the printer to continue reporting
temperatures even on an mcu error.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>