Generate M73 lines for silent mode only for MK3 printers

This commit is contained in:
Enrico Turri 2018-07-13 11:32:50 +02:00
parent ee67b2c7c3
commit 75cf4e0947
7 changed files with 7 additions and 330 deletions

View file

@ -375,15 +375,10 @@ 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)
//############################################################################################################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.
@ -415,10 +410,8 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
PROFILE_FUNC();
// resets time estimators
//#######################################################################################################################################################################
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]);
@ -436,51 +429,11 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
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;
m_silent_time_estimator_enabled = (print.config.gcode_flavor == gcfMarlin) && print.config.silent_mode && boost::starts_with(print.config.printer_model.value, "MK3");
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]);
@ -687,15 +640,6 @@ 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());
// }
//#######################################################################################################################################################################
// Write the custom start G-code
_writeln(file, start_gcode);
// Process filament-specific gcode in extruder order.
@ -900,34 +844,15 @@ 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());
// }
//#######################################################################################################################################################################
_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_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();
@ -935,20 +860,14 @@ 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_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();
double extruded_volume = extruder.extruded_volume();
double filament_weight = extruded_volume * extruder.filament_density() * 0.001;
double filament_cost = filament_weight * extruder.filament_cost() * 0.001;
//#######################################################################################################################################################################
print.filament_stats.insert(std::pair<size_t, float>(extruder.id(), (float)used_filament));
// print.filament_stats.insert(std::pair<size_t, float>(extruder.id(), used_filament));
//#######################################################################################################################################################################
_write_format(file, "; filament used = %.1lfmm (%.1lfcm3)\n", used_filament, extruded_volume * 0.001);
if (filament_weight > 0.) {
print.total_weight = print.total_weight + filament_weight;
@ -962,10 +881,7 @@ 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 (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());
@ -1534,15 +1450,6 @@ void GCode::process_layer(
// printf("G-code after filter:\n%s\n", out.c_str());
_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());
// }
//#######################################################################################################################################################################
}
void GCode::apply_print_config(const PrintConfig &print_config)
@ -2201,10 +2108,7 @@ 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_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);
}

View file

@ -133,10 +133,7 @@ public:
m_last_height(GCodeAnalyzer::Default_Height),
m_brim_done(false),
m_second_layer_things_done(false),
//############################################################################################################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<coord_t>::max(), std::numeric_limits<coord_t>::max()))
@ -296,10 +293,7 @@ protected:
std::pair<const PrintObject*, Point> m_last_obj_copy;
// Time estimators
//############################################################################################################3
GCodeTimeEstimator m_normal_time_estimator;
// GCodeTimeEstimator m_default_time_estimator;
//############################################################################################################3
GCodeTimeEstimator m_silent_time_estimator;
bool m_silent_time_estimator_enabled;

View file

