aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/mcu.py
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* pins: Remove module level get_printer_pins() and setup_pin() functionsKevin O'Connor2018-04-041-1/+1
| | | | | | | | Most callers did a lookup of the pins module via printer.lookup_object("pins"). Use that as the standard method and remove these less frequently used methods. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Automatically clear rollover_info on each restartKevin O'Connor2018-04-031-2/+0
| | | | | | | Automatically clear the information printed at the start of each log file rollover on a klippy internal restart. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Add a wrapper around the results of lookup_command()Kevin O'Connor2018-02-271-49/+40
| | | | | | | | Add a lookup_command() method to the SerialReader class that provides a wrapper that stores the serial and commandqueue references. This makes it easier to run the send() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Fix PWM static start value setupDave Bacon2018-02-101-1/+1
| | | | | | config_setup uses ._start_value instead of ._static_value which isn't defined. Signed-off-by: Dave Bacon <drb.github@mrbacon.com>
* klippy: Allow any stats producer to determine when stats are neededKevin O'Connor2018-02-051-2/+2
| | | | | | | | Instead of using the toolhead class to determine if stats should be reported, allow every printer object with a stats() callback to determine if stats are needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Clarify hardware_pwm and allow cycle_time to be set on software pwmKevin O'Connor2018-01-291-13/+8
| | | | | | | | Specify hardware pwm cycle times using the same method as software pwm (in seconds, not clock ticks). Allow the fan code to be configured with an explicit cycle time even when using software pwm. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Default the restart method to 'command' on non-serial portsKevin O'Connor2018-01-291-2/+8
| | | | | | | | If the mcu supports command restarts and it does not appear to use a real serial port, then default the restart method to 'command'. This is a better default on boards with native USB support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* probe: Support activate/deactivate scripts on each probeKevin O'Connor2018-01-281-0/+4
| | | | | | | | Allow a set of g-code scripts to be run on each probe invocation. This may be useful for probes that need to be setup before they are useful (eg, with servo actuated probes). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* probe: Initial support for Z-Probe hardwareKevin O'Connor2018-01-281-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Support generic printer_state() and stats() callbacksKevin O'Connor2018-01-281-15/+22
| | | | | | | | | | | Instead of hardcoding which objects are called on state transitions, allow any "printer object" to be invoked if it has a printer_state() method. Convert connect, ready, shutdown, and disconnect callbacks to this mechanism. Similarly, allow all printer objects to provide a stats() callback. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Add access methods and avoid peeking into the printer classesKevin O'Connor2018-01-281-36/+28
| | | | | | | | | Add get_reactor(), lookup_object(), lookup_module_objects(), and set_rollover_info() to the main Printer class so that callers do not need to peek into the class' members. Similarly, add get_printer() and get_name() methods to the ConfigWrapper class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Check if the same pin is referenced via different aliasesKevin O'Connor2018-01-101-9/+8
| | | | | | | | Change the update_command() call to use a new PinResolver class. In that new class, verify that the same pin isn't referenced in two different parts of the config using different aliases for the pin. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Setup static values via setup_start_value() callKevin O'Connor2018-01-081-24/+21
| | | | | | | Add an "is_static" setting to setup_start_value() and remove the setup_static() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Only report an MCU timeout onceKevin O'Connor2018-01-081-2/+4
| | | | | | Don't flood the log with timeout messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Add gcc and binutils version to mcu data dictionaryKevin O'Connor2017-12-211-2/+2
| | | | | | | | Store the gcc and binutils versions used in the compilation of the firmware in the firmware data dictionary. Forward that information to the log so it is available during debugging. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Allow both shutdown and startup values to be set for output pinsKevin O'Connor2017-12-181-13/+18
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Store MCU_stepper commanded_pos as a floatKevin O'Connor2017-12-071-7/+6
| | | | | | | It's valid to consider the stepper at a position that is not on a step interval - only the "mcu position" needs to be an integer. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Remove unneeded MCU_digital_out.get_last_setting() methodKevin O'Connor2017-12-061-4/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Reset the stepper step clock on init - not after each motor onKevin O'Connor2017-12-061-13/+8
| | | | | | | Reset the last step clock during the init phase and after each home - this simplifies the runtime code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Be sure all moves are completed before raising a home timeoutKevin O'Connor2017-12-061-7/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Make sure to clean up homing state even if homing failsKevin O'Connor2017-12-061-17/+18
| | | | | | | | | | | Make sure to always call MCU_endstop.home_wait() if MCU_endstop.home_start() is invoked. Rename MCU_stepper.note_homing_triggered() to note_homing_end() and make sure it is always called if MCU_stepper.note_homing_start() is invoked. With these changes, MCU_endstop.home_finalize() is no longer needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Pass list of endstops (not steppers) to the homing codeKevin O'Connor2017-12-061-0/+2
| | | | | | | The homing code wants the list of endstops to enable during a homing operation - it's confusing to pass the steppers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Make sure steppers added to an endstop are on the same mcuKevin O'Connor2017-12-061-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Make sure all endstop objects are disabled on a reconnectKevin O'Connor2017-12-061-0/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Add get_endstops() / set_position wrappersKevin O'Connor2017-11-181-0/+2
| | | | | | | Add wrappers around mcu_endstop and mcu_stepper so that the kinematic classes do not need to directly access these low-level classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Fix command restartKevin O'Connor2017-10-121-3/+3
| | | | | | | Fix omission in commit f8750b14 that broke restarts via Klipper command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>