T1 and M702 C are now evaluated by the time estimator to add the new

"filament_load_time" and "filament_unload_time" values to match
the MK3 MMU2 behavior.

Emitting of the remaining times into the output G-code was made optional
through a new "remaining_times" configuration value, so the firmware
flavors and versions, which do not know the M73 code, will not complain.

Configuration changes:

The wipe tower default position was shifted inwards after the wipe tower
coordinate reference point was changed from the center to the left front
corner.

Added the "filament_load_time" and "filament_unload_time" values
to the MK3 MMU filament profiles.

Enabled "remaining_times" for the MK2.5, MK3 and MK3MMU2 printers.
This commit is contained in:
bubnikv 2018-08-04 17:38:25 +02:00
parent ac2b20b54b
commit 71b1e09af9
11 changed files with 133 additions and 10 deletions

View file

@ -1,4 +1,5 @@
min_slic3r_version = 1.41.0-alpha
0.2.0-alpha8 Added filament_load/unload_time for the PLA/ABS MMU2 filament presets.
0.2.0-alpha7 Fixed the *MK3* references
0.2.0-alpha6
0.2.0-alpha5 Bumped up firmware versions for MK2.5/MK3 to 3.3.1, disabled priming areas for MK3MMU2

View file

@ -5,7 +5,7 @@
name = Prusa Research
# Configuration version of this file. Config file will only be installed, if the config_version differs.
# This means, the server may force the Slic3r configuration to be downgraded.
config_version = 0.2.0-alpha7
config_version = 0.2.0-alpha8
# Where to get the updates from?
config_update_url = https://raw.githubusercontent.com/prusa3d/Slic3r-settings/master/live/PrusaResearch/
@ -133,8 +133,8 @@ wipe_tower = 1
wipe_tower_bridging = 10
wipe_tower_rotation_angle = 0
wipe_tower_width = 60
wipe_tower_x = 200
wipe_tower_y = 155
wipe_tower_x = 180
wipe_tower_y = 135
xy_size_compensation = 0
[print:*MK3*]
@ -844,6 +844,8 @@ filament_cooling_initial_speed = 10
filament_cooling_moves = 5
filament_loading_speed = 14
filament_ramming_parameters = "120 110 5.32258 5.45161 5.67742 6 6.48387 7.12903 7.90323 8.70968 9.3871 9.83871 10.0968 10.2258| 0.05 5.30967 0.45 5.50967 0.95 6.1871 1.45 7.39677 1.95 9.05484 2.45 10 2.95 10.3098 3.45 13.0839 3.95 7.6 4.45 7.6 4.95 7.6";
filament_load_time = 12
filament_unload_time = 11
[filament:Generic ABS MMU2]
inherits = *ABS MMU2*
@ -887,6 +889,8 @@ filament_cooling_initial_speed = 10
filament_cooling_moves = 7
filament_loading_speed = 14
filament_ramming_parameters = "120 110 4.03226 4.12903 4.25806 4.41935 4.58065 4.80645 5.35484 6.29032 7.58065 9.09677 10.5806 11.8387 12.6452 12.9677| 0.05 4.01935 0.45 4.15483 0.95 4.50968 1.45 4.94516 1.95 6.79677 2.45 9.87102 2.95 12.4388 3.45 13.0839 3.95 7.6 4.45 7.6 4.95 7.6"
filament_load_time = 12
filament_unload_time = 11
[filament:Generic PLA MMU2]
inherits = *PLA MMU2*
@ -980,6 +984,7 @@ extruder_colour = #FFFF00
extruder_offset = 0x0
gcode_flavor = marlin
silent_mode = 0
remaining_times = 0
machine_max_acceleration_e = 10000
machine_max_acceleration_extruding = 2000
machine_max_acceleration_retracting = 1500
@ -1124,16 +1129,19 @@ default_print_profile = 0.20mm NORMAL 0.6 nozzle
[printer:Original Prusa i3 MK2.5]
inherits = Original Prusa i3 MK2
printer_model = MK2.5
remaining_times = 1
start_gcode = M115 U3.3.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0
[printer:Original Prusa i3 MK2.5 0.25 nozzle]
inherits = Original Prusa i3 MK2 0.25 nozzle
printer_model = MK2.5
remaining_times = 1
start_gcode = M115 U3.3.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0
[printer:Original Prusa i3 MK2.5 0.6 nozzle]
inherits = Original Prusa i3 MK2 0.6 nozzle
printer_model = MK2.5
remaining_times = 1
start_gcode = M115 U3.3.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0
# XXXXXXXXXXXXXXXXX
@ -1160,6 +1168,7 @@ machine_max_jerk_z = 0.4,0.4
machine_min_extruding_rate = 0,0
machine_min_travel_rate = 0,0
silent_mode = 1
remaining_times = 1
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_PRUSA3D\nPRINTER_MODEL_MK3\n
retract_lift_below = 209
max_print_height = 210

View file

