NEW: add calibration

Change-Id: I03e5489a67042e7f76f5a42260a289d540b5a63a
(cherry picked from commit cbac2c639db830eb779b1979c8d6b4eb3decb7e6)
This commit is contained in:
liz.li 2023-04-23 09:04:55 +08:00 committed by Lane.Wei
parent ff3f78cfb5
commit 1f54aaf22b
35 changed files with 38647 additions and 54 deletions

View file

@ -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