Commit Graph

1562 Commits

Author SHA1 Message Date
3d-gussner
0a68de0bbe Update MSG c=xx
Mark unused strings as `_n`
2022-09-14 11:33:24 +02:00
Alex Voinea
510f13b24a Make the diag pins open collector with pullup.
Solves random crash detected on startup
2022-09-14 07:39:47 +02:00
D.R.racer
996f9943a1 Extract PRINTER_ACTIVE into a noinline function
Having the original PRINTER_ACTIVE macro copied at multiple spots doesn't make sense.
Refactoring it into a non-inline function saved ~400 bytes of code.
It should be safe in terms of performance, all occurrences are at non-time critical spots.
2022-09-14 07:31:39 +02:00
Yuri D'Elia
d78506a8ea TM: Rename D70 I to D70 S for consistency with M310 S 2022-09-02 15:59:29 +02:00
Yuri D'Elia
10c524fdb3 TM: Add M310 [F] parameter to enable autotune self-test 2022-09-02 15:59:29 +02:00
Yuri D'Elia
9b5ef75b68 Correctly translate thermal model LCD messages 2022-09-02 15:59:29 +02:00
Alex Voinea
39eb728d54 More farm optimizations
Kudos @gudnimg
2022-08-30 13:57:43 +02:00
Alex Voinea
d1c30c338f Fix farmless mode 2022-08-30 13:57:43 +02:00
Alex Voinea
bef7b086e3 Isolate the entire farm and statistics code 2022-08-30 13:57:43 +02:00
Alex Voinea
7d597eb8b0 Move farm mode to separate file 2022-08-30 13:57:43 +02:00
Alex Voinea
4e7d686b83
Merge pull request #3574 from leptun/extra_optimizations
More optimizations for 3.12 to fit
2022-08-29 19:25:46 +03:00
Alex Voinea
692f51c51e Save target bed temperature, not current temperature 2022-08-28 11:21:17 +03:00
Guðni Már Gilbert
7d86a0d121 Reduce a few magic numbers for FILENAME_LENGTH
flash: 0
RAM: 0
2022-08-26 19:26:26 +03:00
Guðni Már Gilbert
22582e560e Remove one redundant st_synchronize() call
flash: -4
RAM: 0

st_synchronize() is called just before leaving gcode_G28() so we don't need to call it again just after leaving gcode_G28()
2022-08-26 19:25:07 +03:00
Alex Voinea
25350dfbbc Remove unused variable bFilamentFirstRun
flash: 0
RAM: -1
2022-08-26 19:14:40 +03:00
Guðni Már Gilbert
f7ae3039f8 Don't include M851 in build if Auto Bed Leveling is not enabled
The variable cs.zprobe_zoffset is not used unless
auto bed leveling is enabled
2022-08-26 15:35:28 +00:00
Alex Voinea
78534f3b48 Start at the first segment, not the last segment 2022-08-24 20:19:26 +03:00
Alex Voinea
671519caf3 Optimize by hand since the lto is still stooopit
saves ~100B
2022-08-24 20:19:26 +03:00
Alex Voinea
b27c8b50e0 Fix power panic handling 2022-08-24 20:19:26 +03:00
Alex Voinea
05bd1ba57f Multi-segment pause resume initial 2022-08-24 20:19:26 +03:00
DRracer
0933fdb6fe
Merge pull request #3552 from wavexx/temp_model_check
Thermal Model protection
2022-08-24 19:16:48 +02:00
Yuri D'Elia
7cd888cd0a Update documentation of ThermalStop() 2022-08-21 15:22:46 +02:00
DRracer
3ebd8b88a4
Merge pull request #3486 from gudnimg/gudni-optimisation
Flash optimizations in loop() and status screen menu
2022-08-19 17:21:17 +02:00
DRracer
0a8d2a3224
Merge pull request #3456 from wavexx/filament_load_consistency
Cleanup: use more constants in M701
2022-08-19 17:14:54 +02:00
DRracer
84888507e3
Merge pull request #3557 from wavexx/fix_g28_code_value
G28: check for X/Y/Z parameters before calling code_value_long
2022-08-19 17:12:07 +02:00
Yuri D'Elia
06d19b472a G28: check for X/Y/Z parameters before calling code_value_long
Fixes #3555, thanks to @toombaumarkt
2022-08-07 00:36:54 +02:00
Yuri D'Elia
68c04ca2f6 Switch a few pointers that don't manipute strings to const 2022-08-06 23:08:03 +02:00
Yuri D'Elia
a533ba3574 Reset sdpos_atomic when starting a new SD print
Fix an incorrect SD offset on the first G-Code command when the second
SD print is started.
2022-08-06 22:16:50 +02:00
3d-gussner
8cbe69e285 Update RepRap documentation 2022-08-02 17:56:53 +02:00
Guðni Már Gilbert
33a0a58810 Optimise manage_inactivity call in loop()
Saves 12 bytes of flash
2022-07-27 11:14:17 +00:00
Yuri D'Elia
c5c2557c5e Improve M310 documentation 2022-07-25 17:30:22 +02:00
Yuri D'Elia
374b829fb6 Generalize menu_block_entering_on_serious_errors for menu lockout
Call this variable menu_block_mask instead. We don't need to know the
exact reason of why we're locking the menu.