@ -440,10 +440,9 @@ void GCode::do_export(Print *print, const char *path, GCodePreviewData *preview_
}
fclose(file);
if (print->config.gcode_flavor.value == gcfMarlin)
if (print->config.remaining_times.value)
{
m_normal_time_estimator.post_process_remaining_times(path_tmp, 60.0f);
if (m_silent_time_estimator_enabled)
m_silent_time_estimator.post_process_remaining_times(path_tmp, 60.0f);
}
@ -525,8 +524,13 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Y, print.config.machine_max_jerk_y.values[1]);
m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Z, print.config.machine_max_jerk_z.values[1]);
m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::E, print.config.machine_max_jerk_e.values[1]);
m_silent_time_estimator.set_filament_load_times(print.config.filament_load_time.values);
m_silent_time_estimator.set_filament_unload_times(print.config.filament_unload_time.values);
}
}
// Filament load / unload times are not specific to a firmware flavor. Let anybody use it if they find it useful.
m_normal_time_estimator.set_filament_load_times(print.config.filament_load_time.values);
m_normal_time_estimator.set_filament_unload_times(print.config.filament_unload_time.values);
// resets analyzer
m_analyzer.reset();

View file

@ -114,6 +114,28 @@ void GCodeReader::parse_file(const std::string &file, callback_t callback)
this->parse_line(line, callback);
}
bool GCodeReader::GCodeLine::has(char axis) const
{
const char *c = m_raw.c_str();
// Skip the whitespaces.
c = skip_whitespaces(c);
// Skip the command.
c = skip_word(c);
// Up to the end of line or comment.
while (! is_end_of_gcode_line(*c)) {
// Skip whitespaces.
c = skip_whitespaces(c);
if (is_end_of_gcode_line(*c))
break;
// Check the name of the axis.
if (*c == axis)
return true;
// Skip the rest of the word.
c = skip_word(c);
}
return false;
}
bool GCodeReader::GCodeLine::has_value(char axis, float &value) const
{
const char *c = m_raw.c_str();

View file

@ -27,6 +27,7 @@ public:
bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; }
float value(Axis axis) const { return m_axis[axis]; }
bool has(char axis) const;
bool has_value(char axis, float &value) const;
float new_Z(const GCodeReader &reader) const { return this->has(Z) ? this->z() : reader.z(); }
float new_E(const GCodeReader &reader) const { return this->has(E) ? this->e() : reader.e(); }

View file

@ -469,6 +469,40 @@ namespace Slic3r {
return _state.minimum_travel_feedrate;
}
void GCodeTimeEstimator::set_filament_load_times(const std::vector<double> &filament_load_times)
{
_state.filament_load_times.clear();
for (double t : filament_load_times)
_state.filament_load_times.push_back(t);
}
void GCodeTimeEstimator::set_filament_unload_times(const std::vector<double> &filament_unload_times)
{
_state.filament_unload_times.clear();
for (double t : filament_unload_times)
_state.filament_unload_times.push_back(t);
}
float GCodeTimeEstimator::get_filament_load_time(unsigned int id_extruder)
{
return
(_state.filament_load_times.empty() || id_extruder == _state.extruder_id_unloaded) ?
0 :
(_state.filament_load_times.size() <= id_extruder) ?
_state.filament_load_times.front() :
_state.filament_load_times[id_extruder];
}
float GCodeTimeEstimator::get_filament_unload_time(unsigned int id_extruder)
{
return
(_state.filament_unload_times.empty() || id_extruder == _state.extruder_id_unloaded) ?
0 :
(_state.filament_unload_times.size() <= id_extruder) ?
_state.filament_unload_times.front() :
_state.filament_unload_times[id_extruder];
}
void GCodeTimeEstimator::set_extrude_factor_override_percentage(float percentage)
{
_state.extrude_factor_override_percentage = percentage;
@ -547,7 +581,9 @@ namespace Slic3r {
void GCodeTimeEstimator::reset_extruder_id()
{
_state.extruder_id = 0;
// Set the initial extruder ID to unknown. For the multi-material setup it means
// that all the filaments are parked in the MMU and no filament is loaded yet.
_state.extruder_id = _state.extruder_id_unloaded;
}
void GCodeTimeEstimator::add_additional_time(float timeSec)
@ -590,6 +626,9 @@ namespace Slic3r {
set_axis_max_acceleration(axis, DEFAULT_AXIS_MAX_ACCELERATION[a]);
set_axis_max_jerk(axis, DEFAULT_AXIS_MAX_JERK[a]);
}
_state.filament_load_times.clear();
_state.filament_unload_times.clear();
}
void GCodeTimeEstimator::reset()
@ -794,6 +833,11 @@ namespace Slic3r {
_processM566(line);
break;
}
case 702: // MK3 MMU2: Process the final filament unload.
{
_processM702(line);
break;
}
}
break;
@ -1258,6 +1302,19 @@ namespace Slic3r {
set_axis_max_jerk(E, line.e() * MMMIN_TO_MMSEC);
}
void GCodeTimeEstimator::_processM702(const GCodeReader::GCodeLine& line)
{
PROFILE_FUNC();
if (line.has('C')) {
// MK3 MMU2 specific M code:
// M702 C is expected to be sent by the custom end G-code when finalizing a print.
// The MK3 unit shall unload and park the active filament into the MMU2 unit.
add_additional_time(get_filament_unload_time(get_extruder_id()));
reset_extruder_id();
_simulate_st_synchronize();
}
}
void GCodeTimeEstimator::_processT(const GCodeReader::GCodeLine& line)
{
std::string cmd = line.cmd();
@ -1266,9 +1323,12 @@ namespace Slic3r {
unsigned int id = (unsigned int)::strtol(cmd.substr(1).c_str(), nullptr, 10);
if (get_extruder_id() != id)
{
// Specific to the MK3 MMU2: The initial extruder ID is set to -1 indicating
// that the filament is parked in the MMU2 unit and there is nothing to be unloaded yet.
add_additional_time(get_filament_unload_time(get_extruder_id()));
set_extruder_id(id);
// ADD PROCESSING HERE
add_additional_time(get_filament_load_time(get_extruder_id()));
_simulate_st_synchronize();
}
}
}

