aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
Commit message (Collapse)AuthorAgeFilesLines
...
* fan: Allow heater_fan to work with heater_bedKevin O'Connor2017-09-071-6/+7
| | | | | | | Fix order of init error preventing heater_fan from being used with heater_bed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Provide some further help on common MCU shutdown errorsKevin O'Connor2017-09-051-2/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Eliminate set_max_jerk() from kinematic classesKevin O'Connor2017-09-031-2/+2
| | | | | | | | Allow the kinematic classes to query the max velocity, max accel, and max halt velocity from the toolhead class instead of having the toolhead class call into the kinematic classes with those values. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Move restart logic into Printer() classKevin O'Connor2017-08-261-26/+15
| | | | | | | Move the restart logic out of main() and into Printer.run(). This simplifies the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rename internal functions so that they are prefaced with "_"Kevin O'Connor2017-08-261-8/+8
| | | | | | | Preface the internal functions to make it more clear which functions are interfaces to external code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chipmisc: Add support for statically configured output pinsKevin O'Connor2017-08-261-2/+2
| | | | | | | Allow digital and PWM output pins to be setup via new config sections. This makes it easier to setup pin configurations. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Support registering arbitrary chips that supply configurable pinsKevin O'Connor2017-08-251-6/+6
| | | | | | | | | Allow multiple chips to provide pin mappings (not just the main mcu chip). Move the pin parsing from the mcu.py code to pins.py and support mapping from pin descriptions to their corresponding chips and parameters. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Store printer startup parameters in new "start_args" dictionaryKevin O'Connor2017-08-251-50/+31
| | | | | | | | | 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>
* 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>