We will be able to reuse this to prevent menu entry during more
activities in a cleaner way than testing for each condition as it's
currently done for both menu entry and longpress.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
cb3fec5cac Improve M310 documentation 2022-07-25 17:30:22 +02:00
Yuri D'Elia
39ad53ab11 Simplify fan checks now that lcd pause works correctly 2022-07-25 17:30:22 +02:00
Yuri D'Elia
1eb7871bab Also save fan speeds during a thermal error pause
Similarly to temperatures, the fan speed is overwritten and needs to be
restored appropriately.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
eccfcd7424 Save/restore temperatures during a thermal pause
Re-used saved_* vars (as normally used during the paused state) to
backup the original values when a thermal error occurs.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
63dab63f2e uvlo: Never wait for bed temperature when recovering
If the user accepted to resume, do not wait for bed temperature when
recovering. This only adds a pointless delay when recovering a short
pause and doesn't really improve the recovery quality after a long
pause.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
8f02262bbd Save/restore bed temperature during pause
This will be needed during a thermal error pause that disables the bed
as an additional safety precaution.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
9ef80226c9 Rename argument of ThermalStop for clarity 2022-07-25 17:30:22 +02:00
Yuri D'Elia
b9fc73c4c3 TM: Pause the print and allow recovery from a thermal error
Do not allow resuming until all thermal and fan errors are clear.

Call the appropriate resume function when resuming a printing depending
on the saved_print state (is saved_print is available, then we always
need to resume from the saved state even when printing via usb).

Clear the Stopped state when resuming, so that commands can be accepted
again.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
d1864011f4 Handle pause/stop in the main loop, again
Force processing of the pause and stop "parking" commands _after_ the
main loop completes.

This was/is currently done in lcd_commands, which is a poor place to
continue processing, since it can be called already within an aborted
command. This requires checking for planner_aborted before any action
can be performed.
2022-07-25 17:30:22 +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
48c7c9d464 Exclude M310 if TEMP_MODEL is not enabled 2022-07-25 17:30:22 +02:00
Yuri D'Elia
142db85bbb Pause: only move to park position when homed
This can happen is pause is issued before homing.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
fc10ca3146 Change how "Stopped" is handled internally, do not inhibit motion
Do not inhibit motion when Stopped is set.

We actually do need to move to move away the extruder from the bed, and
setting Stopped breaks it without adding any sort of security (M*
commands, such as M600 could still perform moves and still pass
through, while M104 would still set heaters).

During a hard error the internal queue is cleared (and sd file closed,
if any), so no new "unforeseen" command can be read.

Handle "Stopped" instead as a flag to inhibit serial processing and
automatically switch to "paused for user" state. While in this state
simply drop any input without incrementing the processed gcode line
number, behaving as-if the last command was still being processed.

This allows "Stopped" to correctly handle a printer-initiated paused
state and recover as expected by requesting a resend when resuming.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
6751586db6 Cleanup original thermal error handlers.
Remove useless repeated calls to disable heaters and turn on the fans,
since this is done at a higher level.

Avoid repeating messages on the serial. Do it just once.

Make a critical alert sound unconditionally.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
92bc7554b6 Enable the model last, if set
We need all the values to be set before we can attempt to enable the
model.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
ea0840dee9 Refuse to run TM calibration if the printer is not idle 2022-07-25 17:30:22 +02:00
Yuri D'Elia
cc96a47e7f Implement temperature model autotuning
Calibrate C/R values via univariate minimization using golden section.
This is done in several passes:

- Bootstrap C by setting an initial high R value
- Calibrate R at the requested working temperature
- Cooldown
- Refine C to the final value
- Estimate R losses for a subset of fan speeds
- Interpolate remaining values to speed-up the process

This results in robust values which are tailored to the current
filtering constants, and avoid having to sample for an extended
time to reach the required resolution.

The refining pass could avoid cooldown if the recording buffer was at
least twice as large, so that we could record both the heating and the
steady-state, saving _considerable_ time.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
8620059067 Allow to disable the model warning beeping
Mostly useful for debugging
2022-07-25 17:30:22 +02:00