aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
Commit message (Collapse)AuthorAgeFilesLines
* fan: Add support for heater_fan objectsKevin O'Connor2017-07-171-0/+3
| | | | | | | Add support for fans designed to cool the components of an extruder or heater. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Request python2 for all directly executed python binariesKevin O'Connor2017-06-271-1/+1
| | | | | | | Some systems point python to python3 instead of python2 - explicitly request python2 to avoid conflicts. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Make sure to always sleep before retrying next stats() callKevin O'Connor2017-06-151-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Use newer "except XYZError as e" python syntaxKevin O'Connor2017-06-101-4/+4
| | | | | | Use the newer syntax for python exceptions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Allow each module to define their config sectionsKevin O'Connor2017-06-091-11/+8
| | | | | | | | Create add_printer_objects() functions in the fan, heater, extruder, and toolhead modules. Create the necessary printer component objects from this call instead of placing the code directly in klippy.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Prefer python dictionary comprehension to dict() callKevin O'Connor2017-06-061-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* queuelogger: Add critical information to each logfile on rolloverKevin O'Connor2017-05-011-13/+22
| | | | | | | When the log file does a rollover, start the top of the log with critical system information (eg, software versions). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Don't log stats when the printer is idleKevin O'Connor2017-04-141-8/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Remove CLEAR_SHUTDOWN commandKevin O'Connor2017-04-131-3/+3
| | | | | | | | 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>
* mcu: Support reset commandKevin O'Connor2017-04-131-1/+1
| | | | | | | Extend the FIRMWARE_RESTART command so that it can use the firmware "reset" command instead of the "arduino" mechanism. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Support minimum/maximum value checks on configuration variablesKevin O'Connor2017-04-111-6/+27
| | | | | | | Verify that numeric parameters are in a sane range when reading the config. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Log python info at start of logKevin O'Connor2017-03-161-0/+2
| | | | | | Log the python version and startup command parameters to the log. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Eliminate high-level build_config phaseKevin O'Connor2017-03-131-12/+6
| | | | | | | | | | Now that the mcu objects can be created prior to connecting to the mcu, it is no longer necessary to separate the init and build_config phases in the high-level code. Move the mcu objection creation from the build_config phase to the init phase and eliminate the build_config phase. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Eliminate build_config() methodKevin O'Connor2017-03-131-2/+1
| | | | | | 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-10/+26
| | | | | | | | 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>
* klippy: Log the type of cpu the host is running onKevin O'Connor2017-02-121-0/+1
| | | | | | | | Report in the log the host CPU type and count. This helps distinguish between different rpi versions when debugging the log from a problem report. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Fix omission causing gcode dump to not functionKevin O'Connor2017-02-121-2/+4
| | | | | | Fix bug that broke the gcode command dump after a shutdown. 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-1/+5
| | | | | | | | | | | | | 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>
* klippy: Increase precision of reported statistics timestampKevin O'Connor2017-01-101-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Warn the user on common errors due to old firmwareKevin O'Connor2017-01-101-0/+14
| | | | | | | | Check for msgproto.error and warn the user about version firmware version mismatch. Raise msgproto.error when extracting firmware constants. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add support for M115 commandKevin O'Connor2016-12-281-3/+5
| | | | | | Support querying the firmware type and version. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Log the contents of the config file at startupKevin O'Connor2016-12-241-0/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Log the host software git version at startupKevin O'Connor2016-12-241-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add a "STATUS" commandKevin O'Connor2016-12-211-1/+1
| | | | | | Add a status command that will report the current printer status. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Update config error message - use "RESTART" when ready to continueKevin O'Connor2016-12-211-2/+3
| | | | | | | It is possible to restart the host software with a RESTART command after manually resetting the micro-controller. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: stats() method must check that mcu and toolhead classes existKevin O'Connor2016-12-011-5/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Fix typo causing missing stats on 'exit_eof' caseKevin O'Connor2016-12-011-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Add support for CLEAR_SHUTDOWN commandKevin O'Connor2016-12-011-3/+3
| | | | | | Add ability to clear the MCU shutdown flag from the console. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Add ability to restart the host softwareKevin O'Connor2016-11-301-13/+30
| | | | | | | 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>
* mcu: Detect if the communication channel to the firmware is lostKevin O'Connor2016-11-301-0/+4
| | | | | | Detect a comms loss and report it to the user. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Don't dump the message log directly from set_printer_ready()Kevin O'Connor2016-11-301-0/+7
| | | | | | | | 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>
* klippy: Validate that options in the config file existKevin O'Connor2016-11-301-0/+17
| | | | | | | | 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>
* klippy: Add ConfigWrapper.getchoice methodKevin O'Connor2016-11-301-0/+7
| | | | | | | | 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>
* klippy: Throw an exception if any required config parameter is missingKevin O'Connor2016-11-301-15/+22
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Raise a config error on an invalid pin name in the config fileKevin O'Connor2016-11-301-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Report an error if the config file does not existKevin O'Connor2016-11-301-1/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Improve error reporting during connectKevin O'Connor2016-11-301-10/+56
| | | | | | | 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>
* gcode: Support reading from gcode input before mcu is readyKevin O'Connor2016-11-301-3/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: separate initial config file load into load_config() methodKevin O'Connor2016-11-301-19/+23
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Create the /tmp/printer pseudo tty before opening config fileKevin O'Connor2016-11-301-13/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Defer calling mcu.connect_file() to connect() methodKevin O'Connor2016-11-301-5/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Make SerialReader.connect() blockingKevin O'Connor2016-11-291-3/+0
| | | | | | | 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>
* klippy: Run the MCU connect code within the reactorKevin O'Connor2016-11-291-10/+13
| | | | | | | | 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>
* klippy: Eliminate write_dictionary command line optionKevin O'Connor2016-11-291-9/+0
| | | | | | | The feature is not necessary and it will be difficult to maintain in the future. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Remove support for DummyMCU classKevin O'Connor2016-11-161-4/+0
| | | | | | | It's easier to test with the file output mechanism and the DummyMCU code has grown stale. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* queuelogger: Add support for background log writingKevin O'Connor2016-11-121-4/+6
| | | | | | | | | | | | | | Writing to the debug log can cause an unbounded delay due to disk IO. This is particularly so on embedded machines such as the Raspberry Pi that run on SD cards. These log writing delays can cause problems for the main processing threads. The new "queuelogger" code forwards all the main thread log messages to a queue, and a background thread writes the log messages from the queue to the destination file. This eliminates the IO delay from the main threads. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Create a new class and python file to track the printer extruderKevin O'Connor2016-07-101-4/+4
| | | | | | | | | Create a new python file (extruder.py) to control the extruder heater and stepper motors. This separates the extruder control logic from the cartesian robot code - making it easier to customize both the kinematic control of the robot as well as the extruder. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Split toolhead code from cartesian.py to new file toolhead.pyKevin O'Connor2016-07-101-2/+2
| | | | | | Separate out the toolhead logic to its own python file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian: Rename CartKinematics class to ToolHeadKevin O'Connor2016-07-101-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Initial commit of source code.Kevin O'Connor2016-05-251-0/+163
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>