It is possible to restart the host software with a RESTART command
after manually resetting the micro-controller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of splitting the available "add range" in half, try for add
values closer to the higher end of the range. This heuristic seems to
result in better choices.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the min/maxadd variables to use an inclusive range instead of
exclusive. This better matches min/maxinterval.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make it clear which variables refer to the best verified point found
so far, and which variables deal with the next (not yet verified)
point.
Also, remove checked_count as bestcount serves the same purpose.
Also, allow minmax_point to be inlined.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The arduino style serial port interfaces can reset the MCU when the
serial port is opened. Clearing the HUPCL flag makes this less
likely.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a speed is never specified then default to 25mm/s (up from 1 mm/s).
If a user accidentally issues a move without setting the speed, the
default speed shouldn't be so slow that it takes minutes to finish the
move.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Most moves are on the XY plane - avoid a few multiplications in the
inner loop in this case. When there is a Z move, it is almost always
entirely a Z move - avoid the sqrt() call in the inner loop in this
case.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Taking the inverse of the XY move distance can lead to extremely large
values when the XY distance is very small. This can lead to
saturation of the double precision variables and incorrect results.
Rework the delta kinematic math to avoid using this inverse. Pass the
closestxy_d value directly to the C functions so that the C code can
calculate its intermediate constants.
After this change the move_z special case is no longer necessary as
the regular delta functions now work with movexy_r=0 and movez_r=1.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The head may be far away from an axis at the start of a home, and that
axis must then traverse more than just the distance from zero height
to the endstop position. Add in additional distance to account for
this.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
On a delta printer, z moves require the mcu to support the greatest
number of steps per second. However, z moves are rare, so it makes
sense to limit the velocity of z moves separately from the velocity of
normal xy moves.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the config file so the maximum accel and velocity are specified
in the "printer" section instead of the individual "stepper" sections.
The underlying code limits the velocity and accel of the toolhead
relative to the print object, so it makes sense to configure the
system that was as well.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a "restart" gcode command that will cause the host "klippy"
software to reload its config and restart.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support human readable commands (eg, "help"). Add a "help" command to
list these extended commands.
Also, add support for declaring command aliases, command help, and
command availability next to the handlers themselves.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 1e1364c3 moved the storage of the stepper position to the
mcu_stepper class. The initializing of that position needs to be
pushed back until after the mcu_stepper class is instantiated.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The set_printer_ready() method can be called from a background thread.
Have the main Printer class call a new dump_debug() method in the main
thread on a shutdown event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Check that all options specified in the config file are valid. This
catches possible typos and spelling errors in variable names that have
a default.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add helper function that ensures a config option is one of several
choices. This helps ensure that a proper error is raised if an
invalid choice is made.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of writing error messages to stderr, route them into the
python code and use the standard python logging system.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the greenlet mechanism to wait for the response directly in the
send_with_response() method. This simplifies the calling code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the greenlet mechanism to wait for the connection to come up in
the serial connect() method. This simplifies the calling code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Setup the reactor and run the MCU connection code as a timer within
the reactor. The connection code will make use of reactor greenlets
so that it can wait for events during the connection phase.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>