Re-enable interpolation of duty cycle

This commit is contained in:
Jeremy Soller 2020-04-04 13:30:33 -06:00
parent 20d3808aed
commit 32055d825e
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
3 changed files with 18 additions and 24 deletions

View File

@ -57,14 +57,12 @@ uint8_t fan_duty(int16_t temp) {
// If in between current temp and previous temp, interpolate // If in between current temp and previous temp, interpolate
if (temp > prev->temp) { if (temp > prev->temp) {
return prev->duty; int16_t dtemp = (cur->temp - prev->temp);
int16_t dduty = ((int16_t)cur->duty) - ((int16_t)prev->duty);
// int16_t dtemp = (cur->temp - prev->temp); return (uint8_t)(
// int16_t dduty = ((int16_t)cur->duty) - ((int16_t)prev->duty); ((int16_t)prev->duty) +
// return (uint8_t)( ((temp - prev->temp) * dduty) / dtemp
// ((int16_t)prev->duty) + );
// ((temp - prev->temp) * dduty) / dtemp
// );
} }
} }
} }

View File

@ -57,14 +57,12 @@ uint8_t fan_duty(int16_t temp) {
// If in between current temp and previous temp, interpolate // If in between current temp and previous temp, interpolate
if (temp > prev->temp) { if (temp > prev->temp) {
return prev->duty; int16_t dtemp = (cur->temp - prev->temp);
int16_t dduty = ((int16_t)cur->duty) - ((int16_t)prev->duty);
// int16_t dtemp = (cur->temp - prev->temp); return (uint8_t)(
// int16_t dduty = ((int16_t)cur->duty) - ((int16_t)prev->duty); ((int16_t)prev->duty) +
// return (uint8_t)( ((temp - prev->temp) * dduty) / dtemp
// ((int16_t)prev->duty) + );
// ((temp - prev->temp) * dduty) / dtemp
// );
} }
} }
} }

View File

@ -57,14 +57,12 @@ uint8_t fan_duty(int16_t temp) {
// If in between current temp and previous temp, interpolate // If in between current temp and previous temp, interpolate
if (temp > prev->temp) { if (temp > prev->temp) {
return prev->duty; int16_t dtemp = (cur->temp - prev->temp);
int16_t dduty = ((int16_t)cur->duty) - ((int16_t)prev->duty);
// int16_t dtemp = (cur->temp - prev->temp); return (uint8_t)(
// int16_t dduty = ((int16_t)cur->duty) - ((int16_t)prev->duty); ((int16_t)prev->duty) +
// return (uint8_t)( ((temp - prev->temp) * dduty) / dtemp
// ((int16_t)prev->duty) + );
// ((temp - prev->temp) * dduty) / dtemp
// );
} }
} }
} }