mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
ENABLE_GCODE_VIEWER -> Integration of time estimator into GCodeProcessor
This commit is contained in:
parent
755fdb5ab4
commit
3a88e69896
9 changed files with 1631 additions and 704 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,9 +1,11 @@
|
||||||
#include "libslic3r/libslic3r.h"
|
#include "libslic3r/libslic3r.h"
|
||||||
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "GCodeProcessor.hpp"
|
#include "GCodeProcessor.hpp"
|
||||||
|
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
|
@ -14,20 +16,65 @@
|
||||||
static const float INCHES_TO_MM = 25.4f;
|
static const float INCHES_TO_MM = 25.4f;
|
||||||
static const float MMMIN_TO_MMSEC = 1.0f / 60.0f;
|
static const float MMMIN_TO_MMSEC = 1.0f / 60.0f;
|
||||||
|
|
||||||
static bool is_valid_extrusion_role(int value)
|
static const float DEFAULT_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2
|
||||||
{
|
|
||||||
return ((int)Slic3r::erNone <= value) && (value <= (int)Slic3r::erMixed);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
const std::string GCodeProcessor::Extrusion_Role_Tag = "_PROCESSOR_EXTRUSION_ROLE:";
|
const std::string GCodeProcessor::Extrusion_Role_Tag = "PrusaSlicer__EXTRUSION_ROLE:";
|
||||||
const std::string GCodeProcessor::Width_Tag = "_PROCESSOR_WIDTH:";
|
const std::string GCodeProcessor::Width_Tag = "PrusaSlicer__WIDTH:";
|
||||||
const std::string GCodeProcessor::Height_Tag = "_PROCESSOR_HEIGHT:";
|
const std::string GCodeProcessor::Height_Tag = "PrusaSlicer__HEIGHT:";
|
||||||
const std::string GCodeProcessor::Mm3_Per_Mm_Tag = "_PROCESSOR_MM3_PER_MM:";
|
const std::string GCodeProcessor::Mm3_Per_Mm_Tag = "PrusaSlicer__MM3_PER_MM:";
|
||||||
const std::string GCodeProcessor::Color_Change_Tag = "_PROCESSOR_COLOR_CHANGE";
|
const std::string GCodeProcessor::Color_Change_Tag = "PrusaSlicer__COLOR_CHANGE";
|
||||||
const std::string GCodeProcessor::Pause_Print_Tag = "_PROCESSOR_PAUSE_PRINT";
|
const std::string GCodeProcessor::Pause_Print_Tag = "PrusaSlicer__PAUSE_PRINT";
|
||||||
const std::string GCodeProcessor::Custom_Code_Tag = "_PROCESSOR_CUSTOM_CODE";
|
const std::string GCodeProcessor::Custom_Code_Tag = "PrusaSlicer__CUSTOM_CODE";
|
||||||
|
|
||||||
|
static bool is_valid_extrusion_role(int value)
|
||||||
|
{
|
||||||
|
return (static_cast<int>(erNone) <= value) && (value <= static_cast<int>(erMixed));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_option_value(ConfigOptionFloats& option, size_t id, float value)
|
||||||
|
{
|
||||||
|
if (id < option.values.size())
|
||||||
|
option.values[id] = static_cast<double>(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
static float get_option_value(const ConfigOptionFloats& option, size_t id)
|
||||||
|
{
|
||||||
|
return option.values.empty() ? 0.0f :
|
||||||
|
((id < option.values.size()) ? static_cast<float>(option.values[id]) : static_cast<float>(option.values.back()));
|
||||||
|
}
|
||||||
|
|
||||||
|
static float estimated_acceleration_distance(float initial_rate, float target_rate, float acceleration)
|
||||||
|
{
|
||||||
|
return (acceleration == 0.0f) ? 0.0f : (sqr(target_rate) - sqr(initial_rate)) / (2.0f * acceleration);
|
||||||
|
}
|
||||||
|
|
||||||
|
static float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance)
|
||||||
|
{
|
||||||
|
return (acceleration == 0.0f) ? 0.0f : (2.0f * acceleration * distance - sqr(initial_rate) + sqr(final_rate)) / (4.0f * acceleration);
|
||||||
|
}
|
||||||
|
|
||||||
|
static float speed_from_distance(float initial_feedrate, float distance, float acceleration)
|
||||||
|
{
|
||||||
|
// to avoid invalid negative numbers due to numerical errors
|
||||||
|
float value = std::max(0.0f, sqr(initial_feedrate) + 2.0f * acceleration * distance);
|
||||||
|
return ::sqrt(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the
|
||||||
|
// acceleration within the allotted distance.
|
||||||
|
static float max_allowable_speed(float acceleration, float target_velocity, float distance)
|
||||||
|
{
|
||||||
|
// to avoid invalid negative numbers due to numerical errors
|
||||||
|
float value = std::max(0.0f, sqr(target_velocity) - 2.0f * acceleration * distance);
|
||||||
|
return std::sqrt(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static float acceleration_time_from_distance(float initial_feedrate, float distance, float acceleration)
|
||||||
|
{
|
||||||
|
return (acceleration != 0.0f) ? (speed_from_distance(initial_feedrate, distance, acceleration) - initial_feedrate) / acceleration : 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeProcessor::CachedPosition::reset()
|
void GCodeProcessor::CachedPosition::reset()
|
||||||
{
|
{
|
||||||
|
@ -41,6 +88,208 @@ void GCodeProcessor::CpColor::reset()
|
||||||
current = 0;
|
current = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::Trapezoid::acceleration_time(float entry_feedrate, float acceleration) const
|
||||||
|
{
|
||||||
|
return acceleration_time_from_distance(entry_feedrate, accelerate_until, acceleration);
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::Trapezoid::cruise_time() const
|
||||||
|
{
|
||||||
|
return (cruise_feedrate != 0.0f) ? cruise_distance() / cruise_feedrate : 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::Trapezoid::deceleration_time(float distance, float acceleration) const
|
||||||
|
{
|
||||||
|
return acceleration_time_from_distance(cruise_feedrate, (distance - decelerate_after), -acceleration);
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::Trapezoid::cruise_distance() const
|
||||||
|
{
|
||||||
|
return decelerate_after - accelerate_until;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::TimeBlock::calculate_trapezoid()
|
||||||
|
{
|
||||||
|
trapezoid.cruise_feedrate = feedrate_profile.cruise;
|
||||||
|
|
||||||
|
float accelerate_distance = std::max(0.0f, estimated_acceleration_distance(feedrate_profile.entry, feedrate_profile.cruise, acceleration));
|
||||||
|
float decelerate_distance = std::max(0.0f, estimated_acceleration_distance(feedrate_profile.cruise, feedrate_profile.exit, -acceleration));
|
||||||
|
float cruise_distance = distance - accelerate_distance - decelerate_distance;
|
||||||
|
|
||||||
|
// Not enough space to reach the nominal feedrate.
|
||||||
|
// This means no cruising, and we'll have to use intersection_distance() to calculate when to abort acceleration
|
||||||
|
// and start braking in order to reach the exit_feedrate exactly at the end of this block.
|
||||||
|
if (cruise_distance < 0.0f) {
|
||||||
|
accelerate_distance = std::clamp(intersection_distance(feedrate_profile.entry, feedrate_profile.exit, acceleration, distance), 0.0f, distance);
|
||||||
|
cruise_distance = 0.0f;
|
||||||
|
trapezoid.cruise_feedrate = speed_from_distance(feedrate_profile.entry, accelerate_distance, acceleration);
|
||||||
|
}
|
||||||
|
|
||||||
|
trapezoid.accelerate_until = accelerate_distance;
|
||||||
|
trapezoid.decelerate_after = accelerate_distance + cruise_distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::TimeBlock::time() const
|
||||||
|
{
|
||||||
|
return trapezoid.acceleration_time(feedrate_profile.entry, acceleration)
|
||||||
|
+ trapezoid.cruise_time()
|
||||||
|
+ trapezoid.deceleration_time(distance, acceleration);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::TimeMachine::State::reset()
|
||||||
|
{
|
||||||
|
feedrate = 0.0f;
|
||||||
|
safe_feedrate = 0.0f;
|
||||||
|
axis_feedrate = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
|
abs_axis_feedrate = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::TimeMachine::CustomGCodeTime::reset()
|
||||||
|
{
|
||||||
|
needed = false;
|
||||||
|
cache = 0.0f;
|
||||||
|
times = std::vector<std::pair<CustomGCode::Type, float>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::TimeMachine::reset()
|
||||||
|
{
|
||||||
|
enabled = false;
|
||||||
|
acceleration = 0.0f;
|
||||||
|
extrude_factor_override_percentage = 1.0f;
|
||||||
|
time = 0.0f;
|
||||||
|
curr.reset();
|
||||||
|
prev.reset();
|
||||||
|
gcode_time.reset();
|
||||||
|
blocks = std::vector<TimeBlock>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::TimeMachine::simulate_st_synchronize(float additional_time)
|
||||||
|
{
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
time += additional_time;
|
||||||
|
gcode_time.cache += additional_time;
|
||||||
|
calculate_time();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void planner_forward_pass_kernel(GCodeProcessor::TimeBlock& prev, GCodeProcessor::TimeBlock& curr)
|
||||||
|
{
|
||||||
|
// If the previous block is an acceleration block, but it is not long enough to complete the
|
||||||
|
// full speed change within the block, we need to adjust the entry speed accordingly. Entry
|
||||||
|
// speeds have already been reset, maximized, and reverse planned by reverse planner.
|
||||||
|
// If nominal length is true, max junction speed is guaranteed to be reached. No need to recheck.
|
||||||
|
if (!prev.flags.nominal_length) {
|
||||||
|
if (prev.feedrate_profile.entry < curr.feedrate_profile.entry) {
|
||||||
|
float entry_speed = std::min(curr.feedrate_profile.entry, max_allowable_speed(-prev.acceleration, prev.feedrate_profile.entry, prev.distance));
|
||||||
|
|
||||||
|
// Check for junction speed change
|
||||||
|
if (curr.feedrate_profile.entry != entry_speed) {
|
||||||
|
curr.feedrate_profile.entry = entry_speed;
|
||||||
|
curr.flags.recalculate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void planner_reverse_pass_kernel(GCodeProcessor::TimeBlock& curr, GCodeProcessor::TimeBlock& next)
|
||||||
|
{
|
||||||
|
// If entry speed is already at the maximum entry speed, no need to recheck. Block is cruising.
|
||||||
|
// If not, block in state of acceleration or deceleration. Reset entry speed to maximum and
|
||||||
|
// check for maximum allowable speed reductions to ensure maximum possible planned speed.
|
||||||
|
if (curr.feedrate_profile.entry != curr.max_entry_speed) {
|
||||||
|
// If nominal length true, max junction speed is guaranteed to be reached. Only compute
|
||||||
|
// for max allowable speed if block is decelerating and nominal length is false.
|
||||||
|
if (!curr.flags.nominal_length && curr.max_entry_speed > next.feedrate_profile.entry)
|
||||||
|
curr.feedrate_profile.entry = std::min(curr.max_entry_speed, max_allowable_speed(-curr.acceleration, next.feedrate_profile.entry, curr.distance));
|
||||||
|
else
|
||||||
|
curr.feedrate_profile.entry = curr.max_entry_speed;
|
||||||
|
|
||||||
|
curr.flags.recalculate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void recalculate_trapezoids(std::vector<GCodeProcessor::TimeBlock>& blocks)
|
||||||
|
{
|
||||||
|
GCodeProcessor::TimeBlock* curr = nullptr;
|
||||||
|
GCodeProcessor::TimeBlock* next = nullptr;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < blocks.size(); ++i) {
|
||||||
|
GCodeProcessor::TimeBlock& b = blocks[i];
|
||||||
|
|
||||||
|
curr = next;
|
||||||
|
next = &b;
|
||||||
|
|
||||||
|
if (curr != nullptr) {
|
||||||
|
// Recalculate if current block entry or exit junction speed has changed.
|
||||||
|
if (curr->flags.recalculate || next->flags.recalculate) {
|
||||||
|
// NOTE: Entry and exit factors always > 0 by all previous logic operations.
|
||||||
|
GCodeProcessor::TimeBlock block = *curr;
|
||||||
|
block.feedrate_profile.exit = next->feedrate_profile.entry;
|
||||||
|
block.calculate_trapezoid();
|
||||||
|
curr->trapezoid = block.trapezoid;
|
||||||
|
curr->flags.recalculate = false; // Reset current only to ensure next trapezoid is computed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Last/newest block in buffer. Always recalculated.
|
||||||
|
if (next != nullptr) {
|
||||||
|
GCodeProcessor::TimeBlock block = *next;
|
||||||
|
block.feedrate_profile.exit = next->safe_feedrate;
|
||||||
|
block.calculate_trapezoid();
|
||||||
|
next->trapezoid = block.trapezoid;
|
||||||
|
next->flags.recalculate = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::TimeMachine::calculate_time(size_t keep_last_n_blocks)
|
||||||
|
{
|
||||||
|
if (!enabled || blocks.size() < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
assert(keep_last_n_blocks <= blocks.size());
|
||||||
|
|
||||||
|
// forward_pass
|
||||||
|
for (size_t i = 0; i + 1 < blocks.size(); ++i) {
|
||||||
|
planner_forward_pass_kernel(blocks[i], blocks[i + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// reverse_pass
|
||||||
|
for (int i = static_cast<int>(blocks.size()) - 1; i > 0; --i)
|
||||||
|
planner_reverse_pass_kernel(blocks[i - 1], blocks[i]);
|
||||||
|
|
||||||
|
recalculate_trapezoids(blocks);
|
||||||
|
|
||||||
|
size_t n_blocks_process = blocks.size() - keep_last_n_blocks;
|
||||||
|
// m_g1_times.reserve(m_g1_times.size() + n_blocks_process);
|
||||||
|
for (size_t i = 0; i < n_blocks_process; ++i) {
|
||||||
|
float block_time = blocks[i].time();
|
||||||
|
time += block_time;
|
||||||
|
gcode_time.cache += block_time;
|
||||||
|
|
||||||
|
// if (block.g1_line_id >= 0)
|
||||||
|
// m_g1_times.emplace_back(block.g1_line_id, time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keep_last_n_blocks)
|
||||||
|
blocks.erase(blocks.begin(), blocks.begin() + n_blocks_process);
|
||||||
|
else
|
||||||
|
blocks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::TimeProcessor::reset()
|
||||||
|
{
|
||||||
|
extruder_unloaded = true;
|
||||||
|
machine_limits = MachineEnvelopeConfig();
|
||||||
|
filament_load_times = std::vector<float>();
|
||||||
|
filament_unload_times = std::vector<float>();
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
machines[i].reset();
|
||||||
|
}
|
||||||
|
machines[static_cast<size_t>(ETimeMode::Normal)].enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int GCodeProcessor::s_result_id = 0;
|
unsigned int GCodeProcessor::s_result_id = 0;
|
||||||
|
|
||||||
void GCodeProcessor::apply_config(const PrintConfig& config)
|
void GCodeProcessor::apply_config(const PrintConfig& config)
|
||||||
|
@ -61,6 +310,28 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
||||||
for (size_t id = 0; id < extruders_count; ++id) {
|
for (size_t id = 0; id < extruders_count; ++id) {
|
||||||
m_extruders_color[id] = static_cast<unsigned int>(id);
|
m_extruders_color[id] = static_cast<unsigned int>(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_time_processor.machine_limits = reinterpret_cast<const MachineEnvelopeConfig&>(config);
|
||||||
|
// Filament load / unload times are not specific to a firmware flavor. Let anybody use it if they find it useful.
|
||||||
|
// As of now the fields are shown at the UI dialog in the same combo box as the ramming values, so they
|
||||||
|
// are considered to be active for the single extruder multi-material printers only.
|
||||||
|
m_time_processor.filament_load_times.clear();
|
||||||
|
for (double d : config.filament_load_time.values) {
|
||||||
|
m_time_processor.filament_load_times.push_back(static_cast<float>(d));
|
||||||
|
}
|
||||||
|
m_time_processor.filament_unload_times.clear();
|
||||||
|
for (double d : config.filament_unload_time.values) {
|
||||||
|
m_time_processor.filament_unload_times.push_back(static_cast<float>(d));
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
float max_acceleration = get_option_value(m_time_processor.machine_limits.machine_max_acceleration_extruding, i);
|
||||||
|
m_time_processor.machines[i].acceleration = (max_acceleration > 0.0f) ? max_acceleration : DEFAULT_ACCELERATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::enable_stealth_time_estimator(bool enabled)
|
||||||
|
{
|
||||||
|
m_time_processor.machines[static_cast<size_t>(ETimeMode::Stealth)].enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeProcessor::reset()
|
void GCodeProcessor::reset()
|
||||||
|
@ -71,9 +342,9 @@ void GCodeProcessor::reset()
|
||||||
m_extruder_offsets = std::vector<Vec3f>(1, Vec3f::Zero());
|
m_extruder_offsets = std::vector<Vec3f>(1, Vec3f::Zero());
|
||||||
m_flavor = gcfRepRap;
|
m_flavor = gcfRepRap;
|
||||||
|
|
||||||
std::fill(m_start_position.begin(), m_start_position.end(), 0.0f);
|
m_start_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
std::fill(m_end_position.begin(), m_end_position.end(), 0.0f);
|
m_end_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
std::fill(m_origin.begin(), m_origin.end(), 0.0f);
|
m_origin = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
m_cached_position.reset();
|
m_cached_position.reset();
|
||||||
|
|
||||||
m_feedrate = 0.0f;
|
m_feedrate = 0.0f;
|
||||||
|
@ -87,6 +358,8 @@ void GCodeProcessor::reset()
|
||||||
m_extruders_color = ExtrudersColor();
|
m_extruders_color = ExtrudersColor();
|
||||||
m_cp_color.reset();
|
m_cp_color.reset();
|
||||||
|
|
||||||
|
m_time_processor.reset();
|
||||||
|
|
||||||
m_result.reset();
|
m_result.reset();
|
||||||
m_result.id = ++s_result_id;
|
m_result.id = ++s_result_id;
|
||||||
}
|
}
|
||||||
|
@ -101,11 +374,43 @@ void GCodeProcessor::process_file(const std::string& filename)
|
||||||
m_result.moves.emplace_back(MoveVertex());
|
m_result.moves.emplace_back(MoveVertex());
|
||||||
m_parser.parse_file(filename, [this](GCodeReader& reader, const GCodeReader::GCodeLine& line) { process_gcode_line(line); });
|
m_parser.parse_file(filename, [this](GCodeReader& reader, const GCodeReader::GCodeLine& line) { process_gcode_line(line); });
|
||||||
|
|
||||||
|
// process the remaining time blocks
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
TimeMachine& machine = m_time_processor.machines[i];
|
||||||
|
TimeMachine::CustomGCodeTime& gcode_time = machine.gcode_time;
|
||||||
|
machine.calculate_time();
|
||||||
|
if (gcode_time.needed && gcode_time.cache != 0.0f)
|
||||||
|
gcode_time.times.push_back({ CustomGCode::ColorChange, gcode_time.cache });
|
||||||
|
}
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
m_result.time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start_time).count();
|
m_result.time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start_time).count();
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GCodeProcessor::get_time_dhm(ETimeMode mode) const
|
||||||
|
{
|
||||||
|
std::string ret = "N/A";
|
||||||
|
if (mode < ETimeMode::Count)
|
||||||
|
ret = short_time(get_time_dhms(m_time_processor.machines[static_cast<size_t>(mode)].time));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> GCodeProcessor::get_custom_gcode_times(ETimeMode mode, bool include_remaining) const
|
||||||
|
{
|
||||||
|
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> ret;
|
||||||
|
if (mode < ETimeMode::Count) {
|
||||||
|
const TimeMachine& machine = m_time_processor.machines[static_cast<size_t>(mode)];
|
||||||
|
float total_time = 0.0f;
|
||||||
|
for (const auto& [type, time] : machine.gcode_time.times) {
|
||||||
|
float remaining = include_remaining ? machine.time - total_time : 0.0f;
|
||||||
|
ret.push_back({ type, { time, remaining } });
|
||||||
|
total_time += time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line)
|
void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
/* std::cout << line.raw() << std::endl; */
|
/* std::cout << line.raw() << std::endl; */
|
||||||
|
@ -126,6 +431,8 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line)
|
||||||
case 1: { process_G1(line); break; } // Move
|
case 1: { process_G1(line); break; } // Move
|
||||||
case 10: { process_G10(line); break; } // Retract
|
case 10: { process_G10(line); break; } // Retract
|
||||||
case 11: { process_G11(line); break; } // Unretract
|
case 11: { process_G11(line); break; } // Unretract
|
||||||
|
case 20: { process_G20(line); break; } // Set Units to Inches
|
||||||
|
case 21: { process_G21(line); break; } // Set Units to Millimeters
|
||||||
case 22: { process_G22(line); break; } // Firmware controlled retract
|
case 22: { process_G22(line); break; } // Firmware controlled retract
|
||||||
case 23: { process_G23(line); break; } // Firmware controlled unretract
|
case 23: { process_G23(line); break; } // Firmware controlled unretract
|
||||||
case 90: { process_G90(line); break; } // Set to Absolute Positioning
|
case 90: { process_G90(line); break; } // Set to Absolute Positioning
|
||||||
|
@ -139,6 +446,7 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
switch (::atoi(&cmd[1]))
|
switch (::atoi(&cmd[1]))
|
||||||
{
|
{
|
||||||
|
case 1: { process_M1(line); break; } // Sleep or Conditional stop
|
||||||
case 82: { process_M82(line); break; } // Set extruder to absolute mode
|
case 82: { process_M82(line); break; } // Set extruder to absolute mode
|
||||||
case 83: { process_M83(line); break; } // Set extruder to relative mode
|
case 83: { process_M83(line); break; } // Set extruder to relative mode
|
||||||
case 106: { process_M106(line); break; } // Set fan speed
|
case 106: { process_M106(line); break; } // Set fan speed
|
||||||
|
@ -146,8 +454,15 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line)
|
||||||
case 108: { process_M108(line); break; } // Set tool (Sailfish)
|
case 108: { process_M108(line); break; } // Set tool (Sailfish)
|
||||||
case 132: { process_M132(line); break; } // Recall stored home offsets
|
case 132: { process_M132(line); break; } // Recall stored home offsets
|
||||||
case 135: { process_M135(line); break; } // Set tool (MakerWare)
|
case 135: { process_M135(line); break; } // Set tool (MakerWare)
|
||||||
|
case 201: { process_M201(line); break; } // Set max printing acceleration
|
||||||
|
case 203: { process_M203(line); break; } // Set maximum feedrate
|
||||||
|
case 204: { process_M204(line); break; } // Set default acceleration
|
||||||
|
case 205: { process_M205(line); break; } // Advanced settings
|
||||||
|
case 221: { process_M221(line); break; } // Set extrude factor override percentage
|
||||||
case 401: { process_M401(line); break; } // Repetier: Store x, y and z position
|
case 401: { process_M401(line); break; } // Repetier: Store x, y and z position
|
||||||
case 402: { process_M402(line); break; } // Repetier: Go to stored position
|
case 402: { process_M402(line); break; } // Repetier: Go to stored position
|
||||||
|
case 566: { process_M566(line); break; } // Set allowable instantaneous speed change
|
||||||
|
case 702: { process_M702(line); break; } // Unload the current filament into the MK3 MMU2 unit at the end of print.
|
||||||
default: { break; }
|
default: { break; }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -160,8 +475,7 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line)
|
||||||
default: { break; }
|
default: { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
std::string comment = line.comment();
|
std::string comment = line.comment();
|
||||||
if (comment.length() > 1)
|
if (comment.length() > 1)
|
||||||
// process tags embedded into comments
|
// process tags embedded into comments
|
||||||
|
@ -179,8 +493,7 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
||||||
int role = std::stoi(comment.substr(pos + Extrusion_Role_Tag.length()));
|
int role = std::stoi(comment.substr(pos + Extrusion_Role_Tag.length()));
|
||||||
if (is_valid_extrusion_role(role))
|
if (is_valid_extrusion_role(role))
|
||||||
m_extrusion_role = static_cast<ExtrusionRole>(role);
|
m_extrusion_role = static_cast<ExtrusionRole>(role);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// todo: show some error ?
|
// todo: show some error ?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,11 +560,12 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
||||||
if (m_cp_color.counter == UCHAR_MAX)
|
if (m_cp_color.counter == UCHAR_MAX)
|
||||||
m_cp_color.counter = 0;
|
m_cp_color.counter = 0;
|
||||||
|
|
||||||
if (m_extruder_id == extruder_id)
|
if (m_extruder_id == extruder_id) {
|
||||||
{
|
|
||||||
m_cp_color.current = m_extruders_color[extruder_id];
|
m_cp_color.current = m_extruders_color[extruder_id];
|
||||||
store_move_vertex(EMoveType::Color_change);
|
store_move_vertex(EMoveType::Color_change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process_custom_gcode_time(CustomGCode::ColorChange);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
@ -265,6 +579,7 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
||||||
pos = comment.find(Pause_Print_Tag);
|
pos = comment.find(Pause_Print_Tag);
|
||||||
if (pos != comment.npos) {
|
if (pos != comment.npos) {
|
||||||
store_move_vertex(EMoveType::Pause_Print);
|
store_move_vertex(EMoveType::Pause_Print);
|
||||||
|
process_custom_gcode_time(CustomGCode::PausePrint);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,12 +621,14 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
||||||
type = EMoveType::Travel;
|
type = EMoveType::Travel;
|
||||||
else
|
else
|
||||||
type = EMoveType::Retract;
|
type = EMoveType::Retract;
|
||||||
} else if (delta_pos[E] > 0.0f) {
|
}
|
||||||
|
else if (delta_pos[E] > 0.0f) {
|
||||||
if (delta_pos[X] == 0.0f && delta_pos[Y] == 0.0f && delta_pos[Z] == 0.0f)
|
if (delta_pos[X] == 0.0f && delta_pos[Y] == 0.0f && delta_pos[Z] == 0.0f)
|
||||||
type = EMoveType::Unretract;
|
type = EMoveType::Unretract;
|
||||||
else if ((delta_pos[X] != 0.0f) || (delta_pos[Y] != 0.0f))
|
else if ((delta_pos[X] != 0.0f) || (delta_pos[Y] != 0.0f))
|
||||||
type = EMoveType::Extrude;
|
type = EMoveType::Extrude;
|
||||||
} else if (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f || delta_pos[Z] != 0.0f)
|
}
|
||||||
|
else if (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f || delta_pos[Z] != 0.0f)
|
||||||
type = EMoveType::Travel;
|
type = EMoveType::Travel;
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_AS_STATE
|
#if ENABLE_GCODE_VIEWER_AS_STATE
|
||||||
|
@ -351,7 +668,165 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
||||||
if (max_abs_delta == 0.0f)
|
if (max_abs_delta == 0.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// store g1 move
|
// time estimate section
|
||||||
|
auto move_length = [](const AxisCoords& delta_pos) {
|
||||||
|
float sq_xyz_length = sqr(delta_pos[X]) + sqr(delta_pos[Y]) + sqr(delta_pos[Z]);
|
||||||
|
return (sq_xyz_length > 0.0f) ? std::sqrt(sq_xyz_length) : std::abs(delta_pos[E]);
|
||||||
|
};
|
||||||
|
|
||||||
|
auto is_extruder_only_move = [](const AxisCoords& delta_pos) {
|
||||||
|
return (delta_pos[X] == 0.0f) && (delta_pos[Y] == 0.0f) && (delta_pos[Z] == 0.0f) && (delta_pos[E] != 0.0f);
|
||||||
|
};
|
||||||
|
|
||||||
|
float distance = move_length(delta_pos);
|
||||||
|
assert(distance != 0.0f);
|
||||||
|
float inv_distance = 1.0f / distance;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
TimeMachine& machine = m_time_processor.machines[i];
|
||||||
|
if (!machine.enabled)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
TimeMachine::State& curr = machine.curr;
|
||||||
|
TimeMachine::State& prev = machine.prev;
|
||||||
|
std::vector<TimeBlock>& blocks = machine.blocks;
|
||||||
|
|
||||||
|
curr.feedrate = (delta_pos[E] == 0.0f) ?
|
||||||
|
minimum_travel_feedrate(static_cast<ETimeMode>(i), m_feedrate) :
|
||||||
|
minimum_feedrate(static_cast<ETimeMode>(i), m_feedrate);
|
||||||
|
|
||||||
|
TimeBlock block;
|
||||||
|
block.distance = distance;
|
||||||
|
|
||||||
|
// calculates block cruise feedrate
|
||||||
|
float min_feedrate_factor = 1.0f;
|
||||||
|
for (unsigned char a = X; a <= E; ++a) {
|
||||||
|
curr.axis_feedrate[a] = curr.feedrate * delta_pos[a] * inv_distance;
|
||||||
|
if (a == E)
|
||||||
|
curr.axis_feedrate[a] *= machine.extrude_factor_override_percentage;
|
||||||
|
|
||||||
|
curr.abs_axis_feedrate[a] = std::abs(curr.axis_feedrate[a]);
|
||||||
|
if (curr.abs_axis_feedrate[a] != 0.0f) {
|
||||||
|
float axis_max_feedrate = get_axis_max_feedrate(static_cast<ETimeMode>(i), static_cast<Axis>(a));
|
||||||
|
if (axis_max_feedrate != 0.0f)
|
||||||
|
min_feedrate_factor = std::min(min_feedrate_factor, axis_max_feedrate / curr.abs_axis_feedrate[a]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
block.feedrate_profile.cruise = min_feedrate_factor * curr.feedrate;
|
||||||
|
|
||||||
|
if (min_feedrate_factor < 1.0f) {
|
||||||
|
for (unsigned char a = X; a <= E; ++a) {
|
||||||
|
curr.axis_feedrate[a] *= min_feedrate_factor;
|
||||||
|
curr.abs_axis_feedrate[a] *= min_feedrate_factor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculates block acceleration
|
||||||
|
float acceleration = is_extruder_only_move(delta_pos) ?
|
||||||
|
get_retract_acceleration(static_cast<ETimeMode>(i)) :
|
||||||
|
get_acceleration(static_cast<ETimeMode>(i));
|
||||||
|
|
||||||
|
for (unsigned char a = X; a <= E; ++a) {
|
||||||
|
float axis_max_acceleration = get_axis_max_acceleration(static_cast<ETimeMode>(i), static_cast<Axis>(a));
|
||||||
|
if (acceleration * std::abs(delta_pos[a]) * inv_distance > axis_max_acceleration)
|
||||||
|
acceleration = axis_max_acceleration;
|
||||||
|
}
|
||||||
|
|
||||||
|
block.acceleration = acceleration;
|
||||||
|
|
||||||
|
// calculates block exit feedrate
|
||||||
|
curr.safe_feedrate = block.feedrate_profile.cruise;
|
||||||
|
|
||||||
|
for (unsigned char a = X; a <= E; ++a) {
|
||||||
|
float axis_max_jerk = get_axis_max_jerk(static_cast<ETimeMode>(i), static_cast<Axis>(a));
|
||||||
|
if (curr.abs_axis_feedrate[a] > axis_max_jerk)
|
||||||
|
curr.safe_feedrate = std::min(curr.safe_feedrate, axis_max_jerk);
|
||||||
|
}
|
||||||
|
|
||||||
|
block.feedrate_profile.exit = curr.safe_feedrate;
|
||||||
|
|
||||||
|
static const float PREVIOUS_FEEDRATE_THRESHOLD = 0.0001f;
|
||||||
|
|
||||||
|
// calculates block entry feedrate
|
||||||
|
float vmax_junction = curr.safe_feedrate;
|
||||||
|
if (!blocks.empty() && prev.feedrate > PREVIOUS_FEEDRATE_THRESHOLD) {
|
||||||
|
bool prev_speed_larger = prev.feedrate > block.feedrate_profile.cruise;
|
||||||
|
float smaller_speed_factor = prev_speed_larger ? (block.feedrate_profile.cruise / prev.feedrate) : (prev.feedrate / block.feedrate_profile.cruise);
|
||||||
|
// Pick the smaller of the nominal speeds. Higher speed shall not be achieved at the junction during coasting.
|
||||||
|
vmax_junction = prev_speed_larger ? block.feedrate_profile.cruise : prev.feedrate;
|
||||||
|
|
||||||
|
float v_factor = 1.0f;
|
||||||
|
bool limited = false;
|
||||||
|
|
||||||
|
for (unsigned char a = X; a <= E; ++a) {
|
||||||
|
// Limit an axis. We have to differentiate coasting from the reversal of an axis movement, or a full stop.
|
||||||
|
float v_exit = prev.axis_feedrate[a];
|
||||||
|
float v_entry = curr.axis_feedrate[a];
|
||||||
|
|
||||||
|
if (prev_speed_larger)
|
||||||
|
v_exit *= smaller_speed_factor;
|
||||||
|
|
||||||
|
if (limited) {
|
||||||
|
v_exit *= v_factor;
|
||||||
|
v_entry *= v_factor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the jerk depending on whether the axis is coasting in the same direction or reversing a direction.
|
||||||
|
float jerk =
|
||||||
|
(v_exit > v_entry) ?
|
||||||
|
(((v_entry > 0.0f) || (v_exit < 0.0f)) ?
|
||||||
|
// coasting
|
||||||
|
(v_exit - v_entry) :
|
||||||
|
// axis reversal
|
||||||
|
std::max(v_exit, -v_entry)) :
|
||||||
|
// v_exit <= v_entry
|
||||||
|
(((v_entry < 0.0f) || (v_exit > 0.0f)) ?
|
||||||
|
// coasting
|
||||||
|
(v_entry - v_exit) :
|
||||||
|
// axis reversal
|
||||||
|
std::max(-v_exit, v_entry));
|
||||||
|
|
||||||
|
float axis_max_jerk = get_axis_max_jerk(static_cast<ETimeMode>(i), static_cast<Axis>(a));
|
||||||
|
if (jerk > axis_max_jerk) {
|
||||||
|
v_factor *= axis_max_jerk / jerk;
|
||||||
|
limited = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (limited)
|
||||||
|
vmax_junction *= v_factor;
|
||||||
|
|
||||||
|
// Now the transition velocity is known, which maximizes the shared exit / entry velocity while
|
||||||
|
// respecting the jerk factors, it may be possible, that applying separate safe exit / entry velocities will achieve faster prints.
|
||||||
|
float vmax_junction_threshold = vmax_junction * 0.99f;
|
||||||
|
|
||||||
|
// Not coasting. The machine will stop and start the movements anyway, better to start the segment from start.
|
||||||
|
if ((prev.safe_feedrate > vmax_junction_threshold) && (curr.safe_feedrate > vmax_junction_threshold))
|
||||||
|
vmax_junction = curr.safe_feedrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
float v_allowable = max_allowable_speed(-acceleration, curr.safe_feedrate, block.distance);
|
||||||
|
block.feedrate_profile.entry = std::min(vmax_junction, v_allowable);
|
||||||
|
|
||||||
|
block.max_entry_speed = vmax_junction;
|
||||||
|
block.flags.nominal_length = (block.feedrate_profile.cruise <= v_allowable);
|
||||||
|
block.flags.recalculate = true;
|
||||||
|
block.safe_feedrate = curr.safe_feedrate;
|
||||||
|
|
||||||
|
// calculates block trapezoid
|
||||||
|
block.calculate_trapezoid();
|
||||||
|
|
||||||
|
// updates previous
|
||||||
|
prev = curr;
|
||||||
|
|
||||||
|
blocks.push_back(block);
|
||||||
|
|
||||||
|
if (blocks.size() > TimeProcessor::Planner::refresh_threshold)
|
||||||
|
machine.calculate_time(TimeProcessor::Planner::queue_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
// store move
|
||||||
store_move_vertex(move_type(delta_pos));
|
store_move_vertex(move_type(delta_pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,6 +842,16 @@ void GCodeProcessor::process_G11(const GCodeReader::GCodeLine& line)
|
||||||
store_move_vertex(EMoveType::Unretract);
|
store_move_vertex(EMoveType::Unretract);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_G20(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
m_units = EUnits::Inches;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_G21(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
m_units = EUnits::Millimeters;
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeProcessor::process_G22(const GCodeReader::GCodeLine& line)
|
void GCodeProcessor::process_G22(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
// stores retract move
|
// stores retract move
|
||||||
|
@ -391,32 +876,34 @@ void GCodeProcessor::process_G91(const GCodeReader::GCodeLine& line)
|
||||||
|
|
||||||
void GCodeProcessor::process_G92(const GCodeReader::GCodeLine& line)
|
void GCodeProcessor::process_G92(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
float lengthsScaleFactor = (m_units == EUnits::Inches) ? INCHES_TO_MM : 1.0f;
|
float lengths_scale_factor = (m_units == EUnits::Inches) ? INCHES_TO_MM : 1.0f;
|
||||||
bool anyFound = false;
|
bool any_found = false;
|
||||||
|
|
||||||
if (line.has_x()) {
|
if (line.has_x()) {
|
||||||
m_origin[X] = m_end_position[X] - line.x() * lengthsScaleFactor;
|
m_origin[X] = m_end_position[X] - line.x() * lengths_scale_factor;
|
||||||
anyFound = true;
|
any_found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.has_y()) {
|
if (line.has_y()) {
|
||||||
m_origin[Y] = m_end_position[Y] - line.y() * lengthsScaleFactor;
|
m_origin[Y] = m_end_position[Y] - line.y() * lengths_scale_factor;
|
||||||
anyFound = true;
|
any_found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.has_z()) {
|
if (line.has_z()) {
|
||||||
m_origin[Z] = m_end_position[Z] - line.z() * lengthsScaleFactor;
|
m_origin[Z] = m_end_position[Z] - line.z() * lengths_scale_factor;
|
||||||
anyFound = true;
|
any_found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.has_e()) {
|
if (line.has_e()) {
|
||||||
// extruder coordinate can grow to the point where its float representation does not allow for proper addition with small increments,
|
// extruder coordinate can grow to the point where its float representation does not allow for proper addition with small increments,
|
||||||
// we set the value taken from the G92 line as the new current position for it
|
// we set the value taken from the G92 line as the new current position for it
|
||||||
m_end_position[E] = line.e() * lengthsScaleFactor;
|
m_end_position[E] = line.e() * lengths_scale_factor;
|
||||||
anyFound = true;
|
any_found = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
simulate_st_synchronize();
|
||||||
|
|
||||||
if (!anyFound && !line.has_unknown_axis()) {
|
if (!any_found && !line.has_unknown_axis()) {
|
||||||
// The G92 may be called for axes that PrusaSlicer does not recognize, for example see GH issue #3510,
|
// The G92 may be called for axes that PrusaSlicer does not recognize, for example see GH issue #3510,
|
||||||
// where G92 A0 B0 is called although the extruder axis is till E.
|
// where G92 A0 B0 is called although the extruder axis is till E.
|
||||||
for (unsigned char a = X; a <= E; ++a) {
|
for (unsigned char a = X; a <= E; ++a) {
|
||||||
|
@ -425,6 +912,11 @@ void GCodeProcessor::process_G92(const GCodeReader::GCodeLine& line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_M1(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
simulate_st_synchronize();
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeProcessor::process_M82(const GCodeReader::GCodeLine& line)
|
void GCodeProcessor::process_M82(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
m_e_local_positioning_type = EPositioningType::Absolute;
|
m_e_local_positioning_type = EPositioningType::Absolute;
|
||||||
|
@ -501,6 +993,117 @@ void GCodeProcessor::process_M135(const GCodeReader::GCodeLine& line)
|
||||||
process_T(cmd.substr(pos));
|
process_T(cmd.substr(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_M201(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
// see http://reprap.org/wiki/G-code#M201:_Set_max_printing_acceleration
|
||||||
|
float factor = (m_flavor != gcfRepRap && m_units == EUnits::Inches) ? INCHES_TO_MM : 1.0f;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
if (line.has_x())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_acceleration_x, i, line.x() * factor);
|
||||||
|
|
||||||
|
if (line.has_y() && i < m_time_processor.machine_limits.machine_max_acceleration_y.values.size())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_acceleration_y, i, line.y() * factor);
|
||||||
|
|
||||||
|
if (line.has_z() && i < m_time_processor.machine_limits.machine_max_acceleration_z.values.size())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_acceleration_z, i, line.z() * factor);
|
||||||
|
|
||||||
|
if (line.has_e() && i < m_time_processor.machine_limits.machine_max_acceleration_e.values.size())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_acceleration_e, i, line.e() * factor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_M203(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
// see http://reprap.org/wiki/G-code#M203:_Set_maximum_feedrate
|
||||||
|
if (m_flavor == gcfRepetier)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// see http://reprap.org/wiki/G-code#M203:_Set_maximum_feedrate
|
||||||
|
// http://smoothieware.org/supported-g-codes
|
||||||
|
float factor = (m_flavor == gcfMarlin || m_flavor == gcfSmoothie) ? 1.0f : MMMIN_TO_MMSEC;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
if (line.has_x())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_feedrate_x, i, line.x() * factor);
|
||||||
|
|
||||||
|
if (line.has_y())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_feedrate_y, i, line.y() * factor);
|
||||||
|
|
||||||
|
if (line.has_z())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_feedrate_z, i, line.z() * factor);
|
||||||
|
|
||||||
|
if (line.has_e())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_feedrate_e, i, line.e() * factor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_M204(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
float value;
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
if (line.has_value('S', value)) {
|
||||||
|
// Legacy acceleration format. This format is used by the legacy Marlin, MK2 or MK3 firmware,
|
||||||
|
// and it is also generated by Slic3r to control acceleration per extrusion type
|
||||||
|
// (there is a separate acceleration settings in Slicer for perimeter, first layer etc).
|
||||||
|
set_acceleration(static_cast<ETimeMode>(i), value);
|
||||||
|
if (line.has_value('T', value))
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_acceleration_retracting, i, value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// New acceleration format, compatible with the upstream Marlin.
|
||||||
|
if (line.has_value('P', value))
|
||||||
|
set_acceleration(static_cast<ETimeMode>(i), value);
|
||||||
|
if (line.has_value('R', value))
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_acceleration_retracting, i, value);
|
||||||
|
if (line.has_value('T', value)) {
|
||||||
|
// Interpret the T value as the travel acceleration in the new Marlin format.
|
||||||
|
//FIXME Prusa3D firmware currently does not support travel acceleration value independent from the extruding acceleration value.
|
||||||
|
// set_travel_acceleration(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_M205(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
if (line.has_x()) {
|
||||||
|
float max_jerk = line.x();
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_jerk_x, i, max_jerk);
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_jerk_y, i, max_jerk);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.has_y())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_jerk_y, i, line.y());
|
||||||
|
|
||||||
|
if (line.has_z())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_jerk_z, i, line.z());
|
||||||
|
|
||||||
|
if (line.has_e())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_jerk_e, i, line.e());
|
||||||
|
|
||||||
|
float value;
|
||||||
|
if (line.has_value('S', value))
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_min_extruding_rate, i, value);
|
||||||
|
|
||||||
|
if (line.has_value('T', value))
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_min_travel_rate, i, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_M221(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
float value_s;
|
||||||
|
float value_t;
|
||||||
|
if (line.has_value('S', value_s) && !line.has_value('T', value_t)) {
|
||||||
|
value_s *= 0.01f;
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
m_time_processor.machines[i].extrude_factor_override_percentage = value_s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeProcessor::process_M401(const GCodeReader::GCodeLine& line)
|
void GCodeProcessor::process_M401(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
if (m_flavor != gcfRepetier)
|
if (m_flavor != gcfRepetier)
|
||||||
|
@ -544,6 +1147,34 @@ void GCodeProcessor::process_M402(const GCodeReader::GCodeLine& line)
|
||||||
m_feedrate = p;
|
m_feedrate = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_M566(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
if (line.has_x())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_jerk_x, i, line.x() * MMMIN_TO_MMSEC);
|
||||||
|
|
||||||
|
if (line.has_y())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_jerk_y, i, line.y() * MMMIN_TO_MMSEC);
|
||||||
|
|
||||||
|
if (line.has_z())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_jerk_z, i, line.z() * MMMIN_TO_MMSEC);
|
||||||
|
|
||||||
|
if (line.has_e())
|
||||||
|
set_option_value(m_time_processor.machine_limits.machine_max_jerk_e, i, line.e() * MMMIN_TO_MMSEC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_M702(const GCodeReader::GCodeLine& line)
|
||||||
|
{
|
||||||
|
if (line.has('C')) {
|
||||||
|
// MK3 MMU2 specific M code:
|
||||||
|
// M702 C is expected to be sent by the custom end G-code when finalizing a print.
|
||||||
|
// The MK3 unit shall unload and park the active filament into the MMU2 unit.
|
||||||
|
m_time_processor.extruder_unloaded = true;
|
||||||
|
simulate_st_synchronize(get_filament_unload_time(m_extruder_id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GCodeProcessor::process_T(const GCodeReader::GCodeLine& line)
|
void GCodeProcessor::process_T(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
process_T(line.cmd());
|
process_T(line.cmd());
|
||||||
|
@ -560,8 +1191,16 @@ void GCodeProcessor::process_T(const std::string& command)
|
||||||
if (id >= extruders_count)
|
if (id >= extruders_count)
|
||||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid toolchange, maybe from a custom gcode.";
|
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid toolchange, maybe from a custom gcode.";
|
||||||
else {
|
else {
|
||||||
|
unsigned char old_extruder_id = m_extruder_id;
|
||||||
m_extruder_id = id;
|
m_extruder_id = id;
|
||||||
m_cp_color.current = m_extruders_color[id];
|
m_cp_color.current = m_extruders_color[id];
|
||||||
|
// Specific to the MK3 MMU2:
|
||||||
|
// The initial value of extruder_unloaded is set to true indicating
|
||||||
|
// that the filament is parked in the MMU2 unit and there is nothing to be unloaded yet.
|
||||||
|
float extra_time = get_filament_unload_time(static_cast<size_t>(old_extruder_id));
|
||||||
|
m_time_processor.extruder_unloaded = false;
|
||||||
|
extra_time += get_filament_load_time(static_cast<size_t>(m_extruder_id));
|
||||||
|
simulate_st_synchronize(extra_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
// store tool change move
|
// store tool change move
|
||||||
|
@ -593,6 +1232,120 @@ void GCodeProcessor::store_move_vertex(EMoveType type)
|
||||||
m_result.moves.emplace_back(vertex);
|
m_result.moves.emplace_back(vertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::minimum_feedrate(ETimeMode mode, float feedrate) const
|
||||||
|
{
|
||||||
|
if (m_time_processor.machine_limits.machine_min_extruding_rate.empty())
|
||||||
|
return feedrate;
|
||||||
|
|
||||||
|
return std::max(feedrate, get_option_value(m_time_processor.machine_limits.machine_min_extruding_rate, static_cast<size_t>(mode)));
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::minimum_travel_feedrate(ETimeMode mode, float feedrate) const
|
||||||
|
{
|
||||||
|
if (m_time_processor.machine_limits.machine_min_travel_rate.empty())
|
||||||
|
return feedrate;
|
||||||
|
|
||||||
|
return std::max(feedrate, get_option_value(m_time_processor.machine_limits.machine_min_travel_rate, static_cast<size_t>(mode)));
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::get_axis_max_feedrate(ETimeMode mode, Axis axis) const
|
||||||
|
{
|
||||||
|
switch (axis)
|
||||||
|
{
|
||||||
|
case X: { return get_option_value(m_time_processor.machine_limits.machine_max_feedrate_x, static_cast<size_t>(mode)); }
|
||||||
|
case Y: { return get_option_value(m_time_processor.machine_limits.machine_max_feedrate_y, static_cast<size_t>(mode)); }
|
||||||
|
case Z: { return get_option_value(m_time_processor.machine_limits.machine_max_feedrate_z, static_cast<size_t>(mode)); }
|
||||||
|
case E: { return get_option_value(m_time_processor.machine_limits.machine_max_feedrate_e, static_cast<size_t>(mode)); }
|
||||||
|
default: { return 0.0f; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::get_axis_max_acceleration(ETimeMode mode, Axis axis) const
|
||||||
|
{
|
||||||
|
switch (axis)
|
||||||
|
{
|
||||||
|
case X: { return get_option_value(m_time_processor.machine_limits.machine_max_acceleration_x, static_cast<size_t>(mode)); }
|
||||||
|
case Y: { return get_option_value(m_time_processor.machine_limits.machine_max_acceleration_y, static_cast<size_t>(mode)); }
|
||||||
|
case Z: { return get_option_value(m_time_processor.machine_limits.machine_max_acceleration_z, static_cast<size_t>(mode)); }
|
||||||
|
case E: { return get_option_value(m_time_processor.machine_limits.machine_max_acceleration_e, static_cast<size_t>(mode)); }
|
||||||
|
default: { return 0.0f; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::get_axis_max_jerk(ETimeMode mode, Axis axis) const
|
||||||
|
{
|
||||||
|
switch (axis)
|
||||||
|
{
|
||||||
|
case X: { return get_option_value(m_time_processor.machine_limits.machine_max_jerk_x, static_cast<size_t>(mode)); }
|
||||||
|
case Y: { return get_option_value(m_time_processor.machine_limits.machine_max_jerk_y, static_cast<size_t>(mode)); }
|
||||||
|
case Z: { return get_option_value(m_time_processor.machine_limits.machine_max_jerk_z, static_cast<size_t>(mode)); }
|
||||||
|
case E: { return get_option_value(m_time_processor.machine_limits.machine_max_jerk_e, static_cast<size_t>(mode)); }
|
||||||
|
default: { return 0.0f; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::get_retract_acceleration(ETimeMode mode) const
|
||||||
|
{
|
||||||
|
return get_option_value(m_time_processor.machine_limits.machine_max_acceleration_retracting, static_cast<size_t>(mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::get_acceleration(ETimeMode mode) const
|
||||||
|
{
|
||||||
|
size_t id = static_cast<size_t>(mode);
|
||||||
|
return (id < m_time_processor.machines.size()) ? m_time_processor.machines[id].acceleration : DEFAULT_ACCELERATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::set_acceleration(ETimeMode mode, float value)
|
||||||
|
{
|
||||||
|
size_t id = static_cast<size_t>(mode);
|
||||||
|
if (id < m_time_processor.machines.size()) {
|
||||||
|
float max_acceleration = get_option_value(m_time_processor.machine_limits.machine_max_acceleration_extruding, id);
|
||||||
|
m_time_processor.machines[id].acceleration = (max_acceleration == 0.0f) ? value : std::min(value, max_acceleration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::get_filament_load_time(size_t extruder_id)
|
||||||
|
{
|
||||||
|
return (m_time_processor.filament_load_times.empty() || m_time_processor.extruder_unloaded) ?
|
||||||
|
0.0f :
|
||||||
|
((extruder_id < m_time_processor.filament_load_times.size()) ?
|
||||||
|
m_time_processor.filament_load_times[extruder_id] : m_time_processor.filament_load_times.front());
|
||||||
|
}
|
||||||
|
|
||||||
|
float GCodeProcessor::get_filament_unload_time(size_t extruder_id)
|
||||||
|
{
|
||||||
|
return (m_time_processor.filament_unload_times.empty() || m_time_processor.extruder_unloaded) ?
|
||||||
|
0.0f :
|
||||||
|
((extruder_id < m_time_processor.filament_unload_times.size()) ?
|
||||||
|
m_time_processor.filament_unload_times[extruder_id] : m_time_processor.filament_unload_times.front());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::process_custom_gcode_time(CustomGCode::Type code)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
TimeMachine& machine = m_time_processor.machines[i];
|
||||||
|
if (!machine.enabled)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
TimeMachine::CustomGCodeTime& gcode_time = machine.gcode_time;
|
||||||
|
gcode_time.needed = true;
|
||||||
|
//FIXME this simulates st_synchronize! is it correct?
|
||||||
|
// The estimated time may be longer than the real print time.
|
||||||
|
machine.simulate_st_synchronize();
|
||||||
|
if (gcode_time.cache != 0.0f) {
|
||||||
|
gcode_time.times.push_back({ code, gcode_time.cache });
|
||||||
|
gcode_time.cache = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeProcessor::simulate_st_synchronize(float additional_time)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < static_cast<size_t>(ETimeMode::Count); ++i) {
|
||||||
|
m_time_processor.machines[i].simulate_st_synchronize(additional_time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace Slic3r */
|
} /* namespace Slic3r */
|
||||||
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "libslic3r/GCodeReader.hpp"
|
#include "libslic3r/GCodeReader.hpp"
|
||||||
#include "libslic3r/Point.hpp"
|
#include "libslic3r/Point.hpp"
|
||||||
#include "libslic3r/ExtrusionEntity.hpp"
|
#include "libslic3r/ExtrusionEntity.hpp"
|
||||||
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
|
#include "libslic3r/CustomGCode.hpp"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -41,7 +43,7 @@ namespace Slic3r {
|
||||||
struct CachedPosition
|
struct CachedPosition
|
||||||
{
|
{
|
||||||
AxisCoords position; // mm
|
AxisCoords position; // mm
|
||||||
float feedrate; // mm/s
|
float feedrate; // mm/s
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
@ -54,6 +56,118 @@ namespace Slic3r {
|
||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
struct FeedrateProfile
|
||||||
|
{
|
||||||
|
float entry{ 0.0f }; // mm/s
|
||||||
|
float cruise{ 0.0f }; // mm/s
|
||||||
|
float exit{ 0.0f }; // mm/s
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Trapezoid
|
||||||
|
{
|
||||||
|
float accelerate_until{ 0.0f }; // mm
|
||||||
|
float decelerate_after{ 0.0f }; // mm
|
||||||
|
float cruise_feedrate{ 0.0f }; // mm/sec
|
||||||
|
|
||||||
|
float acceleration_time(float entry_feedrate, float acceleration) const;
|
||||||
|
float cruise_time() const;
|
||||||
|
float deceleration_time(float distance, float acceleration) const;
|
||||||
|
float cruise_distance() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TimeBlock
|
||||||
|
{
|
||||||
|
struct Flags
|
||||||
|
{
|
||||||
|
bool recalculate{ false };
|
||||||
|
bool nominal_length{ false };
|
||||||
|
};
|
||||||
|
|
||||||
|
float distance{ 0.0f }; // mm
|
||||||
|
float acceleration{ 0.0f }; // mm/s^2
|
||||||
|
float max_entry_speed{ 0.0f }; // mm/s
|
||||||
|
float safe_feedrate{ 0.0f }; // mm/s
|
||||||
|
Flags flags;
|
||||||
|
FeedrateProfile feedrate_profile;
|
||||||
|
Trapezoid trapezoid;
|
||||||
|
|
||||||
|
// Calculates this block's trapezoid
|
||||||
|
void calculate_trapezoid();
|
||||||
|
|
||||||
|
float time() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class ETimeMode : unsigned char
|
||||||
|
{
|
||||||
|
Normal,
|
||||||
|
Stealth,
|
||||||
|
Count
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct TimeMachine
|
||||||
|
{
|
||||||
|
struct State
|
||||||
|
{
|
||||||
|
float feedrate; // mm/s
|
||||||
|
float safe_feedrate; // mm/s
|
||||||
|
AxisCoords axis_feedrate; // mm/s
|
||||||
|
AxisCoords abs_axis_feedrate; // mm/s
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CustomGCodeTime
|
||||||
|
{
|
||||||
|
bool needed;
|
||||||
|
float cache;
|
||||||
|
std::vector<std::pair<CustomGCode::Type, float>> times;
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
};
|
||||||
|
|
||||||
|
bool enabled;
|
||||||
|
float acceleration; // mm/s^2
|
||||||
|
float extrude_factor_override_percentage;
|
||||||
|
float time; // s
|
||||||
|
State curr;
|
||||||
|
State prev;
|
||||||
|
CustomGCodeTime gcode_time;
|
||||||
|
std::vector<TimeBlock> blocks;
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
// Simulates firmware st_synchronize() call
|
||||||
|
void simulate_st_synchronize(float additional_time = 0.0f);
|
||||||
|
void calculate_time(size_t keep_last_n_blocks = 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TimeProcessor
|
||||||
|
{
|
||||||
|
struct Planner
|
||||||
|
{
|
||||||
|
// Size of the firmware planner queue. The old 8-bit Marlins usually just managed 16 trapezoidal blocks.
|
||||||
|
// Let's be conservative and plan for newer boards with more memory.
|
||||||
|
static constexpr size_t queue_size = 64;
|
||||||
|
// The firmware recalculates last planner_queue_size trapezoidal blocks each time a new block is added.
|
||||||
|
// We are not simulating the firmware exactly, we calculate a sequence of blocks once a reasonable number of blocks accumulate.
|
||||||
|
static constexpr size_t refresh_threshold = queue_size * 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
// extruder_id is currently used to correctly calculate filament load / unload times into the total print time.
|
||||||
|
// This is currently only really used by the MK3 MMU2:
|
||||||
|
// extruder_unloaded = true means no filament is loaded yet, all the filaments are parked in the MK3 MMU2 unit.
|
||||||
|
bool extruder_unloaded;
|
||||||
|
MachineEnvelopeConfig machine_limits;
|
||||||
|
// Additional load / unload times for a filament exchange sequence.
|
||||||
|
std::vector<float> filament_load_times;
|
||||||
|
std::vector<float> filament_unload_times;
|
||||||
|
std::array<TimeMachine, static_cast<size_t>(ETimeMode::Count)> machines;
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class EMoveType : unsigned char
|
enum class EMoveType : unsigned char
|
||||||
{
|
{
|
||||||
|
@ -85,21 +199,6 @@ namespace Slic3r {
|
||||||
float time{ 0.0f }; // s
|
float time{ 0.0f }; // s
|
||||||
|
|
||||||
float volumetric_rate() const { return feedrate * mm3_per_mm; }
|
float volumetric_rate() const { return feedrate * mm3_per_mm; }
|
||||||
|
|
||||||
std::string to_string() const
|
|
||||||
{
|
|
||||||
std::string str = std::to_string((int)type);
|
|
||||||
str += ", " + std::to_string((int)extrusion_role);
|
|
||||||
str += ", " + Slic3r::to_string((Vec3d)position.cast<double>());
|
|
||||||
str += ", " + std::to_string(extruder_id);
|
|
||||||
str += ", " + std::to_string(cp_color_id);
|
|
||||||
str += ", " + std::to_string(feedrate);
|
|
||||||
str += ", " + std::to_string(width);
|
|
||||||
str += ", " + std::to_string(height);
|
|
||||||
str += ", " + std::to_string(mm3_per_mm);
|
|
||||||
str += ", " + std::to_string(fan_speed);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Result
|
struct Result
|
||||||
|
@ -124,13 +223,13 @@ namespace Slic3r {
|
||||||
GCodeFlavor m_flavor;
|
GCodeFlavor m_flavor;
|
||||||
|
|
||||||
AxisCoords m_start_position; // mm
|
AxisCoords m_start_position; // mm
|
||||||
AxisCoords m_end_position; // mm
|
AxisCoords m_end_position; // mm
|
||||||
AxisCoords m_origin; // mm
|
AxisCoords m_origin; // mm
|
||||||
CachedPosition m_cached_position;
|
CachedPosition m_cached_position;
|
||||||
|
|
||||||
float m_feedrate; // mm/s
|
float m_feedrate; // mm/s
|
||||||
float m_width; // mm
|
float m_width; // mm
|
||||||
float m_height; // mm
|
float m_height; // mm
|
||||||
float m_mm3_per_mm;
|
float m_mm3_per_mm;
|
||||||
float m_fan_speed; // percentage
|
float m_fan_speed; // percentage
|
||||||
ExtrusionRole m_extrusion_role;
|
ExtrusionRole m_extrusion_role;
|
||||||
|
@ -138,6 +237,8 @@ namespace Slic3r {
|
||||||
ExtrudersColor m_extruders_color;
|
ExtrudersColor m_extruders_color;
|
||||||
CpColor m_cp_color;
|
CpColor m_cp_color;
|
||||||
|
|
||||||
|
TimeProcessor m_time_processor;
|
||||||
|
|
||||||
Result m_result;
|
Result m_result;
|
||||||
static unsigned int s_result_id;
|
static unsigned int s_result_id;
|
||||||
|
|
||||||
|
@ -145,6 +246,7 @@ namespace Slic3r {
|
||||||
GCodeProcessor() { reset(); }
|
GCodeProcessor() { reset(); }
|
||||||
|
|
||||||
void apply_config(const PrintConfig& config);
|
void apply_config(const PrintConfig& config);
|
||||||
|
void enable_stealth_time_estimator(bool enabled);
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
const Result& get_result() const { return m_result; }
|
const Result& get_result() const { return m_result; }
|
||||||
|
@ -153,6 +255,9 @@ namespace Slic3r {
|
||||||
// Process the gcode contained in the file with the given filename
|
// Process the gcode contained in the file with the given filename
|
||||||
void process_file(const std::string& filename);
|
void process_file(const std::string& filename);
|
||||||
|
|
||||||
|
std::string get_time_dhm(ETimeMode mode) const;
|
||||||
|
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> get_custom_gcode_times(ETimeMode mode, bool include_remaining) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void process_gcode_line(const GCodeReader::GCodeLine& line);
|
void process_gcode_line(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
@ -169,6 +274,12 @@ namespace Slic3r {
|
||||||
// Unretract
|
// Unretract
|
||||||
void process_G11(const GCodeReader::GCodeLine& line);
|
void process_G11(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Set Units to Inches
|
||||||
|
void process_G20(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Set Units to Millimeters
|
||||||
|
void process_G21(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
// Firmware controlled Retract
|
// Firmware controlled Retract
|
||||||
void process_G22(const GCodeReader::GCodeLine& line);
|
void process_G22(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
@ -184,6 +295,9 @@ namespace Slic3r {
|
||||||
// Set Position
|
// Set Position
|
||||||
void process_G92(const GCodeReader::GCodeLine& line);
|
void process_G92(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Sleep or Conditional stop
|
||||||
|
void process_M1(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
// Set extruder to absolute mode
|
// Set extruder to absolute mode
|
||||||
void process_M82(const GCodeReader::GCodeLine& line);
|
void process_M82(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
@ -205,17 +319,54 @@ namespace Slic3r {
|
||||||
// Set tool (MakerWare)
|
// Set tool (MakerWare)
|
||||||
void process_M135(const GCodeReader::GCodeLine& line);
|
void process_M135(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Set max printing acceleration
|
||||||
|
void process_M201(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Set maximum feedrate
|
||||||
|
void process_M203(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Set default acceleration
|
||||||
|
void process_M204(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Advanced settings
|
||||||
|
void process_M205(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Set extrude factor override percentage
|
||||||
|
void process_M221(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
// Repetier: Store x, y and z position
|
// Repetier: Store x, y and z position
|
||||||
void process_M401(const GCodeReader::GCodeLine& line);
|
void process_M401(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
// Repetier: Go to stored position
|
// Repetier: Go to stored position
|
||||||
void process_M402(const GCodeReader::GCodeLine& line);
|
void process_M402(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Set allowable instantaneous speed change
|
||||||
|
void process_M566(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
|
// Unload the current filament into the MK3 MMU2 unit at the end of print.
|
||||||
|
void process_M702(const GCodeReader::GCodeLine& line);
|
||||||
|
|
||||||
// Processes T line (Select Tool)
|
// Processes T line (Select Tool)
|
||||||
void process_T(const GCodeReader::GCodeLine& line);
|
void process_T(const GCodeReader::GCodeLine& line);
|
||||||
void process_T(const std::string& command);
|
void process_T(const std::string& command);
|
||||||
|
|
||||||
void store_move_vertex(EMoveType type);
|
void store_move_vertex(EMoveType type);
|
||||||
|
|
||||||
|
float minimum_feedrate(ETimeMode mode, float feedrate) const;
|
||||||
|
float minimum_travel_feedrate(ETimeMode mode, float feedrate) const;
|
||||||
|
float get_axis_max_feedrate(ETimeMode mode, Axis axis) const;
|
||||||
|
float get_axis_max_acceleration(ETimeMode mode, Axis axis) const;
|
||||||
|
float get_axis_max_jerk(ETimeMode mode, Axis axis) const;
|
||||||
|
float get_retract_acceleration(ETimeMode mode) const;
|
||||||
|
float get_acceleration(ETimeMode mode) const;
|
||||||
|
void set_acceleration(ETimeMode mode, float value);
|
||||||
|
float get_filament_load_time(size_t extruder_id);
|
||||||
|
float get_filament_unload_time(size_t extruder_id);
|
||||||
|
|
||||||
|
void process_custom_gcode_time(CustomGCode::Type code);
|
||||||
|
|
||||||
|
// Simulates firmware st_synchronize() call
|
||||||
|
void simulate_st_synchronize(float additional_time = 0.0f);
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace Slic3r */
|
} /* namespace Slic3r */
|
||||||
|
|
|
@ -678,21 +678,6 @@ namespace Slic3r {
|
||||||
return _get_time_minutes(get_time());
|
return _get_time_minutes(get_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> GCodeTimeEstimator::get_custom_gcode_times(bool include_remaining) const
|
|
||||||
{
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> ret;
|
|
||||||
|
|
||||||
float total_time = 0.0f;
|
|
||||||
for (const auto& [type, time] : m_custom_gcode_times) {
|
|
||||||
float remaining = include_remaining ? m_time - total_time : 0.0f;
|
|
||||||
ret.push_back({ type, { time, remaining } });
|
|
||||||
total_time += time;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
std::vector<std::pair<CustomGCode::Type, float>> GCodeTimeEstimator::get_custom_gcode_times() const
|
std::vector<std::pair<CustomGCode::Type, float>> GCodeTimeEstimator::get_custom_gcode_times() const
|
||||||
{
|
{
|
||||||
return m_custom_gcode_times;
|
return m_custom_gcode_times;
|
||||||
|
@ -736,7 +721,6 @@ namespace Slic3r {
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> GCodeTimeEstimator::get_custom_gcode_times_dhm(bool include_remaining) const
|
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> GCodeTimeEstimator::get_custom_gcode_times_dhm(bool include_remaining) const
|
||||||
|
|
|
@ -358,9 +358,6 @@ namespace Slic3r {
|
||||||
std::string get_time_minutes() const;
|
std::string get_time_minutes() const;
|
||||||
|
|
||||||
// Returns the estimated time, in seconds, for each custom gcode
|
// Returns the estimated time, in seconds, for each custom gcode
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> get_custom_gcode_times(bool include_remaining) const;
|
|
||||||
#else
|
|
||||||
std::vector<std::pair<CustomGCode::Type, float>> get_custom_gcode_times() const;
|
std::vector<std::pair<CustomGCode::Type, float>> get_custom_gcode_times() const;
|
||||||
|
|
||||||
// Returns the estimated time, in format DDd HHh MMm SSs, for each color
|
// Returns the estimated time, in format DDd HHh MMm SSs, for each color
|
||||||
|
@ -370,7 +367,6 @@ namespace Slic3r {
|
||||||
// Returns the estimated time, in minutes (integer), for each color
|
// Returns the estimated time, in minutes (integer), for each color
|
||||||
// If include_remaining==true the strings will be formatted as: "time for color (remaining time at color start)"
|
// If include_remaining==true the strings will be formatted as: "time for color (remaining time at color start)"
|
||||||
std::vector<std::string> get_color_times_minutes(bool include_remaining) const;
|
std::vector<std::string> get_color_times_minutes(bool include_remaining) const;
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
// Returns the estimated time, in format DDd HHh MMm, for each custom_gcode
|
// Returns the estimated time, in format DDd HHh MMm, for each custom_gcode
|
||||||
// If include_remaining==true the strings will be formatted as: "time for custom_gcode (remaining time at color start)"
|
// If include_remaining==true the strings will be formatted as: "time for custom_gcode (remaining time at color start)"
|
||||||
|
|
|
@ -2190,18 +2190,24 @@ std::string Print::output_filename(const std::string &filename_base) const
|
||||||
DynamicConfig PrintStatistics::config() const
|
DynamicConfig PrintStatistics::config() const
|
||||||
{
|
{
|
||||||
DynamicConfig config;
|
DynamicConfig config;
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
config.set_key_value("print_time", new ConfigOptionString(this->estimated_normal_print_time_str));
|
||||||
|
config.set_key_value("normal_print_time", new ConfigOptionString(this->estimated_normal_print_time_str));
|
||||||
|
config.set_key_value("silent_print_time", new ConfigOptionString(this->estimated_silent_print_time_str));
|
||||||
|
#else
|
||||||
std::string normal_print_time = short_time(this->estimated_normal_print_time);
|
std::string normal_print_time = short_time(this->estimated_normal_print_time);
|
||||||
std::string silent_print_time = short_time(this->estimated_silent_print_time);
|
std::string silent_print_time = short_time(this->estimated_silent_print_time);
|
||||||
config.set_key_value("print_time", new ConfigOptionString(normal_print_time));
|
config.set_key_value("print_time", new ConfigOptionString(normal_print_time));
|
||||||
config.set_key_value("normal_print_time", new ConfigOptionString(normal_print_time));
|
config.set_key_value("normal_print_time", new ConfigOptionString(normal_print_time));
|
||||||
config.set_key_value("silent_print_time", new ConfigOptionString(silent_print_time));
|
config.set_key_value("silent_print_time", new ConfigOptionString(silent_print_time));
|
||||||
config.set_key_value("used_filament", new ConfigOptionFloat (this->total_used_filament / 1000.));
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
config.set_key_value("extruded_volume", new ConfigOptionFloat (this->total_extruded_volume));
|
config.set_key_value("used_filament", new ConfigOptionFloat(this->total_used_filament / 1000.));
|
||||||
config.set_key_value("total_cost", new ConfigOptionFloat (this->total_cost));
|
config.set_key_value("extruded_volume", new ConfigOptionFloat(this->total_extruded_volume));
|
||||||
|
config.set_key_value("total_cost", new ConfigOptionFloat(this->total_cost));
|
||||||
config.set_key_value("total_toolchanges", new ConfigOptionInt(this->total_toolchanges));
|
config.set_key_value("total_toolchanges", new ConfigOptionInt(this->total_toolchanges));
|
||||||
config.set_key_value("total_weight", new ConfigOptionFloat (this->total_weight));
|
config.set_key_value("total_weight", new ConfigOptionFloat(this->total_weight));
|
||||||
config.set_key_value("total_wipe_tower_cost", new ConfigOptionFloat (this->total_wipe_tower_cost));
|
config.set_key_value("total_wipe_tower_cost", new ConfigOptionFloat(this->total_wipe_tower_cost));
|
||||||
config.set_key_value("total_wipe_tower_filament", new ConfigOptionFloat (this->total_wipe_tower_filament));
|
config.set_key_value("total_wipe_tower_filament", new ConfigOptionFloat(this->total_wipe_tower_filament));
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -303,14 +303,18 @@ private:
|
||||||
struct PrintStatistics
|
struct PrintStatistics
|
||||||
{
|
{
|
||||||
PrintStatistics() { clear(); }
|
PrintStatistics() { clear(); }
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
std::string estimated_normal_print_time;
|
std::string estimated_normal_print_time;
|
||||||
std::string estimated_silent_print_time;
|
std::string estimated_silent_print_time;
|
||||||
#if ENABLE_GCODE_VIEWER
|
std::string estimated_normal_print_time_str;
|
||||||
|
std::string estimated_silent_print_time_str;
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> estimated_normal_custom_gcode_print_times;
|
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> estimated_normal_custom_gcode_print_times;
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> estimated_silent_custom_gcode_print_times;
|
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> estimated_silent_custom_gcode_print_times;
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> estimated_normal_custom_gcode_print_times_str;
|
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> estimated_normal_custom_gcode_print_times_str;
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> estimated_silent_custom_gcode_print_times_str;
|
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> estimated_silent_custom_gcode_print_times_str;
|
||||||
#else
|
#else
|
||||||
|
std::string estimated_normal_print_time;
|
||||||
|
std::string estimated_silent_print_time;
|
||||||
std::vector<std::pair<CustomGCode::Type, std::string>> estimated_normal_custom_gcode_print_times;
|
std::vector<std::pair<CustomGCode::Type, std::string>> estimated_normal_custom_gcode_print_times;
|
||||||
std::vector<std::pair<CustomGCode::Type, std::string>> estimated_silent_custom_gcode_print_times;
|
std::vector<std::pair<CustomGCode::Type, std::string>> estimated_silent_custom_gcode_print_times;
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
@ -331,14 +335,12 @@ struct PrintStatistics
|
||||||
std::string finalize_output_path(const std::string &path_in) const;
|
std::string finalize_output_path(const std::string &path_in) const;
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
estimated_normal_print_time.clear();
|
|
||||||
estimated_silent_print_time.clear();
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
estimated_normal_custom_gcode_print_times_str.clear();
|
estimated_normal_custom_gcode_print_times_str.clear();
|
||||||
estimated_silent_custom_gcode_print_times_str.clear();
|
estimated_silent_custom_gcode_print_times_str.clear();
|
||||||
estimated_normal_custom_gcode_print_times.clear();
|
|
||||||
estimated_silent_custom_gcode_print_times.clear();
|
|
||||||
#else
|
#else
|
||||||
|
estimated_normal_print_time.clear();
|
||||||
|
estimated_silent_print_time.clear();
|
||||||
estimated_normal_custom_gcode_print_times.clear();
|
estimated_normal_custom_gcode_print_times.clear();
|
||||||
estimated_silent_custom_gcode_print_times.clear();
|
estimated_silent_custom_gcode_print_times.clear();
|
||||||
#endif //ENABLE_GCODE_VIEWER
|
#endif //ENABLE_GCODE_VIEWER
|
||||||
|
|
|
@ -1720,6 +1720,9 @@ void GCodeViewer::render_time_estimate() const
|
||||||
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
|
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (ps.estimated_normal_print_time.empty() && ps.estimated_silent_print_time.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||||
|
|
||||||
using Time = std::pair<float, float>;
|
using Time = std::pair<float, float>;
|
||||||
|
|
|
@ -1322,7 +1322,11 @@ void Sidebar::update_sliced_info_sizer()
|
||||||
wxString::Format("%.2f", ps.total_cost);
|
wxString::Format("%.2f", ps.total_cost);
|
||||||
p->sliced_info->SetTextAndShow(siCost, info_text, new_label);
|
p->sliced_info->SetTextAndShow(siCost, info_text, new_label);
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
if (ps.estimated_normal_print_time_str == "N/A" && ps.estimated_silent_print_time_str == "N/A")
|
||||||
|
#else
|
||||||
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
|
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
|
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
|
||||||
else {
|
else {
|
||||||
new_label = _L("Estimated printing time") +":";
|
new_label = _L("Estimated printing time") +":";
|
||||||
|
@ -1360,21 +1364,25 @@ void Sidebar::update_sliced_info_sizer()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
if (ps.estimated_normal_print_time_str != "N/A") {
|
||||||
|
new_label += format_wxstr("\n - %1%", _L("normal mode"));
|
||||||
|
info_text += format_wxstr("\n%1%", ps.estimated_normal_print_time_str);
|
||||||
|
fill_labels(ps.estimated_normal_custom_gcode_print_times_str, new_label, info_text);
|
||||||
|
}
|
||||||
|
if (ps.estimated_silent_print_time_str != "N/A") {
|
||||||
|
new_label += format_wxstr("\n - %1%", _L("stealth mode"));
|
||||||
|
info_text += format_wxstr("\n%1%", ps.estimated_silent_print_time_str);
|
||||||
|
fill_labels(ps.estimated_silent_custom_gcode_print_times_str, new_label, info_text);
|
||||||
|
#else
|
||||||
if (ps.estimated_normal_print_time != "N/A") {
|
if (ps.estimated_normal_print_time != "N/A") {
|
||||||
new_label += format_wxstr("\n - %1%", _L("normal mode"));
|
new_label += format_wxstr("\n - %1%", _L("normal mode"));
|
||||||
info_text += format_wxstr("\n%1%", ps.estimated_normal_print_time);
|
info_text += format_wxstr("\n%1%", ps.estimated_normal_print_time);
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
fill_labels(ps.estimated_normal_custom_gcode_print_times_str, new_label, info_text);
|
|
||||||
#else
|
|
||||||
fill_labels(ps.estimated_normal_custom_gcode_print_times, new_label, info_text);
|
fill_labels(ps.estimated_normal_custom_gcode_print_times, new_label, info_text);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
}
|
}
|
||||||
if (ps.estimated_silent_print_time != "N/A") {
|
if (ps.estimated_silent_print_time != "N/A") {
|
||||||
new_label += format_wxstr("\n - %1%", _L("stealth mode"));
|
new_label += format_wxstr("\n - %1%", _L("stealth mode"));
|
||||||
info_text += format_wxstr("\n%1%", ps.estimated_silent_print_time);
|
info_text += format_wxstr("\n%1%", ps.estimated_silent_print_time);
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
fill_labels(ps.estimated_silent_custom_gcode_print_times_str, new_label, info_text);
|
|
||||||
#else
|
|
||||||
fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
|
fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue