aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/mcu.py
Commit message (Collapse)AuthorAgeFilesLines
* mcu: Shutdown if a spontaneous restart of an mcu is observedKevin O'Connor2020-03-221-3/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* clocksync: Remove no longer used get_adjusted_freq() functionKevin O'Connor2020-03-061-2/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Calculate homing rest_ticks via standard print_time_to_clock() callKevin O'Connor2020-03-061-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Introduce new lookup_query_command() command wrapperKevin O'Connor2020-02-201-37/+51
| | | | | | | 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>
* serialhdl: Convert queries to use new notify message ack systemKevin O'Connor2020-02-201-5/+38
| | | | | | | | | | | 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>
* homing: Don't raise a TimeoutError from home_wait()Kevin O'Connor2020-02-191-4/+1
| | | | | | | 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>
* homing: Replace notify callback with a completionKevin O'Connor2020-02-191-9/+7
| | | | | | | | | 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>
* homing: Merge home_prepare()/home_finalize() into move_begin/move_end eventsKevin O'Connor2020-02-151-4/+0
| | | | | | | | 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>
* mcu: Minor simplification to default reset detectionKevin O'Connor2019-11-121-5/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Move MCU_stepper from mcu.py to stepper.pyKevin O'Connor2019-11-121-133/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* query_adc: Add a new module to help query and debug analog pinsKevin O'Connor2019-11-071-0/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Remove unused gen_steps()Kevin O'Connor2019-11-061-5/+0
| | | | | | | 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>
* mcu: Remove set_ignore_move()Kevin O'Connor2019-11-061-15/+4
| | | | | | | Update callers of set_ignore_move() to use the trapq system to set a stepper to ignore moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Add support for generating steps from a trapqKevin O'Connor2019-11-061-3/+35
| | | | | | | 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>
* mcu: Contact and identify all the mcus prior to configuring themKevin O'Connor2019-11-061-20/+23
| | | | | | | | | | | 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>
* 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>