aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/mcu.py
Commit message (Collapse)AuthorAgeFilesLines
* mcu: Prevent "math domain errors" in stats calculationKevin O'Connor2019-08-301-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Move reserved pin handling into PinResolver classKevin O'Connor2019-08-191-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop: Rename mcu end_stop commands to endstopKevin O'Connor2019-07-121-11/+11
| | | | | | | | | 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>
* stepcompress: Remove no longer needed stepcompress_set_homing()Kevin O'Connor2019-07-101-10/+0
| | | | | | | 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>
* homing: Implement homing via new toolhead "drip" movementKevin O'Connor2019-07-101-27/+31
| | | | | | | | | | | Rework the low-level implementation of homing movement. The existing mechanism buffers all homing movement into the micro-controller prior to starting the home. Replace with a system that buffers all movement into the host look-ahead buffer and then "drip feed" those moves to the micro-controllers. Then clear the host look-ahead buffer when all endstops trigger. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Rework home_wait() to use a reactor completionKevin O'Connor2019-07-101-34/+37
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Update SendWithRetry to use reactor completionsKevin O'Connor2019-07-101-4/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Use regular send_with_response() for query_endstop()Kevin O'Connor2019-07-101-16/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Integrate query_endstop_wait() into query_endstop()Kevin O'Connor2019-07-101-3/+1
| | | | | | There is no need to have two separate calls to query an endstop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop_phase: Fix endstop_phase on trinamic drivers that aren't invertedKevin O'Connor2019-06-211-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Support minclock in send_with_response() requestsKevin O'Connor2019-06-211-5/+11
| | | | | | | Enhance send_with_response() so that it supports queries with a minclock. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Move SerialCommand from serialhdl.py to mcu.pyKevin O'Connor2019-06-211-1/+23
| | | | | | | | Move the serial command wrapper class from serialhdl.py to mcu.py. This will allow that class to better support higher level functionality. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Eventually timeout connect attemptKevin O'Connor2019-06-211-2/+5
| | | | | | | If the serial connection has not been successful after 2.5 minutes then report an error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Add a get_msgparser() methodKevin O'Connor2019-06-211-7/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Rename register_callback() to register_response()Kevin O'Connor2019-06-211-9/+9
| | | | | | Rename the method and use that name in the mcu class as well. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Support a start value for soft pwm pinsKevin O'Connor2019-06-021-4/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gpiocmds: Specify soft pwm duration in clock ticksKevin O'Connor2019-05-261-2/+3
| | | | | | | | Improve the precision of soft pwm pulses by allowing the host to directly specify the clock duration of the pulse. This improvement in precision may be noticeable when controller servos (and bltouch). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Fix reserve pin checkKevin O'Connor2019-05-211-3/+3
| | | | | | Fix typo causing conflict with mcu name and constant name. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bus: Support bus enumerations and add support for reserved pinsKevin O'Connor2019-04-041-2/+17
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop: Use "pin_value" instead of "pin" when querying endstop stateKevin O'Connor2019-03-191-3/+3
| | | | | | | | | | Now that enumerations are available, any variable named "pin" can only be used to describe a gpio pin. Rename the end_stop_state "pin" parameter to "pin_value". Also, rename "end_stop_query" command to "end_stop_query_state" to notify users to upgrade both host and mcu code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Convert static strings to a more generic enumeration systemKevin O'Connor2019-03-171-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Attempt to verify that the probe raises after each probe attemptKevin O'Connor2019-01-211-2/+4
| | | | | | | | Query the bltouch state during the pin_up command to try and verify that the probe does actually retract. This may be useful to detect if the bltouch enters into an "error" state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Fix timing of endstop checkingKevin O'Connor2019-01-101-5/+8
| | | | | | | | Make sure to not query the given endstop until after the start of the requested operation. This ensures that the operation has started prior to querying the status of that operation. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Convert printer_state("connect") to an event handlerKevin O'Connor2019-01-081-3/+1
| | | | | | | Convert all users of the printer_state("connect") handler to register a "klippy:connect" event handler instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Convert printer_state("disconnect") to an event handlerKevin O'Connor2019-01-081-2/+2
| | | | | | | Convert all users of the printer_state("disconnect") handler to register a "klippy:disconnect" event handler instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Convert printer_state("shutdown") to an event handlerKevin O'Connor2019-01-081-2/+1
| | | | | | | Convert all users of the printer_state("shutdown") handler to register a "klippy:shutdown" event handler instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Allow set_stepper_kinematics() to set the kinematics back to NoneKevin O'Connor2018-12-241-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Add a set_commanded_position() method to MCU_stepperKevin O'Connor2018-10-101-10/+10
| | | | | | Add the ability to directly set the "commanded" stepper position. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Log MCU information before configuringKevin O'Connor2018-09-031-13/+17
| | | | | | | | Log the details of the MCU prior to attempting to configure the MCU. This way, the log contains the MCU information even if a configuration error occurs. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Rename add_config_object() to register_config_callback()Kevin O'Connor2018-09-031-13/+16
| | | | | | | | | Change the name of the config registration method and pass an explicit reference to the callback to the new method. This makes the relationship between mcu registration and build_config() more clear in the calling code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Avoid adding the same stepper multiple times to an endstopKevin O'Connor2018-08-261-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Minor whitespace changesKevin O'Connor2018-07-261-7/+14
| | | | | | Wrap lines at 80 columns. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Explicitly pass can_invert and can_pullup to lookup_pin()Kevin O'Connor2018-07-261-2/+1
| | | | | | | | | | | | 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>
* itersolve: Support calculating a stepper position from a cartesian coordinateKevin O'Connor2018-07-181-4/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Enhance itersolve stepper kinematics allocationKevin O'Connor2018-07-131-6/+10
| | | | | | | 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>
* klippy: No need to pass printer reference to add_printer_objects()Kevin O'Connor2018-07-121-7/+8
| | | | | | The config reference already stores a reference to the printer object. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Send mcu config and init immediately after building itKevin O'Connor2018-07-121-34/+35
| | | | | | | | | | Don't issue a get_config command after building the config as the built config may contain time sensitive initialization commands. Instead, send the config and init commands immediately after invoking the build_config() callbacks. This avoids some rare "timer too close" errors during configuration. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Add leading underscore to handle_shutdown() and handle_mcu_stats()Kevin O'Connor2018-07-121-5/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adccmds: Add support for min/max temperature check filteringKevin O'Connor2018-07-021-4/+7
| | | | | | | | | | | Extend the ADC out of range check so that it is possible to sample multiple times before going into a shutdown state. This reduces the chance that measurement noise will cause an error. In an actual over temperature (or under temperature event) it is expected that the sensor will consistently report the problem, so extra checks for an additional second or two should not substantially increase risk. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Support setting the stepper position via a cartesian coordinateKevin O'Connor2018-06-221-3/+5
| | | | | | | | | 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>
* itersolve: Move tracking of commanded position to itersolve codeKevin O'Connor2018-06-201-16/+13
| | | | | | | Track the commanded position in just the itersolve.c code instead of in mcu.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kin_cartesian: Remove stepcompress_push_const()Kevin O'Connor2018-06-201-21/+3
| | | | | | | 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>
* stepper_buzz: Convert to iterative solverKevin O'Connor2018-06-201-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* delta: Convert delta kinematics to use iterative solverKevin O'Connor2018-06-201-11/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Allow stepcompress_alloc() to be called earlyKevin O'Connor2018-06-201-9/+9
| | | | | | Don't require an mcu connection to allocate the stepcompress object. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: config_reset_cmd typo fixedcruwaller2018-06-011-1/+1
| | | | Signed-off-by: Petri Honkala <cruwaller@gmail.com>
* clocksync: Simplify is_active() checkKevin O'Connor2018-05-311-2/+2
| | | | | | | | | | | 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>
* mcu: Do not automatically restart MCU with new config if it is shutdownKevin O'Connor2018-05-291-0/+3
| | | | | | | 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>
* stepper: Add STEPPER_BUZZ commandKevin O'Connor2018-05-241-0/+3
| | | | | | Add a new command that can help diagnose stepper motor connectivity. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* z_tilt: Add support for Z_TILT_ADJUSTKevin O'Connor2018-05-221-2/+11
| | | | | | | Add new module to support independent adjustments to multiple Z steppers to account for bed tilt. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>