Commit Graph

970 Commits

Author SHA1 Message Date
Kevin O'Connor 30b6414295 tmc2208: move local set_field/get_field helpers to FieldHelper class
Move these helper functions to the FieldHelper class so that they can
be used by other Trinamic drivers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-03 14:07:27 -05:00
Kevin O'Connor 17a17c5b77 tmc2208: Add helper for setting fields from the config file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-03 13:03:44 -05:00
Kevin O'Connor 83001959f1 tmc2208: Use field definitions during driver init
Reduce the amount of bit manipulations by using the FieldHelper class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-03 12:22:12 -05:00
Dmitry Frolov 51f14b9c8c tmc2208: Add register field formatters
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Dmitry Frolov <dmitry.frolov@gmail.com>
2019-02-03 11:19:36 -05:00
Kevin O'Connor 955fdcaa0c tmc2130: Convert field helper into a class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-03 11:11:15 -05:00
Arksine cdcc320710 bed_mesh: add support for round beds
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-02-02 23:29:00 -05:00
Arksine 542f941f07 bed_mesh: log when fade completes.
- Also simplify the math for the mesh x and y multipliers.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2019-02-02 23:29:00 -05:00
lorf 54683c9535 tmc2208: Decode register fields in DUMP_TMC (#1156)
Report values of TMC2208 register fields in DUMP_TMC command to help in
tuning and diagnostics.

This also adds functions to refer to register fields by name for TMC drivers
and register mappings for TMC2208.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Dmitry Frolov <dmitry.frolov@gmail.com>
2019-02-02 19:46:27 -05:00
Kevin O'Connor 3b6ddb08a1 bltouch: Don't error on startup if the bltouch is in an error state
Stopping the connect sequence can make it difficult to get the bltouch
out of an error state.  Allow the connect to proceed, ideally if the
bltouch stays in an error state it will be detected during the first
probe attempt.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-31 09:43:35 -05:00
Kevin O'Connor a5d3d161d3 bltouch: Retry reset/pin_up if the raise probe attempt fails
There's no harm in retrying the attempt if it appears to have failed
for some reason.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-31 09:43:29 -05:00
Samori Gorse 04c6e1f646 idle_timeout: Added a missing logging import
I noticed Octoprint was disconnecting after a while, and after reading the logs, I came across this error:

```
Unhandled exception during run
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/klippy.py", line 171, in run
    self.reactor.run()
  File "/home/pi/klipper/klippy/reactor.py", line 176, in run
    g_next.switch()
  File "/home/pi/klipper/klippy/reactor.py", line 203, in _dispatch_loop
    timeout = self._check_timers(eventtime)
  File "/home/pi/klipper/klippy/reactor.py", line 82, in _check_timers
    t.waketime = t.callback(eventtime)
  File "/home/pi/klipper/klippy/extras/idle_timeout.py", line 62, in timeout_handler
    return self.check_idle_timeout(eventtime)
  File "/home/pi/klipper/klippy/extras/idle_timeout.py", line 59, in check_idle_timeout
    return self.transition_idle_state(eventtime)
  File "/home/pi/klipper/klippy/extras/idle_timeout.py", line 35, in transition_idle_state
    logging.exception("idle timeout gcode execution")
NameError: global name 'logging' is not defined
```

I therefore added the missing import.

Signed-off-by: Samori Gorse <samori.gorse+github@gmail.com>
2019-01-29 11:18:44 -05:00
Kevin O'Connor 8cd83b4c2d atsamd: Initial support for SAMD51
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-28 20:02:16 -05:00
Arksine 7605752dc2 pause_resume: initial implementation of pause/resume functionality for Klipper
This module adds PAUSE and RESUME gcodes that can programatically determine if the gcode is printing from virtual sd or over the serial connection.  It also captures the current toolhead position and gcode feedrate on pause, and recovers that position and feedrate on resume.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-01-28 11:23:52 -05:00
Arksine 8385dc20e6 gcode: add 'speed' parameter to dictionary returned by get_status()
Signed-off-by: Eric Callahan  <arksine.code@gmail.com>
2019-01-28 11:23:52 -05:00
Arksine e69742df8f virtual_sdcard: prepare for pause_resume implementation
- Add is_active() member function to return the active printing status of the virtual sdcard
- M27 now reports current file position when file has been opened. See http://marlinfw.org/docs/gcode/M027.html

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-01-28 11:23:52 -05:00
Kevin O'Connor eb7842c221 atsam: Add support for the SAM3X8C micro-controller
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-22 09:07:12 -05:00
Kevin O'Connor 7327394c50 adc_temperature: Add support for linear interpolation of resistances
Add support for performing linear interpolation between a set of
measured temperature/resistance pairs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 21:28:25 -05:00
Kevin O'Connor fc946c796c adc_temperature: Split linear interpolation code into its own class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 20:27:41 -05:00
Kevin O'Connor 99980817c3 adc_temperature: Move PrinterADCtoTemperature to adc_temperature.py
Move the low-level PrinterADCtoTemperature() class from thermistor.py
to adc_temperature.py and use it from the Linear() class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 20:24:51 -05:00
Kevin O'Connor 0c4fc64ef8 thermistor: Separate thermistor configuration from basic ADC callback logic
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 18:38:12 -05:00
Kevin O'Connor 5a6a429bc0 bltouch: Take into account clock skew when calculating command duration
We want the duration of each command to be an exact multiple of
SIGNAL_PERIOD.  The durations might not be exact if the bltouch is on
a secondary mcu.  Account for this in send_cmd().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 09:56:08 -05:00
Kevin O'Connor 8a97bc592b bltouch: Add a pin_up_touch_mode_reports_triggered config option
Rework the undocumented test_sensor_pin config option into a
pin_up_touch_mode_reports_triggered option and document it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 09:52:11 -05:00
Kevin O'Connor 56141c21d7 bltouch: Raise probe on startup
Send a pin_up command during startup and try to verify that the probe
actually raises.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 09:52:11 -05:00
Kevin O'Connor e36122797b bltouch: Attempt to verify that the probe raises after each probe attempt
Query the bltouch state during the pin_up command to try and verify
that the probe does actually retract.  This may be useful to detect if
the bltouch enters into an "error" state.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 09:52:11 -05:00
Kevin O'Connor 99f96f2832 bltouch: Use pin_down mode for probing
The BLTouch is more accurate when probing in "pin_down" mode than
"touch_mode" (at least on some hardware).  Rework the code to use that
mode.

When probing in pin_down mode, the BLTouch can go into an error state
if a pin_up is not sent immediately after a touch signal.  Rework the
pin_up code to reduce the time it takes to transmit the command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 09:52:11 -05:00
Kevin O'Connor 04f5baa182 bltouch: Simplify time keeping of scheduled events
Introduce a sync_print_time() method and update send_cmd() to track
the duration of bltouch commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 09:52:11 -05:00
Kevin O'Connor 26e818d900 bltouch: Verify probe always deploys during a homing operation
Verify that there is always some movement during a probing operation.
This is normally done by the homing.py code (via its verify_movement
check), but that check may not be enabled when z_virtual_endstop is
used.  So, always enable the check in the bltouch.py code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-21 09:52:11 -05:00
Kevin O'Connor 293366d033 thermistor: Breakout thermistor math to its own class
Separate the thermistor math from the heater temperature callback
system.  This may make it easier for debugging.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-20 18:51:00 -05:00
Víctor Martínez 432e6c490a util: Don't crash when calling get_cpu_info on OS X (#1102)
Signed-off-by: Víctor Martínez <knoopx@gmail.com>
2019-01-11 13:00:44 -05:00
Kevin O'Connor f0b7d6d67a klippy: Report the first error generated
Only update the status message with the first error report.
Subsequent errors are often the result of the first error and
reporting the last error can be misleading.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-11 12:41:55 -05:00
Kevin O'Connor 32632c8226 mcu: Fix timing of endstop checking
Make sure to not query the given endstop until after the start of the
requested operation.  This ensures that the operation has started
prior to querying the status of that operation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-10 12:27:56 -05:00
Kevin O'Connor 0119e42d13 homing: Always start endstop checking before the nominal move start
Make sure the endstop checking is started prior to any movement.  This
helps ensure the verify_movement check is accurate.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-10 12:17:57 -05:00
Master92 a27838bc05 controller_fan: Add support for a fan cooling the controller-board (#1070)
Whenever a stepper driver or a heater becomes active, it is desirable to turn on a fan cooling the associated parts on the controller board. This module implements such a fan that turns on whenever a stepper or specified heater turns on, decelerates to a configurable speed when all of the watched parts turn off, and returns to an off-speed, when a user-defined timeout is met.

Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
2019-01-10 12:12:15 -05:00
Kevin O'Connor 2c31fd8313 tmc2208: Check for debugging mode before checking for a retransmit
Allow the tmc2208 code to be run from regression test cases.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-10 09:55:54 -05:00
Kevin O'Connor c0ea0312e5 klippy: Fix error handling during connect phase
Make sure to exit the _connect() method if a connect event handler
raises an error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-08 13:46:26 -05:00
Kevin O'Connor bf647749dd menu: Don't peek into printer.objects member variable
Use the printer.lookup_objects() method to get the list of available
printer objects.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-08 12:03:46 -05:00
Kevin O'Connor 857e7ed5f1 klippy: Convert printer_state("connect") to an event handler
Convert all users of the printer_state("connect") handler to register
a "klippy:connect" event handler instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-08 11:09:55 -05:00
Kevin O'Connor 797367b9f5 klippy: Convert printer_state("ready") to an event handler
Convert all users of the printer_state("ready") handler to register a
"klippy:ready" event handler instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-08 10:59:43 -05:00
Kevin O'Connor f4be0ac7be klippy: Convert printer_state("disconnect") to an event handler
Convert all users of the printer_state("disconnect") handler to
register a "klippy:disconnect" event handler instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-08 10:59:43 -05:00
Kevin O'Connor fb7fe282c8 klippy: Convert printer_state("shutdown") to an event handler
Convert all users of the printer_state("shutdown") handler to register
a "klippy:shutdown" event handler instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-08 10:59:43 -05:00
Petri Honkala b2d5a8e65b z_tilt: unresolved reference fixed
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
2019-01-08 08:44:25 -05:00
Janar Sööt 3a4a1d678e menu: allow empty command gcode if action is present
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-01-07 21:39:50 -05:00
Janar Sööt 0cbe851777 menu: enhancements
- changes that make easier to use menu as module UI
- new helper method for delayed callbacks
- method for getting the menu instance from display
- new action for sending menu:action events
- allow_without_selection option for cards

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-01-07 21:39:50 -05:00
Janar Sööt 005cbe157a menu: allow names in card content and simplify define single card decks
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-01-07 21:38:53 -05:00
Janar Sööt b9cccc5959 menu: support for click button long press
- long press with timer (button release is not needed anymore)
- initial support for edit mode long press gcode

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-01-07 21:38:45 -05:00
Janar Sööt 265769787f reactor: support for delayed callbacks
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-01-07 21:38:36 -05:00
Kevin O'Connor e26d1a3567 i2ccmds: Pass the i2c address as a 7-bit number (0-127)
The sam3 i2c code and the linux code use a 7-bit i2c address, while
the avr, lpc176x, and samd21 i2c code uses an 8-bit address with the
least significant bit always zero.  A similar issue occurred in the
host code (sx1509.py and replicape.py use 7-bit addresses while
uc1701.py and mcp4451.py use 8-bit addresses).

Consistently use 7-bit addresses in all the code.  This breaks
compatibility between host and mcu software, so make a change to the
config_i2c command to force users to synchronize software updates.
This also breaks common Smoothieboard configs, so update the mcp4451
code to validate the i2c_address.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 20:00:44 -05:00
Kevin O'Connor 75ad16ea1a sam3: Add support for sam4s8c chips
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:34:31 -05:00
Master92 6ccc0732c1 menu: Fix filament loading and unloading feature (#1082)
As discussed in #1057, the default loading- and unloading procedure does
not behave as expected. Setting the extruder to relative mode fixes this.

Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
2019-01-07 10:25:19 -05:00
Paulo Drugos ffbb4198c1 menu: Correction for the resume option appears when the toolhead is not printing (#1077)
Signed-off-by: Paulo Drugos paulodrugos@gmail.com
2019-01-05 19:11:03 -05:00