From 7ff22b941343bd8f3aabed43d75fb64b9ff5abab Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 27 Jun 2018 15:35:47 +0200 Subject: [PATCH] Time estimate emitted to gcode at requested interval --- lib/Slic3r/GUI/Plater.pm | 10 +- xs/src/libslic3r/GCode.cpp | 157 ++++++--- xs/src/libslic3r/GCode.hpp | 10 +- xs/src/libslic3r/GCodeTimeEstimator.cpp | 418 +++++++++++++++++++----- xs/src/libslic3r/GCodeTimeEstimator.hpp | 67 +++- xs/src/libslic3r/Print.hpp | 5 +- xs/src/libslic3r/PrintConfig.cpp | 10 +- xs/xsp/Print.xsp | 4 +- 8 files changed, 544 insertions(+), 137 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 330ec69d5..9422da354 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -509,7 +509,10 @@ sub new { fil_mm3 => L("Used Filament (mm³)"), fil_g => L("Used Filament (g)"), cost => L("Cost"), - default_time => L("Estimated printing time (default mode)"), +#========================================================================================================================================== + normal_time => L("Estimated printing time (normal mode)"), +# default_time => L("Estimated printing time (default mode)"), +#========================================================================================================================================== silent_time => L("Estimated printing time (silent mode)"), ); while (my $field = shift @info) { @@ -1578,7 +1581,10 @@ sub on_export_completed { $self->{"print_info_cost"}->SetLabel(sprintf("%.2f" , $self->{print}->total_cost)); $self->{"print_info_fil_g"}->SetLabel(sprintf("%.2f" , $self->{print}->total_weight)); $self->{"print_info_fil_mm3"}->SetLabel(sprintf("%.2f" , $self->{print}->total_extruded_volume)); - $self->{"print_info_default_time"}->SetLabel($self->{print}->estimated_default_print_time); +#========================================================================================================================================== + $self->{"print_info_normal_time"}->SetLabel($self->{print}->estimated_normal_print_time); +# $self->{"print_info_default_time"}->SetLabel($self->{print}->estimated_default_print_time); +#========================================================================================================================================== $self->{"print_info_silent_time"}->SetLabel($self->{print}->estimated_silent_print_time); $self->{"print_info_fil_m"}->SetLabel(sprintf("%.2f" , $self->{print}->total_used_filament / 1000)); $self->{"print_info_box_show"}->(1); diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp index c1798b0b5..1f0aac816 100644 --- a/xs/src/libslic3r/GCode.cpp +++ b/xs/src/libslic3r/GCode.cpp @@ -375,8 +375,15 @@ void GCode::do_export(Print *print, const char *path, GCodePreviewData *preview_ } fclose(file); +//################################################################################################################# + m_normal_time_estimator.post_process_remaining_times(path_tmp, 60.0f); +//################################################################################################################# + if (m_silent_time_estimator_enabled) - GCodeTimeEstimator::post_process_elapsed_times(path_tmp, m_default_time_estimator.get_time(), m_silent_time_estimator.get_time()); +//############################################################################################################3 + m_silent_time_estimator.post_process_remaining_times(path_tmp, 60.0f); +// GCodeTimeEstimator::post_process_elapsed_times(path_tmp, m_default_time_estimator.get_time(), m_silent_time_estimator.get_time()); +//############################################################################################################3 if (! this->m_placeholder_parser_failed_templates.empty()) { // G-code export proceeded, but some of the PlaceholderParser substitutions failed. @@ -408,30 +415,72 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data) PROFILE_FUNC(); // resets time estimators - m_default_time_estimator.reset(); - m_default_time_estimator.set_dialect(print.config.gcode_flavor); - m_default_time_estimator.set_acceleration(print.config.machine_max_acceleration_extruding.values[0]); - m_default_time_estimator.set_retract_acceleration(print.config.machine_max_acceleration_retracting.values[0]); - m_default_time_estimator.set_minimum_feedrate(print.config.machine_min_extruding_rate.values[0]); - m_default_time_estimator.set_minimum_travel_feedrate(print.config.machine_min_travel_rate.values[0]); - m_default_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::X, print.config.machine_max_acceleration_x.values[0]); - m_default_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Y, print.config.machine_max_acceleration_y.values[0]); - m_default_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Z, print.config.machine_max_acceleration_z.values[0]); - m_default_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::E, print.config.machine_max_acceleration_e.values[0]); - m_default_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::X, print.config.machine_max_feedrate_x.values[0]); - m_default_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Y, print.config.machine_max_feedrate_y.values[0]); - m_default_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Z, print.config.machine_max_feedrate_z.values[0]); - m_default_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::E, print.config.machine_max_feedrate_e.values[0]); - m_default_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::X, print.config.machine_max_jerk_x.values[0]); - m_default_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Y, print.config.machine_max_jerk_y.values[0]); - m_default_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Z, print.config.machine_max_jerk_z.values[0]); - m_default_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::E, print.config.machine_max_jerk_e.values[0]); +//####################################################################################################################################################################### + m_normal_time_estimator.reset(); + m_normal_time_estimator.set_dialect(print.config.gcode_flavor); + m_normal_time_estimator.set_remaining_times_enabled(false); + m_normal_time_estimator.set_acceleration(print.config.machine_max_acceleration_extruding.values[0]); + m_normal_time_estimator.set_retract_acceleration(print.config.machine_max_acceleration_retracting.values[0]); + m_normal_time_estimator.set_minimum_feedrate(print.config.machine_min_extruding_rate.values[0]); + m_normal_time_estimator.set_minimum_travel_feedrate(print.config.machine_min_travel_rate.values[0]); + m_normal_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::X, print.config.machine_max_acceleration_x.values[0]); + m_normal_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Y, print.config.machine_max_acceleration_y.values[0]); + m_normal_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Z, print.config.machine_max_acceleration_z.values[0]); + m_normal_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::E, print.config.machine_max_acceleration_e.values[0]); + m_normal_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::X, print.config.machine_max_feedrate_x.values[0]); + m_normal_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Y, print.config.machine_max_feedrate_y.values[0]); + m_normal_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Z, print.config.machine_max_feedrate_z.values[0]); + m_normal_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::E, print.config.machine_max_feedrate_e.values[0]); + m_normal_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::X, print.config.machine_max_jerk_x.values[0]); + m_normal_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Y, print.config.machine_max_jerk_y.values[0]); + m_normal_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Z, print.config.machine_max_jerk_z.values[0]); + m_normal_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::E, print.config.machine_max_jerk_e.values[0]); + + std::cout << "Normal" << std::endl; + std::cout << "set_acceleration " << print.config.machine_max_acceleration_extruding.values[0] << std::endl; + std::cout << "set_retract_acceleration " << print.config.machine_max_acceleration_retracting.values[0] << std::endl; + std::cout << "set_minimum_feedrate " << print.config.machine_min_extruding_rate.values[0] << std::endl; + std::cout << "set_minimum_travel_feedrate " << print.config.machine_min_travel_rate.values[0] << std::endl; + std::cout << "set_axis_max_acceleration X " << print.config.machine_max_acceleration_x.values[0] << std::endl; + std::cout << "set_axis_max_acceleration Y " << print.config.machine_max_acceleration_y.values[0] << std::endl; + std::cout << "set_axis_max_acceleration Z " << print.config.machine_max_acceleration_z.values[0] << std::endl; + std::cout << "set_axis_max_acceleration E " << print.config.machine_max_acceleration_e.values[0] << std::endl; + std::cout << "set_axis_max_feedrate X " << print.config.machine_max_feedrate_x.values[0] << std::endl; + std::cout << "set_axis_max_feedrate Y " << print.config.machine_max_feedrate_y.values[0] << std::endl; + std::cout << "set_axis_max_feedrate Z " << print.config.machine_max_feedrate_z.values[0] << std::endl; + std::cout << "set_axis_max_feedrate E " << print.config.machine_max_feedrate_e.values[0] << std::endl; + std::cout << "set_axis_max_jerk X " << print.config.machine_max_jerk_x.values[0] << std::endl; + std::cout << "set_axis_max_jerk Y " << print.config.machine_max_jerk_y.values[0] << std::endl; + std::cout << "set_axis_max_jerk Z " << print.config.machine_max_jerk_z.values[0] << std::endl; + std::cout << "set_axis_max_jerk E " << print.config.machine_max_jerk_e.values[0] << std::endl; + + +// m_default_time_estimator.reset(); +// m_default_time_estimator.set_dialect(print.config.gcode_flavor); +// m_default_time_estimator.set_acceleration(print.config.machine_max_acceleration_extruding.values[0]); +// m_default_time_estimator.set_retract_acceleration(print.config.machine_max_acceleration_retracting.values[0]); +// m_default_time_estimator.set_minimum_feedrate(print.config.machine_min_extruding_rate.values[0]); +// m_default_time_estimator.set_minimum_travel_feedrate(print.config.machine_min_travel_rate.values[0]); +// m_default_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::X, print.config.machine_max_acceleration_x.values[0]); +// m_default_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Y, print.config.machine_max_acceleration_y.values[0]); +// m_default_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Z, print.config.machine_max_acceleration_z.values[0]); +// m_default_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::E, print.config.machine_max_acceleration_e.values[0]); +// m_default_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::X, print.config.machine_max_feedrate_x.values[0]); +// m_default_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Y, print.config.machine_max_feedrate_y.values[0]); +// m_default_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Z, print.config.machine_max_feedrate_z.values[0]); +// m_default_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::E, print.config.machine_max_feedrate_e.values[0]); +// m_default_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::X, print.config.machine_max_jerk_x.values[0]); +// m_default_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Y, print.config.machine_max_jerk_y.values[0]); +// m_default_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Z, print.config.machine_max_jerk_z.values[0]); +// m_default_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::E, print.config.machine_max_jerk_e.values[0]); +//####################################################################################################################################################################### m_silent_time_estimator_enabled = (print.config.gcode_flavor == gcfMarlin) && print.config.silent_mode; if (m_silent_time_estimator_enabled) { m_silent_time_estimator.reset(); m_silent_time_estimator.set_dialect(print.config.gcode_flavor); + m_silent_time_estimator.set_remaining_times_enabled(false); m_silent_time_estimator.set_acceleration(print.config.machine_max_acceleration_extruding.values[1]); m_silent_time_estimator.set_retract_acceleration(print.config.machine_max_acceleration_retracting.values[1]); m_silent_time_estimator.set_minimum_feedrate(print.config.machine_min_extruding_rate.values[1]); @@ -638,12 +687,14 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data) _writeln(file, buf); } - // before start gcode time estimation - if (m_silent_time_estimator_enabled) - { - _write(file, m_default_time_estimator.get_elapsed_time_string().c_str()); - _write(file, m_silent_time_estimator.get_elapsed_time_string().c_str()); - } +//####################################################################################################################################################################### +// // before start gcode time estimation +// if (m_silent_time_estimator_enabled) +// { +// _write(file, m_default_time_estimator.get_elapsed_time_string().c_str()); +// _write(file, m_silent_time_estimator.get_elapsed_time_string().c_str()); +// } +//####################################################################################################################################################################### // Write the custom start G-code _writeln(file, start_gcode); @@ -849,21 +900,34 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data) for (const std::string &end_gcode : print.config.end_filament_gcode.values) _writeln(file, this->placeholder_parser_process("end_filament_gcode", end_gcode, (unsigned int)(&end_gcode - &print.config.end_filament_gcode.values.front()), &config)); } - // before end gcode time estimation - if (m_silent_time_estimator_enabled) - { - _write(file, m_default_time_estimator.get_elapsed_time_string().c_str()); - _write(file, m_silent_time_estimator.get_elapsed_time_string().c_str()); - } +//####################################################################################################################################################################### +// // before end gcode time estimation +// if (m_silent_time_estimator_enabled) +// { +// _write(file, m_default_time_estimator.get_elapsed_time_string().c_str()); +// _write(file, m_silent_time_estimator.get_elapsed_time_string().c_str()); +// } +//####################################################################################################################################################################### _writeln(file, this->placeholder_parser_process("end_gcode", print.config.end_gcode, m_writer.extruder()->id(), &config)); } _write(file, m_writer.update_progress(m_layer_count, m_layer_count, true)); // 100% _write(file, m_writer.postamble()); // calculates estimated printing time - m_default_time_estimator.calculate_time(); +//####################################################################################################################################################################### + m_normal_time_estimator.set_remaining_times_enabled(true); + m_normal_time_estimator.calculate_time(); +// m_default_time_estimator.calculate_time(); +//####################################################################################################################################################################### if (m_silent_time_estimator_enabled) +//####################################################################################################################################################################### + { + m_silent_time_estimator.set_remaining_times_enabled(true); +//####################################################################################################################################################################### m_silent_time_estimator.calculate_time(); +//####################################################################################################################################################################### + } +//####################################################################################################################################################################### // Get filament stats. print.filament_stats.clear(); @@ -871,7 +935,10 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data) print.total_extruded_volume = 0.; print.total_weight = 0.; print.total_cost = 0.; - print.estimated_default_print_time = m_default_time_estimator.get_time_dhms(); +//####################################################################################################################################################################### + print.estimated_normal_print_time = m_normal_time_estimator.get_time_dhms(); +// print.estimated_default_print_time = m_default_time_estimator.get_time_dhms(); +//####################################################################################################################################################################### print.estimated_silent_print_time = m_silent_time_estimator_enabled ? m_silent_time_estimator.get_time_dhms() : "N/A"; for (const Extruder &extruder : m_writer.extruders()) { double used_filament = extruder.used_filament(); @@ -892,7 +959,10 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data) print.total_extruded_volume = print.total_extruded_volume + extruded_volume; } _write_format(file, "; total filament cost = %.1lf\n", print.total_cost); - _write_format(file, "; estimated printing time (default mode) = %s\n", m_default_time_estimator.get_time_dhms().c_str()); +//####################################################################################################################################################################### + _write_format(file, "; estimated printing time (normal mode) = %s\n", m_normal_time_estimator.get_time_dhms().c_str()); +// _write_format(file, "; estimated printing time (default mode) = %s\n", m_default_time_estimator.get_time_dhms().c_str()); +//####################################################################################################################################################################### if (m_silent_time_estimator_enabled) _write_format(file, "; estimated printing time (silent mode) = %s\n", m_silent_time_estimator.get_time_dhms().c_str()); @@ -1462,12 +1532,14 @@ void GCode::process_layer( _write(file, gcode); - // after layer time estimation - if (m_silent_time_estimator_enabled) - { - _write(file, m_default_time_estimator.get_elapsed_time_string().c_str()); - _write(file, m_silent_time_estimator.get_elapsed_time_string().c_str()); - } +//####################################################################################################################################################################### +// // after layer time estimation +// if (m_silent_time_estimator_enabled) +// { +// _write(file, m_default_time_estimator.get_elapsed_time_string().c_str()); +// _write(file, m_silent_time_estimator.get_elapsed_time_string().c_str()); +// } +//####################################################################################################################################################################### } void GCode::apply_print_config(const PrintConfig &print_config) @@ -2126,7 +2198,10 @@ void GCode::_write(FILE* file, const char *what) // writes string to file fwrite(gcode, 1, ::strlen(gcode), file); // updates time estimator and gcode lines vector - m_default_time_estimator.add_gcode_block(gcode); +//####################################################################################################################################################################### + m_normal_time_estimator.add_gcode_block(gcode); +// m_default_time_estimator.add_gcode_block(gcode); +//####################################################################################################################################################################### if (m_silent_time_estimator_enabled) m_silent_time_estimator.add_gcode_block(gcode); } diff --git a/xs/src/libslic3r/GCode.hpp b/xs/src/libslic3r/GCode.hpp index 9fd31b993..d994e750f 100644 --- a/xs/src/libslic3r/GCode.hpp +++ b/xs/src/libslic3r/GCode.hpp @@ -133,7 +133,10 @@ public: m_last_height(GCodeAnalyzer::Default_Height), m_brim_done(false), m_second_layer_things_done(false), - m_default_time_estimator(GCodeTimeEstimator::Default), +//############################################################################################################3 + m_normal_time_estimator(GCodeTimeEstimator::Normal), +// m_default_time_estimator(GCodeTimeEstimator::Default), +//############################################################################################################3 m_silent_time_estimator(GCodeTimeEstimator::Silent), m_silent_time_estimator_enabled(false), m_last_obj_copy(nullptr, Point(std::numeric_limits::max(), std::numeric_limits::max())) @@ -293,7 +296,10 @@ protected: std::pair m_last_obj_copy; // Time estimators - GCodeTimeEstimator m_default_time_estimator; +//############################################################################################################3 + GCodeTimeEstimator m_normal_time_estimator; +// GCodeTimeEstimator m_default_time_estimator; +//############################################################################################################3 GCodeTimeEstimator m_silent_time_estimator; bool m_silent_time_estimator_enabled; diff --git a/xs/src/libslic3r/GCodeTimeEstimator.cpp b/xs/src/libslic3r/GCodeTimeEstimator.cpp index ad82c6820..8f306835f 100644 --- a/xs/src/libslic3r/GCodeTimeEstimator.cpp +++ b/xs/src/libslic3r/GCodeTimeEstimator.cpp @@ -12,15 +12,26 @@ static const float MMMIN_TO_MMSEC = 1.0f / 60.0f; static const float MILLISEC_TO_SEC = 0.001f; static const float INCHES_TO_MM = 25.4f; -static const float DEFAULT_FEEDRATE = 1500.0f; // from Prusa Firmware (Marlin_main.cpp) -static const float DEFAULT_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2 -static const float DEFAULT_RETRACT_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2 -static const float DEFAULT_AXIS_MAX_FEEDRATE[] = { 500.0f, 500.0f, 12.0f, 120.0f }; // Prusa Firmware 1_75mm_MK2 -static const float DEFAULT_AXIS_MAX_ACCELERATION[] = { 9000.0f, 9000.0f, 500.0f, 10000.0f }; // Prusa Firmware 1_75mm_MK2 -static const float DEFAULT_AXIS_MAX_JERK[] = { 10.0f, 10.0f, 0.2f, 2.5f }; // from Prusa Firmware (Configuration.h) -static const float DEFAULT_MINIMUM_FEEDRATE = 0.0f; // from Prusa Firmware (Configuration_adv.h) -static const float DEFAULT_MINIMUM_TRAVEL_FEEDRATE = 0.0f; // from Prusa Firmware (Configuration_adv.h) -static const float DEFAULT_EXTRUDE_FACTOR_OVERRIDE_PERCENTAGE = 1.0f; // 100 percent +//####################################################################################################################################################################### +static const float NORMAL_FEEDRATE = 1500.0f; // from Prusa Firmware (Marlin_main.cpp) +static const float NORMAL_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2 +static const float NORMAL_RETRACT_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2 +static const float NORMAL_AXIS_MAX_FEEDRATE[] = { 500.0f, 500.0f, 12.0f, 120.0f }; // Prusa Firmware 1_75mm_MK2 +static const float NORMAL_AXIS_MAX_ACCELERATION[] = { 9000.0f, 9000.0f, 500.0f, 10000.0f }; // Prusa Firmware 1_75mm_MK2 +static const float NORMAL_AXIS_MAX_JERK[] = { 10.0f, 10.0f, 0.4f, 2.5f }; // from Prusa Firmware (Configuration.h) +static const float NORMAL_MINIMUM_FEEDRATE = 0.0f; // from Prusa Firmware (Configuration_adv.h) +static const float NORMAL_MINIMUM_TRAVEL_FEEDRATE = 0.0f; // from Prusa Firmware (Configuration_adv.h) +static const float NORMAL_EXTRUDE_FACTOR_OVERRIDE_PERCENTAGE = 1.0f; // 100 percent +//static const float DEFAULT_FEEDRATE = 1500.0f; // from Prusa Firmware (Marlin_main.cpp) +//static const float DEFAULT_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2 +//static const float DEFAULT_RETRACT_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2 +//static const float DEFAULT_AXIS_MAX_FEEDRATE[] = { 500.0f, 500.0f, 12.0f, 120.0f }; // Prusa Firmware 1_75mm_MK2 +//static const float DEFAULT_AXIS_MAX_ACCELERATION[] = { 9000.0f, 9000.0f, 500.0f, 10000.0f }; // Prusa Firmware 1_75mm_MK2 +//static const float DEFAULT_AXIS_MAX_JERK[] = { 10.0f, 10.0f, 0.2f, 2.5f }; // from Prusa Firmware (Configuration.h) +//static const float DEFAULT_MINIMUM_FEEDRATE = 0.0f; // from Prusa Firmware (Configuration_adv.h) +//static const float DEFAULT_MINIMUM_TRAVEL_FEEDRATE = 0.0f; // from Prusa Firmware (Configuration_adv.h) +//static const float DEFAULT_EXTRUDE_FACTOR_OVERRIDE_PERCENTAGE = 1.0f; // 100 percent +//####################################################################################################################################################################### static const float SILENT_FEEDRATE = 1500.0f; // from Prusa Firmware (Marlin_main.cpp) static const float SILENT_ACCELERATION = 1250.0f; // Prusa Firmware 1_75mm_MK25-RAMBo13a-E3Dv6full @@ -34,10 +45,12 @@ static const float SILENT_EXTRUDE_FACTOR_OVERRIDE_PERCENTAGE = 1.0f; // 100 perc static const float PREVIOUS_FEEDRATE_THRESHOLD = 0.0001f; -static const std::string ELAPSED_TIME_TAG_DEFAULT = ";_ELAPSED_TIME_DEFAULT: "; -static const std::string ELAPSED_TIME_TAG_SILENT = ";_ELAPSED_TIME_SILENT: "; - -static const std::string REMAINING_TIME_CMD = "M73"; +//############################################################################################################3 +//static const std::string ELAPSED_TIME_TAG_DEFAULT = ";_ELAPSED_TIME_DEFAULT: "; +//static const std::string ELAPSED_TIME_TAG_SILENT = ";_ELAPSED_TIME_SILENT: "; +// +//static const std::string REMAINING_TIME_CMD = "M73"; +//############################################################################################################3 #if ENABLE_MOVE_STATS static const std::string MOVE_TYPE_STR[Slic3r::GCodeTimeEstimator::Block::Num_Types] = @@ -93,8 +106,19 @@ namespace Slic3r { return ::sqrt(value); } +//################################################################################################################# + GCodeTimeEstimator::Block::Time::Time() + : elapsed(-1.0f) + , remaining(-1.0f) + { + } +//################################################################################################################# + GCodeTimeEstimator::Block::Block() : st_synchronized(false) +//################################################################################################################# + , g1_line_id(0) +//################################################################################################################# { } @@ -159,6 +183,13 @@ namespace Slic3r { trapezoid.decelerate_after = accelerate_distance + cruise_distance; } +//################################################################################################################# + void GCodeTimeEstimator::Block::calculate_remaining_time(float final_time) + { + time.remaining = (time.elapsed >= 0.0f) ? final_time - time.elapsed : -1.0f; + } +//################################################################################################################# + float GCodeTimeEstimator::Block::max_allowable_speed(float acceleration, float target_velocity, float distance) { // to avoid invalid negative numbers due to numerical imprecision @@ -217,6 +248,10 @@ namespace Slic3r { _reset_time(); _set_blocks_st_synchronize(false); _calculate_time(); +//################################################################################################################# + if (are_remaining_times_enabled()) + _calculate_remaining_times(); +//################################################################################################################# #if ENABLE_MOVE_STATS _log_moves_stats(); @@ -265,82 +300,180 @@ namespace Slic3r { #endif // ENABLE_MOVE_STATS } - std::string GCodeTimeEstimator::get_elapsed_time_string() - { - calculate_time(); - switch (_mode) - { - default: - case Default: - return ELAPSED_TIME_TAG_DEFAULT + std::to_string(get_time()) + "\n"; - case Silent: - return ELAPSED_TIME_TAG_SILENT + std::to_string(get_time()) + "\n"; - } - } +//############################################################################################################3 +// std::string GCodeTimeEstimator::get_elapsed_time_string() +// { +// calculate_time(); +// switch (_mode) +// { +// default: +// case Default: +// return ELAPSED_TIME_TAG_DEFAULT + std::to_string(get_time()) + "\n"; +// case Silent: +// return ELAPSED_TIME_TAG_SILENT + std::to_string(get_time()) + "\n"; +// } +// } +// +// bool GCodeTimeEstimator::post_process_elapsed_times(const std::string& filename, float default_time, float silent_time) +// { +// boost::nowide::ifstream in(filename); +// if (!in.good()) +// throw std::runtime_error(std::string("Remaining times estimation failed.\nCannot open file for reading.\n")); +// +// std::string path_tmp = filename + ".times"; +// +// FILE* out = boost::nowide::fopen(path_tmp.c_str(), "wb"); +// if (out == nullptr) +// throw std::runtime_error(std::string("Remaining times estimation failed.\nCannot open file for writing.\n")); +// +// std::string line; +// while (std::getline(in, line)) +// { +// if (!in.good()) +// { +// fclose(out); +// throw std::runtime_error(std::string("Remaining times estimation failed.\nError while reading from file.\n")); +// } +// +// // this function expects elapsed time for default and silent mode to be into two consecutive lines inside the gcode +// if (boost::contains(line, ELAPSED_TIME_TAG_DEFAULT)) +// { +// std::string default_elapsed_time_str = line.substr(ELAPSED_TIME_TAG_DEFAULT.length()); +// float elapsed_time = (float)atof(default_elapsed_time_str.c_str()); +// float remaining_time = default_time - elapsed_time; +// line = REMAINING_TIME_CMD + " P" + std::to_string((int)(100.0f * elapsed_time / default_time)); +// line += " R" + _get_time_minutes(remaining_time); +// +// std::string next_line; +// std::getline(in, next_line); +// if (!in.good()) +// { +// fclose(out); +// throw std::runtime_error(std::string("Remaining times estimation failed.\nError while reading from file.\n")); +// } +// +// if (boost::contains(next_line, ELAPSED_TIME_TAG_SILENT)) +// { +// std::string silent_elapsed_time_str = next_line.substr(ELAPSED_TIME_TAG_SILENT.length()); +// float elapsed_time = (float)atof(silent_elapsed_time_str.c_str()); +// float remaining_time = silent_time - elapsed_time; +// line += " Q" + std::to_string((int)(100.0f * elapsed_time / silent_time)); +// line += " S" + _get_time_minutes(remaining_time); +// } +// else +// // found horphaned default elapsed time, skip the remaining time line output +// line = next_line; +// } +// else if (boost::contains(line, ELAPSED_TIME_TAG_SILENT)) +// // found horphaned silent elapsed time, skip the remaining time line output +// continue; +// +// line += "\n"; +// fwrite((const void*)line.c_str(), 1, line.length(), out); +// if (ferror(out)) +// { +// in.close(); +// fclose(out); +// boost::nowide::remove(path_tmp.c_str()); +// throw std::runtime_error(std::string("Remaining times estimation failed.\nIs the disk full?\n")); +// } +// } +// +// fclose(out); +// in.close(); +// +// boost::nowide::remove(filename.c_str()); +// if (boost::nowide::rename(path_tmp.c_str(), filename.c_str()) != 0) +// throw std::runtime_error(std::string("Failed to rename the output G-code file from ") + path_tmp + " to " + filename + '\n' + +// "Is " + path_tmp + " locked?" + '\n'); +// +// return true; +// } +//############################################################################################################3 - bool GCodeTimeEstimator::post_process_elapsed_times(const std::string& filename, float default_time, float silent_time) +//################################################################################################################# + bool GCodeTimeEstimator::post_process_remaining_times(const std::string& filename, float interval) { boost::nowide::ifstream in(filename); if (!in.good()) - throw std::runtime_error(std::string("Remaining times estimation failed.\nCannot open file for reading.\n")); + throw std::runtime_error(std::string("Remaining times export failed.\nCannot open file for reading.\n")); std::string path_tmp = filename + ".times"; FILE* out = boost::nowide::fopen(path_tmp.c_str(), "wb"); if (out == nullptr) - throw std::runtime_error(std::string("Remaining times estimation failed.\nCannot open file for writing.\n")); + throw std::runtime_error(std::string("Remaining times export failed.\nCannot open file for writing.\n")); - std::string line; - while (std::getline(in, line)) + std::string time_mask; + switch (_mode) + { + default: + case Normal: + { + time_mask = "M73 P%s R%s\n"; + break; + } + case Silent: + { + time_mask = "M73 Q%s S%s\n"; + break; + } + } + + unsigned int g1_lines_count = 0; + float last_recorded_time = _time; + std::string gcode_line; + while (std::getline(in, gcode_line)) { if (!in.good()) { fclose(out); - throw std::runtime_error(std::string("Remaining times estimation failed.\nError while reading from file.\n")); + throw std::runtime_error(std::string("Remaining times export failed.\nError while reading from file.\n")); } - // this function expects elapsed time for default and silent mode to be into two consecutive lines inside the gcode - if (boost::contains(line, ELAPSED_TIME_TAG_DEFAULT)) - { - std::string default_elapsed_time_str = line.substr(ELAPSED_TIME_TAG_DEFAULT.length()); - float elapsed_time = (float)atof(default_elapsed_time_str.c_str()); - float remaining_time = default_time - elapsed_time; - line = REMAINING_TIME_CMD + " P" + std::to_string((int)(100.0f * elapsed_time / default_time)); - line += " R" + _get_time_minutes(remaining_time); - - std::string next_line; - std::getline(in, next_line); - if (!in.good()) - { - fclose(out); - throw std::runtime_error(std::string("Remaining times estimation failed.\nError while reading from file.\n")); - } - - if (boost::contains(next_line, ELAPSED_TIME_TAG_SILENT)) - { - std::string silent_elapsed_time_str = next_line.substr(ELAPSED_TIME_TAG_SILENT.length()); - float elapsed_time = (float)atof(silent_elapsed_time_str.c_str()); - float remaining_time = silent_time - elapsed_time; - line += " Q" + std::to_string((int)(100.0f * elapsed_time / silent_time)); - line += " S" + _get_time_minutes(remaining_time); - } - else - // found horphaned default elapsed time, skip the remaining time line output - line = next_line; - } - else if (boost::contains(line, ELAPSED_TIME_TAG_SILENT)) - // found horphaned silent elapsed time, skip the remaining time line output - continue; - - line += "\n"; - fwrite((const void*)line.c_str(), 1, line.length(), out); + // saves back the line + gcode_line += "\n"; + fwrite((const void*)gcode_line.c_str(), 1, gcode_line.length(), out); if (ferror(out)) { in.close(); fclose(out); boost::nowide::remove(path_tmp.c_str()); - throw std::runtime_error(std::string("Remaining times estimation failed.\nIs the disk full?\n")); + throw std::runtime_error(std::string("Remaining times export failed.\nIs the disk full?\n")); } + + // add remaining time lines where needed + _parser.parse_line(gcode_line, + [this, &g1_lines_count, &last_recorded_time, &in, &out, &path_tmp, time_mask, interval](GCodeReader& reader, const GCodeReader::GCodeLine& line) + { + if (line.cmd_is("G1")) + { + ++g1_lines_count; + for (const Block& block : _blocks) + { + if (block.g1_line_id == g1_lines_count) + { + if ((last_recorded_time == _time) || (last_recorded_time - block.time.remaining > interval)) + { + char buffer[1024]; + sprintf(buffer, time_mask.c_str(), std::to_string((int)(100.0f * block.time.elapsed / _time)).c_str(), _get_time_minutes(block.time.remaining).c_str()); + + fwrite((const void*)buffer, 1, ::strlen(buffer), out); + if (ferror(out)) + { + in.close(); + fclose(out); + boost::nowide::remove(path_tmp.c_str()); + throw std::runtime_error(std::string("Remaining times export failed.\nIs the disk full?\n")); + } + + last_recorded_time = block.time.remaining; + break; + } + } + } + } + }); } fclose(out); @@ -353,6 +486,7 @@ namespace Slic3r { return true; } +//################################################################################################################# void GCodeTimeEstimator::set_axis_position(EAxis axis, float position) { @@ -371,6 +505,25 @@ namespace Slic3r { void GCodeTimeEstimator::set_axis_max_jerk(EAxis axis, float jerk) { +//############################################################################################################3 + if ((axis == X) || (axis == Y)) + { + switch (_mode) + { + default: + case Normal: + { + jerk = std::min(jerk, NORMAL_AXIS_MAX_JERK[axis]); + break; + } + case Silent: + { + jerk = std::min(jerk, SILENT_AXIS_MAX_JERK[axis]); + break; + } + } + } +//############################################################################################################3 _state.axis[axis].max_jerk = jerk; } @@ -494,6 +647,33 @@ namespace Slic3r { return _state.e_local_positioning_type; } +//################################################################################################################# + bool GCodeTimeEstimator::are_remaining_times_enabled() const + { + return _state.remaining_times_enabled; + } + + void GCodeTimeEstimator::set_remaining_times_enabled(bool enable) + { + _state.remaining_times_enabled = enable; + } + + int GCodeTimeEstimator::get_g1_line_id() const + { + return _state.g1_line_id; + } + + void GCodeTimeEstimator::increment_g1_line_id() + { + ++_state.g1_line_id; + } + + void GCodeTimeEstimator::reset_g1_line_id() + { + _state.g1_line_id = 0; + } +//################################################################################################################# + void GCodeTimeEstimator::add_additional_time(float timeSec) { _state.additional_time += timeSec; @@ -515,13 +695,22 @@ namespace Slic3r { set_dialect(gcfRepRap); set_global_positioning_type(Absolute); set_e_local_positioning_type(Absolute); +//################################################################################################################# + set_remaining_times_enabled(false); +//################################################################################################################# switch (_mode) { default: - case Default: +//############################################################################################################3 + case Normal: +// case Default: +//############################################################################################################3 { - _set_default_as_default(); +//############################################################################################################3 + _set_default_as_normal(); +// _set_default_as_default(); +//############################################################################################################3 break; } case Silent: @@ -567,6 +756,10 @@ namespace Slic3r { set_axis_position(Z, 0.0f); set_additional_time(0.0f); + +//############################################################################################################3 + reset_g1_line_id(); +//############################################################################################################3 } void GCodeTimeEstimator::_reset_time() @@ -579,22 +772,61 @@ namespace Slic3r { _blocks.clear(); } - void GCodeTimeEstimator::_set_default_as_default() +//############################################################################################################3 + void GCodeTimeEstimator::_set_default_as_normal() +// void GCodeTimeEstimator::_set_default_as_default() +//############################################################################################################3 { - set_feedrate(DEFAULT_FEEDRATE); - set_acceleration(DEFAULT_ACCELERATION); - set_retract_acceleration(DEFAULT_RETRACT_ACCELERATION); - set_minimum_feedrate(DEFAULT_MINIMUM_FEEDRATE); - set_minimum_travel_feedrate(DEFAULT_MINIMUM_TRAVEL_FEEDRATE); - set_extrude_factor_override_percentage(DEFAULT_EXTRUDE_FACTOR_OVERRIDE_PERCENTAGE); +//############################################################################################################3 + set_feedrate(NORMAL_FEEDRATE); + set_acceleration(NORMAL_ACCELERATION); + set_retract_acceleration(NORMAL_RETRACT_ACCELERATION); + set_minimum_feedrate(NORMAL_MINIMUM_FEEDRATE); + set_minimum_travel_feedrate(NORMAL_MINIMUM_TRAVEL_FEEDRATE); + set_extrude_factor_override_percentage(NORMAL_EXTRUDE_FACTOR_OVERRIDE_PERCENTAGE); for (unsigned char a = X; a < Num_Axis; ++a) { EAxis axis = (EAxis)a; - set_axis_max_feedrate(axis, DEFAULT_AXIS_MAX_FEEDRATE[a]); - set_axis_max_acceleration(axis, DEFAULT_AXIS_MAX_ACCELERATION[a]); - set_axis_max_jerk(axis, DEFAULT_AXIS_MAX_JERK[a]); + set_axis_max_feedrate(axis, NORMAL_AXIS_MAX_FEEDRATE[a]); + set_axis_max_acceleration(axis, NORMAL_AXIS_MAX_ACCELERATION[a]); + set_axis_max_jerk(axis, NORMAL_AXIS_MAX_JERK[a]); } + + std::cout << "Normal Default" << std::endl; + std::cout << "set_acceleration " << NORMAL_ACCELERATION << std::endl; + std::cout << "set_retract_acceleration " << NORMAL_RETRACT_ACCELERATION << std::endl; + std::cout << "set_minimum_feedrate " << NORMAL_MINIMUM_FEEDRATE << std::endl; + std::cout << "set_minimum_travel_feedrate " << NORMAL_MINIMUM_TRAVEL_FEEDRATE << std::endl; + std::cout << "set_axis_max_acceleration X " << NORMAL_AXIS_MAX_ACCELERATION[X] << std::endl; + std::cout << "set_axis_max_acceleration Y " << NORMAL_AXIS_MAX_ACCELERATION[Y] << std::endl; + std::cout << "set_axis_max_acceleration Z " << NORMAL_AXIS_MAX_ACCELERATION[Z] << std::endl; + std::cout << "set_axis_max_acceleration E " << NORMAL_AXIS_MAX_ACCELERATION[E] << std::endl; + std::cout << "set_axis_max_feedrate X " << NORMAL_AXIS_MAX_FEEDRATE[X] << std::endl; + std::cout << "set_axis_max_feedrate Y " << NORMAL_AXIS_MAX_FEEDRATE[Y] << std::endl; + std::cout << "set_axis_max_feedrate Z " << NORMAL_AXIS_MAX_FEEDRATE[Z] << std::endl; + std::cout << "set_axis_max_feedrate E " << NORMAL_AXIS_MAX_FEEDRATE[E] << std::endl; + std::cout << "set_axis_max_jerk X " << NORMAL_AXIS_MAX_JERK[X] << std::endl; + std::cout << "set_axis_max_jerk Y " << NORMAL_AXIS_MAX_JERK[Y] << std::endl; + std::cout << "set_axis_max_jerk Z " << NORMAL_AXIS_MAX_JERK[Z] << std::endl; + std::cout << "set_axis_max_jerk E " << NORMAL_AXIS_MAX_JERK[E] << std::endl; + + +// set_feedrate(DEFAULT_FEEDRATE); +// set_acceleration(DEFAULT_ACCELERATION); +// set_retract_acceleration(DEFAULT_RETRACT_ACCELERATION); +// set_minimum_feedrate(DEFAULT_MINIMUM_FEEDRATE); +// set_minimum_travel_feedrate(DEFAULT_MINIMUM_TRAVEL_FEEDRATE); +// set_extrude_factor_override_percentage(DEFAULT_EXTRUDE_FACTOR_OVERRIDE_PERCENTAGE); +// +// for (unsigned char a = X; a < Num_Axis; ++a) +// { +// EAxis axis = (EAxis)a; +// set_axis_max_feedrate(axis, DEFAULT_AXIS_MAX_FEEDRATE[a]); +// set_axis_max_acceleration(axis, DEFAULT_AXIS_MAX_ACCELERATION[a]); +// set_axis_max_jerk(axis, DEFAULT_AXIS_MAX_JERK[a]); +// } +//############################################################################################################3 } void GCodeTimeEstimator::_set_default_as_silent() @@ -631,7 +863,10 @@ namespace Slic3r { _time += get_additional_time(); - for (const Block& block : _blocks) +//########################################################################################################################## + for (Block& block : _blocks) +// for (const Block& block : _blocks) +//########################################################################################################################## { if (block.st_synchronized) continue; @@ -642,6 +877,9 @@ namespace Slic3r { block_time += block.cruise_time(); block_time += block.deceleration_time(); _time += block_time; +//########################################################################################################################## + block.time.elapsed = _time; +//########################################################################################################################## MovesStatsMap::iterator it = _moves_stats.find(block.move_type); if (it == _moves_stats.end()) @@ -653,10 +891,23 @@ namespace Slic3r { _time += block.acceleration_time(); _time += block.cruise_time(); _time += block.deceleration_time(); +//########################################################################################################################## + block.time.elapsed = _time; +//########################################################################################################################## #endif // ENABLE_MOVE_STATS } } +//################################################################################################################# + void GCodeTimeEstimator::_calculate_remaining_times() + { + for (Block& block : _blocks) + { + block.calculate_remaining_time(_time); + } + } +//################################################################################################################# + void GCodeTimeEstimator::_process_gcode_line(GCodeReader&, const GCodeReader::GCodeLine& line) { PROFILE_FUNC(); @@ -790,6 +1041,10 @@ namespace Slic3r { void GCodeTimeEstimator::_processG1(const GCodeReader::GCodeLine& line) { +//############################################################################################################3 + increment_g1_line_id(); +//############################################################################################################3 + // updates axes positions from line EUnits units = get_units(); float new_pos[Num_Axis]; @@ -808,6 +1063,9 @@ namespace Slic3r { // fills block data Block block; +//############################################################################################################3 + block.g1_line_id = get_g1_line_id(); +//############################################################################################################3 // calculates block movement deltas float max_abs_delta = 0.0f; diff --git a/xs/src/libslic3r/GCodeTimeEstimator.hpp b/xs/src/libslic3r/GCodeTimeEstimator.hpp index 14ff1efea..924c9e303 100644 --- a/xs/src/libslic3r/GCodeTimeEstimator.hpp +++ b/xs/src/libslic3r/GCodeTimeEstimator.hpp @@ -19,7 +19,10 @@ namespace Slic3r { public: enum EMode : unsigned char { - Default, +//####################################################################################################################################################################### + Normal, +// Default, +//####################################################################################################################################################################### Silent }; @@ -77,6 +80,10 @@ namespace Slic3r { float minimum_feedrate; // mm/s float minimum_travel_feedrate; // mm/s float extrude_factor_override_percentage; +//################################################################################################################# + bool remaining_times_enabled; + unsigned int g1_line_id; +//################################################################################################################# }; public: @@ -127,6 +134,15 @@ namespace Slic3r { bool nominal_length; }; +//################################################################################################################# + struct Time + { + float elapsed; + float remaining; + + Time(); + }; +//################################################################################################################# #if ENABLE_MOVE_STATS EMoveType move_type; @@ -140,6 +156,10 @@ namespace Slic3r { FeedrateProfile feedrate; Trapezoid trapezoid; +//################################################################################################################# + Time time; + unsigned int g1_line_id; +//################################################################################################################# bool st_synchronized; @@ -169,6 +189,10 @@ namespace Slic3r { // Calculates this block's trapezoid void calculate_trapezoid(); +//################################################################################################################# + void calculate_remaining_time(float final_time); +//################################################################################################################# + // 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); @@ -231,12 +255,25 @@ namespace Slic3r { // Calculates the time estimate from the gcode contained in given list of gcode lines void calculate_time_from_lines(const std::vector& gcode_lines); - // Calculates the time estimate from the gcode lines added using add_gcode_line() or add_gcode_block() - // and returns it in a formatted string - std::string get_elapsed_time_string(); +//############################################################################################################3 +// // Calculates the time estimate from the gcode lines added using add_gcode_line() or add_gcode_block() +// // and returns it in a formatted string +// std::string get_elapsed_time_string(); +//############################################################################################################3 - // Converts elapsed time lines, contained in the gcode saved with the given filename, into remaining time commands - static bool post_process_elapsed_times(const std::string& filename, float default_time, float silent_time); +//############################################################################################################3 +// // Converts elapsed time lines, contained in the gcode saved with the given filename, into remaining time commands +// static bool post_process_elapsed_times(const std::string& filename, float default_time, float silent_time); +//############################################################################################################3 + +//################################################################################################################# + // Process the gcode contained in the file with the given filename, + // placing in it new lines (M73) containing the remaining time, at the given interval in seconds + // and saving the result back in the same file + // This time estimator should have been already used to calculate the time estimate for the gcode + // contained in the given file before to call this method + bool post_process_remaining_times(const std::string& filename, float interval_sec); +//################################################################################################################# // Set current position on the given axis with the given value void set_axis_position(EAxis axis, float position); @@ -282,6 +319,15 @@ namespace Slic3r { void set_e_local_positioning_type(EPositioningType type); EPositioningType get_e_local_positioning_type() const; +//################################################################################################################# + bool are_remaining_times_enabled() const; + void set_remaining_times_enabled(bool enable); + + int get_g1_line_id() const; + void increment_g1_line_id(); + void reset_g1_line_id(); +//################################################################################################################# + void add_additional_time(float timeSec); void set_additional_time(float timeSec); float get_additional_time() const; @@ -305,7 +351,10 @@ namespace Slic3r { void _reset_time(); void _reset_blocks(); - void _set_default_as_default(); +//############################################################################################################3 + void _set_default_as_normal(); +// void _set_default_as_default(); +//############################################################################################################3 void _set_default_as_silent(); void _set_blocks_st_synchronize(bool state); @@ -313,6 +362,10 @@ namespace Slic3r { // Calculates the time estimate void _calculate_time(); +//################################################################################################################# + void _calculate_remaining_times(); +//################################################################################################################# + // Processes the given gcode line void _process_gcode_line(GCodeReader&, const GCodeReader::GCodeLine& line); diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp index db92087b7..9fd59d690 100644 --- a/xs/src/libslic3r/Print.hpp +++ b/xs/src/libslic3r/Print.hpp @@ -235,7 +235,10 @@ public: PrintRegionPtrs regions; PlaceholderParser placeholder_parser; // TODO: status_cb - std::string estimated_default_print_time; +//####################################################################################################################################################################### + std::string estimated_normal_print_time; +// std::string estimated_default_print_time; +//####################################################################################################################################################################### std::string estimated_silent_print_time; double total_used_filament, total_extruded_volume, total_cost, total_weight; std::map filament_stats; diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 8c66d44ec..49568e0ab 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -936,7 +936,10 @@ PrintConfigDef::PrintConfigDef() def->sidetext = L("mm/s²"); def->min = 0; def->width = machine_limits_opt_width; - def->default_value = new ConfigOptionFloats(1500., 1250.); +//################################################################################################################################## + def->default_value = new ConfigOptionFloats{ 1500., 1250. }; +// def->default_value = new ConfigOptionFloats(1500., 1250.); +//################################################################################################################################## // M204 T... [mm/sec^2] def = this->add("machine_max_acceleration_retracting", coFloats); @@ -946,7 +949,10 @@ PrintConfigDef::PrintConfigDef() def->sidetext = L("mm/s²"); def->min = 0; def->width = machine_limits_opt_width; - def->default_value = new ConfigOptionFloats(1500., 1250.); +//################################################################################################################################## + def->default_value = new ConfigOptionFloats{ 1500., 1250. }; +// def->default_value = new ConfigOptionFloats(1500., 1250.); +//################################################################################################################################## def = this->add("max_fan_speed", coInts); def->label = L("Max"); diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp index bc5eb7433..717064916 100644 --- a/xs/xsp/Print.xsp +++ b/xs/xsp/Print.xsp @@ -145,8 +145,8 @@ _constant() %code%{ RETVAL = &THIS->skirt; %}; Ref brim() %code%{ RETVAL = &THIS->brim; %}; - std::string estimated_default_print_time() - %code%{ RETVAL = THIS->estimated_default_print_time; %}; + std::string estimated_normal_print_time() + %code%{ RETVAL = THIS->estimated_normal_print_time; %}; std::string estimated_silent_print_time() %code%{ RETVAL = THIS->estimated_silent_print_time; %};