Commit Graph

1022 Commits

Author SHA1 Message Date
Kevin O'Connor d02c80ef08 output_pin: Make sure to not use a cycle_time or max_duration over 5 seconds
Times longer than 5 seconds may result in a 32bit ticks overflow in
the micro-controller (for fast micro-controllers).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-26 11:37:40 -04:00
Kevin O'Connor 861144d884 output_pin: Increase time host has to confirm a pin setting
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-26 11:33:05 -04:00
Pascal P 88f6061cd7
output_pin: Support setting max_duration (#3995)
Also added documentation for using powered tools.

Signed-off-by: Pascal Pieper <accounts@pascalpieper.de>
2021-03-26 11:25:09 -04:00
Clifford Roche e2a3217289
palette2: Add support for P2 devices (#4057)
Module which bring support for P2 devices running in connected mode. This enables using a Palette2 directly with Klippy without Octoprint, or without Palette2 plugins for Octoprint which are not functional out of the box with Klipper.

Signed-off-by: Clifford Roche <clifford.roche@gmail.com>
2021-03-26 11:21:10 -04:00
Kevin O'Connor 36b1ccd598 replicape: Don't require a host alias for the enable_pin default
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-25 10:49:17 -04:00
Janar Sööt 2130e3e5d4
menu: changes in tune menu according to #4023 (#4086)
- set 1% as input minimum for speed and flow
- set speed maximum from 200% to 500%

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2021-03-23 10:55:25 -04:00
Dmitry Butyugin 2d8945dc1c graph_accelerometer: Support axis-level comparison of adxl345 data
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-03-20 13:24:43 -04:00
Dmitry Butyugin f248b91414 shaper_calibrate: Reduced min shaper freqs to match max_accel ~= 1500
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-03-20 13:24:43 -04:00
Dmitry Butyugin 57494458f3 shaper_calibrate: Ignore vibrations below max_psd / 20 threshold
The input shaper can only reduce vibrations by 20x. Therefore,
the best-case achievable vibrations level is max(psd) / 20.
Any vibrations below that level can be ignored for the prupose
of input shaper scoring. This allows tuning script to ignore
wide tails of resonances, because it is not helpful to try to
reduce them with input shaping.

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-03-20 13:24:43 -04:00
Dmitry Butyugin 73a39370ad shaper_calibrate: Estimate max_accel to avoid excessive smoothing
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-03-20 13:24:43 -04:00
Jon Sanders 6c9404ac0c
htu21d: sensor definition fix (#4075)
HTU21D sensor class lacked the method `get_report_time_delta` invoked
during watermark control loops. This short fix simply adds that method
in, calling the `self.report_time` attribute created during class
construction.

Signed-off-by: Jon Sanders <jonsan@gmail.com>
2021-03-18 23:38:07 -04:00
Kevin O'Connor 2144f716f6 tmc2660: Fix typo in seup field
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 23:36:25 -04:00
Kevin O'Connor b6eea021b1 tmc2660: Use lowercase for stallguard/coolstep fields
Use lowercase for the field names so that it matches the
tmc2130/tmc5160 field names.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 22:44:38 -04:00
Kevin O'Connor 3f04238e79 tmc2660: Report SE in DUMP_TMC even if zero
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-16 11:31:30 -04:00
Kevin O'Connor 6ebdc48b7c tmc2130: Report CS_ACTUAL in DUMP_TMC even if zero
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-16 11:31:24 -04:00
Kevin O'Connor 22753f3b38 tmc: Only check for tmc2130 reset via CS_ACTUAL if IHOLD > 0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-15 13:48:58 -04:00
Michael Kurz b4437f8eee
bme280: Add support for BMP280 and BME680 sensors (#4040)
This adds support for BMP280 and BME680 sensor ICs,
along with fixing calibration data readout for BME280.

Gas sensor readout for the BME680 is just the raw compensated value.
To get actual meaningful values, more research is needed.

Signed-off-by: Michael Kurz <michi.kurz@gmail.com>
2021-03-15 11:50:29 -04:00
Kevin O'Connor 86a924f5a6 tmc: Improve driver reset check on tmc2130 and tmc2660
Use the CS_ACTUAL/SE field to check for a mid-print driver reset.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-15 11:16:15 -04:00
Kevin O'Connor d184d9fd91 tmc: Move clear_gstat check for tmc2130 to within TMCErrorCheck class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-15 10:28:08 -04:00
Kevin O'Connor 88d0af3da3 tmc2660: Change stallguard flags to better match tmc2130/tmc5160
The tmc2660 spec has an ambiguous "SG" field that sometimes refers to
the "stallGuard" flag and sometimes refers to the "SG_RESULT" field.
The tmc2130 and tmc5160 have similar fields that are not ambiguous, so
adopt that naming strategy.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-15 10:28:03 -04:00
TheJoshW bf8f7133b4
filament_motion_sensor: Add filament_motion_sensor (#3857)
Add functionality to support a Filament Motion Sensor for detecting extruder jams as well as runouts.  Works by an encoder toggling the switch_pin 0/1 as the filament is pulled through the sensor.

Signed-off-by: Joshua Wherrett <thejoshw.code@gmail.com>
2021-03-14 21:36:19 -04:00
Kevin O'Connor 041692828c mcu: Add support for connecting to devices on a CAN bus
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-13 11:29:41 -05:00
Kevin O'Connor 9572ad4327 tmc_uart: Limit to only one active uart at a time on an mcu
The tmcuart_send command increases cpu usage on the micro-controller.
Should multiple tmcuart_send commands be issued at the same time to a
single AVR micro-controller, it could increase the load to the point
that it introduces a failure. It could also lead to tmcuart_send
transmission errors, which would cause retransmission requests, which
further increase the load.

Track and share mutexes so that only one tmcuart_send command can be
active on a single mcu at a time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-12 20:51:11 -05:00
Kevin O'Connor bf5c2505ab tmc2130: Fix broken error report due to missing self.name
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-11 17:52:18 -05:00
Kevin O'Connor 7dd2bf4af3 tmc2130: Verify SPI register writes
The tmc2130 (and tmc5160) will respond back with the value written
during the next SPI command.  Use this feature to verify that the
value written matches the value sent.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-10 17:12:25 -05:00
Kevin O'Connor 3ea2e4fc58 tmc2660: Do not enable SFILT by default
None of the other TMC driver enable SFILT by default and it seems
enabling SFILT may not be ideal for sensorless homing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-10 12:07:18 -05:00
fleinze 153698c90d
idle_timeout: change standard timeout g-code (#4018)
Machines that have no heaters produce an error when the idle timeout occurs. This commit fixes this by checking if there are any heaters to turn off.

Signed-off-by: Florian Heinze <florian@heinze.at>
2021-03-07 13:48:54 -05:00
Kevin O'Connor 64b3e5642e heaters: Make sure set_temp() command wakes up the idle_timeout
Introduce a heaters.set_temperature() command and call that from
commands that set a heater temperature.  This new function calls
toolhead.register_lookahead_callback() so that the idle_timeout gets
notification that activity has occurred.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-05 18:59:01 -05:00
teeminus bc2096f543
st7920: Better support for emulated ST7920 displays (#3979)
Added new ST7920E display driver which is better suited for displays with emulated ST7920

Signed-off-by: Christian Kehe <teeminus@posteo.net>
2021-03-01 18:23:06 -05:00
Kevin O'Connor 4d3d25b1f7 fan: Minor updates to tachometer handling
Add new fields to Command_Templates.md.

Remove unused self.rpm variable.

Use an explicit get_frequency() method in keeping with Klipper's
convention of not "peeking into member variables".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-01 14:57:40 -05:00
Adrian Keet 16d85d1a78 fan: Add tachometer support
This adds new config options for fans:  'tachometer_pin' to specify the
GPIO pin, and 'tachometer_ppr' (default 2) to specify the number of
signal pulses per revolution.  The rpm is also exposed by get_status for
command templates and the API server.  For fast fans (at least 10000
RPM), the polling interval can be shortened using the
'tachometer_poll_interval' option.

There is a new mcu object for a generic edge counter, which repeatedly
polls a GPIO pin and periodically reports the count to the host.

Signed-off-by: Adrian Keet <arkeet@gmail.com>
2021-03-01 14:53:13 -05:00
Kevin O'Connor 1b989b81e0 tmc: Fix order of init during sensorless homing
With commit 53b10d3a the setup of sensorless homing could occur before
the driver was enabled which would cause the reinitialization of the
driver settings to undo the sensorless homing setup.

Use set_field() when setting the sensorless homing registers so that
it wont conflict with a driver init.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-28 18:30:25 -05:00
Kevin O'Connor 36ca639e1f tmc: No need to delay init on a stepper enable
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-28 18:04:20 -05:00
Kevin O'Connor c9b81e698e tmc: Allow more retries on a TMC UART read error during background checks
Allow three retries if we can't contact the TMC driver at all when it
is in UART mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-28 16:44:03 -05:00
Kevin O'Connor 86c943467f tmc_uart: Minor change - make the baud rate setting more clear
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 11:46:03 -05:00
Kevin O'Connor f035de264f tmc: Add support for periodic checking of driver status
Check the status of all Trinamic stepper motor drivers once a second.
If the driver reports an error then invoke a shutdown.  Also log any
serious warnings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:47 -05:00
Kevin O'Connor 53b10d3ae7 tmc: Reinitialize on every driver enable
Send the full TMC stepper motor driver initialization sequence every
time the driver is enabled.

Don't raise an error on startup if unable to contact a tmc2208/tmc2209
driver.  If the driver is still unavailable when it is enabled then a
shutdown will be issued.  This allows users to troubleshoot (and
possibly bring up communication to the driver) prior to enabling the
driver.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:47 -05:00
Kevin O'Connor af8bfee210 tmc2660: Fix tmc register reading
The tmc2660 appears to send responses as soon as the clk starts
toggling.  That means the 20 bit response is at the top of the 24bit
sent message.  Also, this implies that RDSEL must already have the
correct value in the prior message.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:47 -05:00
Kevin O'Connor e24709b112 tmc2660: Use common warning/error flag names and descriptions
Where the tmc2660 flags match other drivers, use lowercase so that the
same monitoring code can be used for all the tmc drivers.  Also, use
the same field formatters where applicable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:47 -05:00
Kevin O'Connor 2d781b8340 tmc5160: Merge field formatters into tmc2130.py
The tmc5160 field formatters were mostly duplicates of the tmc2130 -
add the "reset" field to tmc2130.py so both drivers have similar
reporting.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:46 -05:00
Kevin O'Connor 21383fa32e tmc: Always report values after a SET_TMC_CURRENT command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:46 -05:00
Kevin O'Connor 6e4270fa79 tmc: Move SET_TMC_CURRENT command to TMCCommandHelper()
Refactor the tmc driver implementations so that there is a single
implementation of the SET_TMC_CURRENT command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:46 -05:00
Kevin O'Connor a657aab0bf tmc2660: Add set_current()/get_current() helpers to TMC2660CurrentHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:46 -05:00
Kevin O'Connor 8312843bbe tmc5160: Add set_current()/get_current() helpers to TMC5160CurrentHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:46 -05:00
Kevin O'Connor 9c9f78037b tmc2130: Add set_current()/get_current() helper functions to TMCCurrentHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 10:39:46 -05:00
Andre LeBlanc 3fc72da9ae virtual_sdcard: exact filename match before case insensitive one
currently, if there are 2 files on the virtual sd card whose names differ only in
case (eg. MyFile.gcode vs myfile.gcode) the actual file that gets loaded is at
best unpredictable.  this patch checks for an exact match before attempting a
case-insensitive one.

Signed-off-by: Andre LeBlanc <andrepleblanc@gmail.com>
2021-02-26 22:53:35 -05:00
Marco D'Alessio c7688c6bca tmc2130: Add spi daisy chain support
This patch adds the ability to daisy-chain multiple tmc2130 and
tmc5160 drivers.

Signed-off-by: Marco D'Alessio <marco@wrecklab.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-26 10:54:47 -05:00
Kevin O'Connor a8742e982d tmc: Improve error message on missing microsteps config
If microsteps is missing, warn about it in the stepper config section,
not the tmc config section.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-23 12:00:08 -05:00
Kevin O'Connor 2aa2e91f2c Revert "bme280: Rename sensor_type from BME280 to bme280"
This reverts commit ac61f8b726.

Many temperature sensors are capitalized, so don't make this chaneg to
the bme280.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-20 15:39:03 -05:00
Janar Sööt 92cc286159
menu: Default menu should check extruders have heaters (#3969)
For the hotend targets check also available heaters.
It'll solve crash when using shared heaters.

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2021-02-20 11:33:34 -05:00