- In both uvlo_ and uvlo_tiny, calculate Z usteps properly and adjust
the Z position to a true fullstep before disabling the motor. This
avoids shifs during recovery.
- In uvlo_tiny, instead of moving up indefinitely, adjust Z just
once using the smallest move possible (new def UVLO_TINY_Z_AXIS_SHIFT)
- Perform all the uvlo/recovery processing in physical coordinates
and MBL off: there should be no automatic Z movement!
- Disable heaters in both handlers to conserve more power.
- Add timing information to uvlo_tiny too.
- During recovery, to switch between physical and logical positioning
introduce a new "PRUSA MBL" gcode as most of the procedure is
enqueued, and no existing gcode was available.
There is frequently plenty of power left during a PP. Take advantage of
it by moving the extruder to either side of the axis to detach
completely the nozzle from the print.
Re-enable Z during this move to avoid losing the current step.
When the printer is connected to a USB host during a PP (and the host
does not lose power), the rambo can linger for longer, sometimes for
long enough to recover the print state. Drain some more power.
If the motors are off-phase, this is more likely to "bump" them to an
incorrect/reverse full-step, doing worse.
We need to ensure the motors are already positioned on a fullstep
during power panic instead.
Remove the PSU_DELTA exception: Z _always_ needs to be powered here.
Also clear the UVLO flag when using lcd_print_stop. This prevents an
aborted print which has been cancelled while unparking (just prior to
recover) to come back again at the next startup.
- Initially restore the last E position from the eeprom in any case, not
just when using absolute mode (although unnecessary: since it will be
reset later), fixing a possible unitialized position and crash during
recovery (thanks to @leptun)
- Remove useless extra calls to put the extruder in relative mode:
the extruder already starts in relative mode and is later switched to
absolute.
- Replace incorrect calls to STRINGIFY with sprintf_P
- Retract after pressure has been restored in uvlo_tiny, to be
consistent with a regular uvlo (remove the bogus double unretract
as a result).
- Set the real E position prior to the panic *after* the retraction,
using the now-fixed G92.
Do not process serial commands when re-enabling the global isr.
While printing via USB and a power panic is triggered, *any* extra
command should be ignored.
Abuse the "saved_printing" variable to inhibit serial processing.
To maintain an accurate step count (which is required for correct
position recovery), any call to plan_set_position&co needs to be done
synchronously and from a halted state.
However, G92 E* is currently special-cased to skip the sync (likely to
avoid the associated performance cost), causing an incorrect E step
count and position to be set. This breaks absolute position recovery,
miscalculation of the LA factor and possibly other weird issues.
We rewrite the handling of G92 to always sync but still special-case the
frequent "G92 E0" for performance by using a free bit in the block flags.
To avoid a sync, we relay the request for reset first to the planner
which clears its internal state and then relays the request to the final
stepper isr.
When check_z_endstop is set, Z_MIN_PIN is checkend regardless of the
moving direction to support Z calibration. This prevents the ability
to use _just_ SG when moving upwards.
But since we know the extruder is at Z_MIN, it's always safe to raise
irregardless, so we can dodge the issue.
Do not unconditionally enqueue a Z move if no move has been requested.
Since Z is calculated using the absolute current (saved) position and
scheduled for later execution, the queue order becomes relevant.
In preparation for #2161, use MBL (G80) as a "new print" boundary
instead of just re-homing to ensure the reset is issued only once for
each print.
Similarly, do not reset the autodetection when LA is disabled via M900
K0. This can/will be used during a print if different quality settings
are used for different filling roles.
Since the advance factor is computed per-segment in LA15, there's no
need to stop the planner. Allow changing K freely at each segment.
This allows varying quality factors for different filling roles, see:
https://github.com/supermerill/Slic3r/issues/108
During pause/resume/crashdetect or powerpanic K might temporarily be out
of sync when used this way. If this becomes an issue, we might need to
store K for each block, as done for the feedrate.
Allow existing gcode using LA10 to transparently take advantage of LA15
by using a simple linear conversion function based on experimental
results with the MK3 implementation of linear advance.
Autodetect LA10 values based on the first M900 instruction contained in
the print. In order to support printing mixed files without resetting
the printer we also reset the autodetection status when starting a new
SD print and/or when explicitly disabling LA.
Since we cannot reliably detect whether a new print is started when
printing via USB, also reset the detection status when homing in G28,
which is generally performed once at each print. Note that this doesn't
clear the previous K value, it only allows a subsequent M900 to provide
LA10 values when printed after a LA15 file.
axis_relative_modes can cleanly handle G90/G91 and M82/M83 without the
need of "relative_mode" entirely.
Change G90/G91 to simply reset all axes according to the requested
state, which avoids to check two variables in get_coordinates(),
fixing the following incorrect handling:
G91 ; all axis relative
M83 ; set extruder absolute
G1 E1 ; should be an absolute move, but still relative