parent
4f465c2d07
commit
55acb65e27
@ -141,9 +141,10 @@ volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
|
|||||||
long Stepper::counter_m[MIXING_STEPPERS];
|
long Stepper::counter_m[MIXING_STEPPERS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned short Stepper::acc_step_rate; // needed for deceleration start point
|
|
||||||
uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
|
uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
|
||||||
unsigned short Stepper::OCR1A_nominal;
|
|
||||||
|
uint16_t Stepper::OCR1A_nominal,
|
||||||
|
Stepper::acc_step_rate; // needed for deceleration start point
|
||||||
|
|
||||||
volatile long Stepper::endstops_trigsteps[XYZ];
|
volatile long Stepper::endstops_trigsteps[XYZ];
|
||||||
|
|
||||||
@ -711,12 +712,12 @@ void Stepper::isr() {
|
|||||||
NOMORE(acc_step_rate, current_block->nominal_rate);
|
NOMORE(acc_step_rate, current_block->nominal_rate);
|
||||||
|
|
||||||
// step_rate to timer interval
|
// step_rate to timer interval
|
||||||
const uint16_t timer = calc_timer(acc_step_rate);
|
const uint16_t interval = calc_timer_interval(acc_step_rate);
|
||||||
|
|
||||||
SPLIT(timer); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL
|
SPLIT(interval); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL
|
||||||
_NEXT_ISR(ocr_val);
|
_NEXT_ISR(ocr_val);
|
||||||
|
|
||||||
acceleration_time += timer;
|
acceleration_time += interval;
|
||||||
|
|
||||||
#if ENABLED(LIN_ADVANCE)
|
#if ENABLED(LIN_ADVANCE)
|
||||||
|
|
||||||
@ -728,7 +729,7 @@ void Stepper::isr() {
|
|||||||
current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
|
current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], timer, step_loops);
|
eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], interval, step_loops);
|
||||||
|
|
||||||
#endif // LIN_ADVANCE
|
#endif // LIN_ADVANCE
|
||||||
}
|
}
|
||||||
@ -744,12 +745,12 @@ void Stepper::isr() {
|
|||||||
step_rate = current_block->final_rate;
|
step_rate = current_block->final_rate;
|
||||||
|
|
||||||
// step_rate to timer interval
|
// step_rate to timer interval
|
||||||
const uint16_t timer = calc_timer(step_rate);
|
const uint16_t interval = calc_timer_interval(step_rate);
|
||||||
|
|
||||||
SPLIT(timer); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL
|
SPLIT(interval); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL
|
||||||
_NEXT_ISR(ocr_val);
|
_NEXT_ISR(ocr_val);
|
||||||
|
|
||||||
deceleration_time += timer;
|
deceleration_time += interval;
|
||||||
|
|
||||||
#if ENABLED(LIN_ADVANCE)
|
#if ENABLED(LIN_ADVANCE)
|
||||||
|
|
||||||
@ -761,7 +762,7 @@ void Stepper::isr() {
|
|||||||
current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
|
current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], timer, step_loops);
|
eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], interval, step_loops);
|
||||||
|
|
||||||
#endif // LIN_ADVANCE
|
#endif // LIN_ADVANCE
|
||||||
}
|
}
|
||||||
|
@ -138,10 +138,10 @@ class Stepper {
|
|||||||
#endif // !LIN_ADVANCE
|
#endif // !LIN_ADVANCE
|
||||||
|
|
||||||
static long acceleration_time, deceleration_time;
|
static long acceleration_time, deceleration_time;
|
||||||
//unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate;
|
|
||||||
static unsigned short acc_step_rate; // needed for deceleration start point
|
|
||||||
static uint8_t step_loops, step_loops_nominal;
|
static uint8_t step_loops, step_loops_nominal;
|
||||||
static unsigned short OCR1A_nominal;
|
|
||||||
|
static uint16_t OCR1A_nominal,
|
||||||
|
acc_step_rate; // needed for deceleration start point
|
||||||
|
|
||||||
static volatile long endstops_trigsteps[XYZ];
|
static volatile long endstops_trigsteps[XYZ];
|
||||||
static volatile long endstops_stepsTotal, endstops_stepsDone;
|
static volatile long endstops_stepsTotal, endstops_stepsDone;
|
||||||
@ -302,7 +302,7 @@ class Stepper {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
FORCE_INLINE static unsigned short calc_timer(unsigned short step_rate) {
|
FORCE_INLINE static unsigned short calc_timer_interval(unsigned short step_rate) {
|
||||||
unsigned short timer;
|
unsigned short timer;
|
||||||
|
|
||||||
NOMORE(step_rate, MAX_STEP_FREQUENCY);
|
NOMORE(step_rate, MAX_STEP_FREQUENCY);
|
||||||
@ -356,11 +356,11 @@ class Stepper {
|
|||||||
|
|
||||||
deceleration_time = 0;
|
deceleration_time = 0;
|
||||||
// step_rate to timer interval
|
// step_rate to timer interval
|
||||||
OCR1A_nominal = calc_timer(current_block->nominal_rate);
|
OCR1A_nominal = calc_timer_interval(current_block->nominal_rate);
|
||||||
// make a note of the number of step loops required at nominal speed
|
// make a note of the number of step loops required at nominal speed
|
||||||
step_loops_nominal = step_loops;
|
step_loops_nominal = step_loops;
|
||||||
acc_step_rate = current_block->initial_rate;
|
acc_step_rate = current_block->initial_rate;
|
||||||
acceleration_time = calc_timer(acc_step_rate);
|
acceleration_time = calc_timer_interval(acc_step_rate);
|
||||||
_NEXT_ISR(acceleration_time);
|
_NEXT_ISR(acceleration_time);
|
||||||
|
|
||||||
#if ENABLED(LIN_ADVANCE)
|
#if ENABLED(LIN_ADVANCE)
|
||||||
|
Loading…
Reference in New Issue
Block a user