Commit Graph

992 Commits

Author SHA1 Message Date
Florian Heilmann 64e6d85898 sam4e8e: Add the SAM4e8e port
This can be flashed to e.g. the duet wifi using bossac. It requires a
later version as is currently included in the klipper repo (1.8
vs. 1.2). Comms are currently via UART0 only, USB serial is still TBD

Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2018-08-08 10:44:49 -04:00
Kevin O'Connor cf2393efc8 samd21: Add support for gpio pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-08-07 00:03:21 -04:00
Kevin O'Connor 7783767c35 klippy: Move tracking of accessed config items into _read_config() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-08-03 18:54:23 -04:00
Kevin O'Connor 82738955d2 virtual_sdcard: Check if other events need to run after each file read
Periodically check if other events need to run - this prevents the
virtual_sdcard processing from starving other events.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-08-02 20:27:34 -04:00
Kevin O'Connor f2d232ef77 force_move: Provide defaults for SET_KINEMATIC_POSITION parameters
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-08-02 08:58:18 -04:00
Kevin O'Connor c0c892d524 force_move: Add support for FORCE_MOVE command
Add initial support for commands that will forcibly move a stepper
(without updating the kinematic classes with the new position).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-26 12:44:07 -04:00
Kevin O'Connor a434341aa9 force_move: Simplify STEPPER_BUZZ code
Separate the setup and movement parts of cmd_STEPPER_BUZZ() into their
own functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-26 11:45:18 -04:00
Kevin O'Connor 2c5eba44ee force_move: Rename stepper_buzz.py to force_move.py
This is in preparation for extending the ability to make manual moves.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-26 11:15:51 -04:00
Kevin O'Connor 13ccb1a46f mcu: Minor whitespace changes
Wrap lines at 80 columns.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-26 10:54:31 -04:00
Kevin O'Connor 98580ac1c2 adc_temperature: Minor whitespace changes
Wrap lines at 80 columns.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-26 10:51:48 -04:00
Kevin O'Connor 334a839123 stepper: Minor whitespace changes
Wrap lines at 80 columns.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-26 10:18:10 -04:00
Kevin O'Connor 273a98d39a pins: Explicitly pass can_invert and can_pullup to lookup_pin()
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>
2018-07-26 09:44:45 -04:00
Kevin O'Connor 7d0f3649f3 spi_temperature: The query_thermocouple command is an init command
Make sure to use is_init=True when sending query_thermocouple -
otherwise, the config CRC is likely to mismatch on every connection.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 19:50:11 -04:00
Kevin O'Connor 63dffd9307 spi_temperature: Provide a default value for spi_speed
All of the Maxim chips support a 4Mhz spi transfer rate, so use that
as a default spi speed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 15:49:14 -04:00
Kevin O'Connor 5b124d59f2 spi_temperature: Remove spi_mode parameter
All of the Maxim chips can use SPI mode 1, so no need to configure it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 15:47:17 -04:00
Kevin O'Connor 70f765f62f spi_temperature: Don't raise error on a fault - invoke a shutdown
Raising an error from the background message reception thread isn't
well defined.  Instead, on a temperature fault, invoke a printer
shutdown.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 15:20:45 -04:00
Kevin O'Connor a084c38b41 spi_temperature: Eliminate get_configs() callback
Those chips that require an spi init sequence can generate the message
directly in the chip specific class.

Also, don't send an spi init message for chips that are read-only.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 15:20:38 -04:00
Kevin O'Connor c52c398ae8 spi_temperature: Eliminate self.chip_type variable
The chip type is now always unique in each class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 15:00:23 -04:00
Kevin O'Connor f168032901 spi_temperature: Eliminate check_faults() callback
The faults can be checked from the calc_temp() method.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 14:54:31 -04:00
Kevin O'Connor f20dd0c9be spi_temperature: Break up thermocouple code into individual classes
Break the Thermocouple() class into MAX31856(), MAX31855(), and
MAX6675() classes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 14:54:31 -04:00
Kevin O'Connor 7510efe827 spi_temperature: Use setup_minmax() to set the temperature range
Use setup_minmax() instead of directly reading the min/max temperature
from the config.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 14:12:00 -04:00
Kevin O'Connor 270080cd4c spi_temperature: Remove non-spi flags from SensorBase
The SensorBase class is used exclusively for SPI transfers, so no need
to track non-spi settings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 14:05:35 -04:00
Ricardo Amezquita 756514adef thermocouple: Add support for MAX6675 chip
The MAX6675 chip has a different read sequence than the MAX31855 chip.

Signed-off-by: Ricardo Amézquita <ramezquitao@cihologramas.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 11:16:05 -04:00
Kevin O'Connor eba252d3fd thermocouple: Add initial support for common SPI temperature sensing chips
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 11:16:05 -04:00
Kevin O'Connor 6a60fe998d mathutil: Log starting error in coordinate_descent()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 08:32:35 -04:00
Kevin O'Connor fce993478c delta_calibrate: Fix typo in config output (radius should be delta_radius)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-22 11:47:49 -04:00
Kevin O'Connor cb29143939 itersolve: Support calculating a stepper position from a cartesian coordinate
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-18 11:51:28 -04:00
Kevin O'Connor acefe26e0f idle_timeout: Move timeout handling from toolhead.py to new extras module
Move the "motor_off_timeout" tracking to a new module in the extras/
directory.  This makes it easier to customize the idle timeout
behavior.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-16 10:32:48 -04:00
Kevin O'Connor 0025fbf10d toolhead: Replace junction_deviation with square_corner_velocity
The junction_deviation configuration parameter has a number of quirks
that make it difficult to configure.  Replace it with a
"square_corner_velocity" configuration parameter.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-16 10:32:43 -04:00
Kevin O'Connor ca505bf4ac kinematics: Convert get_rails() method to get_steppers()
All callers of get_rails() actually just want the steppers, so return
them directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-16 10:16:16 -04:00
Kevin O'Connor 89835940f7 query_endstops: Move QUERY_ENDSTOP command to it own extras/ module
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-16 10:06:30 -04:00
Kevin O'Connor 28fa954487 delta: Store stable positions as integers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-15 22:05:13 -04:00
Kevin O'Connor 94dc8167c9 z_tilt: Don't default "points" parameter to "z_positions" parameter
It's rare to have all the Z stepper locations directly under the
printable surface, so using z_positions for points is not a good
default.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-15 10:30:27 -04:00
Kevin O'Connor 260d12af6d probe: Make sure there are at least 3 points even if using default_points
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-14 15:33:58 -04:00
Kevin O'Connor ce0f4fe038 delta: Minor change to get_position_from_stable()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-14 11:55:15 -04:00
Kevin O'Connor 2af73d1006 probe: Simplify mcu_probe stepper registration
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-13 17:14:33 -04:00
Kevin O'Connor a31c31aed4 mcu: Enhance itersolve stepper kinematics allocation
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>
2018-07-13 11:37:36 -04:00
Kevin O'Connor b988596519 toolhead: Fill cmove in toolhead instead of in each kinematic class
This simplifies the kinematic classes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-13 11:37:20 -04:00
Kevin O'Connor 8faab46ed2 toolhead: Move kinematic modules to new kinematics/ directory
Move extruder.py, cartesian.py, corexy.py, and delta.py to a new
kinematics/ sub-directory.  This is intended to make adding new
kinematics a little easier.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-12 22:50:25 -04:00
Kevin O'Connor 7d897d84d7 klippy: No need to pass printer reference to add_printer_objects()
The config reference already stores a reference to the printer object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-12 22:26:32 -04:00
Kevin O'Connor 5cdba1fda8 mcu: Send mcu config and init immediately after building it
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>
2018-07-12 12:54:12 -04:00
Kevin O'Connor 211e34e62b mcu: Add leading underscore to handle_shutdown() and handle_mcu_stats()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-12 12:19:04 -04:00
Kevin O'Connor 68d78f0791 delta: Minor comment updates
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-09 18:00:58 -04:00
Kevin O'Connor e1833e020a chelper: Use CLOCK_MONOTONIC_RAW
Switch the host code from the CLOCK_MONOTONIC clock to the Linux
specific CLOCK_MONOTONIC_RAW clock.  It's common for ntp to slew the
CLOCK_MONOTONIC clock to account for drift, and that can break the
host's ability to make accurate predictions of the micro-controller
clock.  This could lead to "move queue empty" errors.  The
CLOCK_MONOTONIC_RAW clock is not slewed and thus should not have this
problem.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-09 12:25:19 -04:00
Kevin O'Connor b4f03e8363 docs: Add display g-code commands to docs/G-Codes.md
Add M117 and M73 to the list of supported G-Codes.

