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>
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>
Update callers to use the printer.command_error reference instead of
directly using homing.CommandError() when raising or catching errors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new "on_restart" parameter to mcu.add_config_cmd() and only send
those commands on a host restart that does not involve a
micro-controller restart.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename try_load_module() so that it uses consistent naming for
"printer objects". Change the function to raise an error by default
if the specified module does not exist.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use new mcu.lookup_query_command() for all commands that query
information from the micro-controller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The STEPPER_BUZZ command needs to know if the axis is using radians
instead of millimeters so that it can move a more appropriate
distance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the only caller to set_commanded_position() is
set_position(), remove the set_commanded_position() method and pass
the set_position() call directly to the itersolve.c code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the homing code does not use get_commanded_position(), it is
no longer necessary to alter the low-level commanded position after a
homing move.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename calc_position() to calc_tag_position() and have it calculate
the value of the position from the last stepper set_tag_position()
call. This enables the calc_tag_position() code to be more flexible
as it can be run with arbitrary positions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the PrinterStepper and MCU_stepper classes have been merged,
there is no need for the add_to_endstop() method.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the enable line tracking out of the main stepper.py code. This
simplifies the main kinematic code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Directly disable all the stepper motors on a global motor_off() from
the StepperEnable() class in stepper_enable.py. This simplifies the
toolhead and kinematic classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Eliminate the old gen_steps() call now that all callers have been
converted to the newer trapq based generate_steps().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support associating a stepper_kinematics with a trapq. Support
generating steps from a time range on the given trapq.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't require (or permit) the user to specify a stepper_z
position_endstop when using the probe:z_virtual_offset mechanism. In
that case the position_endstop should always equal the probe's
z_offset - so no need to have the user specify it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't pass pin_type to lookup_pin() - instead, if a pin can be
inverted or can have a pullup, then the caller must explicitly specify
that when calling lookup_pin(). This simplifies the code for the
cases where it is not valid to invert or pullup.
Explicitly pass the pin_type to setup_pin() and have ppins.setup_pin()
apply default pullup and invert flags.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allocate the stepper_kinematics directly in mcu.py - that way the
kinematic classes don't have to interact with the chelper code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for an itersolve_set_position() function that sets a
stepper position from a cartesian coordinate. This eliminates the
need for both the python and C code to be able to translate from a
cartesian coordinate to a stepper position.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update the code to use the term "rail" when dealing with a motor
controlled "axis". A rail has a series of steppers and endstops that
control that motor controlled "axis".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>