aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/mcu.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* pru: Support config_reset command to manually reset mcuKevin O'Connor2017-09-031-10/+26
| | | | | | | Add support for resetting the MCU via a software only mechanism. This is useful on the PRU. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Add get_mcu() call to the mcu oid objectsKevin O'Connor2017-08-291-7/+10
| | | | | | | | | Allow external code to obtain the mcu object that controls a pin setup with setup_pin(). Also, don't bother defining print_to_mcu_time() and system_to_mcu_time() on each pin object as they can be obtained via the new get_mcu() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Fix bug causing corexy to not work (introduced in 9d75c3b0)Kevin O'Connor2017-08-291-2/+2
| | | | | | | | | Commit 9d75c3b0 changed the order of allocation for mcu oid integer ids. However, the stepper oids must always be allocated before endstop oids so that corexy can register multiple steppers on a single endstop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Drop support for TICKS() expansion in mcu config commandsKevin O'Connor2017-08-261-10/+11
| | | | | | | It's no longer necessary to use the TICKS() hack as the config commands are now all generated after the mcu speed is known. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chipmisc: Add support for statically configured output pinsKevin O'Connor2017-08-261-12/+40
| | | | | | | Allow digital and PWM output pins to be setup via new config sections. This makes it easier to setup pin configurations. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Track stepqueues separately from steppersKevin O'Connor2017-08-251-6/+6
| | | | | | | | The MCU() class needs to track the stepqueues so that it can initialize the steppersync object. Track the stepqueues directly instead of via the list of steppers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Track oids separately from objects requiring a build_config() callbackKevin O'Connor2017-08-251-13/+18
| | | | | | | | Track the oid count separately from the configurable object count - this way it is possible to have internal objects that don't require an oid in the mcu. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Eliminate "init callback" phase during connectKevin O'Connor2017-08-251-28/+21
| | | | | | | | It's not necessary to register and execute "init callbacks" when configuring the mcu. Instead, have each mcu object produce its init messages in the build_config() callback. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Support registering arbitrary chips that supply configurable pinsKevin O'Connor2017-08-251-66/+76
| | | | | | | | | Allow multiple chips to provide pin mappings (not just the main mcu chip). Move the pin parsing from the mcu.py code to pins.py and support mapping from pin descriptions to their corresponding chips and parameters. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Store printer startup parameters in new "start_args" dictionaryKevin O'Connor2017-08-251-11/+22
| | | | | | | | | Store pertinent information from the software startup in a dictionary that the various printer components can access instead of in individual variables in the Printer() class. This makes it easier to add future command-line options. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* irq: Support sleeping when mcu is idleKevin O'Connor2017-07-171-2/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Support converting from a system time to an mcu timeKevin O'Connor2017-07-171-0/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Use newer "except XYZError as e" python syntaxKevin O'Connor2017-06-101-1/+1
| | | | | | Use the newer syntax for python exceptions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Support working with pseudo serial devicesKevin O'Connor2017-05-151-1/+5
| | | | | | | Support working with devices that aren't really serial ports and thus do not have a baud rate. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pwmcmds: Export the maximum PWM valueKevin O'Connor2017-05-151-4/+8
| | | | | | | Instead of assuming the maximum PWM value is 255, export a constant from the firmware to the host with the maximum value. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* queuelogger: Add critical information to each logfile on rolloverKevin O'Connor2017-05-011-0/+11
| | | | | | | When the log file does a rollover, start the top of the log with critical system information (eg, software versions). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: No need to log mcu_stats debuggingKevin O'Connor2017-04-141-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Change "Synchronizing mcu clock" logging to debugKevin O'Connor2017-04-141-1/+4
| | | | | | | Always log the last synchronized clock during a shutdown event, and use debug level for normal reports. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Remove CLEAR_SHUTDOWN commandKevin O'Connor2017-04-131-5/+0
| | | | | | | | Advice users to issue a FIRMWARE_RESTART command on a printer shutdown event, and remove support for CLEAR_SHUTDOWN. A full mcu reset is preferable and it simplifies the interface. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Make sure a FIRMWARE_RESTART actually resets the mcuKevin O'Connor2017-04-131-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* hub-ctrl: Add support for micro-controller reset via RPi usb power togglingKevin O'Connor2017-04-131-9/+25
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Support reset commandKevin O'Connor2017-04-131-4/+27
| | | | | | | Extend the FIRMWARE_RESTART command so that it can use the firmware "reset" command instead of the "arduino" mechanism. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Support minimum/maximum value checks on configuration variablesKevin O'Connor2017-04-111-1/+2
| | | | | | | Verify that numeric parameters are in a sane range when reading the config. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* delta: Make it clear that a "virtual tower" is createdKevin O'Connor2017-04-071-6/+4
| | | | | | | | | | | The delta code calculates a "virtual tower" along the line of movement. Rework the variable names and comments to make it clear that this is occurring. It is not necessary to pass the start_pos variable to the C code as it is simple to update the start_pos at the start of each movement. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Merge stepcompress_delta_const and stepcompress_delta_accelKevin O'Connor2017-04-071-16/+3
| | | | | | | | It's not necessary to have separate C delta kinematic functions for constant acceleration and constant velocity as constant velocity can be obtained by using a constant acceleration of zero. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Pass delta velocity and acceleration directly to C codeKevin O'Connor2017-04-071-22/+13
| | | | | | | | Update the C delta kinematic code to take velocity and acceleration directly in step distances and clock ticks. This simplifies the mcu.py python code as it only needs to do unit and axis conversion. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Merge stepcompress_push_accel() and stepcompress_push_const()Kevin O'Connor2017-04-071-10/+1
| | | | | | | | It's not necessary to have separate C functions for constant acceleration and constant velocity as constant velocity can be obtained by using a constant acceleration of zero. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>