ENH: add initial layer travel acceleration
jira: none Change-Id: I1a9bb6bc8d260cb76a62b18ddaaac54bf74e8602 (cherry picked from commit ab91cb76eb7b3916e4b377ea6a30dcec2ff7bc97)
This commit is contained in:
parent
ca36ee8096
commit
cdd72cd549
|
@ -123,6 +123,9 @@
|
|||
"top_surface_speed": [
|
||||
"30"
|
||||
],
|
||||
"initial_layer_travel_acceleration": [
|
||||
"6000"
|
||||
],
|
||||
"travel_acceleration": [
|
||||
"10000"
|
||||
],
|
||||
|
|
|
@ -16,6 +16,12 @@
|
|||
"10000",
|
||||
"10000"
|
||||
],
|
||||
"initial_layer_travel_acceleration": [
|
||||
"6000",
|
||||
"6000",
|
||||
"6000",
|
||||
"6000"
|
||||
],
|
||||
"travel_acceleration": [
|
||||
"10000",
|
||||
"10000",
|
||||
|
|
|
@ -2427,7 +2427,12 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
for (auto value : m_config.travel_acceleration.values) {
|
||||
travel_accelerations.emplace_back((unsigned int) floor(value + 0.5));
|
||||
}
|
||||
std::vector<unsigned int> first_layer_travel_accelerations;
|
||||
for (auto value : m_config.initial_layer_travel_acceleration.values) {
|
||||
first_layer_travel_accelerations.emplace_back((unsigned int) floor(value + 0.5));
|
||||
}
|
||||
m_writer.set_travel_acceleration(travel_accelerations);
|
||||
m_writer.set_first_layer_travel_acceleration(first_layer_travel_accelerations);
|
||||
|
||||
// OrcaSlicer: calib
|
||||
if (print.calib_params().mode == CalibMode::Calib_PA_Line) {
|
||||
|
@ -3683,6 +3688,8 @@ GCode::LayerResult GCode::process_layer(
|
|||
//BBS: set layer time fan speed after layer change gcode
|
||||
gcode += ";_SET_FAN_SPEED_CHANGING_LAYER\n";
|
||||
|
||||
m_writer.set_first_layer(this->on_first_layer());
|
||||
|
||||
if (print.calib_mode() == CalibMode::Calib_PA_Tower) {
|
||||
gcode += writer().set_pressure_advance(print.calib_params().start + static_cast<int>(print_z) * print.calib_params().step);
|
||||
}
|
||||
|
|
|
@ -1218,8 +1218,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void set_first_layer(bool is_first_layer) { m_is_first_layer = is_first_layer; }
|
||||
void set_normal_acceleration(const std::vector<unsigned int> &accelerations) { m_normal_accelerations = accelerations; };
|
||||
void set_first_layer_normal_acceleration(const std::vector<unsigned int> &accelerations) { m_first_layer_normal_accelerations = accelerations; };
|
||||
void set_travel_acceleration(const std::vector<unsigned int> &accelerations) { m_travel_accelerations = accelerations; };
|
||||
void set_first_layer_travel_acceleration(const std::vector<unsigned int> &accelerations) { m_first_layer_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; }
|
||||
|
@ -1227,18 +1230,20 @@ public:
|
|||
|
||||
private:
|
||||
std::string set_normal_acceleration() {
|
||||
if (m_normal_accelerations.empty() || m_filament_map.empty())
|
||||
std::vector<unsigned int> accelerations = m_is_first_layer ? m_first_layer_normal_accelerations : m_normal_accelerations;
|
||||
if (accelerations.empty() || m_filament_map.empty())
|
||||
return std::string();
|
||||
|
||||
unsigned int acc = m_normal_accelerations[m_filament_map[m_current_tool] - 1];
|
||||
unsigned int acc = 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())
|
||||
std::vector<unsigned int> accelerations = m_is_first_layer ? m_first_layer_travel_accelerations : m_travel_accelerations;
|
||||
if (accelerations.empty() || accelerations.empty())
|
||||
return std::string();
|
||||
|
||||
unsigned int acc = m_travel_accelerations[m_filament_map[m_current_tool] - 1];
|
||||
unsigned int acc = accelerations[m_filament_map[m_current_tool] - 1];
|
||||
return set_acceleration_impl(acc);
|
||||
}
|
||||
std::string set_acceleration_impl(unsigned int acceleration) {
|
||||
|
@ -1278,7 +1283,10 @@ private:
|
|||
return gcode.str();
|
||||
}
|
||||
std::vector<unsigned int> m_normal_accelerations;
|
||||
std::vector<unsigned int> m_first_layer_normal_accelerations;
|
||||
std::vector<unsigned int> m_travel_accelerations;
|
||||
std::vector<unsigned int> m_first_layer_travel_accelerations;
|
||||
bool m_is_first_layer{false};
|
||||
unsigned int m_max_acceleration{0};
|
||||
unsigned int m_last_acceleration{0};
|
||||
std::vector<int> m_filament_map;
|
||||
|
@ -1606,11 +1614,21 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi
|
|||
m_normal_accels.emplace_back((unsigned int) floor(value + 0.5));
|
||||
}
|
||||
|
||||
m_first_layer_normal_accels.clear();
|
||||
for (auto value : config.initial_layer_acceleration.values) {
|
||||
m_first_layer_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_first_layer_travel_accels.clear();
|
||||
for (auto value : config.initial_layer_travel_acceleration.values) {
|
||||
m_first_layer_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,
|
||||
|
@ -2423,10 +2441,13 @@ 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_first_layer_normal_acceleration(m_first_layer_normal_accels);
|
||||
writer.set_first_layer_travel_acceleration(m_first_layer_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);
|
||||
writer.set_first_layer(m_cur_layer_id == 0);
|
||||
}
|
||||
|
||||
WipeTower::ToolChangeResult WipeTower::finish_layer(bool extrude_perimeter, bool extruder_fill)
|
||||
|
|
|
@ -462,7 +462,9 @@ private:
|
|||
GCodeFlavor m_gcode_flavor;
|
||||
|
||||
std::vector<unsigned int> m_normal_accels;
|
||||
std::vector<unsigned int> m_first_layer_normal_accels;
|
||||
std::vector<unsigned int> m_travel_accels;
|
||||
std::vector<unsigned int> m_first_layer_travel_accels;
|
||||
unsigned int m_max_accels;
|
||||
bool m_accel_to_decel_enable;
|
||||
float m_accel_to_decel_factor;
|
||||
|
|
|
@ -175,6 +175,16 @@ void GCodeWriter::set_travel_acceleration(const std::vector<unsigned int>& accel
|
|||
m_travel_accelerations = accelerations;
|
||||
}
|
||||
|
||||
void GCodeWriter::set_first_layer_travel_acceleration(const std::vector<unsigned int> &travel_accelerations)
|
||||
{
|
||||
m_first_layer_travel_accelerations = travel_accelerations;
|
||||
}
|
||||
|
||||
void GCodeWriter::set_first_layer(bool is_first_layer)
|
||||
{
|
||||
m_is_first_layer = is_first_layer;
|
||||
}
|
||||
|
||||
std::string GCodeWriter::set_extrude_acceleration()
|
||||
{
|
||||
return set_acceleration_impl(m_acceleration);
|
||||
|
@ -182,14 +192,15 @@ std::string GCodeWriter::set_extrude_acceleration()
|
|||
|
||||
std::string GCodeWriter::set_travel_acceleration()
|
||||
{
|
||||
if (m_travel_accelerations.empty())
|
||||
std::vector<unsigned int> travel_accelerations = m_is_first_layer ? m_first_layer_travel_accelerations : m_travel_accelerations;
|
||||
if (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()]);
|
||||
return set_acceleration_impl(travel_accelerations[cur_filament->extruder_id()]);
|
||||
}
|
||||
|
||||
std::string GCodeWriter::set_acceleration_impl(unsigned int acceleration)
|
||||
|
@ -529,7 +540,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 slop_move + xy_z_move;
|
||||
return set_travel_acceleration() + slop_move + xy_z_move;
|
||||
}
|
||||
else if (!this->will_move_z(point(2))) {
|
||||
double nominal_z = m_pos(2) - m_lifted;
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
std::string set_chamber_temperature(int temperature, bool wait = false);
|
||||
void set_acceleration(unsigned int acceleration);
|
||||
void set_travel_acceleration(const std::vector<unsigned int>& travel_accelerations);
|
||||
void set_first_layer_travel_acceleration(const std::vector<unsigned int>& travel_accelerations);
|
||||
void set_first_layer(bool is_first_layer);
|
||||
std::string set_pressure_advance(double pa) const;
|
||||
std::string set_jerk_xy(double jerk);
|
||||
std::string reset_e(bool force = false);
|
||||
|
@ -158,8 +160,10 @@ private:
|
|||
std::string m_gcode_label_objects_start;
|
||||
std::string m_gcode_label_objects_end;
|
||||
|
||||
bool m_is_first_layer{false};
|
||||
unsigned int m_acceleration{0};
|
||||
std::vector<unsigned int> m_travel_accelerations; // multi extruder, extruder size
|
||||
std::vector<unsigned int> m_first_layer_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);
|
||||
|
|
|
@ -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", "travel_acceleration", "inner_wall_acceleration", "sparse_infill_acceleration",
|
||||
"initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "travel_acceleration", "initial_layer_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",
|
||||
|
|
|
@ -105,8 +105,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||
"overhang_fan_threshold",
|
||||
"overhang_threshold_participating_cooling",
|
||||
"slow_down_for_layer_cooling",
|
||||
"default_acceleration",
|
||||
"travel_acceleration",
|
||||
"deretraction_speed",
|
||||
"close_fan_the_first_x_layers",
|
||||
"machine_end_gcode",
|
||||
|
@ -299,7 +297,10 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||
|| opt_key == "initial_layer_infill_speed"
|
||||
|| opt_key == "travel_speed"
|
||||
|| opt_key == "travel_speed_z"
|
||||
|| opt_key == "initial_layer_speed") {
|
||||
|| opt_key == "initial_layer_speed"
|
||||
|| opt_key == "default_acceleration"
|
||||
|| opt_key == "travel_acceleration"
|
||||
|| opt_key == "initial_layer_travel_acceleration") {
|
||||
//|| opt_key == "z_offset") {
|
||||
steps.emplace_back(psWipeTower);
|
||||
steps.emplace_back(psSkirtBrim);
|
||||
|
|
|
@ -1258,6 +1258,15 @@ void PrintConfigDef::init_fff_params()
|
|||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{500.0});
|
||||
|
||||
def = this->add("initial_layer_travel_acceleration", coFloats);
|
||||
def->label = L("Initial layer travel");
|
||||
def->tooltip = L("The acceleration of travel of 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");
|
||||
|
@ -5647,6 +5656,7 @@ std::set<std::string> print_options_with_variant = {
|
|||
"travel_speed_z",
|
||||
"default_acceleration",
|
||||
"travel_acceleration",
|
||||
"initial_layer_travel_acceleration",
|
||||
"initial_layer_acceleration",
|
||||
"outer_wall_acceleration",
|
||||
"inner_wall_acceleration",
|
||||
|
|
|
@ -1156,6 +1156,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
((ConfigOptionBools, slow_down_for_layer_cooling))
|
||||
((ConfigOptionFloatsNullable, default_acceleration))
|
||||
((ConfigOptionFloatsNullable, travel_acceleration))
|
||||
((ConfigOptionFloatsNullable, initial_layer_travel_acceleration))
|
||||
((ConfigOptionFloatsNullable, inner_wall_acceleration))
|
||||
((ConfigOptionFloatsOrPercentsNullable, sparse_infill_acceleration))
|
||||
((ConfigOptionBools, activate_air_filtration))
|
||||
|
|
|
@ -2176,6 +2176,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_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