linear advance fix: advance_isr and plan_set_e_position
This commit is contained in:
parent
68f9dabdf2
commit
f42b81fa38
|
|
@ -5764,7 +5764,9 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
||||||
|
|
||||||
else if(code_seen('T'))
|
else if(code_seen('T'))
|
||||||
{
|
{
|
||||||
|
#ifdef SNMM
|
||||||
int index;
|
int index;
|
||||||
|
st_synchronize();
|
||||||
for (index = 1; *(strchr_pointer + index) == ' ' || *(strchr_pointer + index) == '\t'; index++);
|
for (index = 1; *(strchr_pointer + index) == ' ' || *(strchr_pointer + index) == '\t'; index++);
|
||||||
|
|
||||||
if ((*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '9') && *(strchr_pointer + index) != '?') {
|
if ((*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '9') && *(strchr_pointer + index) != '?') {
|
||||||
|
|
@ -5778,7 +5780,6 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
||||||
tmp_extruder = code_value();
|
tmp_extruder = code_value();
|
||||||
}
|
}
|
||||||
snmm_filaments_used |= (1 << tmp_extruder); //for stop print
|
snmm_filaments_used |= (1 << tmp_extruder); //for stop print
|
||||||
#ifdef SNMM
|
|
||||||
#ifdef LIN_ADVANCE
|
#ifdef LIN_ADVANCE
|
||||||
if (snmm_extruder != tmp_extruder)
|
if (snmm_extruder != tmp_extruder)
|
||||||
clear_current_adv_vars(); //Check if the selected extruder is not the active one and reset LIN_ADVANCE variables if so.
|
clear_current_adv_vars(); //Check if the selected extruder is not the active one and reset LIN_ADVANCE variables if so.
|
||||||
|
|
@ -5786,7 +5787,6 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
||||||
|
|
||||||
snmm_extruder = tmp_extruder;
|
snmm_extruder = tmp_extruder;
|
||||||
|
|
||||||
st_synchronize();
|
|
||||||
delay(100);
|
delay(100);
|
||||||
|
|
||||||
disable_e0();
|
disable_e0();
|
||||||
|
|
|
||||||
|
|
@ -1294,6 +1294,9 @@ void plan_set_z_position(const float &z)
|
||||||
|
|
||||||
void plan_set_e_position(const float &e)
|
void plan_set_e_position(const float &e)
|
||||||
{
|
{
|
||||||
|
#ifdef LIN_ADVANCE
|
||||||
|
position_float[E_AXIS] = e;
|
||||||
|
#endif
|
||||||
position[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
|
position[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
|
||||||
st_set_e_position(position[E_AXIS]);
|
st_set_e_position(position[E_AXIS]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -735,7 +735,7 @@ void isr() {
|
||||||
|
|
||||||
void advance_isr() {
|
void advance_isr() {
|
||||||
|
|
||||||
nextAdvanceISR = eISR_Rate;
|
nextAdvanceISR = eISR_Rate;
|
||||||
|
|
||||||
if (e_steps) {
|
if (e_steps) {
|
||||||
bool dir =
|
bool dir =
|
||||||
|
|
@ -752,7 +752,10 @@ void isr() {
|
||||||
e_steps < 0 ? ++e_steps : --e_steps;
|
e_steps < 0 ? ++e_steps : --e_steps;
|
||||||
WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN);
|
WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(eISR_Rate == 0) {
|
||||||
|
nextAdvanceISR = ADV_NEVER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void advance_isr_scheduler() {
|
void advance_isr_scheduler() {
|
||||||
|
|
@ -782,7 +785,7 @@ void isr() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't run the ISR faster than possible
|
// Don't run the ISR faster than possible
|
||||||
if (OCR1A < TCNT1 + 16) OCR1A = TCNT1 + 16;
|
if (OCR1A < TCNT1 + 16) OCR1A = TCNT1 + 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_current_adv_vars() {
|
void clear_current_adv_vars() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue