Minor stepper cleanup
This commit is contained in:
parent
d08867986e
commit
98600e1433
@ -2017,9 +2017,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
// When deploying make sure BLTOUCH is not already triggered
|
// When deploying make sure BLTOUCH is not already triggered
|
||||||
#if ENABLED(BLTOUCH)
|
#if ENABLED(BLTOUCH)
|
||||||
if (deploy && TEST_BLTOUCH()) { stop(); return true; }
|
if (deploy && TEST_BLTOUCH()) { stop(); return true; }
|
||||||
#endif
|
#elif ENABLED(Z_PROBE_SLED)
|
||||||
|
|
||||||
#if ENABLED(Z_PROBE_SLED)
|
|
||||||
if (axis_unhomed_error(true, false, false)) { stop(); return true; }
|
if (axis_unhomed_error(true, false, false)) { stop(); return true; }
|
||||||
#elif ENABLED(Z_PROBE_ALLEN_KEY)
|
#elif ENABLED(Z_PROBE_ALLEN_KEY)
|
||||||
if (axis_unhomed_error(true, true, true )) { stop(); return true; }
|
if (axis_unhomed_error(true, true, true )) { stop(); return true; }
|
||||||
@ -2103,7 +2101,6 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
// Tell the planner where we actually are
|
// Tell the planner where we actually are
|
||||||
SYNC_PLAN_POSITION_KINEMATIC();
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
|
|
||||||
|
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position);
|
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position);
|
||||||
#endif
|
#endif
|
||||||
|
@ -91,8 +91,8 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
|
|||||||
|
|
||||||
#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
|
#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
|
||||||
|
|
||||||
unsigned char Stepper::old_OCR0A = 0;
|
uint8_t Stepper::old_OCR0A = 0;
|
||||||
volatile unsigned char Stepper::eISR_Rate = 200; // Keep the ISR at a low rate until needed
|
volatile uint8_t Stepper::eISR_Rate = 200; // Keep the ISR at a low rate until needed
|
||||||
|
|
||||||
#if ENABLED(LIN_ADVANCE)
|
#if ENABLED(LIN_ADVANCE)
|
||||||
volatile int Stepper::e_steps[E_STEPPERS];
|
volatile int Stepper::e_steps[E_STEPPERS];
|
||||||
@ -328,12 +328,12 @@ ISR(TIMER1_COMPA_vect) { Stepper::isr(); }
|
|||||||
|
|
||||||
void Stepper::isr() {
|
void Stepper::isr() {
|
||||||
if (cleaning_buffer_counter) {
|
if (cleaning_buffer_counter) {
|
||||||
|
--cleaning_buffer_counter;
|
||||||
current_block = NULL;
|
current_block = NULL;
|
||||||
planner.discard_current_block();
|
planner.discard_current_block();
|
||||||
#ifdef SD_FINISHED_RELEASECOMMAND
|
#ifdef SD_FINISHED_RELEASECOMMAND
|
||||||
if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
if (!cleaning_buffer_counter && (SD_FINISHED_STEPPERRELEASE)) enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
||||||
#endif
|
#endif
|
||||||
cleaning_buffer_counter--;
|
|
||||||
OCR1A = 200; // Run at max speed - 10 KHz
|
OCR1A = 200; // Run at max speed - 10 KHz
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -551,7 +551,6 @@ void Stepper::isr() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Calculate new timer value
|
// Calculate new timer value
|
||||||
uint16_t timer, step_rate;
|
|
||||||
if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
|
if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
|
||||||
|
|
||||||
MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
||||||
@ -561,7 +560,7 @@ 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
|
||||||
timer = calc_timer(acc_step_rate);
|
uint16_t timer = calc_timer(acc_step_rate);
|
||||||
OCR1A = timer;
|
OCR1A = timer;
|
||||||
acceleration_time += timer;
|
acceleration_time += timer;
|
||||||
|
|
||||||
@ -603,6 +602,7 @@ void Stepper::isr() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (step_events_completed > (uint32_t)current_block->decelerate_after) {
|
else if (step_events_completed > (uint32_t)current_block->decelerate_after) {
|
||||||
|
uint16_t step_rate;
|
||||||
MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate);
|
MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate);
|
||||||
|
|
||||||
if (step_rate < acc_step_rate) { // Still decelerating?
|
if (step_rate < acc_step_rate) { // Still decelerating?
|
||||||
@ -613,7 +613,7 @@ 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
|
||||||
timer = calc_timer(step_rate);
|
uint16_t timer = calc_timer(step_rate);
|
||||||
OCR1A = timer;
|
OCR1A = timer;
|
||||||
deceleration_time += timer;
|
deceleration_time += timer;
|
||||||
|
|
||||||
|
@ -105,8 +105,8 @@ class Stepper {
|
|||||||
static volatile uint32_t step_events_completed; // The number of step events executed in the current block
|
static volatile uint32_t step_events_completed; // The number of step events executed in the current block
|
||||||
|
|
||||||
#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
|
#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
|
||||||
static unsigned char old_OCR0A;
|
static uint8_t old_OCR0A;
|
||||||
static volatile unsigned char eISR_Rate;
|
static volatile uint8_t eISR_Rate;
|
||||||
#if ENABLED(LIN_ADVANCE)
|
#if ENABLED(LIN_ADVANCE)
|
||||||
static volatile int e_steps[E_STEPPERS];
|
static volatile int e_steps[E_STEPPERS];
|
||||||
static int final_estep_rate;
|
static int final_estep_rate;
|
||||||
|
Loading…
Reference in New Issue
Block a user