Rename some planner acceleration vars

- `per_sq_second` => `per_s2`
- `per_sqr_second` => `per_s2`
- `axis_steps_per_sqr_second` => `max_acceleration_steps_per_s2`
2.0.x
Scott Lahteine 9 years ago
parent 26f8f54c56
commit cb4704e07a

@ -5150,7 +5150,7 @@ inline void gcode_M92() {
float factor = planner.axis_steps_per_unit[i] / value; // increase e constants if M92 E14 is given for netfab. float factor = planner.axis_steps_per_unit[i] / value; // increase e constants if M92 E14 is given for netfab.
planner.max_e_jerk *= factor; planner.max_e_jerk *= factor;
planner.max_feedrate[i] *= factor; planner.max_feedrate[i] *= factor;
planner.axis_steps_per_sqr_second[i] *= factor; planner.max_acceleration_steps_per_s2[i] *= factor;
} }
planner.axis_steps_per_unit[i] = value; planner.axis_steps_per_unit[i] = value;
} }
@ -5337,7 +5337,7 @@ inline void gcode_M200() {
inline void gcode_M201() { inline void gcode_M201() {
for (int8_t i = 0; i < NUM_AXIS; i++) { for (int8_t i = 0; i < NUM_AXIS; i++) {
if (code_seen(axis_codes[i])) { if (code_seen(axis_codes[i])) {
planner.max_acceleration_units_per_sq_second[i] = code_value_axis_units(i); planner.max_acceleration_mm_per_s2[i] = code_value_axis_units(i);
} }
} }
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner) // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)

@ -45,7 +45,7 @@
* *
* 104 M92 XYZE planner.axis_steps_per_unit (float x4) * 104 M92 XYZE planner.axis_steps_per_unit (float x4)
* 120 M203 XYZE planner.max_feedrate (float x4) * 120 M203 XYZE planner.max_feedrate (float x4)
* 136 M201 XYZE planner.max_acceleration_units_per_sq_second (uint32_t x4) * 136 M201 XYZE planner.max_acceleration_mm_per_s2 (uint32_t x4)
* 152 M204 P planner.acceleration (float) * 152 M204 P planner.acceleration (float)
* 156 M204 R planner.retract_acceleration (float) * 156 M204 R planner.retract_acceleration (float)
* 160 M204 T planner.travel_acceleration (float) * 160 M204 T planner.travel_acceleration (float)
@ -175,7 +175,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, ver); // invalidate data first EEPROM_WRITE_VAR(i, ver); // invalidate data first
EEPROM_WRITE_VAR(i, planner.axis_steps_per_unit); EEPROM_WRITE_VAR(i, planner.axis_steps_per_unit);
EEPROM_WRITE_VAR(i, planner.max_feedrate); EEPROM_WRITE_VAR(i, planner.max_feedrate);
EEPROM_WRITE_VAR(i, planner.max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i, planner.max_acceleration_mm_per_s2);
EEPROM_WRITE_VAR(i, planner.acceleration); EEPROM_WRITE_VAR(i, planner.acceleration);
EEPROM_WRITE_VAR(i, planner.retract_acceleration); EEPROM_WRITE_VAR(i, planner.retract_acceleration);
EEPROM_WRITE_VAR(i, planner.travel_acceleration); EEPROM_WRITE_VAR(i, planner.travel_acceleration);
@ -355,7 +355,7 @@ void Config_RetrieveSettings() {
// version number match // version number match
EEPROM_READ_VAR(i, planner.axis_steps_per_unit); EEPROM_READ_VAR(i, planner.axis_steps_per_unit);
EEPROM_READ_VAR(i, planner.max_feedrate); EEPROM_READ_VAR(i, planner.max_feedrate);
EEPROM_READ_VAR(i, planner.max_acceleration_units_per_sq_second); EEPROM_READ_VAR(i, planner.max_acceleration_mm_per_s2);
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner) // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
planner.reset_acceleration_rates(); planner.reset_acceleration_rates();
@ -529,7 +529,7 @@ void Config_ResetDefault() {
for (uint8_t i = 0; i < NUM_AXIS; i++) { for (uint8_t i = 0; i < NUM_AXIS; i++) {
planner.axis_steps_per_unit[i] = tmp1[i]; planner.axis_steps_per_unit[i] = tmp1[i];
planner.max_feedrate[i] = tmp2[i]; planner.max_feedrate[i] = tmp2[i];
planner.max_acceleration_units_per_sq_second[i] = tmp3[i]; planner.max_acceleration_mm_per_s2[i] = tmp3[i];
#if ENABLED(SCARA) #if ENABLED(SCARA)
if (i < COUNT(axis_scaling)) if (i < COUNT(axis_scaling))
axis_scaling[i] = 1; axis_scaling[i] = 1;
@ -687,10 +687,10 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):"); SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
CONFIG_ECHO_START; CONFIG_ECHO_START;
} }
SERIAL_ECHOPAIR(" M201 X", planner.max_acceleration_units_per_sq_second[X_AXIS]); SERIAL_ECHOPAIR(" M201 X", planner.max_acceleration_mm_per_s2[X_AXIS]);
SERIAL_ECHOPAIR(" Y", planner.max_acceleration_units_per_sq_second[Y_AXIS]); SERIAL_ECHOPAIR(" Y", planner.max_acceleration_mm_per_s2[Y_AXIS]);
SERIAL_ECHOPAIR(" Z", planner.max_acceleration_units_per_sq_second[Z_AXIS]); SERIAL_ECHOPAIR(" Z", planner.max_acceleration_mm_per_s2[Z_AXIS]);
SERIAL_ECHOPAIR(" E", planner.max_acceleration_units_per_sq_second[E_AXIS]); SERIAL_ECHOPAIR(" E", planner.max_acceleration_mm_per_s2[E_AXIS]);
SERIAL_EOL; SERIAL_EOL;
CONFIG_ECHO_START; CONFIG_ECHO_START;
if (!forReplay) { if (!forReplay) {

@ -82,8 +82,8 @@ volatile uint8_t Planner::block_buffer_tail = 0;
float Planner::max_feedrate[NUM_AXIS]; // Max speeds in mm per minute float Planner::max_feedrate[NUM_AXIS]; // Max speeds in mm per minute
float Planner::axis_steps_per_unit[NUM_AXIS]; float Planner::axis_steps_per_unit[NUM_AXIS];
unsigned long Planner::axis_steps_per_sqr_second[NUM_AXIS]; unsigned long Planner::max_acceleration_steps_per_s2[NUM_AXIS];
unsigned long Planner::max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software unsigned long Planner::max_acceleration_mm_per_s2[NUM_AXIS]; // Use M201 to override by software
millis_t Planner::min_segment_time; millis_t Planner::min_segment_time;
float Planner::min_feedrate; float Planner::min_feedrate;
@ -946,10 +946,10 @@ void Planner::check_axes_activity() {
} }
// Limit acceleration per axis // Limit acceleration per axis
unsigned long acc_st = block->acceleration_st, unsigned long acc_st = block->acceleration_st,
xsteps = axis_steps_per_sqr_second[X_AXIS], xsteps = max_acceleration_steps_per_s2[X_AXIS],
ysteps = axis_steps_per_sqr_second[Y_AXIS], ysteps = max_acceleration_steps_per_s2[Y_AXIS],
zsteps = axis_steps_per_sqr_second[Z_AXIS], zsteps = max_acceleration_steps_per_s2[Z_AXIS],
esteps = axis_steps_per_sqr_second[E_AXIS], esteps = max_acceleration_steps_per_s2[E_AXIS],
allsteps = block->step_event_count; allsteps = block->step_event_count;
if (xsteps < (acc_st * bsx) / allsteps) acc_st = (xsteps * allsteps) / bsx; if (xsteps < (acc_st * bsx) / allsteps) acc_st = (xsteps * allsteps) / bsx;
if (ysteps < (acc_st * bsy) / allsteps) acc_st = (ysteps * allsteps) / bsy; if (ysteps < (acc_st * bsy) / allsteps) acc_st = (ysteps * allsteps) / bsy;
@ -1148,7 +1148,7 @@ void Planner::set_e_position_mm(const float& e) {
// Recalculate the steps/s^2 acceleration rates, based on the mm/s^2 // Recalculate the steps/s^2 acceleration rates, based on the mm/s^2
void Planner::reset_acceleration_rates() { void Planner::reset_acceleration_rates() {
for (int i = 0; i < NUM_AXIS; i++) for (int i = 0; i < NUM_AXIS; i++)
axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i]; max_acceleration_steps_per_s2[i] = max_acceleration_mm_per_s2[i] * axis_steps_per_unit[i];
} }
#if ENABLED(AUTOTEMP) #if ENABLED(AUTOTEMP)

@ -114,8 +114,8 @@ class Planner {
static float max_feedrate[NUM_AXIS]; // Max speeds in mm per minute static float max_feedrate[NUM_AXIS]; // Max speeds in mm per minute
static float axis_steps_per_unit[NUM_AXIS]; static float axis_steps_per_unit[NUM_AXIS];
static unsigned long axis_steps_per_sqr_second[NUM_AXIS]; static unsigned long max_acceleration_steps_per_s2[NUM_AXIS];
static unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software static unsigned long max_acceleration_mm_per_s2[NUM_AXIS]; // Use M201 to override by software
static millis_t min_segment_time; static millis_t min_segment_time;
static float min_feedrate; static float min_feedrate;

@ -1686,10 +1686,10 @@ static void lcd_control_motion_menu() {
MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.max_feedrate[E_AXIS], 1, 999); MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.max_feedrate[E_AXIS], 1, 999);
MENU_ITEM_EDIT(float3, MSG_VMIN, &planner.min_feedrate, 0, 999); MENU_ITEM_EDIT(float3, MSG_VMIN, &planner.min_feedrate, 0, 999);
MENU_ITEM_EDIT(float3, MSG_VTRAV_MIN, &planner.min_travel_feedrate, 0, 999); MENU_ITEM_EDIT(float3, MSG_VTRAV_MIN, &planner.min_travel_feedrate, 0, 999);
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_X, &planner.max_acceleration_units_per_sq_second[X_AXIS], 100, 99000, _reset_acceleration_rates); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_X, &planner.max_acceleration_mm_per_s2[X_AXIS], 100, 99000, _reset_acceleration_rates);
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Y, &planner.max_acceleration_units_per_sq_second[Y_AXIS], 100, 99000, _reset_acceleration_rates); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Y, &planner.max_acceleration_mm_per_s2[Y_AXIS], 100, 99000, _reset_acceleration_rates);
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &planner.max_acceleration_units_per_sq_second[Z_AXIS], 10, 99000, _reset_acceleration_rates); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &planner.max_acceleration_mm_per_s2[Z_AXIS], 10, 99000, _reset_acceleration_rates);
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_units_per_sq_second[E_AXIS], 100, 99000, _reset_acceleration_rates); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_acceleration_rates);
MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &planner.retract_acceleration, 100, 99000); MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &planner.retract_acceleration, 100, 99000);
MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &planner.travel_acceleration, 100, 99000); MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &planner.travel_acceleration, 100, 99000);
MENU_ITEM_EDIT(float52, MSG_XSTEPS, &planner.axis_steps_per_unit[X_AXIS], 5, 9999); MENU_ITEM_EDIT(float52, MSG_XSTEPS, &planner.axis_steps_per_unit[X_AXIS], 5, 9999);

Loading…
Cancel
Save