Simpler Allen Key config. Fixes, cleanups from refactor (#15256)

This commit is contained in:
Scott Lahteine
2019-09-14 03:05:10 -05:00
committed by GitHub
parent ffb418b226
commit 465c6d9230
62 changed files with 389 additions and 685 deletions

View File

@@ -1320,13 +1320,14 @@ void Temperature::manage_heater() {
if (!WITHIN(t_index, 0, COUNT(user_thermistor) - 1)) return 25;
if (user_thermistor[t_index].pre_calc) {
// pre-calculate some variables
user_thermistor[t_index].pre_calc = false;
user_thermistor[t_index].res_25_recip = 1.0f / user_thermistor[t_index].res_25;
user_thermistor[t_index].res_25_log = logf(user_thermistor[t_index].res_25);
user_thermistor[t_index].beta_recip = 1.0f / user_thermistor[t_index].beta;
user_thermistor[t_index].sh_alpha = (1.0f / (THERMISTOR_RESISTANCE_NOMINAL_C - THERMISTOR_ABS_ZERO_C)) - (user_thermistor[t_index].beta_recip * user_thermistor[t_index].res_25_log) - (user_thermistor[t_index].sh_c_coeff * user_thermistor[t_index].res_25_log * user_thermistor[t_index].res_25_log * user_thermistor[t_index].res_25_log);
user_thermistor_t &t = user_thermistor[t_index];
if (t.pre_calc) { // pre-calculate some variables
t.pre_calc = false;
t.res_25_recip = 1.0f / t.res_25;
t.res_25_log = logf(t.res_25);
t.beta_recip = 1.0f / t.beta;
t.sh_alpha = RECIPROCAL(THERMISTOR_RESISTANCE_NOMINAL_C - (THERMISTOR_ABS_ZERO_C))
- (t.beta_recip * t.res_25_log) - (t.sh_c_coeff * cu(t.res_25_log));
}
// maximum adc value .. take into account the over sampling
@@ -1334,13 +1335,13 @@ void Temperature::manage_heater() {
adc_raw = constrain(raw, 1, adc_max - 1); // constrain to prevent divide-by-zero
const float adc_inverse = (adc_max - adc_raw) - 0.5f,
resistance = user_thermistor[t_index].series_res * (adc_raw + 0.5f) / adc_inverse,
resistance = t.series_res * (adc_raw + 0.5f) / adc_inverse,
log_resistance = logf(resistance);
float value = user_thermistor[t_index].sh_alpha;
value += log_resistance * user_thermistor[t_index].beta_recip;
if (user_thermistor[t_index].sh_c_coeff != 0)
value += user_thermistor[t_index].sh_c_coeff * log_resistance * log_resistance * log_resistance;
float value = t.sh_alpha;
value += log_resistance * t.beta_recip;
if (t.sh_c_coeff != 0)
value += t.sh_c_coeff * cu(log_resistance);
value = 1.0f / value;
//#if (MOTHERBOARD == BOARD_RAMPS_14_EFB)