View file

@ -79,7 +79,14 @@ namespace Slic3r {
float minimum_feedrate; // mm/s
float minimum_travel_feedrate; // mm/s
float extrude_factor_override_percentage;
// Additional load / unload times for a filament exchange sequence.
std::vector<float> filament_load_times;
std::vector<float> filament_unload_times;
unsigned int g1_line_id;
// extruder_id is currently used to correctly calculate filament load / unload times
// into the total print time. This is currently only really used by the MK3 MMU2:
// Extruder id (-1) means no filament is loaded yet, all the filaments are parked in the MK3 MMU2 unit.
static const unsigned int extruder_id_unloaded = (unsigned int)-1;
unsigned int extruder_id;
};
@ -282,6 +289,11 @@ namespace Slic3r {
void set_minimum_travel_feedrate(float feedrate_mm_sec);
float get_minimum_travel_feedrate() const;
void set_filament_load_times(const std::vector<double> &filament_load_times);
void set_filament_unload_times(const std::vector<double> &filament_unload_times);
float get_filament_load_time(unsigned int id_extruder);
float get_filament_unload_time(unsigned int id_extruder);
void set_extrude_factor_override_percentage(float percentage);
float get_extrude_factor_override_percentage() const;
@ -388,6 +400,9 @@ namespace Slic3r {
// Set allowable instantaneous speed change
void _processM566(const GCodeReader::GCodeLine& line);
// Unload the current filament into the MK3 MMU2 unit at the end of print.
void _processM702(const GCodeReader::GCodeLine& line);
// Processes T line (Select Tool)
void _processT(const GCodeReader::GCodeLine& line);

View file

@ -920,8 +920,16 @@ PrintConfigDef::PrintConfigDef()
def->min = 0;
def->default_value = new ConfigOptionFloat(0.3);
def = this->add("remaining_times", coBool);
def->label = L("Supports remaining times");
def->tooltip = L("Emit M73 P[percent printed] R[remaining time in seconds] at 1 minute"
" intervals into the G-code to let the firmware show accurate remaining time."
" As of now only the Prusa i3 MK3 firmware recognizes M73."
" Also the i3 MK3 firmware supports M73 Qxx Sxx for the silent mode.");
def->default_value = new ConfigOptionBool(false);
def = this->add("silent_mode", coBool);
def->label = L("Support silent mode");
def->label = L("Supports silent mode");
def->tooltip = L("Set silent mode for the G-code flavor");
def->default_value = new ConfigOptionBool(true);

View file

@ -566,6 +566,7 @@ public:
ConfigOptionFloat cooling_tube_retraction;
ConfigOptionFloat cooling_tube_length;
ConfigOptionFloat parking_pos_retraction;
ConfigOptionBool remaining_times;
ConfigOptionBool silent_mode;
ConfigOptionFloat extra_loading_move;
@ -631,6 +632,7 @@ protected:
OPT_PTR(cooling_tube_retraction);
OPT_PTR(cooling_tube_length);
OPT_PTR(parking_pos_retraction);
OPT_PTR(remaining_times);
OPT_PTR(silent_mode);
OPT_PTR(extra_loading_move);
}

View file

@ -334,7 +334,7 @@ const std::vector<std::string>& Preset::printer_options()
"single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode",
"between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction",
"cooling_tube_length", "parking_pos_retraction", "extra_loading_move", "max_print_height", "default_print_profile", "inherits",
"silent_mode", "machine_max_acceleration_extruding", "machine_max_acceleration_retracting",
"remaining_times", "silent_mode", "machine_max_acceleration_extruding", "machine_max_acceleration_retracting",
"machine_max_acceleration_x", "machine_max_acceleration_y", "machine_max_acceleration_z", "machine_max_acceleration_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",

View file

@ -1610,6 +1610,7 @@ void TabPrinter::build()
optgroup = page->new_optgroup(_(L("Firmware")));
optgroup->append_single_option_line("gcode_flavor");
optgroup->append_single_option_line("silent_mode");
optgroup->append_single_option_line("remaining_times");
optgroup->m_on_change = [this, optgroup](t_config_option_key opt_key, boost::any value){
wxTheApp->CallAfter([this, opt_key, value](){