mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-16 12:45:53 +08:00
#199 allow the machine limits on non-marlin firmware and add for them a "Time estimation compensation" setting
This commit is contained in:
parent
eb557791b7
commit
04f25541b8
@ -1551,6 +1551,11 @@ void GCode::_do_export(Print &print, FILE *file)
|
|||||||
m_normal_time_estimator.calculate_time(false);
|
m_normal_time_estimator.calculate_time(false);
|
||||||
if (m_silent_time_estimator_enabled)
|
if (m_silent_time_estimator_enabled)
|
||||||
m_silent_time_estimator.calculate_time(false);
|
m_silent_time_estimator.calculate_time(false);
|
||||||
|
if (config().time_estimation_compensation.get_abs_value(1) != 1) {
|
||||||
|
m_normal_time_estimator.scale_time(config().time_estimation_compensation.get_abs_value(1));
|
||||||
|
if (m_silent_time_estimator_enabled)
|
||||||
|
m_silent_time_estimator.scale_time(config().time_estimation_compensation.get_abs_value(1));
|
||||||
|
}
|
||||||
|
|
||||||
// Get filament stats.
|
// Get filament stats.
|
||||||
_write(file, DoExport::update_print_stats_and_format_filament_stats(
|
_write(file, DoExport::update_print_stats_and_format_filament_stats(
|
||||||
|
@ -698,6 +698,11 @@ namespace Slic3r {
|
|||||||
_reset();
|
_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeTimeEstimator::scale_time(float scaling)
|
||||||
|
{
|
||||||
|
m_time *= scaling;
|
||||||
|
}
|
||||||
|
|
||||||
float GCodeTimeEstimator::get_time() const
|
float GCodeTimeEstimator::get_time() const
|
||||||
{
|
{
|
||||||
return m_time;
|
return m_time;
|
||||||
|
@ -359,6 +359,9 @@ namespace Slic3r {
|
|||||||
// Call this method before to start adding lines using add_gcode_line() when reusing an instance of GCodeTimeEstimator
|
// Call this method before to start adding lines using add_gcode_line() when reusing an instance of GCodeTimeEstimator
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
// multiply the stored time by a factor.
|
||||||
|
void scale_time(float scaling);
|
||||||
|
|
||||||
// Returns the estimated time, in seconds
|
// Returns the estimated time, in seconds
|
||||||
float get_time() const;
|
float get_time() const;
|
||||||
|
|
||||||
|
@ -142,6 +142,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|
|||||||
"standby_temperature_delta",
|
"standby_temperature_delta",
|
||||||
"start_gcode",
|
"start_gcode",
|
||||||
"start_filament_gcode",
|
"start_filament_gcode",
|
||||||
|
"time_estimation_compensation",
|
||||||
"toolchange_gcode",
|
"toolchange_gcode",
|
||||||
"threads",
|
"threads",
|
||||||
"travel_speed",
|
"travel_speed",
|
||||||
|
@ -316,7 +316,7 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->label = L("Brim inside holes");
|
def->label = L("Brim inside holes");
|
||||||
def->full_label = L("Brim inside holes");
|
def->full_label = L("Brim inside holes");
|
||||||
def->category = OptionCategory::skirtBrim;
|
def->category = OptionCategory::skirtBrim;
|
||||||
def->tooltip = L("Allow to create brim when over an island when this one is inside a hole.");
|
def->tooltip = L("Allow to create a brim over an island when it's inside a hole (or surrounded by an object).");
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionBool(false));
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
@ -2998,13 +2998,22 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->cli = ConfigOptionDef::nocli;
|
def->cli = ConfigOptionDef::nocli;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def = this->add("time_estimation_compensation", coPercent);
|
||||||
|
def->label = L("Time estimation compensation");
|
||||||
|
def->category = OptionCategory::firmware;
|
||||||
|
def->tooltip = L("This setting allow you to modify the time estiamtion by a % amount. As slic3r only use the marlin algorithm, it's not precise enough if an other firmware is used.");
|
||||||
|
def->mode = comAdvanced;
|
||||||
|
def->sidetext = L("%");
|
||||||
|
def->min = 0;
|
||||||
|
def->set_default_value(new ConfigOptionPercent(100));
|
||||||
|
|
||||||
def = this->add("toolchange_gcode", coString);
|
def = this->add("toolchange_gcode", coString);
|
||||||
def->label = L("Tool change G-code");
|
def->label = L("Tool change G-code");
|
||||||
def->category = OptionCategory::customgcode;
|
def->category = OptionCategory::customgcode;
|
||||||
def->tooltip = L("This custom code is inserted at every extruder change. If you don't leave this empty, you are "
|
def->tooltip = L("This custom code is inserted at every extruder change. If you don't leave this empty, you are "
|
||||||
"expected to take care of the toolchange yourself - slic3r will not output any other G-code to "
|
"expected to take care of the toolchange yourself - slic3r will not output any other G-code to "
|
||||||
"change the filament. You can use placeholder variables for all Slic3r settings as well as [previous_extruder] "
|
"change the filament. You can use placeholder variables for all Slic3r settings as well as [previous_extruder] "
|
||||||
"and [next_extruder], so e.g. the standard toolchange command can be scripted as T[next_extruder].");
|
"and [next_extruder], so e.g. the standard toolchange command can be scripted as T[next_extruder].");
|
||||||
def->multiline = true;
|
def->multiline = true;
|
||||||
def->full_width = true;
|
def->full_width = true;
|
||||||
def->height = 5;
|
def->height = 5;
|
||||||
|
@ -1024,6 +1024,7 @@ public:
|
|||||||
ConfigOptionInt standby_temperature_delta;
|
ConfigOptionInt standby_temperature_delta;
|
||||||
ConfigOptionInts temperature;
|
ConfigOptionInts temperature;
|
||||||
ConfigOptionInt threads;
|
ConfigOptionInt threads;
|
||||||
|
ConfigOptionPercent time_estimation_compensation;
|
||||||
ConfigOptionInts top_fan_speed;
|
ConfigOptionInts top_fan_speed;
|
||||||
ConfigOptionBools wipe;
|
ConfigOptionBools wipe;
|
||||||
ConfigOptionBool wipe_tower;
|
ConfigOptionBool wipe_tower;
|
||||||
@ -1101,6 +1102,7 @@ protected:
|
|||||||
OPT_PTR(standby_temperature_delta);
|
OPT_PTR(standby_temperature_delta);
|
||||||
OPT_PTR(temperature);
|
OPT_PTR(temperature);
|
||||||
OPT_PTR(threads);
|
OPT_PTR(threads);
|
||||||
|
OPT_PTR(time_estimation_compensation);
|
||||||
OPT_PTR(top_fan_speed);
|
OPT_PTR(top_fan_speed);
|
||||||
OPT_PTR(wipe);
|
OPT_PTR(wipe);
|
||||||
OPT_PTR(wipe_tower);
|
OPT_PTR(wipe_tower);
|
||||||
|
@ -577,6 +577,7 @@ const std::vector<std::string>& Preset::printer_options()
|
|||||||
"machine_max_feedrate_x", "machine_max_feedrate_y", "machine_max_feedrate_z", "machine_max_feedrate_e",
|
"machine_max_feedrate_x", "machine_max_feedrate_y", "machine_max_feedrate_z", "machine_max_feedrate_e",
|
||||||
"machine_min_extruding_rate", "machine_min_travel_rate",
|
"machine_min_extruding_rate", "machine_min_travel_rate",
|
||||||
"machine_max_jerk_x", "machine_max_jerk_y", "machine_max_jerk_z", "machine_max_jerk_e",
|
"machine_max_jerk_x", "machine_max_jerk_y", "machine_max_jerk_z", "machine_max_jerk_e",
|
||||||
|
"time_estimation_compensation",
|
||||||
"fan_speedup_time"
|
"fan_speedup_time"
|
||||||
};
|
};
|
||||||
s_opts.insert(s_opts.end(), Preset::nozzle_options().begin(), Preset::nozzle_options().end());
|
s_opts.insert(s_opts.end(), Preset::nozzle_options().begin(), Preset::nozzle_options().end());
|
||||||
|
@ -2770,10 +2770,15 @@ void TabPrinter::append_option_line_kinematics(ConfigOptionsGroupShp optgroup, c
|
|||||||
PageShp TabPrinter::build_kinematics_page()
|
PageShp TabPrinter::build_kinematics_page()
|
||||||
{
|
{
|
||||||
auto page = add_options_page(_(L("Machine limits")), "cog", true);
|
auto page = add_options_page(_(L("Machine limits")), "cog", true);
|
||||||
|
ConfigOptionsGroupShp optgroup;
|
||||||
|
if (m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value != gcfMarlin) {
|
||||||
|
optgroup = page->new_optgroup(_(L("not-marlin firmware compensation")));
|
||||||
|
optgroup->append_single_option_line("time_estimation_compensation");
|
||||||
|
}
|
||||||
|
|
||||||
if (m_use_silent_mode) {
|
if (m_use_silent_mode) {
|
||||||
// Legend for OptionsGroups
|
// Legend for OptionsGroups
|
||||||
auto optgroup = page->new_optgroup("");
|
optgroup = page->new_optgroup("");
|
||||||
optgroup->set_show_modified_btns_val(false);
|
optgroup->set_show_modified_btns_val(false);
|
||||||
optgroup->title_width = 23;// 230;
|
optgroup->title_width = 23;// 230;
|
||||||
auto line = Line{ "", "" };
|
auto line = Line{ "", "" };
|
||||||
@ -2798,7 +2803,7 @@ PageShp TabPrinter::build_kinematics_page()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> axes{ "x", "y", "z", "e" };
|
std::vector<std::string> axes{ "x", "y", "z", "e" };
|
||||||
auto optgroup = page->new_optgroup(_(L("Maximum feedrates")));
|
optgroup = page->new_optgroup(_(L("Maximum feedrates")));
|
||||||
for (const std::string &axis : axes) {
|
for (const std::string &axis : axes) {
|
||||||
append_option_line_kinematics(optgroup, "machine_max_feedrate_" + axis);
|
append_option_line_kinematics(optgroup, "machine_max_feedrate_" + axis);
|
||||||
}
|
}
|
||||||
@ -2831,7 +2836,6 @@ PageShp TabPrinter::build_kinematics_page()
|
|||||||
void TabPrinter::build_unregular_pages()
|
void TabPrinter::build_unregular_pages()
|
||||||
{
|
{
|
||||||
size_t n_before_extruders = 2; // Count of pages before Extruder pages
|
size_t n_before_extruders = 2; // Count of pages before Extruder pages
|
||||||
bool is_marlin_flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlin;
|
|
||||||
|
|
||||||
/* ! Freeze/Thaw in this function is needed to avoid call OnPaint() for erased pages
|
/* ! Freeze/Thaw in this function is needed to avoid call OnPaint() for erased pages
|
||||||
* and be cause of application crash, when try to change Preset in moment,
|
* and be cause of application crash, when try to change Preset in moment,
|
||||||
@ -2851,18 +2855,18 @@ void TabPrinter::build_unregular_pages()
|
|||||||
};
|
};
|
||||||
#endif //__WXMSW__
|
#endif //__WXMSW__
|
||||||
|
|
||||||
// Add/delete Kinematics page according to is_marlin_flavor
|
// Add/delete Kinematics page
|
||||||
size_t existed_page = 0;
|
size_t existed_page = 0;
|
||||||
for (size_t i = n_before_extruders; i < m_pages.size(); ++i) // first make sure it's not there already
|
for (size_t i = n_before_extruders; i < m_pages.size(); ++i) // first make sure it's not there already
|
||||||
if (m_pages[i]->title().find(_(L("Machine limits"))) != std::string::npos) {
|
if (m_pages[i]->title().find(_(L("Machine limits"))) != std::string::npos) {
|
||||||
if (!is_marlin_flavor || m_rebuild_kinematics_page)
|
if (m_rebuild_kinematics_page)
|
||||||
m_pages.erase(m_pages.begin() + i);
|
m_pages.erase(m_pages.begin() + i);
|
||||||
else
|
else
|
||||||
existed_page = i;
|
existed_page = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (existed_page < n_before_extruders && is_marlin_flavor) {
|
if (existed_page < n_before_extruders) {
|
||||||
auto page = build_kinematics_page();
|
auto page = build_kinematics_page();
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
layout_page(page);
|
layout_page(page);
|
||||||
@ -2870,8 +2874,7 @@ void TabPrinter::build_unregular_pages()
|
|||||||
m_pages.insert(m_pages.begin() + n_before_extruders, page);
|
m_pages.insert(m_pages.begin() + n_before_extruders, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_marlin_flavor)
|
n_before_extruders++; // kinematic page
|
||||||
n_before_extruders++;
|
|
||||||
size_t n_after_single_extruder_MM = 2; // Count of pages after single_extruder_multi_material page
|
size_t n_after_single_extruder_MM = 2; // Count of pages after single_extruder_multi_material page
|
||||||
|
|
||||||
if (m_extruders_count_old == m_extruders_count ||
|
if (m_extruders_count_old == m_extruders_count ||
|
||||||
@ -3127,6 +3130,11 @@ void TabPrinter::update_fff()
|
|||||||
else
|
else
|
||||||
GCodeWriter::PausePrintCode = "M601";
|
GCodeWriter::PausePrintCode = "M601";
|
||||||
|
|
||||||
|
if (m_is_marlin != is_marlin_flavor) {
|
||||||
|
m_is_marlin = is_marlin_flavor;
|
||||||
|
m_rebuild_kinematics_page = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_use_silent_mode != m_config->opt_bool("silent_mode")) {
|
if (m_use_silent_mode != m_config->opt_bool("silent_mode")) {
|
||||||
m_rebuild_kinematics_page = true;
|
m_rebuild_kinematics_page = true;
|
||||||
m_use_silent_mode = m_config->opt_bool("silent_mode");
|
m_use_silent_mode = m_config->opt_bool("silent_mode");
|
||||||
|
@ -383,7 +383,8 @@ public:
|
|||||||
void build_printhost(ConfigOptionsGroup *optgroup);
|
void build_printhost(ConfigOptionsGroup *optgroup);
|
||||||
|
|
||||||
bool m_has_single_extruder_MM_page = false;
|
bool m_has_single_extruder_MM_page = false;
|
||||||
bool m_use_silent_mode = false;
|
bool m_is_marlin = false;
|
||||||
|
bool m_use_silent_mode = false;
|
||||||
void append_option_line_kinematics(ConfigOptionsGroupShp optgroup, const std::string opt_key);
|
void append_option_line_kinematics(ConfigOptionsGroupShp optgroup, const std::string opt_key);
|
||||||
bool m_rebuild_kinematics_page = false;
|
bool m_rebuild_kinematics_page = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user