Merge branch lm_colorprint_integration into dev_native + deleting ticks outside slider range

This commit is contained in:
Lukas Matena 2018-11-07 14:44:47 +01:00
parent 69208c4f43
commit 9ca9e2a545
9 changed files with 89 additions and 2 deletions

View file

@ -601,6 +601,9 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
this->apply_print_config(print.config());
this->set_extruders(print.extruders());
// Initialize colorprint.
m_colorprint_heights = cast<float>(print.config().colorprint_heights.values);
// Initialize autospeed.
{
// get the minimum cross-section used in the print
@ -1319,6 +1322,18 @@ void GCode::process_layer(
m_second_layer_things_done = true;
}
// Let's issue a filament change command if requested at this layer.
// In case there are more toolchange requests that weren't done yet and should happen simultaneously, erase them all.
// (Layers can be close to each other, model could have been resliced with bigger layer height, ...).
bool colorprint_change = false;
while (!m_colorprint_heights.empty() && m_colorprint_heights.front()-EPSILON < layer.print_z) {
m_colorprint_heights.erase(m_colorprint_heights.begin());
colorprint_change = true;
}
if (colorprint_change)
gcode += "M600\n";
// Extrude skirt at the print_z of the raft layers and normal object layers
// not at the print_z of the interlaced support material layers.
bool extrude_skirt =

View file

@ -317,6 +317,9 @@ protected:
bool m_second_layer_things_done;
// Index of a last object copy extruded.
std::pair<const PrintObject*, Point> m_last_obj_copy;
// Layer heights for colorprint - updated before the export and erased during the process
// so no toolchange occurs twice.
std::vector<float> m_colorprint_heights;
// Time estimators
GCodeTimeEstimator m_normal_time_estimator;

View file

@ -124,6 +124,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
"between_objects_gcode",
"bridge_acceleration",
"bridge_fan_speed",
"colorprint_heights",
"cooling",
"default_acceleration",
"deretract_speed",

View file

@ -192,6 +192,12 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->default_value = new ConfigOptionBool(false);
def = this->add("colorprint_heights", coFloats);
def->label = L("Colorprint height");
def->tooltip = L("Heights at which a filament change is to occur. ");
def->cli = "colorprint-heights=f@";
def->default_value = new ConfigOptionFloats { };
def = this->add("compatible_printers", coStrings);
def->label = L("Compatible printers");
def->mode = comAdvanced;

View file

@ -704,6 +704,7 @@ public:
ConfigOptionInts bridge_fan_speed;
ConfigOptionFloat brim_width;
ConfigOptionBool complete_objects;
ConfigOptionFloats colorprint_heights;
ConfigOptionBools cooling;
ConfigOptionFloat default_acceleration;
ConfigOptionInts disable_fan_first_layers;
@ -781,6 +782,7 @@ protected:
OPT_PTR(bridge_fan_speed);
OPT_PTR(brim_width);
OPT_PTR(complete_objects);
OPT_PTR(colorprint_heights);
OPT_PTR(cooling);
OPT_PTR(default_acceleration);
OPT_PTR(disable_fan_first_layers);