From e147fc2cb000d80c5bafb511ac4924b50e7c560f Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Thu, 26 Jan 2023 22:45:16 +0100 Subject: [PATCH] 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) --- Firmware/temperature.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 832ee186..06aa5da2 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -2349,6 +2349,7 @@ void model_data::step(uint8_t heater_pwm, uint8_t fan_pwm, float heater_temp, fl const float cur_R = R[fan_pwm]; // resistance at current fan power (K/W) float dP = P * heater_scale; // current power [W] + dP *= (cur_heater_temp * U) + V; // linear temp. correction float dPl = (cur_heater_temp - cur_ambient_temp) / cur_R; // [W] leakage power float dT = (dP - dPl) * C_i; // expected temperature difference (K) @@ -2388,6 +2389,8 @@ static void setup() static bool calibrated() { if(!(data.P > 0)) return false; + if(isnan(data.U)) return false; + if(isnan(data.V)) return false; if(!(data.C > 0)) return false; if(isnan(data.fS)) return false; if(!(data.Ta_corr != NAN)) return false;