FIX:Separate travel acceleration from print acceleration
jira: none Change-Id: Ie262c38bda2e5fd3df582f0aada2a507444355a4 (cherry picked from commit 6fe4edde0769b5ca6a68402984a1dc156b17215c)
This commit is contained in:
parent
43bd523753
commit
ca36ee8096
|
@ -123,6 +123,9 @@
|
|||
"top_surface_speed": [
|
||||
"30"
|
||||
],
|
||||
"travel_acceleration": [
|
||||
"10000"
|
||||
],
|
||||
"travel_speed": [
|
||||
"400"
|
||||
],
|
||||
|
|
|
@ -16,6 +16,12 @@
|
|||
"10000",
|
||||
"10000"
|
||||
],
|
||||
"travel_acceleration": [
|
||||
"10000",
|
||||
"10000",
|
||||
"10000",
|
||||
"10000"
|
||||
],
|
||||
"enable_overhang_speed": [
|
||||
"1",
|
||||
"1",
|
||||
|
|
|
@ -2423,11 +2423,17 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
}
|
||||
if (this->m_objsWithBrim.empty() && this->m_objSupportsWithBrim.empty()) m_brim_done = true;
|
||||
|
||||
std::vector<unsigned int> travel_accelerations;
|
||||
for (auto value : m_config.travel_acceleration.values) {
|
||||
travel_accelerations.emplace_back((unsigned int) floor(value + 0.5));
|
||||
}
|
||||
m_writer.set_travel_acceleration(travel_accelerations);
|
||||
|
||||
// OrcaSlicer: calib
|
||||
if (print.calib_params().mode == CalibMode::Calib_PA_Line) {
|
||||
std::string gcode;
|
||||
if ((m_config.default_acceleration.get_at(cur_extruder_index()) > 0 && m_config.outer_wall_acceleration.get_at(cur_extruder_index()) > 0)) {
|
||||
gcode += m_writer.set_acceleration((unsigned int) floor(m_config.outer_wall_acceleration.get_at(cur_extruder_index()) + 0.5));
|
||||
m_writer.set_acceleration((unsigned int) floor(m_config.outer_wall_acceleration.get_at(cur_extruder_index()) + 0.5));
|
||||
}
|
||||
|
||||
if (m_config.default_jerk.value > 0 && !this->is_BBL_Printer()) {
|
||||
|
@ -3706,7 +3712,7 @@ GCode::LayerResult GCode::process_layer(
|
|||
//BBS: set first layer global acceleration
|
||||
if (m_config.default_acceleration.get_at(cur_extruder_index()) > 0 && m_config.initial_layer_acceleration.get_at(cur_extruder_index()) > 0) {
|
||||
double acceleration = m_config.initial_layer_acceleration.get_at(cur_extruder_index());
|
||||
gcode += m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
|
||||
m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
|
||||
}
|
||||
|
||||
if (m_config.default_jerk.value > 0 && m_config.initial_layer_jerk.value > 0 && !this->is_BBL_Printer())
|
||||
|
@ -3733,7 +3739,7 @@ GCode::LayerResult GCode::process_layer(
|
|||
//BBS: reset acceleration at sencond layer
|
||||
if (m_config.default_acceleration.get_at(cur_extruder_index()) > 0 && m_config.initial_layer_acceleration.get_at(cur_extruder_index()) > 0) {
|
||||
double acceleration = m_config.default_acceleration.get_at(cur_extruder_index());
|
||||
gcode += m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
|
||||
m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
|
||||
}
|
||||
|
||||
if (m_config.default_jerk.value > 0 && m_config.initial_layer_jerk.value > 0 && !this->is_BBL_Printer())
|
||||
|
@ -4784,7 +4790,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
|
|||
//BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value.
|
||||
if (!this->on_first_layer()) {
|
||||
// reset acceleration
|
||||
gcode += m_writer.set_acceleration((unsigned int) (m_config.default_acceleration.get_at(cur_extruder_index()) + 0.5));
|
||||
m_writer.set_acceleration((unsigned int) (m_config.default_acceleration.get_at(cur_extruder_index()) + 0.5));
|
||||
if (!this->is_BBL_Printer())
|
||||
gcode += m_writer.set_jerk_xy(m_config.default_jerk.value);
|
||||
}
|
||||
|
@ -4869,7 +4875,7 @@ std::string GCode::extrude_multi_path(ExtrusionMultiPath multipath, std::string
|
|||
//BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value.
|
||||
if (!this->on_first_layer()) {
|
||||
// reset acceleration
|
||||
gcode += m_writer.set_acceleration((unsigned int) floor(m_config.default_acceleration.get_at(cur_extruder_index()) + 0.5));
|
||||
m_writer.set_acceleration((unsigned int) floor(m_config.default_acceleration.get_at(cur_extruder_index()) + 0.5));
|
||||
if (!this->is_BBL_Printer())
|
||||
gcode += m_writer.set_jerk_xy(m_config.default_jerk.value);
|
||||
}
|
||||
|
@ -4901,7 +4907,7 @@ std::string GCode::extrude_path(ExtrusionPath path, std::string description, dou
|
|||
//BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value.
|
||||
if (!this->on_first_layer()) {
|
||||
// reset acceleration
|
||||
gcode += m_writer.set_acceleration((unsigned int) floor(m_config.default_acceleration.get_at(cur_extruder_index()) + 0.5));
|
||||
m_writer.set_acceleration((unsigned int) floor(m_config.default_acceleration.get_at(cur_extruder_index()) + 0.5));
|
||||
if (!this->is_BBL_Printer())
|
||||
gcode += m_writer.set_jerk_xy(m_config.default_jerk.value);
|
||||
}
|
||||
|
@ -5368,7 +5374,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||
} else {
|
||||
acceleration = m_config.default_acceleration.get_at(cur_extruder_index());
|
||||
}
|
||||
gcode += m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
|
||||
m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
|
||||
}
|
||||
|
||||
if (m_config.default_jerk.value > 0 && !this->is_BBL_Printer()) {
|
||||
|
|
|
@ -670,6 +670,12 @@ public:
|
|||
m_extrusions.emplace_back(WipeTower::Extrusion(rot, width, m_current_tool));
|
||||
}
|
||||
|
||||
if (e == 0.f) {
|
||||
m_gcode += set_travel_acceleration();
|
||||
} else {
|
||||
m_gcode += set_normal_acceleration();
|
||||
}
|
||||
|
||||
m_gcode += "G1";
|
||||
if (std::abs(rot.x() - rotated_current_pos.x()) > (float)EPSILON)
|
||||
m_gcode += set_format_X(rot.x());
|
||||
|
@ -741,6 +747,13 @@ public:
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
if (e == 0.f) {
|
||||
m_gcode += set_travel_acceleration();
|
||||
} else {
|
||||
m_gcode += set_normal_acceleration();
|
||||
}
|
||||
|
||||
m_gcode += arc.direction == ArcDirection::Arc_Dir_CCW ? "G3" : "G2";
|
||||
const Vec2f center_offset = this->rotate(unscaled<float>(arc.center)) - rotated_current_pos;
|
||||
m_gcode += set_format_X(rot.x());
|
||||
|
@ -1205,6 +1218,73 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void set_normal_acceleration(const std::vector<unsigned int> &accelerations) { m_normal_accelerations = accelerations; };
|
||||
void set_travel_acceleration(const std::vector<unsigned int> &accelerations) { m_travel_accelerations = accelerations; };
|
||||
void set_max_acceleration(unsigned int acceleration) { m_max_acceleration = acceleration; };
|
||||
void set_filament_map(const std::vector<int> &filament_map) { m_filament_map = filament_map; }
|
||||
void set_accel_to_decel_enable(bool enable) { m_accel_to_decel_enable = enable; }
|
||||
void set_accel_to_decel_factor(float factor) { m_accel_to_decel_factor = factor; }
|
||||
|
||||
private:
|
||||
std::string set_normal_acceleration() {
|
||||
if (m_normal_accelerations.empty() || m_filament_map.empty())
|
||||
return std::string();
|
||||
|
||||
unsigned int acc = m_normal_accelerations[m_filament_map[m_current_tool] - 1];
|
||||
return set_acceleration_impl(acc);
|
||||
}
|
||||
std::string set_travel_acceleration()
|
||||
{
|
||||
if (m_travel_accelerations.empty() || m_filament_map.empty())
|
||||
return std::string();
|
||||
|
||||
unsigned int acc = m_travel_accelerations[m_filament_map[m_current_tool] - 1];
|
||||
return set_acceleration_impl(acc);
|
||||
}
|
||||
std::string set_acceleration_impl(unsigned int acceleration) {
|
||||
// Clamp the acceleration to the allowed maximum.
|
||||
if (m_max_acceleration > 0 && acceleration > m_max_acceleration)
|
||||
acceleration = m_max_acceleration;
|
||||
|
||||
if (acceleration == 0 || acceleration == m_last_acceleration)
|
||||
return std::string();
|
||||
|
||||
m_last_acceleration = acceleration;
|
||||
|
||||
std::ostringstream gcode;
|
||||
if (m_gcode_flavor == gcfRepetier) {
|
||||
// M201: Set max printing acceleration
|
||||
gcode << "M201 X" << acceleration << " Y" << acceleration;
|
||||
gcode << "\n";
|
||||
// M202: Set max travel acceleration
|
||||
gcode << "M202 X" << acceleration << " Y" << acceleration;
|
||||
} else if (m_gcode_flavor == gcfRepRapFirmware) {
|
||||
// M204: Set default acceleration
|
||||
gcode << "M204 P" << acceleration;
|
||||
} else if (m_gcode_flavor == gcfMarlinFirmware) {
|
||||
// This is new MarlinFirmware with separated print/retraction/travel acceleration.
|
||||
// Use M204 P, we don't want to override travel acc by M204 S (which is deprecated anyway).
|
||||
gcode << "M204 P" << acceleration;
|
||||
}
|
||||
else if (m_gcode_flavor == gcfKlipper && m_accel_to_decel_enable) {
|
||||
gcode << "SET_VELOCITY_LIMIT ACCEL_TO_DECEL=" << acceleration * m_accel_to_decel_factor / 100;
|
||||
gcode << "\nM204 S" << acceleration;
|
||||
}
|
||||
else {
|
||||
// M204: Set default acceleration
|
||||
gcode << "M204 S" << acceleration;
|
||||
}
|
||||
gcode << "\n";
|
||||
return gcode.str();
|
||||
}
|
||||
std::vector<unsigned int> m_normal_accelerations;
|
||||
std::vector<unsigned int> m_travel_accelerations;
|
||||
unsigned int m_max_acceleration{0};
|
||||
unsigned int m_last_acceleration{0};
|
||||
std::vector<int> m_filament_map;
|
||||
bool m_accel_to_decel_enable;
|
||||
float m_accel_to_decel_factor;
|
||||
|
||||
private:
|
||||
Vec2f m_start_pos;
|
||||
Vec2f m_current_pos;
|
||||
|
@ -1517,8 +1597,22 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi
|
|||
m_extra_spacing((float)config.prime_tower_infill_gap.value/100.f),
|
||||
m_tower_framework(config.prime_tower_enable_framework.value),
|
||||
m_max_speed((float)config.prime_tower_max_speed.value*60.f),
|
||||
m_printable_height(config.extruder_printable_height.values)
|
||||
m_printable_height(config.extruder_printable_height.values),
|
||||
m_accel_to_decel_enable(config.accel_to_decel_enable.value),
|
||||
m_accel_to_decel_factor(config.accel_to_decel_factor.value)
|
||||
{
|
||||
m_normal_accels.clear();
|
||||
for (auto value : config.default_acceleration.values) {
|
||||
m_normal_accels.emplace_back((unsigned int) floor(value + 0.5));
|
||||
}
|
||||
|
||||
m_travel_accels.clear();
|
||||
for (auto value : config.travel_acceleration.values) {
|
||||
m_travel_accels.emplace_back((unsigned int) floor(value + 0.5));
|
||||
}
|
||||
|
||||
m_max_accels = config.machine_max_acceleration_extruding.values.front();
|
||||
|
||||
// Read absolute value of first layer speed, if given as percentage,
|
||||
// it is taken over following default. Speeds from config are not
|
||||
// easily accessible here.
|
||||
|
@ -1734,6 +1828,7 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_per
|
|||
"; CP TOOLCHANGE START\n")
|
||||
.comment_with_value(" toolchange #", m_num_tool_changes + 1); // the number is zero-based
|
||||
|
||||
set_for_wipe_tower_writer(writer);
|
||||
|
||||
if (tool != (unsigned)(-1))
|
||||
writer.append(std::string("; material : " + (m_current_tool < m_filpar.size() ? m_filpar[m_current_tool].material : "(NONE)") + " -> " + m_filpar[tool].material + "\n").c_str())
|
||||
|
@ -1893,6 +1988,8 @@ WipeTower::NozzleChangeResult WipeTower::nozzle_change(int old_filament_id, int
|
|||
.set_y_shift(m_y_shift + (new_filament_id != (unsigned int) (-1) && (m_current_shape == SHAPE_REVERSED) ? m_layer_info->depth - m_layer_info->toolchanges_depth() : 0.f))
|
||||
.append(format_nozzle_change_line(true,old_filament_id,new_filament_id));
|
||||
|
||||
set_for_wipe_tower_writer(writer);
|
||||
|
||||
box_coordinates cleaning_box(Vec2f(m_perimeter_width, m_perimeter_width), m_wipe_tower_width - 2 * m_perimeter_width,
|
||||
(new_filament_id != (unsigned int) (-1) ? wipe_depth + m_depth_traversed - m_perimeter_width : m_wipe_tower_depth - m_perimeter_width));
|
||||
|
||||
|
@ -2322,6 +2419,16 @@ WipeTower::box_coordinates WipeTower::align_perimeter(const WipeTower::box_coord
|
|||
return aligned_box;
|
||||
}
|
||||
|
||||
void WipeTower::set_for_wipe_tower_writer(WipeTowerWriter &writer)
|
||||
{
|
||||
writer.set_normal_acceleration(m_normal_accels);
|
||||
writer.set_travel_acceleration(m_travel_accels);
|
||||
writer.set_max_acceleration(m_max_accels);
|
||||
writer.set_filament_map(m_filament_map);
|
||||
writer.set_accel_to_decel_enable(m_accel_to_decel_enable);
|
||||
writer.set_accel_to_decel_factor(m_accel_to_decel_factor);
|
||||
}
|
||||
|
||||
WipeTower::ToolChangeResult WipeTower::finish_layer(bool extrude_perimeter, bool extruder_fill)
|
||||
{
|
||||
assert(! this->layer_finished());
|
||||
|
@ -2335,6 +2442,8 @@ WipeTower::ToolChangeResult WipeTower::finish_layer(bool extrude_perimeter, bool
|
|||
.set_initial_tool(m_current_tool)
|
||||
.set_y_shift(m_y_shift - (m_current_shape == SHAPE_REVERSED ? m_layer_info->toolchanges_depth() : 0.f));
|
||||
|
||||
set_for_wipe_tower_writer(writer);
|
||||
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Tower_Start) + "\n");
|
||||
|
||||
// Slow down on the 1st layer.
|
||||
|
@ -2836,6 +2945,8 @@ WipeTower::ToolChangeResult WipeTower::tool_change_new(size_t new_tool, bool sol
|
|||
"; CP TOOLCHANGE START\n")
|
||||
.comment_with_value(" toolchange #", m_num_tool_changes + 1); // the number is zero-based
|
||||
|
||||
set_for_wipe_tower_writer(writer);
|
||||
|
||||
if (new_tool != (unsigned) (-1))
|
||||
writer.append( std::string("; material : " + (m_current_tool < m_filpar.size() ? m_filpar[m_current_tool].material : "(NONE)") + " -> " + m_filpar[new_tool].material + "\n").c_str())
|
||||
.append(";--------------------\n");
|
||||
|
@ -2885,7 +2996,7 @@ WipeTower::ToolChangeResult WipeTower::tool_change_new(size_t new_tool, bool sol
|
|||
}
|
||||
writer.travel(initial_position);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
toolchange_wipe_new(writer, cleaning_box, wipe_length, solid_toolchange);
|
||||
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Tower_End) + "\n");
|
||||
|
@ -2946,6 +3057,7 @@ WipeTower::NozzleChangeResult WipeTower::nozzle_change_new(int old_filament_id,
|
|||
.set_initial_tool(m_current_tool)
|
||||
.set_y_shift(m_y_shift + (new_filament_id != (unsigned int) (-1) && (m_current_shape == SHAPE_REVERSED) ? m_layer_info->depth - m_layer_info->toolchanges_depth() : 0.f))
|
||||
.append(format_nozzle_change_line(true, old_filament_id, new_filament_id));
|
||||
set_for_wipe_tower_writer(writer);
|
||||
|
||||
WipeTowerBlock* block = get_block_by_category(m_filpar[old_filament_id].category, false);
|
||||
if (!block) {
|
||||
|
@ -3069,6 +3181,8 @@ WipeTower::ToolChangeResult WipeTower::finish_layer_new(bool extrude_perimeter,
|
|||
.set_initial_tool(m_current_tool)
|
||||
.set_y_shift(m_y_shift - (m_current_shape == SHAPE_REVERSED ? m_layer_info->toolchanges_depth() : 0.f));
|
||||
|
||||
set_for_wipe_tower_writer(writer);
|
||||
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Tower_Start) + "\n");
|
||||
|
||||
// Slow down on the 1st layer.
|
||||
|
@ -3240,6 +3354,8 @@ WipeTower::ToolChangeResult WipeTower::finish_block(const WipeTowerBlock &block,
|
|||
.set_initial_tool(filament_id)
|
||||
.set_y_shift(m_y_shift - (m_current_shape == SHAPE_REVERSED ? m_layer_info->toolchanges_depth() : 0.f));
|
||||
|
||||
set_for_wipe_tower_writer(writer);
|
||||
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Tower_Start) + "\n");
|
||||
|
||||
// Slow down on the 1st layer.
|
||||
|
@ -3354,6 +3470,8 @@ WipeTower::ToolChangeResult WipeTower::finish_block_solid(const WipeTowerBlock &
|
|||
.set_initial_tool(filament_id)
|
||||
.set_y_shift(m_y_shift - (m_current_shape == SHAPE_REVERSED ? m_layer_info->toolchanges_depth() : 0.f));
|
||||
|
||||
set_for_wipe_tower_writer(writer);
|
||||
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Tower_Start) + "\n");
|
||||
|
||||
// Slow down on the 1st layer.
|
||||
|
@ -4226,6 +4344,8 @@ WipeTower::ToolChangeResult WipeTower::only_generate_out_wall(bool is_new_mode)
|
|||
.set_initial_tool(m_current_tool)
|
||||
.set_y_shift(m_y_shift - (m_current_shape == SHAPE_REVERSED ? m_layer_info->toolchanges_depth() : 0.f));
|
||||
|
||||
set_for_wipe_tower_writer(writer);
|
||||
|
||||
// Slow down on the 1st layer.
|
||||
bool first_layer = is_first_layer();
|
||||
// BBS: speed up perimeter speed to 90mm/s for non-first layer
|
||||
|
|
|
@ -461,6 +461,12 @@ private:
|
|||
bool m_adhesion = true;
|
||||
GCodeFlavor m_gcode_flavor;
|
||||
|
||||
std::vector<unsigned int> m_normal_accels;
|
||||
std::vector<unsigned int> m_travel_accels;
|
||||
unsigned int m_max_accels;
|
||||
bool m_accel_to_decel_enable;
|
||||
float m_accel_to_decel_factor;
|
||||
|
||||
// Bed properties
|
||||
enum {
|
||||
RectangularBed,
|
||||
|
@ -522,6 +528,7 @@ private:
|
|||
// BBS
|
||||
box_coordinates align_perimeter(const box_coordinates& perimeter_box);
|
||||
|
||||
void set_for_wipe_tower_writer(WipeTowerWriter &writer);
|
||||
|
||||
// to store information about tool changes for a given layer
|
||||
struct WipeTowerInfo{
|
||||
|
|
|
@ -165,7 +165,34 @@ std::string GCodeWriter::set_chamber_temperature(int temperature, bool wait)
|
|||
return gcode.str();
|
||||
}
|
||||
|
||||
std::string GCodeWriter::set_acceleration(unsigned int acceleration)
|
||||
void GCodeWriter::set_acceleration(unsigned int acceleration)
|
||||
{
|
||||
m_acceleration = acceleration;
|
||||
}
|
||||
|
||||
void GCodeWriter::set_travel_acceleration(const std::vector<unsigned int>& accelerations)
|
||||
{
|
||||
m_travel_accelerations = accelerations;
|
||||
}
|
||||
|
||||
std::string GCodeWriter::set_extrude_acceleration()
|
||||
{
|
||||
return set_acceleration_impl(m_acceleration);
|
||||
}
|
||||
|
||||
std::string GCodeWriter::set_travel_acceleration()
|
||||
{
|
||||
if (m_travel_accelerations.empty())
|
||||
return std::string();
|
||||
|
||||
Extruder *cur_filament = filament();
|
||||
if (!cur_filament)
|
||||
return std::string();
|
||||
|
||||
return set_acceleration_impl(m_travel_accelerations[cur_filament->extruder_id()]);
|
||||
}
|
||||
|
||||
std::string GCodeWriter::set_acceleration_impl(unsigned int acceleration)
|
||||
{
|
||||
// Clamp the acceleration to the allowed maximum.
|
||||
if (m_max_acceleration > 0 && acceleration > m_max_acceleration)
|
||||
|
@ -347,7 +374,7 @@ std::string GCodeWriter::travel_to_xy(const Vec2d &point, const std::string &com
|
|||
w.emit_f(this->config.travel_speed.get_at(get_extruder_index(this->config, filament()->id())) * 60.0);
|
||||
//BBS
|
||||
w.emit_comment(GCodeWriter::full_gcode_comment, comment);
|
||||
return w.string();
|
||||
return set_travel_acceleration() + w.string();
|
||||
}
|
||||
|
||||
/* If this method is called more than once before calling unlift(),
|
||||
|
@ -383,7 +410,7 @@ std::string GCodeWriter::lazy_lift(LiftType lift_type, bool spiral_vase, bool to
|
|||
}
|
||||
|
||||
// BBS: immediately execute an undelayed lift move with a spiral lift pattern
|
||||
// designed specifically for subsequent gcode injection (e.g. timelapse)
|
||||
// designed specifically for subsequent gcode injection (e.g. timelapse)
|
||||
std::string GCodeWriter::eager_lift(const LiftType type, bool tool_change)
|
||||
{
|
||||
std::string lift_move;
|
||||
|
@ -542,7 +569,7 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
|
|||
|
||||
m_pos = dest_point;
|
||||
this->set_current_position_clear(true);
|
||||
return out_string;
|
||||
return set_travel_acceleration() + out_string;
|
||||
}
|
||||
|
||||
std::string GCodeWriter::travel_to_z(double z, const std::string &comment)
|
||||
|
@ -561,7 +588,7 @@ std::string GCodeWriter::travel_to_z(double z, const std::string &comment)
|
|||
/* In all the other cases, we perform an actual Z move and cancel
|
||||
the lift. */
|
||||
m_lifted = 0;
|
||||
return this->_travel_to_z(z, comment);
|
||||
return set_travel_acceleration() + this->_travel_to_z(z, comment);
|
||||
}
|
||||
|
||||
std::string GCodeWriter::_travel_to_z(double z, const std::string &comment, bool tool_change)
|
||||
|
@ -579,7 +606,7 @@ std::string GCodeWriter::_travel_to_z(double z, const std::string &comment, bool
|
|||
w.emit_f(speed * 60.0);
|
||||
//BBS
|
||||
w.emit_comment(GCodeWriter::full_gcode_comment, comment);
|
||||
return w.string();
|
||||
return set_travel_acceleration() + w.string();
|
||||
}
|
||||
|
||||
std::string GCodeWriter::_spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment, bool tool_change)
|
||||
|
@ -599,7 +626,7 @@ std::string GCodeWriter::_spiral_travel_to_z(double z, const Vec2d &ij_offset, c
|
|||
w.emit_string(" P1 ");
|
||||
w.emit_f(speed * 60.0);
|
||||
w.emit_comment(GCodeWriter::full_gcode_comment, comment);
|
||||
return output + w.string();
|
||||
return set_travel_acceleration() + output + w.string();
|
||||
}
|
||||
|
||||
bool GCodeWriter::will_move_z(double z) const
|
||||
|
@ -636,7 +663,7 @@ std::string GCodeWriter::extrude_to_xy(const Vec2d &point, double dE, const std:
|
|||
w.emit_e(filament()->E());
|
||||
//BBS
|
||||
w.emit_comment(GCodeWriter::full_gcode_comment, comment);
|
||||
return w.string();
|
||||
return set_extrude_acceleration() + w.string();
|
||||
}
|
||||
|
||||
//BBS: generate G2 or G3 extrude which moves by arc
|
||||
|
@ -658,7 +685,7 @@ std::string GCodeWriter::extrude_arc_to_xy(const Vec2d& point, const Vec2d& cent
|
|||
w.emit_e(filament()->E());
|
||||
//BBS
|
||||
w.emit_comment(GCodeWriter::full_gcode_comment, comment);
|
||||
return w.string();
|
||||
return set_extrude_acceleration() + w.string();
|
||||
}
|
||||
|
||||
std::string GCodeWriter::extrude_to_xyz(const Vec3d &point, double dE, const std::string &comment, bool force_no_extrusion)
|
||||
|
@ -677,7 +704,7 @@ std::string GCodeWriter::extrude_to_xyz(const Vec3d &point, double dE, const std
|
|||
w.emit_e(filament()->E());
|
||||
//BBS
|
||||
w.emit_comment(GCodeWriter::full_gcode_comment, comment);
|
||||
return w.string();
|
||||
return set_extrude_acceleration() + w.string();
|
||||
}
|
||||
|
||||
std::string GCodeWriter::retract(bool before_wipe)
|
||||
|
|
|
@ -54,7 +54,8 @@ public:
|
|||
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const;
|
||||
std::string set_bed_temperature(int temperature, bool wait = false);
|
||||
std::string set_chamber_temperature(int temperature, bool wait = false);
|
||||
std::string set_acceleration(unsigned int acceleration);
|
||||
void set_acceleration(unsigned int acceleration);
|
||||
void set_travel_acceleration(const std::vector<unsigned int>& travel_accelerations);
|
||||
std::string set_pressure_advance(double pa) const;
|
||||
std::string set_jerk_xy(double jerk);
|
||||
std::string reset_e(bool force = false);
|
||||
|
@ -117,6 +118,11 @@ public:
|
|||
//Radian threshold of slope for lazy lift and spiral lift;
|
||||
static const double slope_threshold;
|
||||
|
||||
private:
|
||||
std::string set_extrude_acceleration();
|
||||
std::string set_travel_acceleration();
|
||||
std::string set_acceleration_impl(unsigned int acceleration);
|
||||
|
||||
private:
|
||||
// Extruders are sorted by their ID, so that binary search is possible.
|
||||
std::vector<Extruder> m_filament_extruders;
|
||||
|
@ -152,6 +158,9 @@ private:
|
|||
std::string m_gcode_label_objects_start;
|
||||
std::string m_gcode_label_objects_end;
|
||||
|
||||
unsigned int m_acceleration{0};
|
||||
std::vector<unsigned int> m_travel_accelerations; // multi extruder, extruder size
|
||||
|
||||
std::string _travel_to_z(double z, const std::string &comment,bool tool_change=false);
|
||||
std::string _spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment, bool tool_change = false);
|
||||
std::string _retract(double length, double restart_extra, const std::string &comment);
|
||||
|
|
|
@ -860,7 +860,7 @@ static std::vector<std::string> s_Preset_print_options {
|
|||
"inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed",
|
||||
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_object_first_layer_gap","support_interface_speed",
|
||||
"bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed", "outer_wall_acceleration",
|
||||
"initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "inner_wall_acceleration", "sparse_infill_acceleration",
|
||||
"initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "travel_acceleration", "inner_wall_acceleration", "sparse_infill_acceleration",
|
||||
"accel_to_decel_enable", "accel_to_decel_factor", "skirt_loops", "skirt_distance",
|
||||
"skirt_height", "draft_shield",
|
||||
"brim_width", "brim_object_gap", "brim_type", "enable_support", "support_type", "support_threshold_angle", "enforce_support_layers",
|
||||
|
|
|
@ -106,6 +106,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||
"overhang_threshold_participating_cooling",
|
||||
"slow_down_for_layer_cooling",
|
||||
"default_acceleration",
|
||||
"travel_acceleration",
|
||||
"deretraction_speed",
|
||||
"close_fan_the_first_x_layers",
|
||||
"machine_end_gcode",
|
||||
|
|
|
@ -1249,6 +1249,15 @@ void PrintConfigDef::init_fff_params()
|
|||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{500.0});
|
||||
|
||||
def = this->add("travel_acceleration", coFloats);
|
||||
def->label = L("Travel");
|
||||
def->tooltip = L("The acceleration of travel except initial layer");
|
||||
def->sidetext = "mm/s²";
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{500.0});
|
||||
|
||||
def = this->add("default_filament_profile", coStrings);
|
||||
def->label = L("Default filament profile");
|
||||
def->tooltip = L("Default filament profile when switch to this machine profile");
|
||||
|
@ -5637,6 +5646,7 @@ std::set<std::string> print_options_with_variant = {
|
|||
"travel_speed",
|
||||
"travel_speed_z",
|
||||
"default_acceleration",
|
||||
"travel_acceleration",
|
||||
"initial_layer_acceleration",
|
||||
"outer_wall_acceleration",
|
||||
"inner_wall_acceleration",
|
||||
|
|
|
@ -1155,6 +1155,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
((ConfigOptionInt, other_layers_print_sequence_nums))
|
||||
((ConfigOptionBools, slow_down_for_layer_cooling))
|
||||
((ConfigOptionFloatsNullable, default_acceleration))
|
||||
((ConfigOptionFloatsNullable, travel_acceleration))
|
||||
((ConfigOptionFloatsNullable, inner_wall_acceleration))
|
||||
((ConfigOptionFloatsOrPercentsNullable, sparse_infill_acceleration))
|
||||
((ConfigOptionBools, activate_air_filtration))
|
||||
|
|
|
@ -2175,6 +2175,7 @@ void TabPrint::build()
|
|||
|
||||
optgroup = page->new_optgroup(L("Acceleration"), L"param_acceleration", 15);
|
||||
optgroup->append_single_option_line("default_acceleration", "", 0);
|
||||
optgroup->append_single_option_line("travel_acceleration", "", 0);
|
||||
optgroup->append_single_option_line("initial_layer_acceleration", "", 0);
|
||||
optgroup->append_single_option_line("outer_wall_acceleration", "", 0);
|
||||
optgroup->append_single_option_line("inner_wall_acceleration", "", 0);
|
||||
|
|
Loading…
Reference in New Issue