Commit Graph

333 Commits

Author SHA1 Message Date
Alex Voinea f6135f2ed1 Enable Analog IR sensor again 2023-04-16 13:58:18 +00:00
Alex Voinea f388d8abb6
postponed kill() message with softReset 2023-04-13 10:57:00 +02:00
Yuri D'Elia a8f219259a TM: Split default model parameters into a separate header
Preparation to support multiple default model parameter sets
2023-02-17 15:01:59 +01:00
Yuri D'Elia d1ff728e4f TM: future-proofing for incompatible model upgrades
Introduce a model version. This is initialized at "1" and doesn't
require any upgrade/downgrade checks since it's currently
retro-compatible.
2023-02-17 15:01:59 +01:00
Yuri D'Elia ddf5147f9f TM: Optimize temp_model_set_lag
Save about 20 bytes by rewriting the sample count check
2023-02-17 15:01:59 +01:00
Yuri D'Elia b676d395e3 TM: Handle L/TEMP_MODEL_LAG 2023-02-17 15:01:59 +01:00
Yuri D'Elia 0bf6a5bc4b TM: Handle UV (PTC loss)
Model UV as power-invariant, so that scaling P doesn't change the
intercept location (that is, the zero point remains at the same
temperature even for more powerful heaters).

NOTE: It's not clear to me whether this is generally true (couldn't
find a datasheet from the same heater in diffent power variants
showing the efficiency loss)
2023-02-17 15:01:59 +01:00
Yuri D'Elia ba96c8d457 TM: Handle D/TEMP_MODEL_fS 2023-02-17 15:01:59 +01:00
Yuri D'Elia eb88b720ac TM: Handle UVDL set/load/report/upgrade
- Expose TEMP_MODEL_fS and TEMP_MODEL_LAG as D and L respectively,
  initializing the default values based on the previous hard-coded
  values.
- Always round L to the effective sample lag to future-proof model
  upgrades or changes (the stored value _is_ the effective value).
- Introduce UV as a new linear term for PTC heaters, defaulting
  to an identity for model backward-compatibility.
2023-02-17 15:01:59 +01:00
Guðni Már Gilbert d66e2b66c2 Cleanup: use setTargetHotend consistently for one extruder
Main changes:
* setAllTargetHotends() is removed
* setTargetHotendSafe() is removed
* Extruder parameter on setTargetHotend() is dropped

Change in memory:
Flash: -192 bytes
SRAM: 0 bytes
2023-02-01 08:28:23 +01:00
Yuri D'Elia e39f2d132e TM: Check for PC parameters more carefully 2023-01-27 14:57:59 +01:00
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