Commit Graph

11 Commits

Author SHA1 Message Date
Yuri D'Elia
fd96b79ea9 TM: Split default model parameters into a separate header
Preparation to support multiple default model parameter sets
2023-02-15 13:49:51 +01:00
Yuri D'Elia
b7961ae0e9 TM: Handle L/TEMP_MODEL_LAG 2023-02-10 15:44:28 +01:00
Yuri D'Elia
70fd9a336b 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-10 15:44:28 +01:00
Yuri D'Elia
f6c16455bb 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-15 06:29:10 +01:00
Yuri D'Elia
dac73c9582 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-15 06:28:57 +01:00
3d-gussner
6d358187ff Temp Model cal. menu 2022-10-28 05:39:14 +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
ec74b88ebc Correct pre-warning to just warning 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
Yuri D'Elia
6832ec7648 Allow to save/restore temperature model settings
This currently bypasses the ConfigurationStore, which doesn't fit the
malin model nicely.

temp_model is using it's own private copy directly.

But maybe we should change this in the future.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
b0b2ff5f9e Rewrite/modularize the model checker
- Allow all parameters to be changed at runtime through M310
- Move the model prototypes into a separate temp_model.h header
- Allow the checked to be enabled/disabled at runtime
- Introduce a warning threshold
2022-07-25 17:30:22 +02:00