In practice, these errors are usually due to problems on the host
computer instead of problems with communication.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The tmc2130 (and tmc5160) will respond back with the value written
during the next SPI command. Use this feature to verify that the
value written matches the value sent.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't try to detect a "real serial port" in serialhdl.py. Instead,
have the callers invoke either connect_uart(), connect_file(), or
connect_pipe().
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>
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>
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>
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>
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>
The existence of a __del__() method prevents deallocation on python2
if there are circular references. Just remove the method as
disconnect() should already be called directly.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some mcu implementations don't like it when the pwm pin is configured
twice, so use the normal schedule_pwm_out implementation to update on
a restart.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This makes sure output pins are reset to their defaults when the host
is restarted and the micro-controller is not.
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>
Fysetc Cheetah v1.2 boards require a special sequence to reset reliably.
This sequence works for me in all cases. Simpler sequences without
double reset did not work correctly. This is likely because of a weird
stateful circuitry for toggling the bootloader state.
Cheetah boards use RTS to configure bootloader triggering. By default,
pySerial sets RTS on connect, which unfortunately configures the board
to start the bootloader on reset.
Add a toggle for the RTS state to allow users to workaround. The RTS state
is set before the serial connection is opened, so there are no glitches.
Addresses #2026.
Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
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>
Convert standard queries to use the acknowledgments of the sent
command to determine if the response was received or not. This also
controls command retransmissions (should the response have been lost).
The tmc_uart.py will continue to use the old mechanism as the tmcuart
responses are not sent synchronously with the query command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change home_wait() to return if the homing operation completed
succesfully or not. This simplifies the callers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update the endstop code to return its trigger completion object during
home_start(). Update the toolhead class to take a completion object
(instead of creating its own). This reduces the number of
intermediate callbacks needed during a homing operation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Collapse the "homing:move_begin", "homing:move_end", home_prepare(),
and home_finalize() into two new events: "homing:homing_move_begin"
and "homing:homing_move_end". This simplifies the homing code.
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>
Break up the connect phase into two phases - mcu_identify and connect.
The first phase will contact all the micro-controllers and obtain the
"identify" data dictionaries for them. Once all the micro-controllers
have been contacted, then they can be configured. This fixes an issue
with FIRMWARE_RESTART not working correctly on multi-mcu setups that
use restart_method=command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename the commands.
The main reason for this change is to force a micro-controller code
updated (due to important bugfix in 7fefe52d).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that homing is implemented via "drip moves", it is no longer
necessary for the stepcompress code to have special homing logic.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>