Commit Graph

64 Commits

Author SHA1 Message Date
Guðni Már Gilbert 2b1c49dae2 Remove legacy Auto Bed Leveling code
The goal is to clean up the project
2024-08-24 07:11:38 +00:00
3d-gussner 45a223a1f9 Remove White spaces 2024-05-20 19:09:03 +02:00
3d-gussner e5d504b855 Add Extrude mintemp save and restore during power panic
Thanks to @wavexx in #3008
2024-04-09 09:34:24 +02:00
Guðni Már Gilbert a8c75090b2 Change unsigned long to uint32_t 2023-07-25 17:10:44 +02:00
Guðni Már Gilbert 8689a28776 Rename max_acceleration_units_per_sq_second to max_acceleration_mm_per_s2 2023-07-25 17:10:44 +02:00
Guðni Már Gilbert 5d880919f8 Align comment 2023-07-25 09:00:47 +02:00
Guðni Már Gilbert d5f4f6700d Optimise the acceleration limit checks
Kudos goes to Marlin FW

Change in memory:
Flash: -314 bytes
SRAM: 0 bytes
2023-07-25 09:00:47 +02:00
Guðni Már Gilbert 1984091c10 Rename axis_steps_per_sqr_second to max_acceleration_steps_per_s2 2023-07-25 09:00:47 +02:00
Guðni Már Gilbert 876ea6c228 Change block buffer fan speed to one byte
It's only assigned to variables which are uint8_t

Change in memory:
Flash: -10 bytes
SRAM: -16 bytes
2023-04-06 06:05:59 +02:00
Guðni Már Gilbert c0e21563e7 planner: optimise acceleration limits
Rename acceleration_st to acceleration_steps_per_s2 to be same as Marlin 2

Store the accelerator in local variable accel
while we are performing the limit checks.

When limit checks are done we can assign
the block it's acceleration. Especially
block->acceleration_steps_per_s2 is now only written to once, instead of direcly in the limit checks.

Change in memory:
Flash: -118 bytes
SRAM: 0 bytes
2023-04-04 15:11:29 +02:00
Guðni Már Gilbert 0b261ad4de remove duplicate function in planner
moves_planned() should be used instead

No change in memory
2023-03-03 21:11:16 +00:00
Guðni Már Gilbert 8c79bab503 optimisation: there is only one extruder when planning a line
Change in memory:
Flash: -50 bytes
SRAM: -3 bytes
2023-01-06 19:33:32 +01:00
D.R.racer 022aa53b2d Remove active_extruder completely
we only use 1 extruder + saves ~800B
2022-09-16 10:22:38 +02:00
Alex Voinea 05bd1ba57f Multi-segment pause resume initial 2022-08-24 20:19:26 +03:00
Yuri D'Elia 7907e14cbf Resync planner position upon exiting xyzcal
Split the planner sync code out of planner_abort_hard() so that we can
independently resync the planner position from the counters.

This is needed in xyzcal as we directly modify the stepper counters
(bypassing both planner and stepper).

Call this new function instead of planner_abort_hard() when leaving, so
that motion can resume in the middle of the gcode_M45 instruction.
2022-08-23 17:25:24 +02:00
Yuri D'Elia 5965572e88 Enforce full-loop handling of aborted commands
After calling planner_abort_hard() no motion command can be
scheduled until we return to the main loop since the call can
potentially be scheduled inside a nested process_command call.

Despite previous fixes, bugs keep creeping in due to nested calls not
being obvious to detect at all.

Stop allowing motion _completely_ for the entire processing loop by
default. That is, instead of aborting the current plan_buffer_line call,
abort the entire command until we can actually schedule motion safely
again.

This benefits handling of pretty much all g/m-codes, since this flag
(now "planner_aborted" for clarity) becomes a general "command aborted"
call.

This also now ensures that the flag prevents _any_ new block (including
blocks partially planned while servicing an interrupt) are scheduled
after planner_abort_hard is called.

There are only two exceptions where it's safe to resume in this context:

- Within uvlo_, where we never return to the main processing loop
- When we're intentionally scheduling a new process_command loop for a
  MK3 filament recheck (which is *bad*)

Handle those two cases as exceptions.
2022-07-25 17:30:22 +02:00
Yuri D'Elia ea46402e4d Replace EXTRUDE_MINTEMP with the configurable extrude_min_temp
Everywhere MINTEMP is checked, use the configurable value set by M302,
not an hardcoded value.

EXTRUDE_MINTEMP is now used only as the initial default value.

Reduce the precision of extrude_min_temp to an integer to reduce the
generated code size (constant folding did in fact do the same previously
anyway). Having tenths of degrees is not necessary for this feature.
2022-05-11 20:07:38 +02:00
Voinea Dragos 9abae2fd97 Remove maxlimit_status 2022-01-30 11:22:43 +00:00
Yuri D'Elia 79287ffb3d Use uint8_t consistently for the block buffer's index
Instead of using a mixture of int8_t, unsigned char and (incorrectly)
int, use uint8_t consistently for indexing the current block.

This improves the performance of the wait loop in plan_buffer_line,
which currently expands all comparisons to a word for no reason.

