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:
parent
17df029c9d
commit
f7390c7ad6
@ -412,6 +412,14 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
|
||||
// resets time estimators
|
||||
m_normal_time_estimator.reset();
|
||||
m_normal_time_estimator.set_dialect(print.config.gcode_flavor);
|
||||
m_silent_time_estimator_enabled = (print.config.gcode_flavor == gcfMarlin) && print.config.silent_mode;
|
||||
|
||||
// Until we have a UI support for the other firmwares than the Marlin, use the hardcoded default values
|
||||
// and let the user to enter the G-code limits into the start G-code.
|
||||
// If the following block is enabled for other firmwares than the Marlin, then the function
|
||||
// this->print_machine_envelope(file, print);
|
||||
// shall be adjusted as well to produce a G-code block compatible with the particular firmware flavor.
|
||||
if (print.config.gcode_flavor.value == gcfMarlin) {
|
||||
m_normal_time_estimator.set_max_acceleration(print.config.machine_max_acceleration_extruding.values[0]);
|
||||
m_normal_time_estimator.set_retract_acceleration(print.config.machine_max_acceleration_retracting.values[0]);
|
||||
m_normal_time_estimator.set_minimum_feedrate(print.config.machine_min_extruding_rate.values[0]);
|
||||
@ -429,7 +437,6 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
|
||||
m_normal_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Z, print.config.machine_max_jerk_z.values[0]);
|
||||
m_normal_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::E, print.config.machine_max_jerk_e.values[0]);
|
||||
|
||||
m_silent_time_estimator_enabled = (print.config.gcode_flavor == gcfMarlin) && print.config.silent_mode && boost::starts_with(print.config.printer_model.value, "MK3");
|
||||
if (m_silent_time_estimator_enabled)
|
||||
{
|
||||
m_silent_time_estimator.reset();
|
||||
@ -451,6 +458,8 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
|
||||
m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Z, print.config.machine_max_jerk_z.values[1]);
|
||||
m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::E, print.config.machine_max_jerk_e.values[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// resets analyzer
|
||||
m_analyzer.reset();
|
||||
m_enable_analyzer = preview_data != nullptr;
|
||||
|
@ -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,6 +428,7 @@ namespace Slic3r {
|
||||
void GCodeTimeEstimator::set_max_acceleration(float acceleration_mm_sec2)
|
||||
{
|
||||
_state.max_acceleration = acceleration_mm_sec2;
|
||||
if (acceleration_mm_sec2 > 0)
|
||||
_state.acceleration = acceleration_mm_sec2;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user