Commit Graph

322 Commits

Author SHA1 Message Date
Guðni Már Gilbert 79a10868fe cleanup: FILWIDTH_PIN doesn't exist
raw_filwidth_value variable is never used
2023-01-24 19:41:45 +00:00
Yuri D'Elia 4f177f0b38 TM: Fan measuring state reset unification
Add resetFanCheck() to reset the fan measuring state as it's needed in
several places and save some flash space.
2023-01-16 08:43:36 +01:00
Yuri D'Elia 204df90d6d TM: Set the cal status bit when running `M310 A` directly
Running `M310 A` should set the TM calibration bit status if the
autotune procedure was successful.

Partially addresses #3891 and #3890, since running `M310 A F0` should
*still* count as valid calibration data and is not something that can be
replicated by using the LCD (which enforces self-test).
2023-01-16 07:32:57 +01:00
Yuri D'Elia 7a6d588d97 TM: Mark more internal functions as static 2023-01-02 10:52:07 +01:00
Yuri D'Elia 50209815ea TM: Also clear the status flags when disabling the model
Disabling the model during a warn/error condition will also stop
updating the warning/error flag, keeping the printer in an error state.

Clear all flags as well when changing model settings.
2023-01-02 10:52:07 +01:00
3d-gussner 0bcb4ab59d
Merge pull request #3822 from wavexx/tm_partial_lock
MK3: TM: Prevent lockout on invalid model values
2022-12-20 14:13:56 +01:00
3d-gussner 65f5b9e53d
Merge pull request #3818 from wavexx/tm_default_state
TM: Provide full defaults for model data and enable it by default
2022-12-20 07:08:25 +01:00
Yuri D'Elia c0f96e062b TM: Force initialization after reset 2022-12-19 18:08:01 +01:00
Yuri D'Elia 0972ef70d0 Use menu_set_block() in ThermalStop()
Set a menu block for fatal thermal errors instead of abusing
lcd_return_to_status() to kick the user out of the menus.

This now allows a thermal model error to be recoverable through menu
access.
2022-12-17 16:42:22 +01:00
Yuri D'Elia 365f845c99 TM: correctly mark repeated anomalies 2022-12-17 16:33:42 +01:00
Yuri D'Elia c05ac535be TM: reset fan measuring state when changing speed
Ensure that fan checks are reset and use the new speed at each step of
the calibration.

This also gives extra time to the fan to ramp-up from a cold start,
when a fancheck could previously start right *after* the speed change.

Should fix #3791
2022-12-16 15:30:30 +01:00
Yuri D'Elia 36575a4f83 Restore the previous model state when performing a nozzle change
Do not force-enable the model if it was previously disabled.
2022-12-12 20:17:56 +01:00
Yuri D'Elia 249be543fc TM: Restore all original values if autotune fails
- Ensures repeated autotune attempts with self-check can't succeed due
  to different starting conditions.
- Allows for a simpler workflow during selftest and wizard if autotune
  fails.
2022-12-12 17:52:48 +01:00
Yuri D'Elia 2051809e2f TM: Store only the last autotune result state
- Remove tm::valid and temp_model_valid as it's a duplicate of the
  calibrated() state.
- Add temp_model_autotune_result() for future use.
2022-12-12 17:52:48 +01:00
Yuri D'Elia 324e501b18 TM: Set default resistance levels for MK3/MK3S
Provide average calibrated values for all fan levels for MK3/MK3S
variants and enable the model by default.

This ensures the calibration step is not skipped unless explicitly
disabled.

Force-clear fan values during autotune to restore the previous
calibration behavior, as fan resistance levels can be too big and
prevent the autotune-with-selfcheck to fail.
2022-12-12 17:52:48 +01:00
Yuri D'Elia 877c0bd35c Fix potential buffer overflow in LCD messages 2022-12-12 17:52:48 +01:00
Yuri D'Elia e2f1bfe506 TM: Remove unnecessary display comments
Favor code readability
2022-12-12 17:52:48 +01:00
3d-gussner fd6da0e766 Fix typo
Add lcd_setatatus_serial to output lcd status message and serial at the same time
2022-11-02 10:09:32 +01:00
3d-gussner 072b3f8300 Temp Model cal. menu 2022-10-26 13:34:27 +02:00
3d-gussner f2fe9a51ee rename `Extruder fan` to `Hotend fan` 2022-10-17 13:49:18 +02:00
Alex Voinea 629fc9d0f1
Merge pull request #3638 from wavexx/tm_cal_click
TM: Consume LCD click after calibration
2022-10-06 14:29:40 +02:00
Yuri D'Elia 1d3ee1caba build: Add Configuration_var.h as a configuration wrapper
Instead of including Configuration_prusa.h directly, include
Configuration_var which then includes the proper variant file though a
preprocessor macro.

