Merge pull request #5246 from thinkyhead/rc_some_cleanup

Minor stepper cleanup
master
Scott Lahteine 8 years ago committed by GitHub
commit 9b96a4a53b

@ -2023,9 +2023,7 @@ static void clean_up_after_endstop_or_probe_move() {
// When deploying make sure BLTOUCH is not already triggered
#if ENABLED(BLTOUCH)
if (deploy && TEST_BLTOUCH()) { stop(); return true; }
#endif
#if ENABLED(Z_PROBE_SLED)
#elif ENABLED(Z_PROBE_SLED)
if (axis_unhomed_error(true, false, false)) { stop(); return true; }
#elif ENABLED(Z_PROBE_ALLEN_KEY)
if (axis_unhomed_error(true, true, true )) { stop(); return true; }
@ -2109,7 +2107,6 @@ static void clean_up_after_endstop_or_probe_move() {
// Tell the planner where we actually are
SYNC_PLAN_POSITION_KINEMATIC();
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position);
#endif

@ -91,8 +91,8 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
unsigned char Stepper::old_OCR0A = 0;
volatile unsigned char Stepper::eISR_Rate = 200; // Keep the ISR at a low rate until needed
uint8_t Stepper::old_OCR0A = 0;
volatile uint8_t Stepper::eISR_Rate = 200; // Keep the ISR at a low rate until needed
#if ENABLED(LIN_ADVANCE)
volatile int Stepper::e_steps[E_STEPPERS];
@ -332,12 +332,12 @@ ISR(TIMER1_COMPA_vect) { Stepper::isr(); }
void Stepper::isr() {
if (cleaning_buffer_counter) {
--cleaning_buffer_counter;
current_block = NULL;
planner.discard_current_block();
#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
cleaning_buffer_counter--;
OCR1A = 200; // Run at max speed - 10 KHz
return;
}
@ -570,7 +570,6 @@ void Stepper::isr() {
#endif
// Calculate new timer value
uint16_t timer, step_rate;
if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
@ -580,7 +579,7 @@ void Stepper::isr() {
NOMORE(acc_step_rate, current_block->nominal_rate);
// step_rate to timer interval
timer = calc_timer(acc_step_rate);
uint16_t timer = calc_timer(acc_step_rate);
OCR1A = timer;
acceleration_time += timer;
@ -622,6 +621,7 @@ void Stepper::isr() {
#endif
}
else if (step_events_completed > (uint32_t)current_block->decelerate_after) {
uint16_t step_rate;
MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate);
if (step_rate < acc_step_rate) { // Still decelerating?
@ -632,7 +632,7 @@ void Stepper::isr() {
step_rate = current_block->final_rate;
// step_rate to timer interval
timer = calc_timer(step_rate);
uint16_t timer = calc_timer(step_rate);
OCR1A = 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
#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
static unsigned char old_OCR0A;
static volatile unsigned char eISR_Rate;
static uint8_t old_OCR0A;
static volatile uint8_t eISR_Rate;
#if ENABLED(LIN_ADVANCE)
static volatile int e_steps[E_STEPPERS];
static int final_estep_rate;

Loading…
Cancel
Save