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>
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>
Specify hardware pwm cycle times using the same method as software pwm
(in seconds, not clock ticks). Allow the fan code to be configured
with an explicit cycle time even when using software pwm.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the mcu supports command restarts and it does not appear to use a
real serial port, then default the restart method to 'command'. This
is a better default on boards with native USB support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Report the current temperature, current pwm setting, and target
temperature as statistics in the log.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for disabling homing checks via the homing_override
mechanism. This may be useful to move an axis prior to homing it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a virtual pin that may be used as the z endstop pin on
cartesian printers that use the probe in place of a z endstop.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow a set of g-code scripts to be run on each probe invocation.
This may be useful for probes that need to be setup before they are
useful (eg, with servo actuated probes).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow users to override the behavior of G28 using a new
"homing_override" config section. This may be used on printers that
require specific steps during the homing process.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The print cooling fan and printer heater_fan are independent modules
that can reside in the extras directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Check if a config section matches a python filename in the
klippy/extras/ directory. If it does, load that python code to handle
the config section.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
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>
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>
The previous code increases print_stall if a move is proactively
flushed due to buffer_time_low and a follow up move is ready to send
before the existing moves are fully retired. However, this would not
track the case where a move is proactively flushed and it takes an
extended amount of time to get sufficient moves to refill the queue.
Change the code so that print_stall increases anytime a new move is
queued after a proactive flush and there are existing moves not yet
fully retired.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Determine the median period from the pin tuning tests and use that to
recommend a set of PID parameters. Report the results over the g-code
terminal.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Enable all the steppers via the shift registers when the first stepper
is enabled, and disable all the steppers once all steppers are
disabled. This avoids having to enable all the steppers all of the
time. Note that, this support is independent from the current control
for each stepper, which is still done individually.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The enable lines are not one per stepper - instead there are 5
distinct enable settings. Handle them properly.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the update_command() call to use a new PinResolver class. In
that new class, verify that the same pin isn't referenced in two
different parts of the config using different aliases for the pin.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's common for multiple steppers to use the same stepper enable
line. Detect this and only create a single digital_out oid on the
micro-controller.
Also, prohibit any other pin from being used multiple times in the
config file.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Always set the pin_params['type'] field on a pin lookup. Rename
parse_pin_desc() to lookup_pin() to make the change more clear.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The extruder check_move() code will permit moves with huge extrusion
ratios if the amount extruded is tiny. (Some slicers emit these silly
moves - they are allowed because they are harmless.) Unfortunately,
the pressure advance code did not handle the huge extrusion ratios -
it would result in a massive, near instantaneous, extruder move in an
attempt to build pressure in the extruder. Catch this case and limit
the impact to the pressure advance code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Added the pwm_cycle_time option for heater config sections. Defaults
to previous value of 0.100 seconds, but may be reduced to shorter times
at the expense of MCU workload and possible MOSFET heating, depending on
controller design. Some printers that need bed PID to be enabled,
notably the Felixprinters series, are known to benefit from shorter
cycle times, as the default 10hz rate results in excessive voltage
supply droop.
While this option can be used on extruder heaters as well, there
is not expected to be any particular benefit from doing so unless
the extruder heater presents a particularly large load.
Signed-off-by: Andy Silverman <andrewsi@outlook.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add PID_SETTLE_DELTA and PID_SETTLE_SLOPE constants to the code to try
and make it a little more clear how the wait for temperature code
works.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Store the gcc and binutils versions used in the compilation of the
firmware in the firmware data dictionary. Forward that information to
the log so it is available during debugging.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 002dc0df added rounding to the homing speed, but it did not
work if the configured homing speed was less than the printer's
maximum velocity. Move the speed rounding from stepper.py to
homing.py and make sure the rounded speed is less than the maximum
speed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>