fix:wrong origin point on G92 && scarf seam
Change-Id: Ifc2306f5e7756874b627d3a37d3c7dc78cd31712 jira:none
This commit is contained in:
parent
8214f92dc8
commit
d3167336df
|
@ -17,6 +17,8 @@ const std::string Extrusion_Role_Tag = " FEATURE: ";
|
||||||
const std::string Width_Tag = " LINE_WIDTH: ";
|
const std::string Width_Tag = " LINE_WIDTH: ";
|
||||||
const std::string Wipe_Start_Tag = " WIPE_START";
|
const std::string Wipe_Start_Tag = " WIPE_START";
|
||||||
const std::string Wipe_End_Tag = " WIPE_END";
|
const std::string Wipe_End_Tag = " WIPE_END";
|
||||||
|
const std::string Wipe_Tower_Start_Tag = " WIPE_TOWER_START";
|
||||||
|
const std::string Wipe_Tower_End_Tag = " WIPE_TOWER_END";
|
||||||
const std::string Layer_Change_Tag = " CHANGE_LAYER";
|
const std::string Layer_Change_Tag = " CHANGE_LAYER";
|
||||||
const std::string Height_Tag = " LAYER_HEIGHT: ";
|
const std::string Height_Tag = " LAYER_HEIGHT: ";
|
||||||
const std::string filament_flow_ratio_tag = " filament_flow_ratio";
|
const std::string filament_flow_ratio_tag = " filament_flow_ratio";
|
||||||
|
@ -131,6 +133,12 @@ GCodeCheckResult GCodeChecker::parse_comment(GCodeLine& line)
|
||||||
m_wiping = true;
|
m_wiping = true;
|
||||||
} else if (starts_with(comment, Wipe_End_Tag)) {
|
} else if (starts_with(comment, Wipe_End_Tag)) {
|
||||||
m_wiping = false;
|
m_wiping = false;
|
||||||
|
}
|
||||||
|
else if (starts_with(comment, Wipe_Tower_Start_Tag)) {
|
||||||
|
is_wipe_tower = true;
|
||||||
|
}
|
||||||
|
else if (starts_with(comment, Wipe_Tower_End_Tag)) {
|
||||||
|
is_wipe_tower = false;
|
||||||
} else if (starts_with(comment, Height_Tag)) {
|
} else if (starts_with(comment, Height_Tag)) {
|
||||||
std::string str = comment.substr(Height_Tag.size());
|
std::string str = comment.substr(Height_Tag.size());
|
||||||
if (!parse_double_from_str(str, m_height)) {
|
if (!parse_double_from_str(str, m_height)) {
|
||||||
|
@ -417,20 +425,31 @@ GCodeCheckResult GCodeChecker::parse_G92(GCodeLine& gcode_line)
|
||||||
return GCodeCheckResult::ParseFailed;
|
return GCodeCheckResult::ParseFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gcode_line.has(X))
|
bool any_found = false;
|
||||||
|
if (gcode_line.has(X)){
|
||||||
m_origin[X] = m_end_position[X] - gcode_line.get(X);
|
m_origin[X] = m_end_position[X] - gcode_line.get(X);
|
||||||
|
any_found = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (gcode_line.has(Y))
|
if (gcode_line.has(Y)){
|
||||||
m_origin[Y] = m_end_position[Y] - gcode_line.get(Y);
|
m_origin[Y] = m_end_position[Y] - gcode_line.get(Y);
|
||||||
|
any_found = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (gcode_line.has(Z))
|
if (gcode_line.has(Z)){
|
||||||
m_origin[Z] = m_end_position[Z] - gcode_line.get(Z);
|
m_origin[Z] = m_end_position[Z] - gcode_line.get(Z);
|
||||||
|
any_found = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (gcode_line.has(E))
|
if (gcode_line.has(E)){
|
||||||
m_end_position[E] = gcode_line.get(E);
|
m_end_position[E] = gcode_line.get(E);
|
||||||
|
any_found = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned char a = X; a <= E; ++a) {
|
if (!any_found) {
|
||||||
m_origin[a] = m_end_position[a];
|
for (unsigned char a = X; a <= E; ++a) {
|
||||||
|
m_origin[a] = m_end_position[a];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GCodeCheckResult::Success;
|
return GCodeCheckResult::Success;
|
||||||
|
@ -512,10 +531,10 @@ GCodeCheckResult GCodeChecker::parse_M1020(const GCodeLine& gcode_line)
|
||||||
return GCodeCheckResult::ParseFailed;
|
return GCodeCheckResult::ParseFailed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Missing 'S' character in the G-code line!" << std::endl;
|
std::cout << "Missing 'S' character in the G-code line!" << std::endl;
|
||||||
return GCodeCheckResult::ParseFailed;
|
return GCodeCheckResult::ParseFailed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,15 +662,19 @@ GCodeCheckResult GCodeChecker::check_G0_G1_width(const GCodeLine& line)
|
||||||
std::array<double, 3> target = { m_end_position[X], m_end_position[Y], m_end_position[Z] };
|
std::array<double, 3> target = { m_end_position[X], m_end_position[Y], m_end_position[Z] };
|
||||||
|
|
||||||
bool is_bridge = m_role == erOverhangPerimeter || m_role == erBridgeInfill;
|
bool is_bridge = m_role == erOverhangPerimeter || m_role == erBridgeInfill;
|
||||||
if (!is_bridge) {
|
if (!is_bridge && !is_wipe_tower) {
|
||||||
double real_height = m_height;
|
double real_height = m_height;
|
||||||
if (line.has(Z) && has_scarf_joint_seam && line.get(Z) != 0)
|
if (line.has(Z) && has_scarf_joint_seam && line.get(Z) != 0)
|
||||||
{
|
{
|
||||||
if (line.get(Z) == z_height)
|
if (line.get(Z) == z_height)
|
||||||
{
|
{
|
||||||
return GCodeCheckResult::Success;
|
return GCodeCheckResult::Success;
|
||||||
}
|
}
|
||||||
real_height = line.get(Z) - (z_height - m_height);
|
if (line.get(Z) && line.get(E))
|
||||||
|
{
|
||||||
|
return GCodeCheckResult::Success;
|
||||||
|
}
|
||||||
|
real_height = line.get(Z) - (z_height - m_height);
|
||||||
}
|
}
|
||||||
double width_real = calculate_G1_width(source, target, delta_pos[E], real_height, is_bridge);
|
double width_real = calculate_G1_width(source, target, delta_pos[E], real_height, is_bridge);
|
||||||
if (fabs(width_real - m_width) > WIDTH_THRESHOLD) {
|
if (fabs(width_real - m_width) > WIDTH_THRESHOLD) {
|
||||||
|
|
|
@ -219,6 +219,7 @@ private:
|
||||||
std::vector<double> nozzle_temperature;
|
std::vector<double> nozzle_temperature;
|
||||||
std::vector<double> nozzle_temperature_initial_layer;
|
std::vector<double> nozzle_temperature_initial_layer;
|
||||||
bool has_scarf_joint_seam = false;
|
bool has_scarf_joint_seam = false;
|
||||||
|
bool is_wipe_tower = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue