Fully refresh config

This commit is contained in:
thewildmage
2023-07-16 08:53:26 -06:00
parent f75c4bea68
commit 30b33e9c06
3 changed files with 30 additions and 18 deletions

View File

@@ -344,18 +344,16 @@ void CalibPressureAdvanceLine::delta_modify_start(double& startx, double& starty
CalibPressureAdvancePattern::CalibPressureAdvancePattern( CalibPressureAdvancePattern::CalibPressureAdvancePattern(
const Calib_Params& params, const Calib_Params& params,
DynamicPrintConfig config, const DynamicPrintConfig& config,
const bool& is_bbl_machine, const bool& is_bbl_machine,
Model& model Model& model
) : ) :
CalibPressureAdvance(),
m_params(params), m_params(params),
m_initial_config(config),
m_is_bbl_machine(is_bbl_machine) m_is_bbl_machine(is_bbl_machine)
{ {
this->m_draw_digit_mode = DrawDigitMode::Bottom_To_Top; this->m_draw_digit_mode = DrawDigitMode::Bottom_To_Top;
refresh_pattern_setup(model); refresh_setup(config, model);
}; };
void CalibPressureAdvancePattern::set_starting_point(const Model& model) void CalibPressureAdvancePattern::set_starting_point(const Model& model)
@@ -378,12 +376,16 @@ void CalibPressureAdvancePattern::set_starting_point(const Model& model)
} }
} }
void CalibPressureAdvancePattern::generate_custom_gcodes(Model& model, const Vec3d& origin) void CalibPressureAdvancePattern::generate_custom_gcodes(
const DynamicPrintConfig& config,
Model& model,
const Vec3d& origin
)
{ {
std::stringstream gcode; std::stringstream gcode;
gcode << "; start pressure advance pattern for layer\n"; gcode << "; start pressure advance pattern for layer\n";
refresh_pattern_setup(model); refresh_setup(config, model);
GCodeWriter writer = pattern_writer(model, origin); GCodeWriter writer = pattern_writer(model, origin);
GCodeProcessor processor; GCodeProcessor processor;
processor.s_IsBBLPrinter = m_is_bbl_machine; processor.s_IsBBLPrinter = m_is_bbl_machine;
@@ -544,14 +546,16 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(Model& model, const Vec
model.plates_custom_gcodes[model.curr_plate_index] = info; model.plates_custom_gcodes[model.curr_plate_index] = info;
} }
void CalibPressureAdvancePattern::refresh_pattern_setup(const Model& model) void CalibPressureAdvancePattern::refresh_setup(
const DynamicPrintConfig& config,
const Model& model
)
{ {
DynamicPrintConfig updated_config(m_initial_config); m_config = config;
updated_config.apply(model.objects.front()->config.get(), true); m_config.apply(model.objects.front()->config.get(), true);
updated_config.apply(model.objects.front()->volumes.front()->config.get(), true); m_config.apply(model.objects.front()->volumes.front()->config.get(), true);
m_config = updated_config;
m_is_delta = (updated_config.option<ConfigOptionPoints>("printable_area")->values.size() > 4); m_is_delta = (m_config.option<ConfigOptionPoints>("printable_area")->values.size() > 4);
set_starting_point(model); set_starting_point(model);
} }

View File

@@ -140,7 +140,7 @@ friend struct DrawBoxOptArgs;
public: public:
CalibPressureAdvancePattern( CalibPressureAdvancePattern(
const Calib_Params& params, const Calib_Params& params,
DynamicPrintConfig config, const DynamicPrintConfig& config,
const bool& is_bbl_machine, const bool& is_bbl_machine,
Model& model Model& model
); );
@@ -152,7 +152,11 @@ public:
void set_starting_point(const Model& model); void set_starting_point(const Model& model);
void generate_custom_gcodes(Model& model, const Vec3d& origin); void generate_custom_gcodes(
const DynamicPrintConfig& config,
Model& model,
const Vec3d& origin
);
protected: protected:
double speed_first_layer() const { return m_config.option<ConfigOptionFloat>("initial_layer_speed")->value; }; double speed_first_layer() const { return m_config.option<ConfigOptionFloat>("initial_layer_speed")->value; };
@@ -190,7 +194,7 @@ private:
double speed; double speed;
}; };
void refresh_pattern_setup(const Model& model); void refresh_setup(const DynamicPrintConfig& config, const Model& model);
GCodeWriter pattern_writer( GCodeWriter pattern_writer(
const Model& model, const Model& model,
const Vec3d& origin const Vec3d& origin
@@ -244,10 +248,9 @@ private:
double print_size_y() const { return object_size_y(); }; double print_size_y() const { return object_size_y(); };
const Calib_Params& m_params; const Calib_Params& m_params;
const DynamicPrintConfig m_initial_config;
const bool& m_is_bbl_machine;
DynamicPrintConfig m_config; DynamicPrintConfig m_config;
const bool& m_is_bbl_machine;
bool m_is_delta; bool m_is_delta;
Vec3d m_starting_point; Vec3d m_starting_point;

View File

@@ -8185,7 +8185,11 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
); );
center_selection(); center_selection();
pa_pattern.generate_custom_gcodes(model(), get_partplate_list().get_current_plate_origin()); pa_pattern.generate_custom_gcodes(
full_config,
model(),
get_partplate_list().get_current_plate_origin()
);
model().calib_pa_pattern = std::make_unique<CalibPressureAdvancePattern>(pa_pattern); model().calib_pa_pattern = std::make_unique<CalibPressureAdvancePattern>(pa_pattern);
changed_objects({ 0 }); changed_objects({ 0 });
} }
@@ -10346,6 +10350,7 @@ void Plater::reslice()
// regenerate CalibPressureAdvancePattern custom G-code to apply changes // regenerate CalibPressureAdvancePattern custom G-code to apply changes
if (model().calib_pa_pattern) { if (model().calib_pa_pattern) {
model().calib_pa_pattern->generate_custom_gcodes( model().calib_pa_pattern->generate_custom_gcodes(
wxGetApp().preset_bundle->full_config(),
model(), model(),
get_partplate_list().get_current_plate_origin() get_partplate_list().get_current_plate_origin()
); );