aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/mcu.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* klippy: Rework shutdown handlingKevin O'Connor2017-10-121-4/+6
| | | | | | | | | If an MCU signals a shutdown from the background thread, notify the main thread and handle the shutdown there. Dispatch shutdown handling from the main Printer() class instead of from the Toolhead class. This simplifies the shutdown logic. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gpiocmds: Allow the start value for a pin to differ from the default_valueKevin O'Connor2017-10-121-11/+24
| | | | | | | | | Allow the start value to be different from the default/shutdown value for the pin. This will be useful for "heater fans" that should startup in the off state, and transition to full on in a shutdown state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop: Eliminate end_stop_set_oversample commandKevin O'Connor2017-10-121-13/+6
| | | | | | | | | | Pass the sample_ticks and sample_count parameters directly in the end_stop_home command instead. This simplifies the code. Also, simplify calculation of next wakeup time in end_stop_oversample_event(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop: Support oversampling of the endstopKevin O'Connor2017-10-011-0/+9
| | | | | | | | Some printers can show occasional noise on the endstop pin. Support sampling the endstop pin multiple times to attempt to filter out this noise. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* clocksync: Add support for dumping internal state for debuggingKevin O'Connor2017-09-271-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Make dump_debug() output atomicKevin O'Connor2017-09-271-2/+2
| | | | | | | Build a single (very large) logging message with the debug state. This prevents the output from being fragmented. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Separate restart_microcontroller() into multiple functionsKevin O'Connor2017-09-201-38/+37
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Initial support for running Klipper in a Linux real-time processKevin O'Connor2017-09-201-1/+2
| | | | | | | Add support for compiling the Klipper micro-controller code as a real-time process capable of running on standard Linux systems. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Initial support for multiple micro-controllersKevin O'Connor2017-09-201-34/+73
| | | | | | | | | Add initial support for controlling multiple independent micro-controllers from a single Klippy host instance. Add basic support for synchronizing the clocks of the additional mcus to the main mcu's clock. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Move code around in MCU class to keep like code togetherKevin O'Connor2017-09-191-108/+107
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Move print_time to clock conversion code to clocksync.pyKevin O'Connor2017-09-191-9/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Add mcu wrapper functions and avoid direct acccess to mcu variablesKevin O'Connor2017-09-191-37/+39
| | | | | | | | Don't directly access any of the mcu class variables externally from the class. Add wrapper functions for those external callers that need access to some internal state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Implement print time to clock conversion in C codeKevin O'Connor2017-09-191-13/+8
| | | | | | | Implement the conversion from print_time to the local mcu's clock within the C code. This simplifies the python code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* clocksync: Don't export get_last_clock()Kevin O'Connor2017-09-191-32/+18
| | | | | | | Everywhere the data in get_last_clock() is used can be done just as easily with estimated_print_time(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* clocksync: Move clock synchronization code into new fileKevin O'Connor2017-09-191-12/+19
| | | | | | | Move the low-level clock synchronization code from serialhdl.py to a new file clocksync.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Update file purpose commentKevin O'Connor2017-09-191-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Pass print_time directly to MCU callsKevin O'Connor2017-09-191-48/+44
| | | | | | | | | Now that the print_time is always synchronized with the mcu_time, there is no longer a need to track mcu_time as a separate quantity. Eliminate references to mcu_time from the code and pass print_time directly in its place. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Synchronize print_time to main mcu's timeKevin O'Connor2017-09-191-29/+12
| | | | | | | | Instead of starting the print_time at zero, start it at the estimated time of the main mcu's clock. This simplifies the code and it ensures that print_time never goes backwards. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Return number of steps traveled from stepcompress_push()Kevin O'Connor2017-09-131-7/+4
| | | | | | | Return the same information from stepcompress_push() that is returned from stepcompress_push_const() and stpcompress_push_delta(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Don't pass mcu_freq to update_command()Kevin O'Connor2017-09-131-2/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Limit value range of PWM and digital outputs prior to transmissionKevin O'Connor2017-09-061-10/+7
| | | | | | | Make sure schedule_digital_out and schedule_pwm_out commands always go out with a value that is in range for the particular command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Improve error descriptions in Common_MCU_errorsKevin O'Connor2017-09-061-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Provide some further help on common MCU shutdown errorsKevin O'Connor2017-09-051-2/+28
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Limit ADC min/max range to a 16bit integerKevin O'Connor2017-09-051-2/+3
| | | | | | | | | Make sure the ADC range sent to the MCU can be encoded into a 16bit integer. Otherwise, if the provided min_temp/max_temp was outside the range of possible values it could result in a spurious mcu shutdown. In particular, the AD595 could not properly encode a min_temp of zero. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>