Also, remove M117 from the list of commands reported by the HELP
command as that command is typically only used to list "extended
g-code" commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-08 10:12:23 -04:00
Kevin O'Connor b0ee323e2e heater: Introduce smooth_time config option; remove pid_deriv_time
Add generic temperature smoothing to the Heater class.  This is useful
to avoid min_extrude_temp and verify_heater errors due to measurement
noise.

Rename the pid_deriv_time config option to smooth_time so that the
smoothing amount need only be specified once.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-06 13:47:10 -04:00
Eric Callahan b91b0f24db gcode: fix for GET_POSITION (#454)
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-07-03 12:22:55 -04:00
Kevin O'Connor 0dbfa915de adccmds: Add support for min/max temperature check filtering
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>
2018-07-02 13:56:34 -04:00
Janar Sööt 3a1d9e779c buttons: Improve rotary encoder handler by using Ben Buxton state machine. (#445)
https://github.com/brianlow/Rotary

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2018-07-01 08:41:14 -04:00
Kevin O'Connor b41770caa6 tmc2130: Add a DUMP_TMC helper command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-30 19:01:56 -04:00
Kevin O'Connor 38d7b9ada0 buttons: Add initial support for detecting button presses
Add mcu support for periodically polling for a button press.  Add host
code support for registering buttons and invoking callbacks for them.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-30 14:28:51 -04:00
Kevin O'Connor 4061026c25 reactor: Add ability to register callbacks
Add the ability to register callbacks - both asynchronous (ie, from
another thread) and synchronous.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-30 14:13:47 -04:00
Kevin O'Connor ecf53e6194 gcode: Add run_script() method that is valid from non-command contexts
Add an ability to run a series of g-code commands from a reactor
callback that isn't part of the normal g-code command processing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-30 14:13:06 -04:00
Kevin O'Connor 4ad44e3e83 gcode: Rename run_script() to run_script_from_command()
Emphasize that the run_script() method is only valid when run from a
g-code command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-30 14:08:02 -04:00
Kevin O'Connor 53b718a621 pins: Strip pin names before trying to parse them
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-30 14:05:27 -04:00
Kevin O'Connor d725160706 mcp4451: Add initial support for programming the mcp4451 on lpc176x
Add support for programming smoothieboard current.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-29 21:20:12 -04:00
Arksine 640169310f display: fix for 128 x 64 pixel displays
Right justify fan speed and feed rate, keep progress centered.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-06-28 13:11:44 -04:00
Kevin O'Connor efb27f095c build: Cleanup whitespace errors
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-28 13:00:20 -04:00
Arksine e11851276d display: uc1701 spi fix
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-06-28 10:01:57 -04:00
Arksine 593b4d2656 display: add UC1701 graphics controller support
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-06-27 19:46:38 -04:00
Arksine 19d6205492 display: add VGA font
Font from fntcol16.zip package:
ftp://ftp.simtel.net/pub/simtelnet/msdos/screen/fntcol16.zip
(c) Joseph Gil
Font is public domain

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-06-27 19:46:38 -04:00
Kevin O'Connor 4889e8241d pid_calibrate: Update the heater's target temperature during calibration
Update the target temperature during the pid calibration.  This gives
additional feedback to the user and it makes it less likely that a
verify_heater error will be raised during calibration.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-27 14:39:20 -04:00
Kevin O'Connor 7e497af184 heater: Don't peak into Heater class member variables
The control classes should not peak into the heater member variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-27 14:32:10 -04:00
Kevin O'Connor 483c51e864 display: Move icons to their own module
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-27 13:18:03 -04:00
Kevin O'Connor e907253dba display: Move st7920 code to its own module
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-27 13:18:03 -04:00
Kevin O'Connor f85b43a789 display: Move hd44780 code to its own module
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-27 13:18:03 -04:00
Kevin O'Connor 373c7ff301 display: Move klippy/extras/display.py to klippy/extras/display/display.py
Move the display code into its own directory.  This is in preparation
for splitting it up into its own modules.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-27 13:18:03 -04:00
Kevin O'Connor 2622b439fc klippy: Allow extras modules to be directories
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-27 13:01:48 -04:00
Arksine d350e2c617 display: add M117 "show message" support
When M117 is followed by an empty string, the display will reset to
Klipper's default.

Internal modules may look up the display and directly call
set_message(), with a timeout if desired.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-06-27 12:33:25 -04:00
Arksine 8a0c9a457a display: M73 Updates
- Add M73 support for HD44780
- Include HD44780 USB and SD glyphs to differentiate progress type
- Fix bug that prevented M73 from updated when virtual_sd is enabled
- Add 5 second timeout to reset display when not Printing

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-06-27 12:32:30 -04:00
Kevin O'Connor 41058d22a6 toolhead: Disable all extruder motors on a motor_off()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-23 20:41:43 -04:00
Kevin O'Connor f08a0c5e93 lcd_st7920: Use a longer delay at the start of each command/data
It appears the st7920 requires a longer delay when switching from
command to data mode (and vice-versa).  Slower MCUs don't show a
problem because the klipper command processing time results in a
sufficient delay.  However, some of the faster MCUs can process
klipper commands fast enough that the next st7920 transfer is sent too
fast.  Add an additional delay to account for this.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 23:47:09 -04:00
Kevin O'Connor 74de181e59 delta: Don't peak into PrinterRail class from get_calibrate_params()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 15:42:20 -04:00
Kevin O'Connor d9a32f75fa probe: Rename get_position() callback to get_probed_position()
The different uses of get_position() can be confusing, so choose a
different name for the ProbePointsHelper callback.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 15:33:12 -04:00
Kevin O'Connor 3e88ffabf1 mathutil: Move trilateration code from delta.py to mathutil.py
Move the trilateration algorithm to mathutil.py.  It may be useful
outside of delta kinematics, and it complicates the delta code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:12:09 -04:00
Kevin O'Connor 77a2c95b5e delta: Remove the unnecessary StepList constant
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 4e01ab4ef0 corexy: Remove the unnecessary StepList constant
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 13acdf7832 cartesian: Remove the unnecessary StepList constant
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 890298d34d itersolve: Support setting the stepper position via a cartesian coordinate
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>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 0216201cb6 delta: Rename get_position() to calc_position()
Calculating the cartesian position from the stepper positions can be
complex and cpu intensive, so rename it to calc_position() to be more
descriptive.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 20b404ecf5 probe: No need to call kin.get_position() to report position
After a probe operation, homing_move() will already have recalculated
the toolhead position.  The get_position() method can be slow, so use
the already calculated position.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 0791c69499 stepper: Replace PrinterHomingStepper with PrinterRail
Update the code to use the term "rail" when dealing with a motor
controlled "axis".  A rail has a series of steppers and endstops that
control that motor controlled "axis".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 93d0526a77 stepper: Add a get_homing_info() method to PrinterHomingStepper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 968ed58b61 stepper: Add a get_range() method to PrinterHomingStepper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor b96542f0e5 stepper: Don't peak into PrinterStepper members
Add additional wrapper functions so that no outside callers need to
peak into the member variables of PrinterStepper.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 9a97a348ae stepper: Add a is_stepper_enabled() method to PrinterStepper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 28b7a28651 stepper: Don't store step_dist in PrinterStepper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor 544f8c1e85 stepper: Add a get_name() method to PrinterStepper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor d0590ccb0e stepper: No need to pass printer reference to kinematic/stepper constructors
The config reference already stores a reference to the printer object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-22 14:09:01 -04:00
Kevin O'Connor d94c856118 display: Allow the ST7920_DISPLAY parameter to be configured
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-21 09:58:35 -04:00
Kevin O'Connor 926829e737 itersolve: Move tracking of commanded position to itersolve code
Track the commanded position in just the itersolve.c code instead of
in mcu.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 8f747e2720 kin_cartesian: Remove stepcompress_push_const()
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>
2018-06-20 09:26:10 -04:00
Kevin O'Connor eb73b5d0b0 stepper_buzz: Convert to iterative solver
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor bbe53cf8e5 extruder: Convert to using iterative solver
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 7148ebd565 cartesian: Convert cartesian kinematics to use the iterative solver
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor fc4a9e7564 corexy: Convert corexy to use the iterative solver
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor ca0d0135dc delta: Convert delta kinematics to use iterative solver
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 2511471b0d itersolve: Add kinematic iterative solver code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor ba3428822d stepcompress: Allow stepcompress_alloc() to be called early
Don't require an mcu connection to allocate the stepcompress object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 9a2eb4bedd chelper: Move cartesian and delta kinematics code to their own C files
Move the cartesian and delta specific code to new files
kin_cartesian.c and kin_delta.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 8a830ff0ce chelper: Compile with gcc -fwhole-program option
Use the -fwhole-program option when compiling the host C code.  This
makes it easier to support inlining across C files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 189ebb4c7d chelper: Add compiler.h header
Add the compiler.h header file to the chelper code - this adds a
number of useful gcc definitions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor bedbfceafc stepper_buzz: Move STEPPER_BUZZ command from stepper.py to new file
Add a klippy/extras/stepper_buzz.py file to handle the STEPPER_BUZZ
command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor c60c9ee302 klippy: try_load_module() should return the module loaded
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Douglas Hammond 9519e05394 temperature_fan: Fix issue 403 use max_speed
Signed-off-by Douglas Hammond  <wizhippo@gmail.com>
2018-06-19 11:51:07 -04:00
Kevin O'Connor 780e3c3022 klippy: Return an error code if batch input results in an error
When reading from a debug input file, propagate any errors to the
program return status.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-16 16:18:01 -04:00
Kevin O'Connor efe63d5efe toolhead: Add support for the M204 command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-15 12:05:45 -04:00
Hans Raaf 4ec1244c31 Extras: Probing does reply with the z position where the probe triggers.
This change will make the "PROBE" command actually reply with the
z-position where the probe triggers. As this command is called
internally for the BED_TILT_CALIBRATE and Z_TILT_ADJUST those commands
will also give a response while probing, which I see as advantage over
the silent operation.

This change also lets one define some gcode for a repeatable probing
test to meassure the quality of the sensor and overall probing accuracy.

Signed-off-by: Hans Raaf <hr-klipper@oderwat.de>
2018-06-13 22:34:25 -04:00
Kevin O'Connor 3819ad2986 probe: Catch and propagate errors raised during ProbePointsHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-11 21:35:53 -04:00
Hans Raaf e110e1fecc homing_override: Add axes config parameter
Added a config parameter to define the homing override axes. This way
one can still home x and y axis without the z-probe cycle coming in the
way.

Signed-off-by: Hans Raaf <hr-klipper@oderwat.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-11 20:41:18 -04:00
Kevin O'Connor 4367a985e2 verify_heater: Disable when writing output to a debug file
Disable the verify_heater checks when debugging, as otherwise it can
cause failures when processing files in batch mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-08 23:51:41 -04:00
Kevin O'Connor 1ace688ea3 extruder: Report max_extrude_ratio in log
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-05 20:48:55 -04:00
Kevin O'Connor 183e0decf8 output_pin: Fix SET_PIN max_val check
The maxval should be self.scale.  Reported by @mvturnho.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-05 09:12:31 -04:00
Michael Barbour a748cf39eb stepcompress: Fix comment typo.
Signed-off-by: Michael Barbour <barbour.michael.0@gmail.com>
2018-06-04 09:41:55 -04:00
cruwaller 404cd376b5 gcode: mux command is already registered error print fixed
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
2018-06-01 16:05:10 -04:00
cruwaller 26378c2564 mcu: config_reset_cmd typo fixed
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
2018-06-01 09:49:55 -04:00
Kevin O'Connor ff9543eee2 clocksync: Simplify is_active() check
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>
2018-05-31 18:20:30 -04:00
Kevin O'Connor 1b1d2adb31 gcode: Apply SET_GCODE_OFFSET to next move command
Apply the changes made by a SET_GCODE_OFFSET command to the next move,
even if the move is relative to the last movement.  This allows the
command to implement "babystepping" requests.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-29 14:09:04 -04:00
Kevin O'Connor b93fd5b1b5 basecmd: Rename get_status to get_clock
Change the get_status command to get_clock.  Don't report the shutdown
status in the new get_clock command.

The primary purpose of this change is to force the host code to report
a firmware version mismatch with older firmwares as recent changes
(namely the ordering of message block acks) have subtle
incompatibilities if different host/mcu code is used.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-29 10:57:29 -04:00
Kevin O'Connor 879c45db19 mcu: Do not automatically restart MCU with new config if it is shutdown
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>
2018-05-29 10:57:29 -04:00
Kevin O'Connor d798fae20b serialqueue: Limit message transmission to available receive buffer size
If the mcu is using a traditional serial port, then only send a new
message block if there is space available in the mcu receive buffer.
This should make it significantly less likely that high load on the
mcu will result in retransmits.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-28 11:12:30 -04:00
Kevin O'Connor 0728c1a8be msgproto: Add support for a get_constant_int() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-28 10:43:40 -04:00
Kevin O'Connor 75f8709947 command: Wait to send ack until after processing commands
Send the ack after processing commands - this gives the host code more
information on serial buffer utilization.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-28 10:43:40 -04:00
Kevin O'Connor 20ddd842b7 klippy: Fix detection of mixed case section names
If a section name had mixed case it would cause an incorrect error
during the section/option config checking.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 12:47:51 -04:00
Kevin O'Connor c38a63d4db gcode_macro: Add the ability to define custom g-code macros
Add the ability to add a custom g-code command that in turn executes
one or more configured g-code commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 12:40:06 -04:00
Kevin O'Connor c78b90767f lpc176x: Add support for GPIO pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:52:13 -04:00
Kevin O'Connor 5ae22a5e51 tmc2130: Allow the PWMCONF register to be configured
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:38:27 -04:00
Kevin O'Connor 1e6fa5722a tmc2130: Initial support for sensorless homing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:38:23 -04:00
Kevin O'Connor 26246b1f28 tmc2130: Use an SPI rate of 4Mhz
The spec recommends 4Mhz for SPI, so use that.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:38:18 -04:00
Kevin O'Connor 3799f40f29 tmc2130: Configure stealthchop velocity limit
Change stealhchop config option to a stealthchop_threshold
configuration option.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:38:12 -04:00
Kevin O'Connor c4fe43ffce tmc2130: The default TOFF time should be 4
The recommended TOFF time in "standalone mode" according to the
tmc2130 is 4, so use that as the default.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-24 10:44:45 -04:00
Kevin O'Connor ee4f37fe0c stepper: Add STEPPER_BUZZ command
Add a new command that can help diagnose stepper motor connectivity.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-24 09:49:17 -04:00
FeepingCreature 237c242d65 Display M73-indicated progress plus linear ETA on ST7920 displays.
Signed-off-by: Mathis Beer <mathis_beer@yahoo.de>
2018-05-23 20:46:17 -04:00
Kevin O'Connor d7b29eca47 temperature_fan: Don't write "temperature_fan " to prefix stats
Just write the user provided name in the stats.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-23 18:22:02 -04:00
Kevin O'Connor 3e1febce78 temperature_fan: Don't always enable stats generation
Don't return True from the stats() method - that keeps stats logging
on permanently.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-23 00:27:32 -04:00
Kevin O'Connor 3025638b9b z_tilt: Add support for Z_TILT_ADJUST
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>
2018-05-22 22:23:44 -04:00
Kevin O'Connor 4bf1b042b1 console: Report timestamp on each read message
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-21 12:01:26 -04:00
Kevin O'Connor 680c92de40 tmc2130: Add initial support for TMC2130 stepper motor drivers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 18:03:06 -04:00
Kevin O'Connor 61fbd193f9 gcode: Reset extrude_factor and extruder position on a tool change
The extrude_factor and extruder position are specific to the current
extruder, so reset them to default values on a Tn command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 13:47:00 -04:00
Kevin O'Connor 33c2c8f1bd gcode: Raise an error if a duplicate command is registered
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 13:08:22 -04:00
Kevin O'Connor 2ab47cd20c extruder: Fix SET_PRESSURE_ADVANCE so that it works with multiple extruders
Use the new gcode.register_mux_command() so that SET_PRESSURE_ADVANCE
works correctly with multiple extruders.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 12:52:19 -04:00
Kevin O'Connor 75a1e9ea21 output_pin: Use new gcode.register_mux_command()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 12:44:02 -04:00
Kevin O'Connor 5a88a14afc servo: Use new gcode.register_mux_command()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 12:40:10 -04:00
Kevin O'Connor abe79056c9 gcode: Add ability to register a "mux" command
It's common to add commands that dispatch to a particular object
instance depending on the value of a command parameter.  (For example,
the command "SET_SERVO SERVO=xyz" wants to be handled by the
particular "xyz" servo instance.)  Add a register_mux_command() helper
to gcode.py make it easier to do this.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 12:33:43 -04:00
Kevin O'Connor 6869e7d1ec probe: Verify horizontal_move_z not less than probe's z_offset
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 11:41:28 -04:00
Kevin O'Connor c5bff88943 probe: Move code from bed_tilt and delta_calibrate into ProbePointsHelper
Move the common config reading and probe object lookup from the
bed_tilt.py and delta_calibrate.py code into the ProbePointsHelper
class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 11:41:07 -04:00
Kevin O'Connor 11816295e7 stepper: Raise an error if position_endstop is not in min/max range
Raise an error during config parsing if the position_endstop is not
between the position_min and position_max.  This avoids a confusing
error message during homing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-18 19:41:03 -04:00
Kevin O'Connor 2740838b2e fan: Allow the fan shutdown_speed to be configured
Add a shutdown_speed config option to fans so that users can specify
the speed on a shutdown event.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-18 19:12:03 -04:00
Douglas Hammond 5712283e91 Add temperature controlled fans
Signed-off-by Douglas Hammond  <wizhippo@gmail.com>
2018-05-17 12:50:21 -04:00
Kevin O'Connor c331406774 util: Change the /tmp/printer pty to be group readable
For some reason, Linux creates the pseudo tty with group writable
permissions, but not group readable.  Use chmod to allow the device to
also be group readable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-16 13:25:21 -04:00
Kevin O'Connor 907cfb9105 stepper: Fix typo in error report - name should be self.name
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-14 12:31:28 -04:00
Kevin O'Connor 6c3db80d89 homing: Apply speed rounding after calling home_prepare()
The step speed rounding and the cpu delay must be run after running
the endstop specific preparation code.  Otherwise, a delay in the
home_prepare() code could undo those calculations.  Specifically, this
could lead to errors on a multi-mcu setup when the Z is homed using a
virtual_z_offset and there is a delay in the activate_gcode section.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-14 11:40:35 -04:00
Michael Barbour bf3c41cd06 temperature_fan: Add support for temperature-triggered fan.
Signed-off-by: Michael Barbour <barbour.michael.0@gmail.com>
2018-05-10 19:32:23 -04:00
Kevin O'Connor 2e3fa8da13 console: Fix handling of bad commands
Don't return early on a command error - continue to process remaining
commands and pop commands from the queue.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-08 11:31:25 -04:00
Kevin O'Connor f70fefa06f linux: Convert linux SPI code to use the generic spicmds.c code
Use the generic spi send/receive code on Linux.  Update the replicape
code to use the updated command format.

Also, update the replicape code to turn off the stepper motors on a
shutdown event.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-07 09:10:34 -04:00
Kevin O'Connor 22487d95e9 spicmds: Rework SPI message transmission
Improve the SPI message transmit system.  Add support for bus speed
and bus mode.  Add support for sending SPI messages on shutdown.

Signed-off-by: Petri Honkala <cruwaller@gmail.com>
Signed-off-by: Douglas Hammond <wizhippo@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-07 09:10:34 -04:00
Kevin O'Connor 838da992e8 msgproto: Support sending empty strings from create_message()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-07 09:07:22 -04:00
Kevin O'Connor 99b233df3f serialqueue: Fix batching of BACKGROUND_PRIORITY_CLOCK messages
In order to properly delay BACKGROUND_PRIORITY_CLOCK messages, they
must be 5ms beyond the minimum defined by MIN_REQTIME_DELTA.  So, add
both MIN_REQTIME_DELTA and MIN_BACKGROUND_DELTA to the timing of these
messages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-05 20:59:33 -04:00
Kevin O'Connor 640ff1ad56 clocksync: Change timer frequency to avoid resonating with other timers
If the clock querying messages occur at a similar frequency to other
events on the micro-controller or host, then it's possible for the
load created by those other events to skew the clock synchronization.
In particular, the 500ms lcd screen update could resonate with the 1
second clock query.  Use an unusual clock querying frequency to avoid
this issue.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-05 20:14:46 -04:00
cruwaller 7fd14848ca chelper: Fix hub-ctrl compilation
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
2018-05-05 11:23:18 -04:00
Kevin O'Connor 1f11c171c7 thermistor: Add Honeywell 100K and MGB18 thermistor definitions
Add two additional thermistors (as suggested by Tim Miller).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-30 16:08:17 -04:00
Kevin O'Connor 15248706ae chelper: Move the host C code to a new klippy/chelper/ directory
Move the C code out of the main klippy/ directory and into its own
directory.  This reduces the clutter in the main klippy directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-30 11:44:53 -04:00
Kevin O'Connor 76bafadb71 virtual_sdcard: Add logging on start, stop, stats, and shutdown
Add additional logging to the virtual_sdcard support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-23 18:35:15 -04:00
Kevin O'Connor bdd26e421b toolhead: Add a SET_VELOCITY_LIMIT command
Add a command to adjust the maximum velocity, acceleration, and
junction deviation parameters.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 22:36:05 -04:00
Kevin O'Connor d5dc6b785d gcode: Add minval/maxval/above/below options to get_X parsers
Add value checking to gcode parameter parsing code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 22:24:36 -04:00
Kevin O'Connor 8f4f5da11c fan: Add a set_shutdown_speed() method
Add a set_shutdown_speed() method so that the heater_fan code does not
need to peek into the fan object's internal members.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 22:16:08 -04:00
Kevin O'Connor 6d03dee104 gcode: Add a SET_GCODE_OFFSET command
The M206 command is confusing (it uses negative offsets) and isn't
very flexible.  Add a new SET_GCODE_OFFSET command to make it easier
to add virtual offsets to gcode commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 20:04:41 -04:00
Kevin O'Connor 93262919ed gcode: Rename homing_add to homing_offset
The M206 command is confusing as positive values in that command
result in negative offsets to future g-code commands.  Perform the
parameter negation in the M206 command instead of storing it that way
internally.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 19:46:19 -04:00
Kevin O'Connor 68864333f3 probe: Limit Z lift speed to be the same as the probing speed
When using an automatic probe, limit the Z lift speed to be no greater
than the Z probing speed.  This can reduce Z jerks during probing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 14:00:41 -04:00
Kevin O'Connor eff1c8604d klippy: Reword the error messages during config file parsing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 13:38:08 -04:00
Kevin O'Connor 85e6cd865c fan: Scale fan speed requests between 0 and max_power
If the fan's max power is limited by the config, then scale speed
requests between 0 and max_power.  This makes more sense for typical
g-code fan speeds.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 13:15:03 -04:00
Kevin O'Connor 48e9fa04e7 toolhead: Allow max_accel_to_decel to be greater than max_accel in config
If max_accel_to_decel is greater than max_accel in the config, then
just internally limit max_accel_to_decel to max_accel.  This makes it
easier to completely disable the max_accel_to_decel feature (as it can
just be set to a high value in the config).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 12:50:04 -04:00
Grigori Goronzy 75d5737211 Add STM32F103 port
Add a fully functional STM32F1 port, currently mostly targeting STM32F103
microcontrollers. This requires an 8 MHz XTAL. The maximum possible step rate
is around 282K steps per second.

This uses stm32flash to burn the firmware. The bootloader needs to be started
by setting BOOT0 to 1 and resetting the MCU. There is no automatic bootloader,
unlike on Arduino.

Signed-off-by: Grigori Goronzy <greg@kinoho.net>
2018-04-09 18:08:29 -04:00
Kevin O'Connor 6466af6313 adc_temperature: Support defining custom sensors in the config file
Allow the user to define a custom sensor with their own set of
temperature/voltage measurements.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-09 15:44:34 -04:00
Kevin O'Connor c463893a5e adc_temperatures: Add "PT100 INA826" sensor type
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-09 15:12:35 -04:00
Kevin O'Connor b2caa486c5 adc_temperature: Support multiple ranges for ADC lookup
Instead of supporting a single linear range for the temperature
lookup, allow multiple ranges to be defined.  This makes the lookup
more accurate when a full lookup table is available.

Update the AD595 sensor to use the full table defined in its spec.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-09 15:06:53 -04:00
Kevin O'Connor 75b89f5261 thermistor: Fallback to using beta if Steinhart-Hart c3 is negative
If the c3 coefficient is negative it can cause the adc calculations to
fail.  The c3 shouldn't be negative in practice, so fallback to a
simple beta calculation in that case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-09 12:35:18 -04:00
Kevin O'Connor 8c8261ba80 thermistor: Add support for defining custom thermistors
Add the ability to define a new thermistor type in the config file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-09 12:17:39 -04:00
Kevin O'Connor 460cc88f3d pid_calibrate: Make sure to unregister new control class on error
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-06 11:39:24 -04:00
Kevin O'Connor 06d73207e7 heater: Move Thermistor and Linear to their own files in extras/
Move the Thermistor code to a new thermistor.py module.  Move the
Linear code to a new adc_temperature.py module.  This simplifies the
heater.py code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-04 23:14:55 -04:00
Kevin O'Connor 0fc4f0946e heater: Move adc logic into Thermistor class
The Thermistor (and Linear) class should handle all the details of
reading the ADC values and converting them to temperatures.  So, move
that logic out of the Heater() class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-04 23:14:33 -04:00
Kevin O'Connor 7e78b2665e heater: Merge ThermistorBeta class into Thermistor class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-04 23:13:55 -04:00
Kevin O'Connor aed958eb5c heater: Add PrinterHeaters class that stores all sensors and heaters
Add a PrinterHeaters class that can stores references to available
temperature sensors and stores references to instantiated heaters.

Add a extras/heater_bed.py file and delay instantiation of the
heater_bed object.  This allows the heater.py module to be imported
earlier during the setup phase, and allows the PrinterHeaters class to
be available for registering sensors and heaters.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-04 23:13:53 -04:00
Kevin O'Connor 4eeb43b191 pins: Remove module level get_printer_pins() and setup_pin() functions
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>
2018-04-04 12:26:39 -04:00
Kevin O'Connor a4439b93b7 toolhead: Limit junction speed of short moves
The existing junction algorithm limits the speed between two moves by
determining the maximum speed an arc between those two moves would
have if the cetripetal acceleration of that arc did not exceed the
printer's maximum acceleration.

However, should the slicer send an actual arc to the printer, then the
existing junction algorithm would not impose any significant limit on
the travel speed of that arc.  This would permit the head to travel in
a circle at high velocity and with a greater centripetal acceleration
than the printer's maximum acceleration.  To avoid this, impose a
limit on the junction velocity of short moves so that an approximate
centripetal acceleration of that move does not exceed the move's
acceleration limit.

Suggested by Michael Barbour.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-03 13:35:10 -04:00
Kevin O'Connor 5e060c3c65 bed_tilt: Apply bed_tilt_calibrate settings to current session
Apply the bed tilt settings immediately after finding them.  This
makes it easier for users to perform automatic tilt calibration at the
start of every print.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-03 13:18:53 -04:00
Kevin O'Connor 0f1a142779 extruder: Log SET_PRESSURE_ADVANCE changes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-03 13:18:53 -04:00
Kevin O'Connor bb8926d67a klippy: Automatically clear rollover_info on each restart
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>
2018-04-03 13:18:52 -04:00
Michael Barbour a301713361 extruder: Add SET_PRESSURE_ADVANCE command.
Signed-off-by: Michael Barbour <barbour.michael.0@gmail.com>
2018-04-03 00:00:41 -04:00
Kevin O'Connor b0b4bc8958 heater: Add some comments to the thermistor math
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-29 16:40:26 -04:00
Kevin O'Connor 99f3c99238 display: Round temperature and position to nearest whole number
The "%d" formatting truncates a floating point number - use "%.0f" to
show a rounded number.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-19 15:17:53 -04:00
Kevin O'Connor aba04bf3bd display: Remove unneeded semicolons from file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-19 15:16:01 -04:00
Kevin O'Connor 973ef97143 pid_calibrate: Move PID calibration logic from heater.py to new file
Drop support for M303 and PID_TUNE, and replace it with a new
PID_CALIBRATE command.  Move the logic for this command from heater.py
to a new pid_calibrate.py file in the extras/ directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-18 12:02:30 -04:00
Kevin O'Connor e3f9ff6701 probe: Add z_offset parameter
Move the probe_z_offset parameter from delta_calibrate and
bed_tilt_calibrate to a z_offset parameter within the probe config
section.  It's easier to understand the z offset setting when it is in
the probe config section.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-17 14:07:15 -04:00
Kevin O'Connor c95cc3fb66 bed_tilt: Take into account the XY position used with z_virtual_endstop
If a z_virtual_endstop is in use, then record the last XY position
that is used when the Z is homed.  Use that XY position to report what
change is needed to the z position_endstop.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-17 13:47:31 -04:00
Kevin O'Connor 1dda4628a0 bed_tilt: Require at least 3 probing points for bed_tilt_calibrate
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-17 13:47:31 -04:00
Kevin O'Connor 36612fd544 probe: Default z_position to the configured minimum position on Z axis
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-17 13:47:31 -04:00
Kevin O'Connor ef8c464d97 output_pin: Move pwm and digital output pins to new module in extras/
Rename the digital_output, pwm_output, and static_pwm_output config
sections to output_pin and move to a new module in the extras/
directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-17 13:46:36 -04:00
Kevin O'Connor 66eefa1da8 static_digital_output: Add static_digital_output section to extras/
Move the code for the static_digital_output config section from
chipmisc.py to a new file in the extras/ directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-17 13:06:51 -04:00
Kevin O'Connor e78377eebd replicape: Add config controls for the servo[01]_enable lines
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-17 12:55:48 -04:00
Kevin O'Connor 451f7d5672 gcode: Position returned by M114 should be relative to last G92
It looks like OctoPrint is expecting the result from M114 to be
relative to the last G92 command.  Also, introduce GET_POSITION to
report the actual location that the printer is at.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-15 20:00:51 -04:00
Kevin O'Connor 9dfe612516 verify_heater: Provide additional information on a heater error
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-12 23:31:17 -04:00
Kevin O'Connor 830cfc5414 klippy: Rework starting error message
Commit 9bc4239e now emphasizes the first line of a multi-line error
message, so rework startup_message to conform to that.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-12 23:15:22 -04:00
Kevin O'Connor 45afa04578 probe: Add some hints for common errors during PROBE
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-12 23:00:50 -04:00
Kevin O'Connor 9bc4239e9c gcode: On a multi-line error message, report the first line twice
Report the first line of a multi-line error message twice - once as
part of the informational content, and once with the "!!" error
prefix.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-12 22:56:31 -04:00
Kevin O'Connor 3a1cdc7d70 virtual_sdcard: Fix typo in seek error handling
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-12 22:36:39 -04:00
Kevin O'Connor e336c24665 heater: Allow min_temp to go below zero
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-12 14:36:45 -04:00
Kevin O'Connor 849f4ed25f verify_heater: Scale hysteresis duration check
If a heater falls out of the target range, accumulate the temperature
differences to determine if an error should be raised.  This should
make it less likely to report an error for heaters that drift slightly
out of range, and it should make error reporting faster for heaters
that rapidly fall out of range.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-11 19:21:32 -04:00
Kevin O'Connor 57d342b455 verify_heater: Change default hysteresis to 10 degrees
A default of 4 degrees and 10 seconds may be too aggressive - change
the default to 10 degrees and 15 seconds.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-11 13:29:28 -04:00
Kevin O'Connor 5208fc38ed verify_heater: Add initial support for verifying heaters and sensors
Add runtime checks to heaters and temperature sensors to check for
possible hardware faults.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-11 00:49:11 -05:00
Kevin O'Connor b549c3927e klippy: Allow external callers of try_load_module()
It can be useful to automatically pull in a module in the extras/
directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-11 00:04:30 -05:00
Kevin O'Connor 4d48c111d8 cartesian: Initial support for dual carriages
Add support for additional carriages on cartesian printers.  This is
used by some printers to handle multiple extruders.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-09 10:26:21 -05:00
Kevin O'Connor 6c1e1dcc8d display: Use separate hd44780 screen drawing
Separate out the hd44780 screen drawing from the st7920 code.  Use a
layout that takes advantage of the 20 columns.  Add custom hd44780
fonts.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-08 22:44:40 -05:00
Marcio Teixeira 04602b2470 display: Choose arrow character based on display
Choose the arrow character based on whether the display is ST7920 or
HD44780.

Signed-off-by: Marcio Teixeira <marcio@alephobjects.com>
2018-03-06 14:01:10 -05:00
cruwaller 923954772f homing: allow to disable homing retract
Homing retract can be disabled by setting homing_retract_dist to 0.

Signed-off-by: Petri Honkala <cruwaller@gmail.com>
2018-03-06 13:45:48 -05:00
Kevin O'Connor 08a5f8a5ff display: Add initial support for LCD screens attached to an MCU
Add support for displaying basic status information on ST7920 and
HD44780 based LCDs that are attached directly to a micro-controller.

Signed-off-by: Marcio Teixeira <marcio@alephobjects.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-06 11:30:46 -05:00
Kevin O'Connor 43ac56766e serialqueue: Support sending messages at a background priority
Support low-priority message transmits.  This may be useful for bulk
commands that should be delayed util the comms are otherwise idle.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-06 11:30:41 -05:00
Kevin O'Connor fa07be9346 mathutil: Move coordinate_descent() to new file
Add a new python file (mathutil.py) and move the coordinate_descent()
code to it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-04 09:56:50 -05:00
Kevin O'Connor 7290ed5f73 clocksync: Fix multi-mcu frequency adjustments with long moves
Commit 02ae2ab9 had a typo causing the new long move handling logic to
not take effect.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-03 21:54:25 -05:00
Kevin O'Connor fc60bda4d1 virtual_sdcard: Remove trailing '*' checksum indicator from M23 command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-02 11:58:00 -05:00
Kevin O'Connor b139a8561f serialhdl: Add a wrapper around the results of lookup_command()
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>
2018-02-27 21:06:16 -05:00
Kevin O'Connor 656cb2c417 build: Use git describe --always
Add --always flag to "git describe" command to get a build identifier
even if one checks out the repo with a depth parameter that prunes out
the last tagged version.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-26 21:50:05 -05:00
Kevin O'Connor 239c1ad5c9 serialqueue: Don't clear must_exit flag at start of pollreactor_run()
Avoid a timing race where must_exit is set before pollreactor_run() is
started.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-26 16:21:10 -05:00
Douglas Hammond d139389267 avr: Add at90usb646 support
Signed-off-by: Douglas Hammond wizhippo@gmail.com
2018-02-25 10:23:00 -05:00
Kevin O'Connor 02ae2ab984 clocksync: Rework multi-mcu adjust to better handle long moves
The multi-mcu clock syncing code relies on the ability to periodically
update the mcu clock adjustments.  If a series of very long moves are
submitted then it is possible the adjustments could become unstable.
For example, if an adjustment is made to reduce a clock error over the
next couple of seconds, but it is applied to a longer period because
the next move lasts many seconds, then this would result in a bigger
adjustment for the following move, which would result in an even
bigger error when that move lasts many seconds.  This can repeat until
the system destabilizes.

Check for cases where the print_time is far in the future of the
current estimated print time and average over a longer period in that
case.  That should reduce the possibility of the adjustment code
becoming unstable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-19 22:13:28 -05:00
Kevin O'Connor 69486e45c1 ad5206: Warn if ad5206 enable pin is inverted
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-17 23:18:10 -05:00
Kevin O'Connor 5e8aaed41f docs: Add tips for porting to new kinematics to Code_Overview.md
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-17 13:48:53 -05:00
Kevin O'Connor c128a9dfd5 probe: Increase calibration log level from debug to info
Output more information by default from the bed_tilt and
delta_calibrate commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-16 13:30:49 -05:00
Kevin O'Connor 08a1183a01 virtual_sdcard: Initial support for virtual sdcard
Add support for directly printing from a local file on the host.  This
may be useful if the host cpu is not fast enough to run OctoPrint
well.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-11 14:13:12 -05:00
Kevin O'Connor f77e1b67f6 gcode: Introduce request_restart() method
Use request_restart() method instead of prep_restart() and
motor_heater_off().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-11 14:11:33 -05:00
Kevin O'Connor 11c7c110a1 gcode: Extract special cases from process_data()
Handle the unlikely case of pending commands in a new method
process_pending().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-11 14:10:09 -05:00
Dave Bacon 5abea041b4 mcu: Fix PWM static start value setup
config_setup uses ._start_value instead of ._static_value which isn't defined.

Signed-off-by: Dave Bacon <drb.github@mrbacon.com>
2018-02-10 13:00:22 -05:00
Kevin O'Connor 561c84dd93 pins: Warn on invalid pin format
Raise an error if a pin description isn't formatted correctly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-07 16:09:25 -05:00
Kevin O'Connor 955d940b60 bed_tilt: Negate parameters reported by bed_tilt_calibrate
The bed_tilt_calibrate command determines the tilt of the bed.
However, we need to report the tilt compensation which is the negative
of the bed tilt.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-05 14:52:38 -05:00
Kevin O'Connor e0cedfb853 heater: Report stats whenever the heater is active
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-05 13:55:59 -05:00
Kevin O'Connor 0a5b07f9da klippy: Allow any stats producer to determine when stats are needed
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>
2018-02-05 13:52:05 -05:00
Kevin O'Connor 08874b9c91 clocksync: Respond faster to clock changes
Average clock sync times over approximately 30 seconds instead of 120
seconds so that the clock prediction responds to changes faster.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-05 12:33:29 -05:00
Kevin O'Connor f4bfce260a klippy: Introduce load_config_prefix() for modules that take parameters
Use both load_config() and load_config_prefix() functions when
dynamically loading a module from the extras directory - if the config
section name has parameters in it then use load_config_prefix().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-03 12:53:11 -05:00
Kevin O'Connor 7e3adde542 klippy: No need to store fileconfig in main printer object
Just pass the fileconfig reference to the ConfigWrapper instances.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-03 12:17:42 -05:00
Kevin O'Connor 33bdc2fc32 util: Call set_nonblock() in create_pty()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-02 18:32:03 -05:00
Kevin O'Connor 0b76864453 gcode: Make sure need_ack is always restored on run_script()
Restore need_ack even on a G-Code exception.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-02 18:32:03 -05:00
Kevin O'Connor 56bfb3280a gcode: Keep reading input to check for M112 (emergency stop)
OctoPrint (and other software) will sometimes send additional commands
even if the previous command has not yet responded with an "ok".
Change the g-code input reading code to keep reading input so that an
M112 can be detected (and processed out-of-order).  To avoid the
extreme case where one writes an entire g-code file to the input
without any pacing, disable the input reading if more than 20 commands
are pending.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-02 11:00:46 -05:00
Kevin O'Connor 3ddbd34a7c gcode: Propagate errors from run_script()
If the script being run raises an error, then stop running that script
and return the error to the caller.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-01 12:18:47 -05:00
Kevin O'Connor 67f9c4948d gcode: Ack even empty lines
An empty input line should still return an "ok" message.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-01 11:03:49 -05:00
Kevin O'Connor 21df21b7af fan: Clarify hardware_pwm and allow cycle_time to be set on software pwm
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>
2018-01-29 13:08:15 -05:00
Kevin O'Connor 077a56c2ca mcu: Default the restart method to 'command' on non-serial ports
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>
2018-01-29 10:25:25 -05:00
Kevin O'Connor a67306c76b msgproto: Support default values in get_constant() calls
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-29 10:10:27 -05:00
Kevin O'Connor 6eefbe5e30 heater: Add stats reporting
Report the current temperature, current pwm setting, and target
temperature as statistics in the log.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 23:37:56 -05:00
Kevin O'Connor 1a67902858 homing_override: Allow moves prior to homing an axis
Add support for disabling homing checks via the homing_override
mechanism.  This may be useful to move an axis prior to homing it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 01bb4b291e probe: Create a probe:z_virtual_endstop pin
Create a virtual pin that may be used as the z endstop pin on
cartesian printers that use the probe in place of a z endstop.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor e38c7df064 probe: Support activate/deactivate scripts on each probe
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>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 3001a089c0 homing_override: Add basic support for running custom g-code on G28
Allow users to override the behavior of G28 using a new
"homing_override" config section.  This may be used on printers that
require specific steps during the homing process.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 39d62556b1 bed_tilt: Add support for automatic bed tilt move transformation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 434341d074 delta_calibrate: Add initial support for a DELTA_CALIBRATE command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor ce9db609ad probe: Initial support for Z-Probe hardware
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 6c252d30f5 delta: Allow the user to specify a minimum z position
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 978777f09f replicape: Move the replicape code from chipmisc.py to extras directory
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 5db84779c6 ad5206: Move the ad5206 code from chipmisc.py to extras directory
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 1e3a03fbee servo: Move the servo code from chipmisc.py to extras directory
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 01a89b951a multi_pin: Move the multi_pin code from chipmisc.py to extras directory
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor d166d1f692 fan: Move fan code to extras directory
The print cooling fan and printer heater_fan are independent modules
that can reside in the extras directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 9399911490 klippy: Add support for dynamic loading of python modules
Check if a config section matches a python filename in the
klippy/extras/ directory.  If it does, load that python code to handle
the config section.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor d3665699f1 klippy: Support generic printer_state() and stats() callbacks
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>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 81013ba5c8 klippy: Add access methods and avoid peeking into the printer classes
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>
2018-01-28 12:19:26 -05:00
Kevin O'Connor f0a754e496 gcode: Add a run_script() helper method to run g-code scripts
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 51e1085dbc gcode: Extend register_command() so that it can also unregister a command
If register_command() is passed None as the function to call, then
treat it as an unregister command request.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-28 12:19:26 -05:00
Kevin O'Connor 09eec3710d extruder: Add support for extruders sharing the same heater
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-21 23:25:11 -05:00
Kevin O'Connor 1d11c4e74d gcode: Use reset_last_position() from cmd_G28()
Use the existing reset_last_position() code in cmd_G28() instead of
manually implementing the logic.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-16 21:46:42 -05:00
Kevin O'Connor f8bb383e9a extruder: Remove unused variable self.config
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-16 21:40:53 -05:00
Kevin O'Connor 0d8ddcadbb toolhead: Improve tracking of print_stall
The previous code increases print_stall if a move is proactively
flushed due to buffer_time_low and a follow up move is ready to send
before the existing moves are fully retired.  However, this would not
track the case where a move is proactively flushed and it takes an
extended amount of time to get sufficient moves to refill the queue.

Change the code so that print_stall increases anytime a new move is
queued after a proactive flush and there are existing moves not yet
fully retired.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-12 16:56:31 -05:00
Kevin O'Connor 5caff594c5 heater: Report PID tuning results via the g-code terminal
Determine the median period from the pin tuning tests and use that to
recommend a set of PID parameters.  Report the results over the g-code
terminal.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-10 22:58:12 -05:00
Kevin O'Connor 5a68c636da chipmisc: Enable replicape steppers dynamically
Enable all the steppers via the shift registers when the first stepper
is enabled, and disable all the steppers once all steppers are
disabled.  This avoids having to enable all the steppers all of the
time.  Note that, this support is independent from the current control
for each stepper, which is still done individually.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-10 19:30:57 -05:00
Kevin O'Connor 02b141ac43 chipmisc: Fix replicape enable line setup
The enable lines are not one per stepper - instead there are 5
distinct enable settings.  Handle them properly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-10 19:30:51 -05:00
Kevin O'Connor 47e458210e chipmisc: Support start values on pca9685 pins
Default the pca9685 enable line on if any of the pins attached to it
have a non-zero start value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-10 19:30:47 -05:00
Kevin O'Connor 3833669c3a pins: Check if the same pin is referenced via different aliases
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>
2018-01-10 19:26:06 -05:00
Kevin O'Connor df6528715e stepper: Automatically detect and handle shared stepper enable lines
It's common for multiple steppers to use the same stepper enable
line.  Detect this and only create a single digital_out oid on the
micro-controller.

Also, prohibit any other pin from being used multiple times in the
config file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-10 19:10:26 -05:00
Kevin O'Connor 265b9097d5 pins: Rename parse_pin_desc() to lookup_pin()
Always set the pin_params['type'] field on a pin lookup.  Rename
parse_pin_desc() to lookup_pin() to make the change more clear.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-10 14:21:25 -05:00
Kevin O'Connor ed80b92b59 mcu: Setup static values via setup_start_value() call
Add an "is_static" setting to setup_start_value() and remove the
setup_static() method.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-08 21:21:30 -05:00
Kevin O'Connor f6f174ab36 extruder: Fix pressure advance on tiny moves with over extrusions
The extruder check_move() code will permit moves with huge extrusion
ratios if the amount extruded is tiny.  (Some slicers emit these silly
moves - they are allowed because they are harmless.)  Unfortunately,
the pressure advance code did not handle the huge extrusion ratios -
it would result in a massive, near instantaneous, extruder move in an
attempt to build pressure in the extruder.  Catch this case and limit
the impact to the pressure advance code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-08 14:39:19 -05:00
Kevin O'Connor ed9dee4602 mcu: Only report an MCU timeout once
Don't flood the log with timeout messages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-08 10:55:37 -05:00
Kevin O'Connor 3ab9a8d26c gcode: Add support for M221 (set extrude factor) g-code command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-03 17:12:31 -05:00
Kevin O'Connor 5db4886c9c gcode: Add support for M220 (set speed factor) g-code command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-03 17:12:26 -05:00
Andy Silverman b22a81cd34 heater: Added config for heater PWM cycle time.
Added the pwm_cycle_time option for heater config sections.  Defaults
to previous value of 0.100 seconds, but may be reduced to shorter times
at the expense of MCU workload and possible MOSFET heating, depending on
controller design.  Some printers that need bed PID to be enabled,
notably the Felixprinters series, are known to benefit from shorter
cycle times, as the default 10hz rate results in excessive voltage
supply droop.

While this option can be used on extruder heaters as well, there
is not expected to be any particular benefit from doing so unless
the extruder heater presents a particularly large load.

Signed-off-by: Andy Silverman <andrewsi@outlook.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-03 12:32:11 -05:00
Kevin O'Connor bba22ab7f0 heater: Provide symbolic names for pid check_busy (aka M109 / M190)
Add PID_SETTLE_DELTA and PID_SETTLE_SLOPE constants to the code to try
and make it a little more clear how the wait for temperature code
works.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-03 10:44:01 -05:00
Kevin O'Connor a0b4cdb5c4 gcode: Don't wait for temperature if the temperature is disabled
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-01-03 10:33:10 -05:00
Kevin O'Connor 1d276d160f gcode: Dump internal g-code state in dump_debug()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-21 22:27:49 -05:00
Kevin O'Connor 9313e58123 gcode: Group similar G-Code commands together
Group commands by category instead of listing them in numerical
order.  This is just code movement; no code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-21 20:58:25 -05:00
Kevin O'Connor d778ae1846 build: Add gcc and binutils version to mcu data dictionary
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>
2017-12-21 20:32:10 -05:00
Kevin O'Connor 1d21bf66c6 homing: Handle speed rounding when homing speed greater than max_velocity
Commit 002dc0df added rounding to the homing speed, but it did not
work if the configured homing speed was less than the printer's
maximum velocity.  Move the speed rounding from stepper.py to
homing.py and make sure the rounded speed is less than the maximum
speed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-20 14:41:20 -05:00
Kevin O'Connor 1b07505973 chipmisc: Add multi_pin capability
Add the ability to alias multiple output pins from a single pin alias.
This makes it possible to support some cases where a single logical
output is driven by multiple output pins.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-18 21:00:06 -05:00
Kevin O'Connor 3c5649219f chipmisc: Add support for output pins set at runtime
Add the ability to define output pins that may be set at runtime with
a new SET_PIN extended g-code command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-18 20:59:07 -05:00
Kevin O'Connor 68d03e4a3e mcu: Allow both shutdown and startup values to be set for output pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-18 20:45:00 -05:00
Kevin O'Connor e6e0a21b06 toolhead: Allow junction_deviation to be set to zero
Allow lookahead to be effectively disabled by setting
junction_deviation to zero.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-18 20:44:59 -05:00
Kevin O'Connor 8d62318c5f clocksync: The clock estimate should add the rtt time not subtract it
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-16 20:21:38 -05:00
Kevin O'Connor 4a5801bb2e pins: Fix atmega168/328 mappings
The atmega168 and atmega328 need to define PE0 and PE1 in order to
support the 2 extra analog pins.

Also, support the arduino mappings for the atmega328.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-09 11:48:26 -05:00
Kevin O'Connor f8acf0f54f delta: Default stepper_b/c position_endstop to stepper_a's
If the position_endstop is not set for stepper_b or stepper_c then use
the value from stepper_a.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-08 18:20:04 -05:00
Kevin O'Connor bc5d900e61 delta: Support different arm lengths for each tower
Change the config file so that the delta arm length is specified
per-tower.  This makes it possible to support advanced calibration.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-08 18:20:04 -05:00
Kevin O'Connor efb4a5daa1 delta: Rework actuator_to_cartesian() using trilateration
Use the formulas for trilateration (instead of the circumcenter
formulas) when calculating the position of the nozzle from the
position of the carriages.  The trilateration formula is more general
and it allows each tower to have a different arm length.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-08 18:09:19 -05:00
Kevin O'Connor e0c947e188 mcu: Store MCU_stepper commanded_pos as a float
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>
2017-12-07 18:14:50 -05:00
Kevin O'Connor 3ffab763c0 stepper: Only align the stepper motor to a full step when requested
Add a new config option 'homing_endstop_align_zero' to enable the
alignment of the endstop to a stepper full step.  It's possible one
may wish to specify a homing_endstop_phase while not aligning the
endstop.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-07 17:35:19 -05:00