Ultimate followup to Stepper/Planner patch

- Search all symbols and apply prefixes where needed
- Encapsulate some private methods
- Inline some setters
- Make `microstep_mode` a public method
2.0.x
Scott Lahteine 9 years ago
parent b959020532
commit 6398d497b3

@ -21,24 +21,12 @@
*/ */
/** /**
* planner.cpp - Buffer movement commands and manage the acceleration profile plan * planner.cpp
* Part of Grbl
* *
* Copyright (c) 2009-2011 Simen Svale Skogsrud * Buffer movement commands and manage the acceleration profile plan
*
* Grbl is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Grbl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Grbl. If not, see <http://www.gnu.org/licenses/>.
* *
* Derived from Grbl
* Copyright (c) 2009-2011 Simen Svale Skogsrud
* *
* The ring buffer implementation gleaned from the wiring_serial library by David A. Mellis. * The ring buffer implementation gleaned from the wiring_serial library by David A. Mellis.
* *

@ -21,28 +21,14 @@
*/ */
/** /**
planner.h - buffers movement commands and manages the acceleration profile plan * planner.h
Part of Grbl *
* Buffer movement commands and manage the acceleration profile plan
Copyright (c) 2009-2011 Simen Svale Skogsrud *
* Derived from Grbl
Grbl is free software: you can redistribute it and/or modify * Copyright (c) 2009-2011 Simen Svale Skogsrud
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/ */
// This module is to be considered a sub-module of stepper.c. Please don't include
// this file from any other module.
#ifndef PLANNER_H #ifndef PLANNER_H
#define PLANNER_H #define PLANNER_H
@ -268,6 +254,17 @@ class Planner {
return NULL; return NULL;
} }
#if ENABLED(AUTOTEMP)
float autotemp_max = 250;
float autotemp_min = 210;
float autotemp_factor = 0.1;
bool autotemp_enabled = false;
void getHighESpeed();
void autotemp_M109();
#endif
private:
/** /**
* Get the index of the next / previous block in the ring buffer * Get the index of the next / previous block in the ring buffer
*/ */
@ -305,18 +302,6 @@ class Planner {
return sqrt(target_velocity * target_velocity - 2 * acceleration * distance); return sqrt(target_velocity * target_velocity - 2 * acceleration * distance);
} }
#if ENABLED(AUTOTEMP)
float autotemp_max = 250;
float autotemp_min = 210;
float autotemp_factor = 0.1;
bool autotemp_enabled = false;
void getHighESpeed();
void autotemp_M109();
#endif
private:
void calculate_trapezoid_for_block(block_t* block, float entry_factor, float exit_factor); void calculate_trapezoid_for_block(block_t* block, float entry_factor, float exit_factor);
void reverse_pass_kernel(block_t* previous, block_t* current, block_t* next); void reverse_pass_kernel(block_t* previous, block_t* current, block_t* next);

@ -979,9 +979,3 @@ void Stepper::microstep_readings() {
SERIAL_PROTOCOLLN(digitalRead(E1_MS2_PIN)); SERIAL_PROTOCOLLN(digitalRead(E1_MS2_PIN));
#endif #endif
} }
#if ENABLED(Z_DUAL_ENDSTOPS)
void Stepper::set_homing_flag(bool state) { performing_homing = state; }
void Stepper::set_z_lock(bool state) { locked_z_motor = state; }
void Stepper::set_z2_lock(bool state) { locked_z2_motor = state; }
#endif

@ -224,9 +224,9 @@ class Stepper {
void microstep_readings(); void microstep_readings();
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
void set_homing_flag(bool state); FORCE_INLINE void set_homing_flag(bool state) { performing_homing = state; }
void set_z_lock(bool state); FORCE_INLINE void set_z_lock(bool state) { locked_z_motor = state; }
void set_z2_lock(bool state); FORCE_INLINE void set_z2_lock(bool state) { locked_z2_motor = state; }
#endif #endif
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
@ -249,6 +249,8 @@ class Stepper {
return endstops_trigsteps[axis] / planner.axis_steps_per_unit[axis]; return endstops_trigsteps[axis] / planner.axis_steps_per_unit[axis];
} }
private:
FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) { FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
unsigned short timer; unsigned short timer;
@ -324,7 +326,6 @@ class Stepper {
// SERIAL_ECHOLN(current_block->final_advance/256.0); // SERIAL_ECHOLN(current_block->final_advance/256.0);
} }
private:
void digipot_init(); void digipot_init();
void microstep_init(); void microstep_init();

Loading…
Cancel
Save