Browse Source

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.
Yuri D'Elia 1 year ago
parent
commit
324e501b18

+ 1 - 0
Firmware/temp_model.h

@@ -15,6 +15,7 @@ constexpr uint8_t TEMP_MODEL_LAG_SIZE = (TEMP_MODEL_LAG / TEMP_MGR_INTV + 0.5);
 
 // resistance values for all fan levels
 constexpr uint8_t TEMP_MODEL_R_SIZE = (1 << FAN_SOFT_PWM_BITS);
+static const float TEMP_MODEL_R_DEFAULT[TEMP_MODEL_R_SIZE] PROGMEM = TEMP_MODEL_Rv;
 
 namespace temp_model {
 

+ 7 - 4
Firmware/temperature.cpp

@@ -2581,14 +2581,13 @@ void temp_model_reset_settings()
 
     temp_model::data.P = TEMP_MODEL_P;
     temp_model::data.C = TEMP_MODEL_C;
-    temp_model::data.R[0] = TEMP_MODEL_R;
-    for(uint8_t i = 1; i != TEMP_MODEL_R_SIZE; ++i)
-        temp_model::data.R[i] = NAN;
+    for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i)
+        temp_model::data.R[i] = pgm_read_float(TEMP_MODEL_R_DEFAULT + i);
     temp_model::data.Ta_corr = TEMP_MODEL_Ta_corr;
     temp_model::data.warn = TEMP_MODEL_W;
     temp_model::data.err = TEMP_MODEL_E;
     temp_model::warn_beep = true;
-    temp_model::enabled = false;
+    temp_model::enabled = true;
     temp_model::valid = false;
 }
 
@@ -2844,6 +2843,10 @@ static bool autotune(int16_t cal_temp)
     wait(30000);
 
     for(int8_t i = TEMP_MODEL_R_SIZE - 1; i > 0; i -= TEMP_MODEL_CAL_R_STEP) {
+        // always disable the checker while estimating fan resistance as the difference
+        // (esp with 3rd-party blowers) can be massive
+        temp_model::data.R[i] = NAN;
+
         uint8_t speed = 256 / TEMP_MODEL_R_SIZE * (i + 1) - 1;
         set_fan_speed(speed);
         wait(10000);

+ 3 - 0
Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h

@@ -437,6 +437,9 @@
 #define TEMP_MODEL_CAL_Th 230 // Default calibration working temperature (C)
 #define TEMP_MODEL_CAL_Tl 50  // Default calibration cooling temperature (C)
 
+// fall-back resistance vector (R0-15)
+#define TEMP_MODEL_Rv {TEMP_MODEL_R, 18.4, 16.7, 15.2, 14.1, 13.3, 12.7, 12.1, 11.7, 11.3, 11., 10.8, 10.6, 10.4, 10.2, 10.1}
+
 
 /*------------------------------------
  MOTOR CURRENT SETTINGS

+ 3 - 0
Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h

@@ -441,6 +441,9 @@
 #define TEMP_MODEL_CAL_Th 230 // Default calibration working temperature (C)
 #define TEMP_MODEL_CAL_Tl 50  // Default calibration cooling temperature (C)
 
+// fall-back resistance vector (R0-15)
+#define TEMP_MODEL_Rv {TEMP_MODEL_R, 18.4, 16.7, 15.2, 14.1, 13.3, 12.7, 12.1, 11.7, 11.3, 11., 10.8, 10.6, 10.4, 10.2, 10.1}
+
 
 /*------------------------------------
  MOTOR CURRENT SETTINGS