Avoid using the absolute E position when calculating pressure advance
as that position can grow arbitrarily large, which can result in
"numerical stability" problems. That instability could eventually
lead to internal errors during step compression.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some RPi0 users were reporting "timer too close" errors due to pwm pin
resets - increase the time the host has to complete the startup to
avoid this.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
On a reset, the mcu.py code may have sent an initialization message to
the bltouch, which needs time to complete. Add additional time during
the bltouch setup to avoid a race with these two times. This avoids
some "timer too close" errors that users of fast host machines were
reporting.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The M117 command parser discards the last character of the message
whenever the M117 command does not begin the line and there is no *xx
checksum, e.g.
N0 M117 Look at me
causes the banner area of the printer screen to display "Look at m".
This patch only trims the checksum when one is found to trim.
Signed-Off-By: Jonathan Pickard <jhp@adjustablelabs.info>
Add support for performing Python gc work only from the main reactor
thread and only when it appears the main thread is idle.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Explicitly run the python garbage collector on a restart. This cleans
up memory from the previous session.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure to terminate any greenlets that are in a pause() state.
This is necessary to ensure the reactor can be deallocated.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The existence of a __del__() method prevents deallocation on python2
if there are circular references. Replace the __del__() method with a
new finalize() call and arrange for it to be called when the main
reactor is released.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The existence of a __del__() method prevents deallocation on python2
if there are circular references. Just remove the method as
disconnect() should already be called directly.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The existence of a __del__() method prevents deallocation on python2
if there are circular references. Just remove the method as
disconnect() should already be called directly.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The default on X86 32bit machines is to use 80bit floating point math
(as found in the ancient "387 coprocessor"). This can cause numerical
stability problems. Set the compiler flags to make sure the newer SSE
math is always used on X86.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add get_status wrapper with last_query status for macros It is sometimes useful to determine the state of the probe from a macro. If the probe is connected to an endstop pin, the results can be obtained via QUERY_ENDSTOPS but if a physical endstop is in use in addition to the probe the probe state cannot be obtained. This change allows one to use QUERY_PROBE and then access the printer.probe.last_query object to obtain the state.
Signed-off-by: Paul McGowan <mental405@gmail.com>
Some mcu implementations don't like it when the pwm pin is configured
twice, so use the normal schedule_pwm_out implementation to update on
a restart.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Try to invoke a shutdown on an unhandled exception from reactor.run().
If that fails, try to do a clean exit.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update callers to use the printer.command_error reference instead of
directly using homing.CommandError() when raising or catching errors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There's no reason to distinguish between an EndstopError and a
CommandError, so just use CommandError.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The optimized version is only available if it's the only axis used.
This fixes input_shaper on corexz.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Combine the shaper pulses and count of those pulses into a `struct
shaper_pulses`. Allocate space for the maximum number of pulses in
`struct input_shaper`.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Increase the maximum redraw rate from 4 times per second to 10 times
per second. Some users have reported slower rendering times as a
result of 8fa1c977.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Split up the main GCodeParser class into GCodeDispatch and GCodeMove
classes. The GCodeMove class is now available using the "gcode_move"
printer object name. This split simplifies the gcode.py code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The "status" and "printing_time" are now available in the
"idle_timeout" module, so no need to report them from toolhead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename printer.gcode.action_emergency_stop() to
action_emergency_stop(), printer.gcode.action_respond_info() to
action_respond_info(), and printer.gcode.action_respond_error() to
action_raise_error() in command templates.
This simplifies the get_status() interface, as returning callable
functions from that interface was confusing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a helper function for submitting relative movements. This
function will also automatically ensure gcode.reset_last_position() is
called.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Generate a "toolhead:set_position" event on a call to
toolhead.set_position() and use that event to automatically call
gcode.reset_last_position().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a request_redraw() method and call it when a key menu event
occurs. Limit these proactive screen redraws to no more than 4 per
second.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
After reading the first item of self.filament_array, filament_width is updated back to self.nominal_filament_dia or self.diameter instead of retaining the value until next pending_position.
Updated Filament Menu Template.
Signed-off-by: Nicola Falciani <nicola.fal@gmail.com>
- don't populate all items at once
- populate items when container is pushed to stack
- precreate List back item, don't create it during populate.
- don't update items during populate
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
Clients can now subscribe to the webhooks get_status() info to
determine if the printer state changes. It is no longer needed to
send a message to all clients on a shutdown transition.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Implement a new subscription system for get_status() updates.
Subscriptions are per-client. After an initial update, only changes
will be transmitted. Responses are only transmitted to the client
that issued the subscription.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new "gcode/subscribe_output" webhook endpoint to subscribe to
gcode output. Only client connections that subscribe to the gcode
output will receive that output.
This also moves all the gcode webhooks from gcode.py to webhooks.py
and arranges for gcode.py to be initialized prior to webhooks.py.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the "info" webhook to pass critical process information back to
the caller. The remaining users of register_static_path() can get the
required information via get_status() calls.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't default to "/tmp/klippy_uds" for the webhooks unix domain socket
filename. Instead, require the filename to be specified on the
command-line (via a new "-a" parameter).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In case of an overwriting existing menu item,
the new item was added additionally to the end of the items list.
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
This prevents ClientConnection.send() from blocking, removing the possibility that callers become reentrant.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>