From 7dbe0afdc4e7641fa4c32264eb879c0bed7495fd Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 24 Sep 2018 15:47:36 +0200 Subject: [PATCH] Use cs.acceleration from ConfigurationStore. --- Firmware/ConfigurationStore.cpp | 4 ++-- Firmware/ConfigurationStore.h | 2 +- Firmware/Marlin_main.cpp | 4 ++-- Firmware/planner.cpp | 3 +-- Firmware/planner.h | 1 - 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index c4afb22d..7b99dc3c 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -102,7 +102,7 @@ void Config_PrintSettings(uint8_t level) echomagic, echomagic, max_feedrate_silent[X_AXIS], max_feedrate_silent[Y_AXIS], max_feedrate_silent[Z_AXIS], max_feedrate_silent[E_AXIS], echomagic, echomagic, cs.max_acceleration_units_per_sq_second_normal[X_AXIS], cs.max_acceleration_units_per_sq_second_normal[Y_AXIS], cs.max_acceleration_units_per_sq_second_normal[Z_AXIS], cs.max_acceleration_units_per_sq_second_normal[E_AXIS], echomagic, echomagic, max_acceleration_units_per_sq_second_silent[X_AXIS], max_acceleration_units_per_sq_second_silent[Y_AXIS], max_acceleration_units_per_sq_second_silent[Z_AXIS], max_acceleration_units_per_sq_second_silent[E_AXIS], - echomagic, echomagic, acceleration, retract_acceleration, + echomagic, echomagic, cs.acceleration, retract_acceleration, echomagic, echomagic, minimumfeedrate, mintravelfeedrate, minsegmenttime, max_jerk[X_AXIS], max_jerk[Y_AXIS], max_jerk[Z_AXIS], max_jerk[E_AXIS], echomagic, echomagic, add_homing[X_AXIS], add_homing[Y_AXIS], add_homing[Z_AXIS] #else //TMC2130 @@ -117,7 +117,7 @@ void Config_PrintSettings(uint8_t level) echomagic, echomagic, cs.axis_steps_per_unit[X_AXIS], cs.axis_steps_per_unit[Y_AXIS], cs.axis_steps_per_unit[Z_AXIS], cs.axis_steps_per_unit[E_AXIS], echomagic, echomagic, max_feedrate[X_AXIS], max_feedrate[Y_AXIS], max_feedrate[Z_AXIS], max_feedrate[E_AXIS], echomagic, echomagic, max_acceleration_units_per_sq_second[X_AXIS], max_acceleration_units_per_sq_second[Y_AXIS], max_acceleration_units_per_sq_second[Z_AXIS], max_acceleration_units_per_sq_second[E_AXIS], - echomagic, echomagic, acceleration, retract_acceleration, + echomagic, echomagic, cs.acceleration, retract_acceleration, echomagic, echomagic, minimumfeedrate, mintravelfeedrate, minsegmenttime, max_jerk[X_AXIS], max_jerk[Y_AXIS], max_jerk[Z_AXIS], max_jerk[E_AXIS], echomagic, echomagic, add_homing[X_AXIS], add_homing[Y_AXIS], add_homing[Z_AXIS] #endif //TMC2130 diff --git a/Firmware/ConfigurationStore.h b/Firmware/ConfigurationStore.h index 761af1c8..36ec2c1e 100644 --- a/Firmware/ConfigurationStore.h +++ b/Firmware/ConfigurationStore.h @@ -10,7 +10,7 @@ typedef struct float axis_steps_per_unit[4]; float max_feedrate_normal[4]; unsigned long max_acceleration_units_per_sq_second_normal[4]; - float acceleration; + float acceleration; //!< Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX float retract_acceleration; float minimumfeedrate; float mintravelfeedrate; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 40de9ec5..e5b76c9f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -5941,14 +5941,14 @@ Sigma_Exit: // Legacy acceleration format. This format is used by the legacy Marlin, MK2 or MK3 firmware, // and it is also generated by Slic3r to control acceleration per extrusion type // (there is a separate acceleration settings in Slicer for perimeter, first layer etc). - acceleration = code_value(); + cs.acceleration = code_value(); // Interpret the T value as retract acceleration in the old Marlin format. if(code_seen('T')) retract_acceleration = code_value(); } else { // New acceleration format, compatible with the upstream Marlin. if(code_seen('P')) - acceleration = code_value(); + cs.acceleration = code_value(); if(code_seen('R')) retract_acceleration = code_value(); if(code_seen('T')) { diff --git a/Firmware/planner.cpp b/Firmware/planner.cpp index 8f28ab71..bd01ef3c 100644 --- a/Firmware/planner.cpp +++ b/Firmware/planner.cpp @@ -84,7 +84,6 @@ unsigned long max_acceleration_units_per_sq_second_silent[NUM_AXIS]; unsigned long* max_acceleration_units_per_sq_second = cs.max_acceleration_units_per_sq_second_normal; float minimumfeedrate; -float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX // Jerk is a maximum immediate velocity change. float max_jerk[NUM_AXIS]; @@ -1009,7 +1008,7 @@ Having the real displacement of the head, we can calculate the total movement le } else { - block->acceleration_st = ceil(acceleration * steps_per_mm); // convert to: acceleration steps/sec^2 + block->acceleration_st = ceil(cs.acceleration * steps_per_mm); // convert to: acceleration steps/sec^2 // Limit acceleration per axis //FIXME Vojtech: One shall rather limit a projection of the acceleration vector instead of using the limit. if(((float)block->acceleration_st * (float)block->steps_x.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[X_AXIS]) diff --git a/Firmware/planner.h b/Firmware/planner.h index 18f4cd02..99e921d7 100644 --- a/Firmware/planner.h +++ b/Firmware/planner.h @@ -170,7 +170,6 @@ extern unsigned long max_acceleration_units_per_sq_second_silent[NUM_AXIS]; extern unsigned long* max_acceleration_units_per_sq_second; extern float minimumfeedrate; -extern float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX extern float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX // Jerk is a maximum immediate velocity change. extern float max_jerk[NUM_AXIS];