mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 01:37:53 -06:00
Time estimator: added placeholder to process gcode lines T
This commit is contained in:
parent
bf4871d7f8
commit
8e433c32bf
2 changed files with 44 additions and 0 deletions
|
@ -535,6 +535,21 @@ namespace Slic3r {
|
||||||
_state.g1_line_id = 0;
|
_state.g1_line_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeTimeEstimator::set_extruder_id(unsigned int id)
|
||||||
|
{
|
||||||
|
_state.extruder_id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int GCodeTimeEstimator::get_extruder_id() const
|
||||||
|
{
|
||||||
|
return _state.extruder_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeTimeEstimator::reset_extruder_id()
|
||||||
|
{
|
||||||
|
_state.extruder_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeTimeEstimator::add_additional_time(float timeSec)
|
void GCodeTimeEstimator::add_additional_time(float timeSec)
|
||||||
{
|
{
|
||||||
PROFILE_FUNC();
|
PROFILE_FUNC();
|
||||||
|
@ -613,6 +628,7 @@ namespace Slic3r {
|
||||||
|
|
||||||
set_additional_time(0.0f);
|
set_additional_time(0.0f);
|
||||||
|
|
||||||
|
reset_extruder_id();
|
||||||
reset_g1_line_id();
|
reset_g1_line_id();
|
||||||
_g1_line_ids.clear();
|
_g1_line_ids.clear();
|
||||||
|
|
||||||
|
@ -780,6 +796,11 @@ namespace Slic3r {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'T': // Select Tools
|
||||||
|
{
|
||||||
|
_processT(line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1223,6 +1244,21 @@ namespace Slic3r {
|
||||||
set_axis_max_jerk(E, line.e() * MMMIN_TO_MMSEC);
|
set_axis_max_jerk(E, line.e() * MMMIN_TO_MMSEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeTimeEstimator::_processT(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
std::string cmd = line.cmd();
|
||||||
|
if (cmd.length() > 1)
|
||||||
|
{
|
||||||
|
unsigned int id = (unsigned int)::strtol(cmd.substr(1).c_str(), nullptr, 10);
|
||||||
|
if (get_extruder_id() != id)
|
||||||
|
{
|
||||||
|
set_extruder_id(id);
|
||||||
|
|
||||||
|
// ADD PROCESSING HERE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeTimeEstimator::_simulate_st_synchronize()
|
void GCodeTimeEstimator::_simulate_st_synchronize()
|
||||||
{
|
{
|
||||||
PROFILE_FUNC();
|
PROFILE_FUNC();
|
||||||
|
|
|
@ -80,6 +80,7 @@ namespace Slic3r {
|
||||||
float minimum_travel_feedrate; // mm/s
|
float minimum_travel_feedrate; // mm/s
|
||||||
float extrude_factor_override_percentage;
|
float extrude_factor_override_percentage;
|
||||||
unsigned int g1_line_id;
|
unsigned int g1_line_id;
|
||||||
|
unsigned int extruder_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -300,6 +301,10 @@ namespace Slic3r {
|
||||||
void increment_g1_line_id();
|
void increment_g1_line_id();
|
||||||
void reset_g1_line_id();
|
void reset_g1_line_id();
|
||||||
|
|
||||||
|
void set_extruder_id(unsigned int id);
|
||||||
|
unsigned int get_extruder_id() const;
|
||||||
|
void reset_extruder_id();
|
||||||
|
|
||||||
void add_additional_time(float timeSec);
|
void add_additional_time(float timeSec);
|
||||||
void set_additional_time(float timeSec);
|
void set_additional_time(float timeSec);
|
||||||
float get_additional_time() const;
|
float get_additional_time() const;
|
||||||
|
@ -383,6 +388,9 @@ namespace Slic3r {
|
||||||
// Set allowable instantaneous speed change
|
// Set allowable instantaneous speed change
|
||||||
void _processM566(const GCodeReader::GCodeLine& line);
|
void _processM566(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Processes T line (Select Tool)
|
||||||
|
void _processT(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
// Simulates firmware st_synchronize() call
|
// Simulates firmware st_synchronize() call
|
||||||
void _simulate_st_synchronize();
|
void _simulate_st_synchronize();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue