TM autotune: fix off-by-one in fan power levels
This commit is contained in:
parent
5dc0d5f7fa
commit
f454d1ecf2
|
|
@ -2784,8 +2784,8 @@ bool autotune(int16_t cal_temp)
|
||||||
fanSpeedSoftPwm = 255;
|
fanSpeedSoftPwm = 255;
|
||||||
wait(30000);
|
wait(30000);
|
||||||
|
|
||||||
for(int8_t i = TEMP_MODEL_R_SIZE; i > 0; i -= TEMP_MODEL_CAL_R_STEP) {
|
for(int8_t i = TEMP_MODEL_R_SIZE - 1; i > 0; i -= TEMP_MODEL_CAL_R_STEP) {
|
||||||
fanSpeedSoftPwm = 256 / TEMP_MODEL_R_SIZE * i - 1;
|
fanSpeedSoftPwm = 256 / TEMP_MODEL_R_SIZE * (i + 1) - 1;
|
||||||
wait(10000);
|
wait(10000);
|
||||||
|
|
||||||
printf_P(PSTR("TM: R[%u] estimation\n"), (unsigned)i);
|
printf_P(PSTR("TM: R[%u] estimation\n"), (unsigned)i);
|
||||||
|
|
@ -2803,6 +2803,7 @@ bool autotune(int16_t cal_temp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// interpolate remaining steps to speed-up calibration
|
// interpolate remaining steps to speed-up calibration
|
||||||
|
// TODO: verify that the sampled values are monotically increasing?
|
||||||
int8_t next = TEMP_MODEL_R_SIZE - 1;
|
int8_t next = TEMP_MODEL_R_SIZE - 1;
|
||||||
for(uint8_t i = TEMP_MODEL_R_SIZE - 2; i != 0; --i) {
|
for(uint8_t i = TEMP_MODEL_R_SIZE - 2; i != 0; --i) {
|
||||||
if(!((TEMP_MODEL_R_SIZE - i - 1) % TEMP_MODEL_CAL_R_STEP)) {
|
if(!((TEMP_MODEL_R_SIZE - i - 1) % TEMP_MODEL_CAL_R_STEP)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue