Commit Graph

160 Commits

Author SHA1 Message Date
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
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
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 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 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 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 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 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 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 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 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 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
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 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 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 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 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 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
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 f6d4284d5c homing: Directly interact with the kinematic class on query_endstops()
Move the query_endstop logic out of toolhead.py and into homing.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-06 19:13:54 -05:00
Kevin O'Connor 8d9ca6f2dd homing: Directly interact with the kinematic class when homing
Move the homing logic out of toolhead.py and into homing.py.  This
simplifies the toolhead logic and centralizes the homing code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-06 19:13:54 -05:00
Kevin O'Connor bc9cbc8133 gcode: Move SET_SERVO command from gcode.py to chipmisc.py
Now that commands can be registered dynamically, move the code for
SET_SERVO from gcode.py to the PrinterServo() class in chipmisc.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-06 18:35:51 -05:00
Kevin O'Connor b5a41d0dd1 gcode: Rework gcode handler setup to allow dynamic command registration
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-06 18:35:51 -05:00
Kevin O'Connor 64a091fb98 gcode: Add a get_str() method
Add a get_str() method that can extract a required parameter from a
g-code command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-06 18:35:51 -05:00
Kevin O'Connor 80f23441dd gcode: Simplify exception handling
Translate caught exceptions into a gcode.error() exception.  This way
there is one standard place to invoke respond_error().  Also, always
reset the last_position on a handled error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-06 18:35:51 -05:00
Kevin O'Connor 3a2d16abb3 gcode: Always allow M112 command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-06 18:35:49 -05:00
Kevin O'Connor f8750b142f klippy: Rework shutdown handling
If an MCU signals a shutdown from the background thread, notify the
main thread and handle the shutdown there.  Dispatch shutdown handling
from the main Printer() class instead of from the Toolhead class.
This simplifies the shutdown logic.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-10-12 16:28:53 -04:00
Kevin O'Connor d03cf2b83f adccmds: Continue to query analog inputs after a shutdown
Continue to sample the ADC input pins even if the MCU goes into a
shutdown state.  This enables the printer to continue reporting
temperatures even on an mcu error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-10-12 11:59:27 -04:00
Kevin O'Connor ecf2596469 gcode: Don't warn on fan not present if input is from a file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-10-11 14:28:19 -04:00
Kevin O'Connor ce9523fb90 gcode: Report the raw MCU position from the M114 command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-10-03 22:03:52 -04:00
Kevin O'Connor 06420b0ddf gcode: Carry over #original and #command in get_extended_params()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-10-02 22:06:43 -04:00
Kevin O'Connor 6e5bcc69bc gcode: Make dump_debug() output atomic
Build a single (very large) logging message with the debug state.
This prevents the output from being fragmented.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-27 11:58:21 -04:00
Kevin O'Connor 8d04d3d8fd gcode: Exit if a shutdown occurs while running in batch mode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-27 10:05:11 -04:00
Kevin O'Connor 6dcc44ce2d chipmisc: Add initial support for servos
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-20 14:21:36 -04:00
Kevin O'Connor 0d13834293 gcode: Fix error that could cause commands to be processed out of order
Commit d0932009 changed the way command handling was performed, and
commit 95950949 fixed a defect in that commit.  Unfortunately, the fix
was incomplete.

If multiple commands were sent to Klippy without waiting for an "ok"
response from Klippy, then it was possible for those additional
commands to be queued and processed after subsequent commands.  This
would result in commands being processed out of order.

