TM: Move initial R0 initialization closer to usage
This commit is contained in:
parent
9b5ef75b68
commit
54e5702f30
@ -2768,16 +2768,16 @@ static bool autotune(int16_t cal_temp)
|
|||||||
wait(10000);
|
wait(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need a valid R value for the initial C guess
|
|
||||||
if(isnan(temp_model::data.R[0]))
|
|
||||||
temp_model::data.R[0] = TEMP_MODEL_Rh;
|
|
||||||
|
|
||||||
printf_P(PSTR("TM: %S C estimation\n"), verb);
|
printf_P(PSTR("TM: %S C estimation\n"), verb);
|
||||||
target_temperature[0] = cal_temp;
|
target_temperature[0] = cal_temp;
|
||||||
samples = record();
|
samples = record();
|
||||||
if(temp_error_state.v || !samples)
|
if(temp_error_state.v || !samples)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// we need a high R value for the initial C guess
|
||||||
|
if(isnan(temp_model::data.R[0]))
|
||||||
|
temp_model::data.R[0] = TEMP_MODEL_Rh;
|
||||||
|
|
||||||
e = estimate(samples, &temp_model::data.C,
|
e = estimate(samples, &temp_model::data.C,
|
||||||
TEMP_MODEL_Cl, TEMP_MODEL_Ch, TEMP_MODEL_C_thr, TEMP_MODEL_C_itr,
|
TEMP_MODEL_Cl, TEMP_MODEL_Ch, TEMP_MODEL_C_thr, TEMP_MODEL_C_itr,
|
||||||
0, current_temperature_ambient);
|
0, current_temperature_ambient);
|
||||||
|
Loading…
Reference in New Issue
Block a user