The acceleration G-codes (M204 Sxxx) emited for Marlin are now

clamped by the maximum acceleration when extruding.

The machine envelope values are only set at the time estimator
from the Printer parameters for the Marlin firmware.
This commit is contained in:
bubnikv 2018-07-18 14:00:42 +02:00
parent 17df029c9d
commit f7390c7ad6
2 changed files with 56 additions and 40 deletions

View file

@ -414,7 +414,10 @@ namespace Slic3r {
void GCodeTimeEstimator::set_acceleration(float acceleration_mm_sec2)
{
_state.acceleration = std::min(_state.max_acceleration, acceleration_mm_sec2);
_state.acceleration = (_state.max_acceleration == 0) ?
acceleration_mm_sec2 :
// Clamp the acceleration with the maximum.
std::min(_state.max_acceleration, acceleration_mm_sec2);
}
float GCodeTimeEstimator::get_acceleration() const
@ -425,7 +428,8 @@ namespace Slic3r {
void GCodeTimeEstimator::set_max_acceleration(float acceleration_mm_sec2)
{
_state.max_acceleration = acceleration_mm_sec2;
_state.acceleration = acceleration_mm_sec2;
if (acceleration_mm_sec2 > 0)
_state.acceleration = acceleration_mm_sec2;
}
float GCodeTimeEstimator::get_max_acceleration() const
@ -551,7 +555,10 @@ namespace Slic3r {
set_e_local_positioning_type(Absolute);
set_feedrate(DEFAULT_FEEDRATE);
set_max_acceleration(DEFAULT_ACCELERATION);
// Setting the maximum acceleration to zero means that the there is no limit and the G-code
// is allowed to set excessive values.
set_max_acceleration(0);
set_acceleration(DEFAULT_ACCELERATION);
set_retract_acceleration(DEFAULT_RETRACT_ACCELERATION);
set_minimum_feedrate(DEFAULT_MINIMUM_FEEDRATE);
set_minimum_travel_feedrate(DEFAULT_MINIMUM_TRAVEL_FEEDRATE);