#3287 - Fixed GCodeAnalyzer and GCodeTimeEstimator when using Machinekit and Mach3/Linuxcnc gcode flavours

This commit is contained in:
Enrico Turri 2019-12-09 11:40:26 +01:00
parent 24bbad634a
commit 61ab9e37d6
5 changed files with 13 additions and 18 deletions

View file

@ -803,6 +803,7 @@ void GCode::_do_export(Print& print, FILE* file)
// resets time estimators
m_normal_time_estimator.reset();
m_normal_time_estimator.set_dialect(print.config().gcode_flavor);
m_normal_time_estimator.set_extrusion_axis(print.config().get_extrusion_axis()[0]);
m_silent_time_estimator_enabled = (print.config().gcode_flavor == gcfMarlin) && print.config().silent_mode;
// Until we have a UI support for the other firmwares than the Marlin, use the hardcoded default values
@ -832,6 +833,7 @@ void GCode::_do_export(Print& print, FILE* file)
{
m_silent_time_estimator.reset();
m_silent_time_estimator.set_dialect(print.config().gcode_flavor);
m_silent_time_estimator.set_extrusion_axis(print.config().get_extrusion_axis()[0]);
/* "Stealth mode" values can be just a copy of "normal mode" values
* (when they aren't input for a printer preset).
* Thus, use back value from values, instead of second one, which could be absent
@ -881,6 +883,9 @@ void GCode::_do_export(Print& print, FILE* file)
}
m_analyzer.set_extruder_offsets(extruder_offsets);
// tell analyzer about the extrusion axis
m_analyzer.set_extrusion_axis(print.config().get_extrusion_axis()[0]);
// send extruders count to analyzer to allow it to detect invalid extruder idxs
const ConfigOptionStrings* extruders_opt = dynamic_cast<const ConfigOptionStrings*>(print.config().option("extruder_colour"));
const ConfigOptionStrings* filamemts_opt = dynamic_cast<const ConfigOptionStrings*>(print.config().option("filament_colour"));

View file

@ -108,16 +108,6 @@ GCodeAnalyzer::GCodeMove::GCodeMove(GCodeMove::EType type, const GCodeAnalyzer::
{
}
GCodeAnalyzer::GCodeAnalyzer()
{
reset();
}
void GCodeAnalyzer::set_extruder_offsets(const GCodeAnalyzer::ExtruderOffsetsMap& extruder_offsets)
{
m_extruder_offsets = extruder_offsets;
}
void GCodeAnalyzer::set_extruders_count(unsigned int count)
{
m_extruders_count = count;
@ -125,11 +115,6 @@ void GCodeAnalyzer::set_extruders_count(unsigned int count)
m_extruder_color[i] = i;
}
void GCodeAnalyzer::set_gcode_flavor(const GCodeFlavor& flavor)
{
m_gcode_flavor = flavor;
}
void GCodeAnalyzer::reset()
{
_set_units(Millimeters);

View file

@ -123,12 +123,14 @@ private:
std::string m_process_output;
public:
GCodeAnalyzer();
GCodeAnalyzer() { reset(); }
void set_extruder_offsets(const ExtruderOffsetsMap& extruder_offsets);
void set_extruder_offsets(const ExtruderOffsetsMap& extruder_offsets) { m_extruder_offsets = extruder_offsets; }
void set_extruders_count(unsigned int count);
void set_gcode_flavor(const GCodeFlavor& flavor);
void set_extrusion_axis(char axis) { m_parser.set_extrusion_axis(axis); }
void set_gcode_flavor(const GCodeFlavor& flavor) { m_gcode_flavor = flavor; }
// Reinitialize the analyzer
void reset();

View file

@ -119,6 +119,7 @@ public:
float f() const { return m_position[F]; }
char extrusion_axis() const { return m_extrusion_axis; }
void set_extrusion_axis(char axis) { m_extrusion_axis = axis; }
private:
const char* parse_line_internal(const char *ptr, GCodeLine &gline, std::pair<const char*, const char*> &command);

View file

@ -342,6 +342,8 @@ namespace Slic3r {
void increment_g1_line_id();
void reset_g1_line_id();
void set_extrusion_axis(char axis) { m_parser.set_extrusion_axis(axis); }
void set_extruder_id(unsigned int id);
unsigned int get_extruder_id() const;
void reset_extruder_id();