Fix this by only reregistering the input fd in the greenlet that
performs the unregistration of the fd.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-02 12:05:51 -04:00
Kevin O'Connor ac53806e04 gcode: Add an ECHO command for debugging purposes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-02 12:05:51 -04:00
Kevin O'Connor 0c2919b534 klippy: Move restart logic into Printer() class
Move the restart logic out of main() and into Printer.run().  This
simplifies the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-08-26 18:27:21 -04:00
Kevin O'Connor a42cb4fecf toolhead: Avoid directly accessing the printer.mcu field
Lookup the mcu object from the printer objects and store it locally in
the toolhead class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-08-26 18:27:21 -04:00
Kevin O'Connor 268834e4ae klippy: Store printer startup parameters in new "start_args" dictionary
Store pertinent information from the software startup in a dictionary
that the various printer components can access instead of in
individual variables in the Printer() class.  This makes it easier to
add future command-line options.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-08-25 19:27:05 -04:00
Kevin O'Connor 7bf0ec2fe7 gcode: Don't wait for moves to finish if both debug input and output
Don't wait for moves to finish if the output is going to a debug file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-07-23 21:32:26 -04:00
Kevin O'Connor 7faa5fe233 gcode: Improve end-of-file handling when input is a debug file
Wait for any pending moves to be fully handled before exiting.  Make
sure the wait is done inside the "self.is_processing_data" check to
avoid infinite recursion.  Don't keep reading from the file while
waiting to exit.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-07-21 21:22:12 -04:00
Kevin O'Connor 12ca45a264 gcode: Log g-code error responses
Be sure to log g-code errors even if debug logging is not enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-07-17 11:24:15 -04:00
Kevin O'Connor 959509496a gcode: Fix regression causing lost asynchronous commands
Commit d0932009 introduced an error that could cause lost input in
cases where the sender did not wait for an "ok" message before sending
the next command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-11 12:42:11 -04:00
Kevin O'Connor 8419e152bb klippy: Remove some obscure python2 dependencies
Don't modify dictionaries while iterating them and be careful to use
// when doing an integer divide.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-10 00:12:14 -04:00
Kevin O'Connor 1bc3e0a678 klippy: Use newer "except XYZError as e" python syntax
Use the newer syntax for python exceptions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-10 00:08:06 -04:00
Kevin O'Connor d093200966 gcode: Support running arbitrary gcode on extruder change
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-09 18:55:33 -04:00
Kevin O'Connor 72dc21fb1a gcode: Support for querying and setting multiple extruder heaters
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-09 18:55:30 -04:00
Kevin O'Connor 24b8f4ebc1 extruder: Add initial support for multi-extruders
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-09 18:54:38 -04:00
Kevin O'Connor 01ee9e16c5 klippy: Prefer python dictionary comprehension to dict() call
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-06 12:35:13 -04:00
Kevin O'Connor c9d21574d8 gcode: Check for invalid speeds
Raise an error if the move speed is set to a zero or negative value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-02 07:54:48 -04:00
Kevin O'Connor fc9fb7473c gcode: Don't report an error if turning off an unknown fan or heater
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-01 15:02:27 -04:00
Kevin O'Connor 35a6d9ba87 gcode: Sort the order of commands in HELP
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-04-26 10:44:22 -04:00
Kevin O'Connor c63754fc32 gcode: Limit build_handlers() method to just building available commands
The set_printer_ready() can be called from a background thread on a
shutdown event, so don't try to lookup the printer components in that
case.  Simplify build_handlers() so that it no longer tests for
components being available - test for component availability in the
command handlers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-04-26 10:31:58 -04:00
Kevin O'Connor 167b18b58f gcode: Ignore M21 command
No need to recommend users disable "SD card support" in octoprint -
instead, just ignore the M21 command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-04-20 10:11:10 -04:00
Kevin O'Connor 8920479f85 klippy: Remove CLEAR_SHUTDOWN command
Advice users to issue a FIRMWARE_RESTART command on a printer shutdown
event, and remove support for CLEAR_SHUTDOWN.  A full mcu reset is
preferable and it simplifies the interface.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-04-13 14:53:41 -04:00
Kevin O'Connor cbdc54843d gcode: Catch common gcode parameter errors
Don't force a firmware shutdown on a simple gcode parse error.
Instead, report the error back to the user and otherwise ignore the
command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-16 13:13:36 -04:00
Kevin O'Connor be91c1229f gcode: Eliminate build_config() method
Lookup the printer components during the set_printer_ready() callback.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-13 00:38:17 -04:00
Kevin O'Connor 64407dc5d2 klippy: Support FIRMWARE_RESTART command
Add initial support for micro-controller resets via the Arduino reset
mechanism.  Also, automatically attempt a firmware restart if the
printer CRC does not match.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-08 23:02:31 -05:00
Kevin O'Connor 47f1d377f5 heater: Enforce min/max_temp in heater.set_temp()
Raise an error if the user requests a temperate outside the configured
min/max_temp range.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-02-21 10:48:42 -05:00
Kevin O'Connor 29131c873a gcode: Attempt to shutdown heaters and fans prior to a RESTART
If the user requests a restart and the machine appears to be otherwise
functioning normally, then attempt to stop the heaters and fans prior
to restarting the host.  This prevents the firmware from going into a
shutdown state when the heater is on and the host restarts.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-02-12 18:48:21 -05:00
Kevin O'Connor 6179839215 toolhead: Separate motor off timer from main flush timer
Move the motor off time checking to its own code.  This simplifies the
main flush handler.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-02-12 17:20:40 -05:00
Kevin O'Connor 20d0936fa2 reactor: Use the system monotonic clock instead of the normal system clock
The normal system clock can have sudden jumps if the system clock is
changed.  Use the system monotonic clock to avoid these sudden changes
in time.

It appears the Raspbian OS (which is used by OctoPi) is setup to
update the system clock upon network connectivity.  This could cause
sudden system clock changes which could lead to Klippy processing
errors.  Using the monotonic clock eliminates these issues.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-02-06 13:31:34 -05:00
Kevin O'Connor 667b72870f gcode: Exit on an unhandled exception when reading from a file
When testing via a gcode input file, it's easier to debug problems if
the program exits upon the first exception.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-02-06 12:17:50 -05:00
Kevin O'Connor 860fc3e91d gcode: Add support for M115 command
Support querying the firmware type and version.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-28 22:38:29 -05:00
Kevin O'Connor 2e03d84755 gcode: Add support for M400 command
Add ability to fully stall the input until all moves are complete.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-28 22:38:28 -05:00
Kevin O'Connor 219796ef4e gcode: Add a "STATUS" command
Add a status command that will report the current printer status.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-21 11:35:00 -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 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 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 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 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 5d805ba550 klippy: Run the MCU connect code within the reactor
Setup the reactor and run the MCU connection code as a timer within
the reactor.  The connection code will make use of reactor greenlets
so that it can wait for events during the connection phase.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-29 21:54:45 -05:00
Kevin O'Connor d161d66741 mcu: Handle adc initialization entirely in mcu code
Don't expose the ADC initialization to the gcode and heater code -
instead, register a callback within the MCU_adc class and call it
directly from the MCU class after configuration completes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-29 18:21:56 -05:00
Kevin O'Connor 9755182adf homing: Check homing distance to verify endstop trigger after retract
Instead of checking the endstop trigger directly after a retract move,
verify some distance is traveled during the following homing
operation.  This reduces the amount of synchronization between mcu and
host during homing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-28 11:23:26 -05:00
Kevin O'Connor e0aa067cc9 homing: Check for timeout during homing operation
Should a homing move complete without hitting the endstop, then
disable motors, disable the endstop checking, and report the error to
the user.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-18 14:17:53 -05:00
Kevin O'Connor 781cf608d7 homing: Create Homing class from gcode
Create the Homing class in the gcode handler instead of in the
kinematic classes.  This will make it easier to pass error messages
back to the user.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-18 14:04:09 -05:00
Kevin O'Connor 9e1059afb4 homing: Create QueryEndstops class from gcode
Create the QueryEndstops in the gcode handler instead of in the
kinematic classes.  This simplifies the gcode handler as it can
directly register its response callback.

Also, store the stepper name in the stepper class.  Also, propagate
the print_time of the query request to the mcu_endstop class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-18 14:04:09 -05:00