GCodeProcessor - Added processing of gcode line M220
This commit is contained in:
parent
be6922795d
commit
1d0af50a94
@ -1196,6 +1196,7 @@ void GCodeProcessor::reset()
|
|||||||
m_line_id = 0;
|
m_line_id = 0;
|
||||||
m_last_line_id = 0;
|
m_last_line_id = 0;
|
||||||
m_feedrate = 0.0f;
|
m_feedrate = 0.0f;
|
||||||
|
m_feed_multiply.reset();
|
||||||
m_width = 0.0f;
|
m_width = 0.0f;
|
||||||
m_height = 0.0f;
|
m_height = 0.0f;
|
||||||
m_forced_width = 0.0f;
|
m_forced_width = 0.0f;
|
||||||
@ -1698,6 +1699,7 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line, bool
|
|||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
switch (cmd[3]) {
|
switch (cmd[3]) {
|
||||||
|
case '0': { process_M220(line); break; } // Set Feedrate Percentage
|
||||||
case '1': { process_M221(line); break; } // Set extrude factor override percentage
|
case '1': { process_M221(line); break; } // Set extrude factor override percentage
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@ -2498,7 +2500,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
|||||||
|
|
||||||
// updates feedrate from line, if present
|
// updates feedrate from line, if present
|
||||||
if (line.has_f())
|
if (line.has_f())
|
||||||
m_feedrate = line.f() * MMMIN_TO_MMSEC;
|
m_feedrate = m_feed_multiply.current * line.f() * MMMIN_TO_MMSEC;
|
||||||
|
|
||||||
// calculates movement deltas
|
// calculates movement deltas
|
||||||
float max_abs_delta = 0.0f;
|
float max_abs_delta = 0.0f;
|
||||||
@ -2863,7 +2865,7 @@ void GCodeProcessor::process_G61(const GCodeReader::GCodeLine& line)
|
|||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
if (line.has_f())
|
if (line.has_f())
|
||||||
m_feedrate = line.f();
|
m_feedrate = m_feed_multiply.current * line.f();
|
||||||
|
|
||||||
if (!modified)
|
if (!modified)
|
||||||
m_end_position = m_saved_position;
|
m_end_position = m_saved_position;
|
||||||
@ -3136,6 +3138,20 @@ void GCodeProcessor::process_M205(const GCodeReader::GCodeLine& line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_M220(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
if (m_flavor != gcfMarlinLegacy && m_flavor != gcfMarlinFirmware)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (line.has('B'))
|
||||||
|
m_feed_multiply.saved = m_feed_multiply.current;
|
||||||
|
float value;
|
||||||
|
if (line.has_value('S', value))
|
||||||
|
m_feed_multiply.current = value * 0.01f;
|
||||||
|
if (line.has('R'))
|
||||||
|
m_feed_multiply.current = m_feed_multiply.saved;
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeProcessor::process_M221(const GCodeReader::GCodeLine& line)
|
void GCodeProcessor::process_M221(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
float value_s;
|
float value_s;
|
||||||
|
@ -525,6 +525,17 @@ namespace Slic3r {
|
|||||||
unsigned int m_line_id;
|
unsigned int m_line_id;
|
||||||
unsigned int m_last_line_id;
|
unsigned int m_last_line_id;
|
||||||
float m_feedrate; // mm/s
|
float m_feedrate; // mm/s
|
||||||
|
struct FeedMultiply
|
||||||
|
{
|
||||||
|
float current; // percentage
|
||||||
|
float saved; // percentage
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
current = 1.0f;
|
||||||
|
saved = 1.0f;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FeedMultiply m_feed_multiply;
|
||||||
float m_width; // mm
|
float m_width; // mm
|
||||||
float m_height; // mm
|
float m_height; // mm
|
||||||
float m_forced_width; // mm
|
float m_forced_width; // mm
|
||||||
@ -719,6 +730,9 @@ namespace Slic3r {
|
|||||||
// Advanced settings
|
// Advanced settings
|
||||||
void process_M205(const GCodeReader::GCodeLine& line);
|
void process_M205(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Set Feedrate Percentage
|
||||||
|
void process_M220(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
// Set extrude factor override percentage
|
// Set extrude factor override percentage
|
||||||
void process_M221(const GCodeReader::GCodeLine& line);
|
void process_M221(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user