mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-12 21:31:48 +08:00
#7843 - Added processing of gcode lines G60 and G61 for Marlin firmwares
This commit is contained in:
parent
383f6509a9
commit
0c0250750b
@ -1188,6 +1188,7 @@ void GCodeProcessor::reset()
|
|||||||
|
|
||||||
m_start_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
m_start_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
m_end_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
m_end_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
|
m_saved_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
m_origin = { 0.0f, 0.0f, 0.0f, 0.0f };
|
m_origin = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
m_cached_position.reset();
|
m_cached_position.reset();
|
||||||
m_wiping = false;
|
m_wiping = false;
|
||||||
@ -1616,6 +1617,13 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line, bool
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case '6':
|
||||||
|
switch (cmd[2]) {
|
||||||
|
case '0': { process_G60(line); break; } // Save Current Position
|
||||||
|
case '1': { process_G61(line); break; } // Return to Saved Position
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case '9':
|
case '9':
|
||||||
switch (cmd[2]) {
|
switch (cmd[2]) {
|
||||||
case '0': { process_G90(line); break; } // Set to Absolute Positioning
|
case '0': { process_G90(line); break; } // Set to Absolute Positioning
|
||||||
@ -2828,6 +2836,43 @@ void GCodeProcessor::process_G28(const GCodeReader::GCodeLine& line)
|
|||||||
process_G1(new_gline);
|
process_G1(new_gline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_G60(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
if (m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware)
|
||||||
|
m_saved_position = m_end_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_G61(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
if (m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware) {
|
||||||
|
bool modified = false;
|
||||||
|
if (line.has_x()) {
|
||||||
|
m_end_position[X] = m_saved_position[X];
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
if (line.has_y()) {
|
||||||
|
m_end_position[Y] = m_saved_position[Y];
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
if (line.has_z()) {
|
||||||
|
m_end_position[Z] = m_saved_position[Z];
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
if (line.has_e()) {
|
||||||
|
m_end_position[E] = m_saved_position[E];
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
if (line.has_f())
|
||||||
|
m_feedrate = line.f();
|
||||||
|
|
||||||
|
if (!modified)
|
||||||
|
m_end_position = m_saved_position;
|
||||||
|
|
||||||
|
|
||||||
|
store_move_vertex(EMoveType::Travel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeProcessor::process_G90(const GCodeReader::GCodeLine& line)
|
void GCodeProcessor::process_G90(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
m_global_positioning_type = EPositioningType::Absolute;
|
m_global_positioning_type = EPositioningType::Absolute;
|
||||||
|
@ -517,6 +517,7 @@ namespace Slic3r {
|
|||||||
|
|
||||||
AxisCoords m_start_position; // mm
|
AxisCoords m_start_position; // mm
|
||||||
AxisCoords m_end_position; // mm
|
AxisCoords m_end_position; // mm
|
||||||
|
AxisCoords m_saved_position; // mm
|
||||||
AxisCoords m_origin; // mm
|
AxisCoords m_origin; // mm
|
||||||
CachedPosition m_cached_position;
|
CachedPosition m_cached_position;
|
||||||
bool m_wiping;
|
bool m_wiping;
|
||||||
@ -661,6 +662,12 @@ namespace Slic3r {
|
|||||||
// Move to origin
|
// Move to origin
|
||||||
void process_G28(const GCodeReader::GCodeLine& line);
|
void process_G28(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Save Current Position
|
||||||
|
void process_G60(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Return to Saved Position
|
||||||
|
void process_G61(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
// Set to Absolute Positioning
|
// Set to Absolute Positioning
|
||||||
void process_G90(const GCodeReader::GCodeLine& line);
|
void process_G90(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user