mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-10 02:37:04 +00:00
Fix overzealous m_last_pos initialization
This commit is contained in:
@@ -395,8 +395,6 @@ void CalibPressureAdvancePattern::starting_point(const Model& model)
|
|||||||
m_starting_point.x() *= -1;
|
m_starting_point.x() *= -1;
|
||||||
m_starting_point.y() -= (frame_size_y() / 2);
|
m_starting_point.y() -= (frame_size_y() / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_last_pos = m_starting_point;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibPressureAdvancePattern::generate_gcodes(Model& model)
|
void CalibPressureAdvancePattern::generate_gcodes(Model& model)
|
||||||
@@ -405,6 +403,7 @@ void CalibPressureAdvancePattern::generate_gcodes(Model& model)
|
|||||||
|
|
||||||
gcode << "; start pressure advance pattern for layer\n";
|
gcode << "; start pressure advance pattern for layer\n";
|
||||||
|
|
||||||
|
refresh_pattern_config(model);
|
||||||
GCodeWriter writer = pattern_writer(model);
|
GCodeWriter writer = pattern_writer(model);
|
||||||
|
|
||||||
gcode << move_to(Vec2d(m_starting_point.x(), m_starting_point.y()), writer, "Move to start XY position");
|
gcode << move_to(Vec2d(m_starting_point.x(), m_starting_point.y()), writer, "Move to start XY position");
|
||||||
@@ -557,7 +556,7 @@ void CalibPressureAdvancePattern::generate_gcodes(Model& model)
|
|||||||
model.plates_custom_gcodes[model.curr_plate_index] = info;
|
model.plates_custom_gcodes[model.curr_plate_index] = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicPrintConfig CalibPressureAdvancePattern::pattern_config(const Model& model)
|
void CalibPressureAdvancePattern::refresh_pattern_config(const Model& model)
|
||||||
{
|
{
|
||||||
DynamicPrintConfig updated_config(m_initial_config);
|
DynamicPrintConfig updated_config(m_initial_config);
|
||||||
updated_config.apply(model.objects.front()->config.get(), true);
|
updated_config.apply(model.objects.front()->config.get(), true);
|
||||||
@@ -571,13 +570,13 @@ DynamicPrintConfig CalibPressureAdvancePattern::pattern_config(const Model& mode
|
|||||||
m_line_width = line_width();
|
m_line_width = line_width();
|
||||||
m_pattern_settings = PatternSettings(*this);
|
m_pattern_settings = PatternSettings(*this);
|
||||||
|
|
||||||
return updated_config;
|
m_config = updated_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
GCodeWriter CalibPressureAdvancePattern::pattern_writer(const Model& model)
|
GCodeWriter CalibPressureAdvancePattern::pattern_writer(const Model& model)
|
||||||
{
|
{
|
||||||
PrintConfig print_config;
|
PrintConfig print_config;
|
||||||
print_config.apply(pattern_config(model), true);
|
print_config.apply(m_config, true);
|
||||||
|
|
||||||
GCodeWriter writer;
|
GCodeWriter writer;
|
||||||
writer.apply_print_config(print_config);
|
writer.apply_print_config(print_config);
|
||||||
@@ -599,13 +598,11 @@ std::string CalibPressureAdvancePattern::draw_line(
|
|||||||
Model& model
|
Model& model
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const DynamicPrintConfig& config = pattern_config(model);
|
|
||||||
|
|
||||||
const double e_per_mm = CalibPressureAdvance::e_per_mm(
|
const double e_per_mm = CalibPressureAdvance::e_per_mm(
|
||||||
opt_args.line_width,
|
opt_args.line_width,
|
||||||
opt_args.height,
|
opt_args.height,
|
||||||
config.option<ConfigOptionFloats>("filament_diameter")->get_at(0),
|
m_config.option<ConfigOptionFloats>("filament_diameter")->get_at(0),
|
||||||
config.option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0)
|
m_config.option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0)
|
||||||
);
|
);
|
||||||
|
|
||||||
const double length = get_distance(Vec2d(m_last_pos.x(), m_last_pos.y()), to_pt);
|
const double length = get_distance(Vec2d(m_last_pos.x(), m_last_pos.y()), to_pt);
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ protected:
|
|||||||
int anchor_perimeters() const { return m_anchor_perimeters; };
|
int anchor_perimeters() const { return m_anchor_perimeters; };
|
||||||
double encroachment() const { return m_encroachment; };
|
double encroachment() const { return m_encroachment; };
|
||||||
private:
|
private:
|
||||||
DynamicPrintConfig pattern_config(const Model& model);
|
void refresh_pattern_config(const Model& model);
|
||||||
GCodeWriter pattern_writer(const Model& model); // travel_to and extrude_to require a non-const GCodeWriter
|
GCodeWriter pattern_writer(const Model& model); // travel_to and extrude_to require a non-const GCodeWriter
|
||||||
|
|
||||||
const int get_num_patterns() const
|
const int get_num_patterns() const
|
||||||
@@ -239,6 +239,7 @@ private:
|
|||||||
const bool& m_is_bbl_machine;
|
const bool& m_is_bbl_machine;
|
||||||
const Vec3d& m_origin;
|
const Vec3d& m_origin;
|
||||||
|
|
||||||
|
DynamicPrintConfig m_config;
|
||||||
bool m_is_delta;
|
bool m_is_delta;
|
||||||
Vec3d m_starting_point;
|
Vec3d m_starting_point;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user