Commit Graph

1237 Commits

Author SHA1 Message Date
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 7a9553b38a thermocouple: Minor fixes
Send the temperature before checking for an out of range error (that
makes it easier to debug).

The query_thermocouple clock parameter is unpredictable and a value of
zero can't be used to disable the query - use rest_ticks instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-25 09:06:50 -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
Kevin O'Connor c0bf4327fd test: Add a test case for less common temperature sensors
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-24 12:54:22 -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
Ricardo Amezquita 940db6bd70 linux: Add support for bi-directional SPI communication
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 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 e2b4b1616f lpc176x: Add support for SPI
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-18 10:11:29 -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
Pascal Albert 244d0aa65b atmega1284p: Add choice between UART0 or UART1 to Kconfig
Signed-off-by: Pascal Albert <lucky@foxserver.org>
2018-07-13 19:58:04 -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 21563c5965 config: Minor updates to example-extras.cfg
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-12 12:18:31 -04:00
Kevin O'Connor 32a85edb16 spidev: Minor rework to spidev_transfer()
Gcc does a better job of inlining code if spidev_transfer() is
reworked slightly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-11 19:43:20 -04:00
Kevin O'Connor 733506dfb2 sam3x8e: Configure spi transfer in spi_prepare()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-11 19:40:51 -04:00
Kevin O'Connor d9f960fb0c avr: Configure spi transfer in spi_prepare()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-11 19:40:21 -04:00
Kevin O'Connor f60b0093b7 docs: Add a section with micro-controller porting tips to Code_Overview.md
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-11 14:40:39 -04:00
Kevin O'Connor 5294b3cd2d simulator: Rework dummy simulator code to user timer_irq / serial_irq
Change the simulator to use the generic timer_irq.c and serial_irq.c
code for (dummy) timer and io handling.  This is just to make the code
a better example for other developers (most micro-controllers will use
the timer_irq.c and serial_irq.c code).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-11 14:35:24 -04:00
Kevin O'Connor 00ea4428a3 test: Add recent printer config files to printers.test test case
Add printer-tronxy-x8-2018.cfg and printer-anycubic-kossel-plus-2017.cfg.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-10 12:04:39 -04:00
Seyed Seraj 70b5e1eb69 Add Printer Configuration File for the Tronxy X8
Added printer-tronxy-x8-2018.cfg for the Tronxy X8 with the CXY-V2-0508 board.

Signed-off-by: Seyed Seraj <s.seraj@hotmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-10 11:59:07 -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 4125e176b7 docs: Expand on why it is important to provide the log in Contact.md
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-08 20:30:35 -04:00
Kevin O'Connor fa9b321991 docs: Update main documentation to not Smoothieboard support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-08 11:01:54 -04:00
Kevin O'Connor f7c2d918b6 config: Update Smoothieboard configs with notes on flashing the devices
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-08 10:45:17 -04:00
Kevin O'Connor f3ac1a2306 docs: Add M206 and M119 to G-Codes.md
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-08 10:23:44 -04:00