Merge pull request #2457 from wavexx/la15_fixes

Linear Advance 1.5 fixes
This commit is contained in:
DRracer 2020-02-03 15:27:02 +01:00 committed by GitHub
commit 796dcd6a3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -168,7 +168,5 @@ const char MSG_OCTOPRINT_CANCEL[] PROGMEM_N1 = "// action:cancel"; ////
const char MSG_FANCHECK_EXTRUDER[] PROGMEM_N1 = "Err: EXTR. FAN ERROR"; ////c=20 const char MSG_FANCHECK_EXTRUDER[] PROGMEM_N1 = "Err: EXTR. FAN ERROR"; ////c=20
const char MSG_FANCHECK_PRINT[] PROGMEM_N1 = "Err: PRINT FAN ERROR"; ////c=20 const char MSG_FANCHECK_PRINT[] PROGMEM_N1 = "Err: PRINT FAN ERROR"; ////c=20
const char MSG_M112_KILL[] PROGMEM_N1 = "M112 called. Emergency Stop."; ////c=20 const char MSG_M112_KILL[] PROGMEM_N1 = "M112 called. Emergency Stop."; ////c=20
#ifdef LA_LIVE_K
const char MSG_ADVANCE_K[] PROGMEM_N1 = "Advance K:"; ////c=13 const char MSG_ADVANCE_K[] PROGMEM_N1 = "Advance K:"; ////c=13
#endif
const char MSG_POWERPANIC_DETECTED[] PROGMEM_N1 = "POWER PANIC DETECTED"; ////c=20 const char MSG_POWERPANIC_DETECTED[] PROGMEM_N1 = "POWER PANIC DETECTED"; ////c=20

View File

@ -1137,17 +1137,24 @@ Having the real displacement of the head, we can calculate the total movement le
// still need to replicate the *exact* same step grouping policy (see below) // still need to replicate the *exact* same step grouping policy (see below)
float advance_speed = (extruder_advance_K * e_D_ratio * block->acceleration * cs.axis_steps_per_unit[E_AXIS]); float advance_speed = (extruder_advance_K * e_D_ratio * block->acceleration * cs.axis_steps_per_unit[E_AXIS]);
if (advance_speed > MAX_STEP_FREQUENCY) advance_speed = MAX_STEP_FREQUENCY; if (advance_speed > MAX_STEP_FREQUENCY) advance_speed = MAX_STEP_FREQUENCY;
block->advance_rate = (F_CPU / 8.0) / advance_speed; float advance_rate = (F_CPU / 8.0) / advance_speed;
if (block->advance_rate > 20000) { if (advance_speed > 20000) {
block->advance_rate = (block->advance_rate >> 2)&0x3fff; block->advance_rate = advance_rate * 4;
block->advance_step_loops = 4; block->advance_step_loops = 4;
} }
else if (block->advance_rate > 10000) { else if (advance_speed > 10000) {
block->advance_rate = (block->advance_rate >> 1)&0x7fff; block->advance_rate = advance_rate * 2;
block->advance_step_loops = 2; block->advance_step_loops = 2;
} }
else else
{
// never overflow the internal accumulator with very low rates
if (advance_rate < UINT16_MAX)
block->advance_rate = advance_rate;
else
block->advance_rate = UINT16_MAX;
block->advance_step_loops = 1; block->advance_step_loops = 1;
}
#ifdef LA_DEBUG #ifdef LA_DEBUG
if (block->advance_step_loops > 2) if (block->advance_step_loops > 2)