aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/gcode.py
Commit message (Collapse)AuthorAgeFilesLines
...
* gcode: Add support for M220 (set speed factor) g-code commandKevin O'Connor2018-01-031-4/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Don't wait for temperature if the temperature is disabledKevin O'Connor2018-01-031-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Dump internal g-code state in dump_debug()Kevin O'Connor2017-12-211-0/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Group similar G-Code commands togetherKevin O'Connor2017-12-211-44/+49
| | | | | | | 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>
* homing: Directly interact with the kinematic class on query_endstops()Kevin O'Connor2017-12-061-7/+2
| | | | | | Move the query_endstop logic out of toolhead.py and into homing.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Directly interact with the kinematic class when homingKevin O'Connor2017-12-061-2/+2
| | | | | | | 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>
* gcode: Move SET_SERVO command from gcode.py to chipmisc.pyKevin O'Connor2017-12-061-14/+6
| | | | | | | 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>
* gcode: Rework gcode handler setup to allow dynamic command registrationKevin O'Connor2017-12-061-17/+21
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add a get_str() methodKevin O'Connor2017-12-061-17/+10
| | | | | | | 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>
* gcode: Simplify exception handlingKevin O'Connor2017-12-061-19/+16
| | | | | | | | 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>
* gcode: Always allow M112 commandKevin O'Connor2017-12-061-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rework shutdown handlingKevin O'Connor2017-10-121-21/+21
| | | | | | | | | 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>
* adccmds: Continue to query analog inputs after a shutdownKevin O'Connor2017-10-121-6/+6
| | | | | | | | 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>
* gcode: Don't warn on fan not present if input is from a fileKevin O'Connor2017-10-111-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Report the raw MCU position from the M114 commandKevin O'Connor2017-10-031-3/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Carry over #original and #command in get_extended_params()Kevin O'Connor2017-10-021-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Make dump_debug() output atomicKevin O'Connor2017-09-271-2/+4
| | | | | | | 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>
* gcode: Exit if a shutdown occurs while running in batch modeKevin O'Connor2017-09-271-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chipmisc: Add initial support for servosKevin O'Connor2017-09-201-8/+38
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Fix error that could cause commands to be processed out of orderKevin O'Connor2017-09-021-7/+5
| | | | | | | | | | | | | | | | 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>
* gcode: Add an ECHO command for debugging purposesKevin O'Connor2017-09-021-1/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Move restart logic into Printer() classKevin O'Connor2017-08-261-2/+2
| | | | | | | Move the restart logic out of main() and into Printer.run(). This simplifies the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Avoid directly accessing the printer.mcu fieldKevin O'Connor2017-08-261-1/+1
| | | | | | | 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>
* klippy: Store printer startup parameters in new "start_args" dictionaryKevin O'Connor2017-08-251-7/+6
| | | | | | | | | 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>
* gcode: Don't wait for moves to finish if both debug input and outputKevin O'Connor2017-07-231-1/+2
| | | | | | 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>
* gcode: Improve end-of-file handling when input is a debug fileKevin O'Connor2017-07-211-7/+10
| | | | | | | | | 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>
* gcode: Log g-code error responsesKevin O'Connor2017-07-171-2/+3
| | | | | | Be sure to log g-code errors even if debug logging is not enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Fix regression causing lost asynchronous commandsKevin O'Connor2017-06-111-1/+2
| | | | | | | | 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>
* klippy: Remove some obscure python2 dependenciesKevin O'Connor2017-06-101-1/+1
| | | | | | | 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>
* klippy: Use newer "except XYZError as e" python syntaxKevin O'Connor2017-06-101-7/+7
| | | | | | Use the newer syntax for python exceptions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Support running arbitrary gcode on extruder changeKevin O'Connor2017-06-091-9/+14
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Support for querying and setting multiple extruder heatersKevin O'Connor2017-06-091-24/+33
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Add initial support for multi-extrudersKevin O'Connor2017-06-091-4/+28
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Prefer python dictionary comprehension to dict() callKevin O'Connor2017-06-061-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Check for invalid speedsKevin O'Connor2017-05-021-1/+4
| | | | | | Raise an error if the move speed is set to a zero or negative value. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Don't report an error if turning off an unknown fan or heaterKevin O'Connor2017-05-011-3/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Sort the order of commands in HELPKevin O'Connor2017-04-261-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Limit build_handlers() method to just building available commandsKevin O'Connor2017-04-261-34/+40
| | | | | | | | | | 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>
* gcode: Ignore M21 commandKevin O'Connor2017-04-201-10/+8
| | | | | | | 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>
* klippy: Remove CLEAR_SHUTDOWN commandKevin O'Connor2017-04-131-9/+1
| | | | | | | | 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>
* gcode: Catch common gcode parameter errorsKevin O'Connor2017-03-161-28/+58
| | | | | | | | 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>
* gcode: Eliminate build_config() methodKevin O'Connor2017-03-131-3/+4
| | | | | | Lookup the printer components during the set_printer_ready() callback. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Support FIRMWARE_RESTART commandKevin O'Connor2017-03-081-9/+16
| | | | | | | | 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>
* heater: Enforce min/max_temp in heater.set_temp()Kevin O'Connor2017-02-211-1/+5
| | | | | | | 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>
* gcode: Attempt to shutdown heaters and fans prior to a RESTARTKevin O'Connor2017-02-121-5/+14
| | | | | | | | | 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>
* toolhead: Separate motor off timer from main flush timerKevin O'Connor2017-02-121-1/+1
| | | | | | | 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>
* reactor: Use the system monotonic clock instead of the normal system clockKevin O'Connor2017-02-061-2/+2
| | | | | | | | | | | | | 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>
* gcode: Exit on an unhandled exception when reading from a fileKevin O'Connor2017-02-061-0/+3
| | | | | | | 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>
* gcode: Add support for M115 commandKevin O'Connor2016-12-281-1/+7
| | | | | | Support querying the firmware type and version. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add support for M400 commandKevin O'Connor2016-12-281-1/+5
| | | | | | Add ability to fully stall the input until all moves are complete. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>