Commit Graph

3599 Commits

Author SHA1 Message Date
Kevin O'Connor e4c4a4628b stepcompress: Use inclusive range on min/maxadd
Change the min/maxadd variables to use an inclusive range instead of
exclusive.  This better matches min/maxinterval.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-19 11:20:38 -05:00
Kevin O'Connor a217c0f394 stepcompress: Be consistent with "point" vs "nextpoint"
Make it clear which variables refer to the best verified point found
so far, and which variables deal with the next (not yet verified)
point.

Also, remove checked_count as bestcount serves the same purpose.

Also, allow minmax_point to be inlined.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-19 11:20:38 -05:00
Kevin O'Connor 1dbd11446c stepcompress: Don't warn on multi-step interval=0 sequences
It is possible to get a valid multi-step sequence with an interval of
zero if the add is non-zero.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-14 11:03:16 -05:00
Kevin O'Connor 74fa8a3907 serialhdl: Clear "hupcl" bit from serial port
The arduino style serial port interfaces can reset the MCU when the
serial port is opened.  Clearing the HUPCL flag makes this less
likely.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-09 19:07:03 -05:00
Kevin O'Connor cad1e0b985 docs: Recommend latest version of pyserial in installation instructions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-09 18:59:36 -05:00
Kevin O'Connor b099851a8b gcode: Increase initial speed
If a speed is never specified then default to 25mm/s (up from 1 mm/s).
If a user accidentally issues a move without setting the speed, the
default speed shouldn't be so slow that it takes minutes to finish the
move.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-09 17:28:09 -05:00
Kevin O'Connor f25ead109c gcode: Handle M112 emergency stop command
Also try to support the command if it is sent out of order.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-09 17:09:51 -05:00
Kevin O'Connor edd7dfe1c8 gcode: Rework toolhead stalling to use greenlets
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-09 17:09:51 -05:00
Kevin O'Connor 89f5452ddb gcode: Rework homing to use greenlets
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-09 17:09:51 -05:00
Kevin O'Connor a6de1db94d gcode: Rework endstop query to use greenlets
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-09 17:09:51 -05:00
Kevin O'Connor ed9d7e4fae gcode: Convert wait for temp to use greenlets
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-08 18:15:11 -05:00
Kevin O'Connor e169f70bfb gcode: Convert busy handler from timer to greenlet
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-08 18:15:11 -05:00
Kevin O'Connor 35428f2e04 cartesian: Make it clear which methods of CartKinematics are internal
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-08 18:14:46 -05:00
Kevin O'Connor 0718a1bd1f delta: Make it clear which methods of DeltaKinematics are internal
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-08 18:13:34 -05:00
Kevin O'Connor 83f7d702e7 stepcompress: Encourage add=0 in compress_bisect_add()
Only use a non-zero 'add' if it actually extends the number of steps
the command covers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-06 19:01:00 -05:00
Kevin O'Connor 12d4888321 graphstats: Updates for recent stats changes
Update the graphstats helper script to account for recent changes in
the statistics output.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-06 11:10:52 -05:00
Kevin O'Connor 4565a73e91 stepcompress: Optimize push_delta_const() for common XY or Z only moves
Most moves are on the XY plane - avoid a few multiplications in the
inner loop in this case.  When there is a Z move, it is almost always
entirely a Z move - avoid the sqrt() call in the inner loop in this
case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-05 14:40:29 -05:00
Kevin O'Connor 9c932ad514 delta: Rework delta math to avoid using inv_movexy_r
Taking the inverse of the XY move distance can lead to extremely large
values when the XY distance is very small.  This can lead to
saturation of the double precision variables and incorrect results.

Rework the delta kinematic math to avoid using this inverse.  Pass the
closestxy_d value directly to the C functions so that the C code can
calculate its intermediate constants.