This also extends the theoretical limit to 128 entries.
Add some static assertions to ensure BLOCK_BUFFER_SIZE is correct.
2021-06-22 06:59:57 +02:00
Yuri D'Elia 30a806608f Also convert acceleration_rate to uint32_t
acceleration_rate is also unsigned
2020-08-03 19:01:38 +02:00
Yuri D'Elia 4654283f54 Restore indentation 2020-08-03 18:16:20 +02:00
Alex Voinea 12be141188 Fix high speed deceleration 2020-08-03 18:16:13 +02:00
DRracer eb44ee0f57
Code size optimization: 2KB down (#2687)
* Combine repeated calls into functions with much less parameters -> 2KB
down.

* Save some bytes by removing unnecessary 1-character strings: "x" -> 'x'
used in SERIAL_xxx printing macros.
This is also saves some CPU cycles

* Fix compilation for MK25S and MK3

* Copy surrounding indentation

* Fix compilation for a rare HW setup

* rename mesh_planXX_buffer_line back to mesh_plan_buffer_line

* Remove active_extruder from remaining plan_buffer_line_destinationXYZE
calls and one more fix of indentation
2020-06-01 17:51:28 +02:00
Alex Voinea 2e50954710
Merge branch 'MK3' into MK3_fix_selftest_Z_crash2 2020-01-22 14:56:54 +02:00
Yuri D'Elia bab756699f Fix incorrect usage of plan_set_e_position() in G92 E*
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.
2020-01-14 20:24:14 +01:00
Yuri D'Elia 5122f79a39 Merge remote-tracking branch 'upstream/MK3' into MK3_LA15 2019-12-04 17:27:23 +01:00
Yuri D'Elia 18eaf21baf Halve memory usage of saved feedrate
Truncate the saved feedrate to an uint16_t.
This is more than sufficient for recovery.
2019-11-28 17:16:37 +01:00
Yuri D'Elia 17176c1df2 Save/restore the default feedrate correctly
Since the global feedrate can be similarly modified for moves ahead of
time, save the original feedrate in the planner as we do for
gcode_target.

This avoids having to undo feedmultiply (and machine limits!) from
"nominal_speed" as previously done.

Thanks @leptun
2019-11-28 17:16:37 +01:00
Yuri D'Elia 4268c2fdae Fix recovery from relative/chunked moves
When starting to replay existing USB/SD commands from a recovery state,
an immediate relative move needs to compensate for a previously
interrupted move. This is almost the norm for the E axis.

Instead of saving the relative status of the move (which needs to
account for the world2machine conversion and is not always available on
a chunked move split by MBL) save directly the calculated target
position for the move in the original plan, which is easy to replay.
2019-11-28 16:42:35 +01:00
Yuri D'Elia 0f6b9b4051 Unroll the stack in restore_print_from_ram_and_continue
While handling moves in a recursive plan, such a filament check,
ensure restore_print_from_ram_and_continue unwinds the stack by
aborting early from any call that waits on the planner.

This currently only handles G1 moves, but hard-coded behavior that can
trigger recursive behavior (such as filament change) will probably have
to be checked too.
2019-11-28 15:57:20 +01:00
leptun 350e27810a fix selftest Z crash. Use stallGuard when testing Z 2019-10-11 21:00:51 +03:00
DRracer a7c2aec04c Code size reduced by almost 5KB 2019-08-21 09:59:51 +02:00
Yuri D'Elia 0239f4bce1 Update/compute advance steps inside calculate_trapezoid_for_block
Do not store the block e_D ratio, store directly the computed
compression factor so that we can recompute the advance steps
quickly and update them in sync with the acceleration rates.
2019-06-05 20:25:26 +02:00
Yuri D'Elia 942c38c18b Minor reformatting 2019-05-24 17:08:32 +02:00
Yuri D'Elia a2fa8e5313 Rewrite the advance_isr scheduler 2019-05-24 17:08:32 +02:00
Yuri D'Elia cbf1a85ec3 Switch original LA implementation with LA1.5
This discards several Prusa optimizations for LA1.0.
We'll re-implement those later if needed.

Debugging is turned on.
2019-05-24 17:08:32 +02:00
Yuri D'Elia eeea2725cb Partial LA15 support 2019-05-24 17:08:32 +02:00
Marek Bel c38fef281d Use cs.max_feedrate_silent, cs.max_acceleration_units_per_sq_second_silent from ConfigurationStore. 2018-09-24 17:33:58 +02:00
Marek Bel ac7c062161 Use cs.max_jerk from ConfigurationStore. 2018-09-24 16:35:33 +02:00
Marek Bel bb66bfe6a7 Use cs.minsegmenttime from ConfigurationStore. 2018-09-24 16:22:50 +02:00
Marek Bel 10428b30d9 Use cs.mintravelfeedrate from ConfigurationStore. 2018-09-24 16:01:58 +02:00
Marek Bel 26e2fd1c76 Use cs.minimumfeedrate from ConfigurationStore. 2018-09-24 15:57:24 +02:00
Marek Bel b8fefceb4d Use cs.retract_acceleration from ConfigurationStore. 2018-09-24 15:53:35 +02:00
Marek Bel 7dbe0afdc4 Use cs.acceleration from ConfigurationStore. 2018-09-24 15:47:36 +02:00
Marek Bel cee51cf9c3 Use cs.max_acceleration_units_per_sq_second_normal from ConfigurationStore. 2018-09-24 15:40:35 +02:00
Marek Bel 02becb5e6a Use cs.max_feedrate_normal from ConfigurationStore. 2018-09-24 15:09:19 +02:00
Marek Bel 3f28632443 Use cs.axis_steps_per_unit from ConfigurationStore. 2018-09-24 14:54:41 +02:00
PavelSindler ceb49d1262 finda filament runout: initial version 2018-08-27 04:21:43 +02:00
Robert Pelnar 896734c06b Display '!' instead of 'FR' on status screen when feedrate or acceleration limit reached. 2018-07-23 14:30:41 +02:00
Robert Pelnar 2ce210a8bb TMC2130 feedrate and acceleration limitation - separate profiles for normal and stealth mode 2018-07-19 18:56:01 +02:00