diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index fa3f5d464b..25d204d60c 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1637,18 +1637,24 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato this->m_objSupportsWithBrim.insert(iter->first); } if (this->m_objsWithBrim.empty() && this->m_objSupportsWithBrim.empty()) m_brim_done = true; + + // SoftFever: calib if (print.calib_mode() == Calib_PA_DDE || print.calib_mode() == Calib_PA_Bowden) { std::string gcode; - auto s = m_config.inner_wall_speed.value; gcode += m_writer.set_acceleration((unsigned int)floor(m_config.outer_wall_acceleration.value + 0.5)); if (m_config.default_jerk.value > 0) { double jerk = m_config.outer_wall_jerk.value; gcode += m_writer.set_jerk_xy((unsigned int)floor(jerk + 0.5)); } - m_config.outer_wall_speed = print.default_region_config().outer_wall_speed; - m_config.inner_wall_speed = print.default_region_config().inner_wall_speed; + calib_pressure_advance pa_test(this); + double filament_max_volumetric_speed = m_config.option("filament_max_volumetric_speed")->get_at(initial_extruder_id); + Flow pattern_line = Flow(pa_test.line_width(), 0.2, m_config.nozzle_diameter.get_at(0)); + auto fast_speed = std::min(print.default_region_config().outer_wall_speed.value, filament_max_volumetric_speed / pattern_line.mm3_per_mm()); + auto slow_speed = std::max(20.0, fast_speed / 10.0); + pa_test.set_speed(fast_speed, slow_speed); + if(print.calib_mode() == Calib_PA_DDE) gcode += pa_test.generate_test(); else diff --git a/src/libslic3r/calib.cpp b/src/libslic3r/calib.cpp index 0899eefb7d..e5147f428d 100644 --- a/src/libslic3r/calib.cpp +++ b/src/libslic3r/calib.cpp @@ -7,7 +7,7 @@ namespace Slic3r { - calib_pressure_advance::calib_pressure_advance(GCode* gcodegen) :mp_gcodegen(gcodegen), m_length_short(20.0), m_length_long(40.0), m_space_y(3.5) {} + calib_pressure_advance::calib_pressure_advance(GCode* gcodegen) :mp_gcodegen(gcodegen), m_length_short(20.0), m_length_long(40.0), m_space_y(3.5), m_line_width(0.6) {} std::string calib_pressure_advance::generate_test(double start_pa/*= 0*/, double step_pa /*= 0.005*/, int count/*= 10*/) { auto bed_sizes = mp_gcodegen->config().printable_area.values; @@ -32,11 +32,14 @@ namespace Slic3r { std::string calib_pressure_advance::print_pa_lines(double start_x, double start_y, double start_pa, double step_pa, int num) { auto& writer = mp_gcodegen->writer(); - const double e_calib = 0.05; // filament_mm/extrusion_mm - const double e = 0.038; // filament_mm/extrusion_mm + Flow line_flow = Flow(m_line_width, 0.2, mp_gcodegen->config().nozzle_diameter.get_at(0)); + Flow thin_line_flow = Flow(0.44, 0.2, mp_gcodegen->config().nozzle_diameter.get_at(0)); + const double e_calib = line_flow.mm3_per_mm() / 2.40528; // filament_mm/extrusion_mm + const double e = thin_line_flow.mm3_per_mm() / 2.40528; // filament_mm/extrusion_mm - const double fast = mp_gcodegen->config().get_abs_value("outer_wall_speed") * 60.0; - const double slow = std::max(1200.0, fast * 0.1); + + const double fast = m_fast_speed * 60.0; + const double slow = m_slow_speed * 60.0; std::stringstream gcode; gcode << mp_gcodegen->writer().travel_to_z(0.2); double y_pos = start_y; @@ -81,9 +84,10 @@ namespace Slic3r { auto& writer = mp_gcodegen->writer(); std::stringstream gcode; const double lw = 0.48; + Flow line_flow = Flow(lw, 0.2, mp_gcodegen->config().nozzle_diameter.get_at(0)); const double len = 2; const double gap = lw / 2.0; - const double e = 0.04; // filament_mm/extrusion_mm + const double e = line_flow.mm3_per_mm() / 2.40528; // filament_mm/extrusion_mm // 0-------1 // | | diff --git a/src/libslic3r/calib.hpp b/src/libslic3r/calib.hpp index 687059a334..741891af95 100644 --- a/src/libslic3r/calib.hpp +++ b/src/libslic3r/calib.hpp @@ -12,6 +12,11 @@ public: ~calib_pressure_advance() {} std::string generate_test(double start_pa = 0, double step_pa = 0.002, int count = 50); + void set_speed(double fast = 100.0,double slow = 20.0) { + m_slow_speed = slow; + m_fast_speed = fast; + } + double& line_width() { return m_line_width; }; private: std::string move_to(Vec2d pt); @@ -22,5 +27,7 @@ private: GCode* mp_gcodegen; double m_length_short, m_length_long; double m_space_y; + double m_slow_speed, m_fast_speed; + double m_line_width; }; } // namespace Slic3r \ No newline at end of file