This allows to keep the existing build system intact, but also redefine
at compile time the final header without having to make copies on the
file system.
2022-10-05 01:26:26 +02:00
Yuri D'Elia 31ea48246a TM: Consume LCD click after calibration
Consume any pending LCD click after the temperature model calibration.
Since we're already in the status menu, the usual consume action is not
done automatically here.
2022-09-30 12:24:54 +02:00
3d-gussner 74e15ac233 Rename EN_ONLY to EN_FARM
remove DEBUG/DEVEL/ALPHA/BETA lcd warning
2022-09-29 16:39:02 +02:00
Alex Voinea 43db24e4fe IR_sensor_analog voltage readings 2022-09-16 10:08:39 +02:00
Alex Voinea 45e43137a5 Filament sensor refactoring initial 2022-09-16 10:07:49 +02:00
3d-gussner ee6821eb0e Add missing MSG_ c= r= 2022-09-14 11:33:24 +02:00
Yuri D'Elia 9dbee61b74 TM: Remove an unnecessary fabsf call
Ironically gcc was stripping that one for us already.
2022-09-02 15:59:29 +02:00
Yuri D'Elia 9b9ce1733c TM: Allow to keep model checking enabled during autotuning
Allow running the model checking during autotuning, with the only
exception being the parameter estimation stage where we alter the same
value which is used by the checker (done to conserve memory/code).

With previous changes the model checker will disable/enable itself when
passing through an unavailable R vector entry, allowing to start the
calibration by checking only the stages where the part fan is disabled.

The C/R0 values should be stable enough to provide a fail-safe mechanism
for printers of the same variant right from the factory.
2022-09-02 15:59:29 +02:00
Yuri D'Elia ff459a6427 TM: Handle dynamic parameter changing
Instead of assuming the model state is always valid, allow NAN values to
pass-through the various check/estimation stages.

This allows running the model checker with incomplete parameters (for
example, missing entries in the R vector) and resume automatically.
2022-09-02 15:59:29 +02:00
Yuri D'Elia 54e5702f30 TM: Move initial R0 initialization closer to usage 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
Yuri D'Elia 331de988f7 TM: Avoid an useless float promotion 2022-09-02 15:59:29 +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
Yuri D'Elia cf1edc85c3 Set a few function attributes to conserve space 2022-08-25 16:50:06 +02:00
Yuri D'Elia 7c8539a9f9 Report correct fan speeds in M155 during calibration 2022-08-25 16:15:51 +02:00
Alex Voinea f2f136e014 Use timer3 instead of timer5 on miniRambo 2022-08-24 10:18:45 +03:00
Yuri D'Elia 35708a61fe No longer disable temperature management in xyzcal
We already disable the heaters upon entering, and the new temperature
isr doesn't perform any direct movement until we return to the main
loop.

This allows us to remove direct control of the soft_pwm interrupt from
the header, which is dangerous.
2022-08-23 17:19:23 +02:00
Yuri D'Elia b672be90b2 Do not overwrite saved values if TM error occurs while paused 2022-08-21 14:53:42 +02:00
Yuri D'Elia d8d085287e Re-enable bed temperature automatically for transitory errors 2022-08-21 14:49:12 +02:00
Yuri D'Elia 30dccb3252 Switch to ATOMIC sections instead of cli/sei/CRITICAL_SECTION 2022-08-21 14:49:12 +02:00
Yuri D'Elia 41abe1689c Block LCD during temperature model autocalibration 2022-07-25 17:30:22 +02:00
Yuri D'Elia 79161f829e Remove last_alert_sent_to_lcd and simplify mintemp alert automaton
Thanks to LCD message priorities this not needed anymore and it's just
overhead.
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 49a288e6cf Restore the "MINTEMP * fixed" message
Set the LCD messages with the correct priority
2022-07-25 17:30:22 +02:00
Yuri D'Elia e77a5345a2 Do not show "THERMAL ANOMALY" with "M310 B0"
This allows us to use "M310 B0 W0.01" as a way to report the current
error continuosly on the serial without 1) more code and 2) without
preventing regular usage.
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 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