@ -12,7 +12,6 @@ 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 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
@ -22,16 +21,6 @@ static const float NORMAL_AXIS_MAX_JERK[] = { 10.0f, 10.0f, 0.4f, 2.5f }; // fro
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
@ -45,13 +34,6 @@ static const float SILENT_EXTRUDE_FACTOR_OVERRIDE_PERCENTAGE = 1.0f; // 100 perc
static const float PREVIOUS_FEEDRATE_THRESHOLD = 0.0001f;
//############################################################################################################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] =
{
@ -278,98 +260,6 @@ namespace Slic3r {
#endif // ENABLE_MOVE_STATS
}
//############################################################################################################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_remaining_times(const std::string& filename, float interval)
{
boost::nowide::ifstream in(filename);
@ -481,7 +371,6 @@ namespace Slic3r {
return true;
}
//#################################################################################################################
void GCodeTimeEstimator::set_axis_position(EAxis axis, float position)
{
@ -500,7 +389,6 @@ namespace Slic3r {
void GCodeTimeEstimator::set_axis_max_jerk(EAxis axis, float jerk)
{
//############################################################################################################3
if ((axis == X) || (axis == Y))
{
switch (_mode)
@ -518,7 +406,7 @@ namespace Slic3r {
}
}
}
//############################################################################################################3
_state.axis[axis].max_jerk = jerk;
}
@ -642,17 +530,6 @@ 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;
@ -667,7 +544,6 @@ namespace Slic3r {
{
_state.g1_line_id = 0;
}
//#################################################################################################################
void GCodeTimeEstimator::add_additional_time(float timeSec)
{
@ -690,22 +566,13 @@ namespace Slic3r {
set_dialect(gcfRepRap);
set_global_positioning_type(Absolute);
set_e_local_positioning_type(Absolute);
//#################################################################################################################
set_remaining_times_enabled(false);
//#################################################################################################################
switch (_mode)
{
default:
//############################################################################################################3
case Normal:
// case Default:
//############################################################################################################3
{
//############################################################################################################3
_set_default_as_normal();
// _set_default_as_default();
//############################################################################################################3
break;
}
case Silent:
@ -752,10 +619,8 @@ namespace Slic3r {
set_additional_time(0.0f);
//############################################################################################################3
reset_g1_line_id();
_g1_line_ids.clear();
//############################################################################################################3
}
void GCodeTimeEstimator::_reset_time()
@ -768,12 +633,8 @@ namespace Slic3r {
_blocks.clear();
}
//############################################################################################################3
void GCodeTimeEstimator::_set_default_as_normal()
// void GCodeTimeEstimator::_set_default_as_default()
//############################################################################################################3
{
//############################################################################################################3
set_feedrate(NORMAL_FEEDRATE);
set_acceleration(NORMAL_ACCELERATION);
set_retract_acceleration(NORMAL_RETRACT_ACCELERATION);
@ -788,41 +649,6 @@ namespace Slic3r {
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()
@ -859,10 +685,7 @@ namespace Slic3r {
_time += get_additional_time();
//##########################################################################################################################
for (Block& block : _blocks)
// for (const Block& block : _blocks)
//##########################################################################################################################
{
if (block.st_synchronized)
continue;
@ -873,9 +696,7 @@ namespace Slic3r {
block_time += block.cruise_time();
block_time += block.deceleration_time();
_time += block_time;
//##########################################################################################################################
block.elapsed_time = are_remaining_times_enabled() ? _time : -1.0f;
//##########################################################################################################################
block.elapsed_time = _time;
MovesStatsMap::iterator it = _moves_stats.find(block.move_type);
if (it == _moves_stats.end())
@ -887,9 +708,7 @@ namespace Slic3r {
_time += block.acceleration_time();
_time += block.cruise_time();
_time += block.deceleration_time();
//##########################################################################################################################
block.elapsed_time = are_remaining_times_enabled() ? _time : -1.0f;
//##########################################################################################################################
block.elapsed_time = _time;
#endif // ENABLE_MOVE_STATS
}
}
@ -1027,9 +846,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_processG1(const GCodeReader::GCodeLine& line)
{
//############################################################################################################3
increment_g1_line_id();
//############################################################################################################3
// updates axes positions from line
EUnits units = get_units();
@ -1218,9 +1035,7 @@ namespace Slic3r {
// adds block to blocks list
_blocks.emplace_back(block);
//############################################################################################################3
_g1_line_ids.insert(G1LineIdToBlockIdMap::value_type(get_g1_line_id(), (unsigned int)_blocks.size() - 1));
//############################################################################################################3
}
void GCodeTimeEstimator::_processG4(const GCodeReader::GCodeLine& line)

View file

@ -19,10 +19,7 @@ namespace Slic3r {
public:
enum EMode : unsigned char
{
//#######################################################################################################################################################################
Normal,
// Default,
//#######################################################################################################################################################################
Silent
};
@ -79,11 +76,8 @@ namespace Slic3r {
float additional_time; // s
float minimum_feedrate; // mm/s
float minimum_travel_feedrate; // mm/s
float extrude_factor_override_percentage;
//#################################################################################################################
bool remaining_times_enabled;
float extrude_factor_override_percentage;
unsigned int g1_line_id;
//#################################################################################################################
};
public:
@ -146,9 +140,7 @@ namespace Slic3r {
FeedrateProfile feedrate;
Trapezoid trapezoid;
//#################################################################################################################
float elapsed_time;
//#################################################################################################################
bool st_synchronized;
@ -244,25 +236,12 @@ namespace Slic3r {
// Calculates the time estimate from the gcode contained in given list of gcode lines
void calculate_time_from_lines(const std::vector<std::string>& gcode_lines);
//############################################################################################################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
//############################################################################################################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);
@ -308,14 +287,9 @@ 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);
@ -340,10 +314,7 @@ namespace Slic3r {
void _reset_time();
void _reset_blocks();
//############################################################################################################3
void _set_default_as_normal();
// void _set_default_as_default();
//############################################################################################################3
void _set_default_as_silent();
void _set_blocks_st_synchronize(bool state);

View file

@ -235,10 +235,7 @@ public:
PrintRegionPtrs regions;
PlaceholderParser placeholder_parser;
// TODO: status_cb
//#######################################################################################################################################################################
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<size_t, float> filament_stats;

View file

@ -936,10 +936,7 @@ 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.);
//##################################################################################################################################
// M204 T... [mm/sec^2]
def = this->add("machine_max_acceleration_retracting", coFloats);
@ -949,10 +946,7 @@ 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 = this->add("max_fan_speed", coInts);
def->label = L("Max");

View file

@ -666,6 +666,7 @@ public:
ConfigOptionString output_filename_format;
ConfigOptionFloat perimeter_acceleration;
ConfigOptionStrings post_process;
ConfigOptionString printer_model;
ConfigOptionString printer_notes;
ConfigOptionFloat resolution;
ConfigOptionFloats retract_before_travel;
@ -736,6 +737,7 @@ protected:
OPT_PTR(output_filename_format);
OPT_PTR(perimeter_acceleration);
OPT_PTR(post_process);
OPT_PTR(printer_model);
OPT_PTR(printer_notes);
OPT_PTR(resolution);
OPT_PTR(retract_before_travel);