After this change the move_z special case is no longer necessary as
the regular delta functions now work with movexy_r=0 and movez_r=1.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-05 14:36:02 -05:00
Kevin O'Connor 5458f3cbd2 delta: Make sure homing distance is large enough to hit the endstop
The head may be far away from an axis at the start of a home, and that
axis must then traverse more than just the distance from zero height
to the endstop position.  Add in additional distance to account for
this.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-05 14:06:38 -05:00
Kevin O'Connor 611e1d239b config: Update avrsim.cfg with recent config file changes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-02 16:21:23 -05:00
Kevin O'Connor d2abbd8f5d extruder: Fix retract
Commit 7554c7f6 broke retract moves.  Fix by making sure extrude_r is
always a positive number.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-01 18:17:54 -05:00
Kevin O'Connor 00b40b720f klippy: stats() method must check that mcu and toolhead classes exist
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-01 18:17:54 -05:00
Kevin O'Connor 71b4923208 delta: Support limiting the maximum velocity of z moves
On a delta printer, z moves require the mcu to support the greatest
number of steps per second.  However, z moves are rare, so it makes
sense to limit the velocity of z moves separately from the velocity of
normal xy moves.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-01 18:17:54 -05:00
Kevin O'Connor c49d3fdb17 toolhead: Specify maximum acceleration and velocity in toolhead class
Change the config file so the maximum accel and velocity are specified
in the "printer" section instead of the individual "stepper" sections.
The underlying code limits the velocity and accel of the toolhead
relative to the print object, so it makes sense to configure the
system that was as well.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-01 18:17:54 -05:00
Kevin O'Connor fcaf359e89 stepstats: Update stepstats script with change in dir_pin meaning
Commit afecf7ce inverted the direction of the direction pin in
queue_step commands - update the stepstats script to conform.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-01 18:16:18 -05:00
Kevin O'Connor 9a31c068c4 klippy: Fix typo causing missing stats on 'exit_eof' case
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-01 10:55:04 -05:00
Kevin O'Connor babc9e7a1e docs: Minor updates to wording of some documents
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-01 10:21:36 -05:00
Kevin O'Connor d2ecc9d80c gcode: Add support for CLEAR_SHUTDOWN command
Add ability to clear the MCU shutdown flag from the console.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-01 00:21:20 -05:00
Kevin O'Connor fbd7cc243b klippy: Add ability to restart the host software
Add a "restart" gcode command that will cause the host "klippy"
software to reload its config and restart.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 23:53:03 -05:00
Kevin O'Connor a6055ce069 gcode: Support parsing of "extended" gcode commands
Support human readable commands (eg, "help").  Add a "help" command to
list these extended commands.

Also, add support for declaring command aliases, command help, and
command availability next to the handlers themselves.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 23:00:29 -05:00
Kevin O'Connor 35719e665c delta: Fix delta kinematics startup
Commit 1e1364c3 moved the storage of the stepper position to the
mcu_stepper class.  The initializing of that position needs to be
pushed back until after the mcu_stepper class is instantiated.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:24:03 -05:00
Kevin O'Connor bc80ed4e88 mcu: Detect if the communication channel to the firmware is lost
Detect a comms loss and report it to the user.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:20:09 -05:00
Kevin O'Connor 5ebe8ce025 gcode: Don't dump the message log directly from set_printer_ready()
The set_printer_ready() method can be called from a background thread.
Have the main Printer class call a new dump_debug() method in the main
thread on a shutdown event.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:20:09 -05:00
Kevin O'Connor 17dcb42752 klippy: Validate that options in the config file exist
Check that all options specified in the config file are valid.  This
catches possible typos and spelling errors in variable names that have
a default.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:20:09 -05:00
Kevin O'Connor 2f97b2d7c2 klippy: Add ConfigWrapper.getchoice method
Add helper function that ensures a config option is one of several
choices.  This helps ensure that a proper error is raised if an
invalid choice is made.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:44 -05:00
Kevin O'Connor 57244de37d klippy: Throw an exception if any required config parameter is missing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:44 -05:00
Kevin O'Connor 3806ed882a mcu: Raise a config error on an invalid pin name in the config file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:44 -05:00
Kevin O'Connor ce7e7c4048 klippy: Report an error if the config file does not exist
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:44 -05:00
Kevin O'Connor 524e0290bc klippy: Improve error reporting during connect
Catch exceptions during the connect phase and report them via the
gcode interface to the user.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:44 -05:00
Kevin O'Connor dbdf1e137e gcode: Support reading from gcode input before mcu is ready
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:43 -05:00
Kevin O'Connor 6ebb1a68cb klippy: separate initial config file load into load_config() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:43 -05:00
Kevin O'Connor 7e7e607e3f klippy: Create the /tmp/printer pseudo tty before opening config file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:43 -05:00
Kevin O'Connor 4eb21a71ae klippy: Defer calling mcu.connect_file() to connect() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:43 -05:00
Kevin O'Connor 4f07ee4d92 pyhelper: Add ability to route error messages to python logging
Instead of writing error messages to stderr, route them into the
python code and use the standard python logging system.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:43 -05:00
Kevin O'Connor b14db404b5 pyhelper: Move helper functions from serialqueue.c to new file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 13:33:16 -05:00
Kevin O'Connor 7cb71df02c mcu: Be careful to free memory allocated in C code
Free steppersync, stepcompress, and commandqueue objects.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 13:33:16 -05:00
Kevin O'Connor 55fc11ff02 serialhdl: Retry opening of serial port
Continually retry to open the serial port.  This helps with connecting
to some micro-controllers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-29 21:58:48 -05:00
Kevin O'Connor 0d43d269ed serialhdl: Fully deallocate serialqueue on disconnect
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-29 21:58:48 -05:00
Kevin O'Connor a0829c63de serialhdl: Make SerialReader.send_with_response() blocking
Use the greenlet mechanism to wait for the response directly in the
send_with_response() method.  This simplifies the calling code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-29 21:58:45 -05:00
Kevin O'Connor 535c7b99b4 serialhdl: Make SerialReader.connect() blocking
Use the greenlet mechanism to wait for the connection to come up in
the serial connect() method.  This simplifies the calling code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-29 21:57:49 -05:00