mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 06:41:14 -06:00
NEW: add calibration
Change-Id: I03e5489a67042e7f76f5a42260a289d540b5a63a (cherry picked from commit cbac2c639db830eb779b1979c8d6b4eb3decb7e6)
This commit is contained in:
parent
ff3f78cfb5
commit
1f54aaf22b
35 changed files with 38647 additions and 54 deletions
|
@ -37,6 +37,7 @@ set(lisbslic3r_sources
|
|||
Brim.hpp
|
||||
BuildVolume.cpp
|
||||
BuildVolume.hpp
|
||||
Calib.hpp
|
||||
Circle.cpp
|
||||
Circle.hpp
|
||||
clipper.cpp
|
||||
|
|
26
src/libslic3r/Calib.hpp
Normal file
26
src/libslic3r/Calib.hpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Point.hpp"
|
||||
namespace Slic3r {
|
||||
|
||||
class GCode;
|
||||
|
||||
enum class CalibMode : int {
|
||||
Calib_None = 0,
|
||||
Calib_PA_Line,
|
||||
Calib_PA_Tower,
|
||||
Calib_Flow_Rate,
|
||||
Calib_Temp_Tower,
|
||||
Calib_Vol_speed_Tower,
|
||||
Calib_VFA_Tower
|
||||
|
||||
};
|
||||
struct Calib_Params
|
||||
{
|
||||
Calib_Params() : mode(CalibMode::Calib_None){}
|
||||
double start, end, step;
|
||||
bool print_numbers;
|
||||
CalibMode mode;
|
||||
};
|
||||
} // namespace Slic3r
|
|
@ -2703,6 +2703,19 @@ GCode::LayerResult GCode::process_layer(
|
|||
config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
|
||||
}
|
||||
|
||||
if (print.calib_mode() == CalibMode::Calib_Temp_Tower) {
|
||||
auto offset = static_cast<unsigned int>(print_z / 10.001) * 5;
|
||||
gcode += writer().set_temperature(print.calib_params().start - offset);
|
||||
}
|
||||
else if (print.calib_mode() == CalibMode::Calib_Vol_speed_Tower) {
|
||||
auto _speed = print.calib_params().start + print_z * print.calib_params().step;
|
||||
m_calib_config.set_key_value("outer_wall_speed", new ConfigOptionFloat(std::round(_speed)));
|
||||
}
|
||||
else if (print.calib_mode() == CalibMode::Calib_VFA_Tower) {
|
||||
auto _speed = print.calib_params().start + std::floor(print_z / 5.0) * print.calib_params().step;
|
||||
m_calib_config.set_key_value("outer_wall_speed", new ConfigOptionFloat(std::round(_speed)));
|
||||
}
|
||||
|
||||
//BBS
|
||||
if (first_layer) {
|
||||
//BBS: set first layer global acceleration
|
||||
|
@ -3654,6 +3667,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||
|
||||
// compensate retraction
|
||||
gcode += this->unretract();
|
||||
m_config.apply(m_calib_config);
|
||||
|
||||
// adjust acceleration
|
||||
if (m_config.default_acceleration.value > 0) {
|
||||
|
@ -3680,7 +3694,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||
}
|
||||
|
||||
// calculate extrusion length per distance unit
|
||||
double e_per_mm = m_writer.extruder()->e_per_mm3() * path.mm3_per_mm;
|
||||
auto _mm3_per_mm = path.mm3_per_mm * (m_curr_print->calib_mode() == CalibMode::Calib_Flow_Rate ? this->config().print_flow_ratio : 1);
|
||||
double e_per_mm = m_writer.extruder()->e_per_mm3() * _mm3_per_mm;
|
||||
|
||||
double min_speed = double(m_config.slow_down_min_speed.get_at(m_writer.extruder()->id()));
|
||||
// set speed
|
||||
|
|
|
@ -413,6 +413,7 @@ private:
|
|||
methods. */
|
||||
Vec2d m_origin;
|
||||
FullPrintConfig m_config;
|
||||
DynamicConfig m_calib_config;
|
||||
// scaled G-code resolution
|
||||
double m_scaled_resolution;
|
||||
GCodeWriter m_writer;
|
||||
|
|
|
@ -747,7 +747,9 @@ static std::vector<std::string> s_Preset_print_options {
|
|||
"initial_layer_infill_speed", "only_one_wall_top", "only_one_wall_first_layer",
|
||||
"timelapse_type", "internal_bridge_support_thickness",
|
||||
"wall_generator", "wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle",
|
||||
"wall_distribution_count", "min_feature_size", "min_bead_width", "post_process"
|
||||
"wall_distribution_count", "min_feature_size", "min_bead_width", "post_process",
|
||||
// calib
|
||||
"print_flow_ratio"
|
||||
};
|
||||
|
||||
static std::vector<std::string> s_Preset_filament_options {
|
||||
|
|
|
@ -253,6 +253,11 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||
return invalidated;
|
||||
}
|
||||
|
||||
void Print::set_calib_params(const Calib_Params ¶ms)
|
||||
{
|
||||
m_calib_params = params;
|
||||
}
|
||||
|
||||
bool Print::invalidate_step(PrintStep step)
|
||||
{
|
||||
bool invalidated = Inherited::invalidate_step(step);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <functional>
|
||||
#include <set>
|
||||
#include "Calib.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
@ -788,6 +789,11 @@ public:
|
|||
// Return 4 wipe tower corners in the world coordinates (shifted and rotated), including the wipe tower brim.
|
||||
std::vector<Point> first_layer_wipe_tower_corners(bool check_wipe_tower_existance=true) const;
|
||||
|
||||
CalibMode & calib_mode() { return m_calib_params.mode; }
|
||||
const CalibMode& calib_mode() const { return m_calib_params.mode; }
|
||||
void set_calib_params(const Calib_Params ¶ms);
|
||||
const Calib_Params& calib_params() const { return m_calib_params; }
|
||||
|
||||
protected:
|
||||
// Invalidates the step, and its depending steps in Print.
|
||||
bool invalidate_step(PrintStep step);
|
||||
|
@ -841,6 +847,9 @@ private:
|
|||
ConflictResultOpt m_conflict_result;
|
||||
FakeWipeTower m_fake_wipe_tower;
|
||||
|
||||
// SoftFever: calibration
|
||||
Calib_Params m_calib_params;
|
||||
|
||||
// To allow GCode to set the Print's GCodeExport step status.
|
||||
friend class GCode;
|
||||
// Allow PrintObject to access m_mutex and m_cancel_callback.
|
||||
|
|
|
@ -1119,6 +1119,14 @@ void PrintConfigDef::init_fff_params()
|
|||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 1. });
|
||||
|
||||
def = this->add("print_flow_ratio", coFloat);
|
||||
def->label = L("Object flow ratio");
|
||||
def->tooltip = L("The flow ratio set by object, the meaning is the same as flow ratio.");
|
||||
def->mode = comDevelop;
|
||||
def->max = 2;
|
||||
def->min = 0.01;
|
||||
def->set_default_value(new ConfigOptionFloat(1));
|
||||
|
||||
def = this->add("line_width", coFloat);
|
||||
def->label = L("Default");
|
||||
def->category = L("Quality");
|
||||
|
|
|
@ -756,8 +756,14 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
((ConfigOptionFloat, overhang_1_4_speed))
|
||||
((ConfigOptionFloat, overhang_2_4_speed))
|
||||
((ConfigOptionFloat, overhang_3_4_speed))
|
||||
<<<<<<< HEAD (88f268 FIX: wipe tower is not generated with different filament lay)
|
||||
((ConfigOptionFloatOrPercent, sparse_infill_anchor))
|
||||
((ConfigOptionFloatOrPercent, sparse_infill_anchor_max))
|
||||
=======
|
||||
((ConfigOptionFloat, overhang_4_4_speed))
|
||||
//calib
|
||||
((ConfigOptionFloat, print_flow_ratio)))
|
||||
>>>>>>> CHANGE (cbac2c NEW: add calibration)
|
||||
|
||||
PRINT_CONFIG_CLASS_DEFINE(
|
||||
MachineEnvelopeConfig,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue