mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
preheat work - done
This commit is contained in:
parent
7d0fb4f42a
commit
447cc01405
13 changed files with 69 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Custom Printer",
|
"name": "Custom Printer",
|
||||||
"version": "02.01.03.00",
|
"version": "02.01.04.00",
|
||||||
"force_update": "0",
|
"force_update": "0",
|
||||||
"description": "My configurations",
|
"description": "My configurations",
|
||||||
"machine_model_list": [
|
"machine_model_list": [
|
||||||
|
|
|
@ -182,7 +182,7 @@
|
||||||
"purge_in_prime_tower": "0",
|
"purge_in_prime_tower": "0",
|
||||||
"machine_pause_gcode": "M601",
|
"machine_pause_gcode": "M601",
|
||||||
"machine_start_gcode": "PRINT_START TOOL_TEMP={first_layer_temperature[initial_tool]} {if is_extruder_used[0]}T0_TEMP={first_layer_temperature[0]}{endif} {if is_extruder_used[1]}T1_TEMP={first_layer_temperature[1]}{endif} {if is_extruder_used[2]}T2_TEMP={first_layer_temperature[2]}{endif} {if is_extruder_used[3]}T3_TEMP={first_layer_temperature[3]}{endif} {if is_extruder_used[4]}T4_TEMP={first_layer_temperature[4]}{endif} {if is_extruder_used[5]}T5_TEMP={first_layer_temperature[5]}{endif} BED_TEMP=[first_layer_bed_temperature] TOOL=[initial_tool]\n\n",
|
"machine_start_gcode": "PRINT_START TOOL_TEMP={first_layer_temperature[initial_tool]} {if is_extruder_used[0]}T0_TEMP={first_layer_temperature[0]}{endif} {if is_extruder_used[1]}T1_TEMP={first_layer_temperature[1]}{endif} {if is_extruder_used[2]}T2_TEMP={first_layer_temperature[2]}{endif} {if is_extruder_used[3]}T3_TEMP={first_layer_temperature[3]}{endif} {if is_extruder_used[4]}T4_TEMP={first_layer_temperature[4]}{endif} {if is_extruder_used[5]}T5_TEMP={first_layer_temperature[5]}{endif} BED_TEMP=[first_layer_bed_temperature] TOOL=[initial_tool]\n\n",
|
||||||
"change_filament_gcode": "M104 S{nozzle_temperature[next_extruder]} T[next_extruder] ; set new tool temperature so it can start heating while changing",
|
"change_filament_gcode": "",
|
||||||
"scan_first_layer": "0",
|
"scan_first_layer": "0",
|
||||||
"nozzle_type": "undefine",
|
"nozzle_type": "undefine",
|
||||||
"auxiliary_fan": "0"
|
"auxiliary_fan": "0"
|
||||||
|
|
|
@ -23,5 +23,9 @@
|
||||||
"enable_prime_tower": "1",
|
"enable_prime_tower": "1",
|
||||||
"wipe_tower_cone_angle": "25",
|
"wipe_tower_cone_angle": "25",
|
||||||
"wipe_tower_extra_spacing": "150%",
|
"wipe_tower_extra_spacing": "150%",
|
||||||
"wipe_tower_rotation_angle": "90"
|
"wipe_tower_rotation_angle": "90",
|
||||||
|
"ooze_prevention": "1",
|
||||||
|
"standby_temperature_delta": "-40",
|
||||||
|
"preheat_time": "30",
|
||||||
|
"preheat_steps": "1"
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Prusa",
|
"name": "Prusa",
|
||||||
"version": "02.01.01.30",
|
"version": "02.01.02.30",
|
||||||
"force_update": "0",
|
"force_update": "0",
|
||||||
"description": "Prusa configurations",
|
"description": "Prusa configurations",
|
||||||
"machine_model_list": [
|
"machine_model_list": [
|
||||||
|
|
|
@ -10,5 +10,7 @@
|
||||||
"wipe_tower_rotation_angle": "90",
|
"wipe_tower_rotation_angle": "90",
|
||||||
"single_extruder_multi_material_priming": "0",
|
"single_extruder_multi_material_priming": "0",
|
||||||
"ooze_prevention": "1",
|
"ooze_prevention": "1",
|
||||||
"standby_temperature_delta": "-40"
|
"standby_temperature_delta": "-40",
|
||||||
|
"preheat_time": "120",
|
||||||
|
"preheat_steps": "10"
|
||||||
}
|
}
|
|
@ -1058,7 +1058,12 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
||||||
|
|
||||||
// Orca:
|
// Orca:
|
||||||
m_is_XL_printer = is_XL_printer(config);
|
m_is_XL_printer = is_XL_printer(config);
|
||||||
m_result.backtrace_enabled = m_is_XL_printer || ( !m_single_extruder_multi_material && extruders_count > 1);
|
m_preheat_time = config.preheat_time;
|
||||||
|
m_preheat_steps = config.preheat_steps;
|
||||||
|
// sanity check
|
||||||
|
if(m_preheat_steps < 1)
|
||||||
|
m_preheat_steps = 1;
|
||||||
|
m_result.backtrace_enabled = m_preheat_time > 0 && (m_is_XL_printer || (!m_single_extruder_multi_material && extruders_count > 1));
|
||||||
|
|
||||||
m_extruder_offsets.resize(extruders_count);
|
m_extruder_offsets.resize(extruders_count);
|
||||||
m_extruder_colors.resize(extruders_count);
|
m_extruder_colors.resize(extruders_count);
|
||||||
|
@ -1570,6 +1575,8 @@ void GCodeProcessor::reset()
|
||||||
m_detect_layer_based_on_tag = false;
|
m_detect_layer_based_on_tag = false;
|
||||||
|
|
||||||
m_seams_count = 0;
|
m_seams_count = 0;
|
||||||
|
m_preheat_time = 0.f;
|
||||||
|
m_preheat_steps = 1;
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
m_mm3_per_mm_compare.reset();
|
m_mm3_per_mm_compare.reset();
|
||||||
|
@ -4465,7 +4472,7 @@ void GCodeProcessor::run_post_process()
|
||||||
struct Backtrace
|
struct Backtrace
|
||||||
{
|
{
|
||||||
float time{ 60.0f };
|
float time{ 60.0f };
|
||||||
unsigned int steps{ 10 };
|
int steps{ 10 };
|
||||||
float time_step() const { return time / float(steps); }
|
float time_step() const { return time / float(steps); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4601,11 +4608,18 @@ void GCodeProcessor::run_post_process()
|
||||||
void insert_lines(const Backtrace& backtrace, const std::string& cmd,
|
void insert_lines(const Backtrace& backtrace, const std::string& cmd,
|
||||||
std::function<std::string(unsigned int, const std::vector<float>&)> line_inserter,
|
std::function<std::string(unsigned int, const std::vector<float>&)> line_inserter,
|
||||||
std::function<std::string(const std::string&)> line_replacer) {
|
std::function<std::string(const std::string&)> line_replacer) {
|
||||||
|
// Orca: find start pos by seaching G28/G29/PRINT_START/START_PRINT commands
|
||||||
|
auto is_start_pos = [](const std::string& curr_cmd) {
|
||||||
|
return boost::iequals(curr_cmd, "G28")
|
||||||
|
|| boost::iequals(curr_cmd, "G29")
|
||||||
|
|| boost::iequals(curr_cmd, "PRINT_START")
|
||||||
|
|| boost::iequals(curr_cmd, "START_PRINT");
|
||||||
|
};
|
||||||
assert(!m_lines.empty());
|
assert(!m_lines.empty());
|
||||||
const float time_step = backtrace.time_step();
|
const float time_step = backtrace.time_step();
|
||||||
size_t rev_it_dist = 0; // distance from the end of the cache of the starting point of the backtrace
|
size_t rev_it_dist = 0; // distance from the end of the cache of the starting point of the backtrace
|
||||||
float last_time_insertion = 0.0f; // used to avoid inserting two lines at the same time
|
float last_time_insertion = 0.0f; // used to avoid inserting two lines at the same time
|
||||||
for (unsigned int i = 0; i < backtrace.steps; ++i) {
|
for (int i = 0; i < backtrace.steps; ++i) {
|
||||||
const float backtrace_time_i = (i + 1) * time_step;
|
const float backtrace_time_i = (i + 1) * time_step;
|
||||||
const float time_threshold_i = m_times[Normal] - backtrace_time_i;
|
const float time_threshold_i = m_times[Normal] - backtrace_time_i;
|
||||||
auto rev_it = m_lines.rbegin() + rev_it_dist;
|
auto rev_it = m_lines.rbegin() + rev_it_dist;
|
||||||
|
@ -4613,18 +4627,15 @@ void GCodeProcessor::run_post_process()
|
||||||
|
|
||||||
std::string curr_cmd = GCodeReader::GCodeLine::extract_cmd(rev_it->line);
|
std::string curr_cmd = GCodeReader::GCodeLine::extract_cmd(rev_it->line);
|
||||||
// backtrace into the cache to find the place where to insert the line
|
// backtrace into the cache to find the place where to insert the line
|
||||||
while (rev_it != m_lines.rend() && rev_it->times[Normal] > time_threshold_i && curr_cmd != cmd && curr_cmd != "G28" && curr_cmd != "G29") {
|
while (rev_it != m_lines.rend() && rev_it->times[Normal] > time_threshold_i && curr_cmd != cmd && !is_start_pos(curr_cmd)) {
|
||||||
rev_it->line = line_replacer(rev_it->line);
|
rev_it->line = line_replacer(rev_it->line);
|
||||||
++rev_it;
|
++rev_it;
|
||||||
if (rev_it != m_lines.rend())
|
if (rev_it != m_lines.rend())
|
||||||
curr_cmd = GCodeReader::GCodeLine::extract_cmd(rev_it->line);
|
curr_cmd = GCodeReader::GCodeLine::extract_cmd(rev_it->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we met the previous evenience of cmd, or a G28/G29 command. stop inserting lines
|
// we met the previous evenience of cmd, or the start position, stop inserting lines
|
||||||
// Orca: 1. Use boost::iequals to handle g28/g29 cases
|
if (rev_it != m_lines.rend() && (curr_cmd == cmd || is_start_pos(curr_cmd)))
|
||||||
// 2. Handle PRINT_START and START_PRINT to the stop condition
|
|
||||||
if (rev_it != m_lines.rend() && (curr_cmd == cmd || boost::iequals(curr_cmd, "G28") || boost::iequals(curr_cmd, "G29") ||
|
|
||||||
boost::iequals(curr_cmd, "PRINT_START") || boost::iequals(curr_cmd, "START_PRINT")))
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// insert the line for the current step
|
// insert the line for the current step
|
||||||
|
@ -4970,8 +4981,8 @@ void GCodeProcessor::run_post_process()
|
||||||
out += " S" + std::to_string(temperature) + "\n";
|
out += " S" + std::to_string(temperature) + "\n";
|
||||||
return out;
|
return out;
|
||||||
} else {
|
} else {
|
||||||
std::string comment = "preheat tool " + std::to_string(tool_number) +
|
std::string comment = "preheat T" + std::to_string(tool_number) +
|
||||||
"time: " + std::to_string(std::round(time_diffs[0])) + "s";
|
" time: " + std::to_string((int) std::round(time_diffs[0])) + "s";
|
||||||
return GCodeWriter::set_temperature(temperature, this->m_flavor, false, tool_number, comment);
|
return GCodeWriter::set_temperature(temperature, this->m_flavor, false, tool_number, comment);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -4983,7 +4994,7 @@ void GCodeProcessor::run_post_process()
|
||||||
reader.parse_line(line, [&gline](GCodeReader& reader, const GCodeReader::GCodeLine& l) { gline = l; });
|
reader.parse_line(line, [&gline](GCodeReader& reader, const GCodeReader::GCodeLine& l) { gline = l; });
|
||||||
|
|
||||||
float val;
|
float val;
|
||||||
if (gline.has_value('T', val) && gline.raw().find("cooldown") != std::string::npos && m_is_XL_printer) {
|
if (gline.has_value('T', val) && gline.raw().find("cooldown") != std::string::npos) {
|
||||||
if (static_cast<int>(val) == tool_number)
|
if (static_cast<int>(val) == tool_number)
|
||||||
return std::string("; removed M104\n");
|
return std::string("; removed M104\n");
|
||||||
}
|
}
|
||||||
|
@ -4998,7 +5009,7 @@ void GCodeProcessor::run_post_process()
|
||||||
|
|
||||||
unsigned int line_id = 0;
|
unsigned int line_id = 0;
|
||||||
// Backtrace data for Tx gcode lines
|
// Backtrace data for Tx gcode lines
|
||||||
static const ExportLines::Backtrace backtrace_T = { 120.0f, 10 };
|
const ExportLines::Backtrace backtrace_T = { m_preheat_time, m_preheat_steps };
|
||||||
// In case there are multiple sources of backtracing, keeps track of the longest backtrack time needed
|
// In case there are multiple sources of backtracing, keeps track of the longest backtrack time needed
|
||||||
// to flush the backtrace cache accordingly
|
// to flush the backtrace cache accordingly
|
||||||
float max_backtrace_time = 120.0f;
|
float max_backtrace_time = 120.0f;
|
||||||
|
|
|
@ -731,6 +731,8 @@ class Print;
|
||||||
bool m_detect_layer_based_on_tag {false};
|
bool m_detect_layer_based_on_tag {false};
|
||||||
int m_seams_count;
|
int m_seams_count;
|
||||||
bool m_single_extruder_multi_material;
|
bool m_single_extruder_multi_material;
|
||||||
|
float m_preheat_time;
|
||||||
|
int m_preheat_steps;
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time;
|
std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time;
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
|
@ -784,7 +784,7 @@ static std::vector<std::string> s_Preset_print_options {
|
||||||
"support_top_z_distance", "support_on_build_plate_only","support_critical_regions_only", "bridge_no_support", "thick_bridges", "thick_internal_bridges","dont_filter_internal_bridges", "max_bridge_length", "print_sequence", "print_order", "support_remove_small_overhang",
|
"support_top_z_distance", "support_on_build_plate_only","support_critical_regions_only", "bridge_no_support", "thick_bridges", "thick_internal_bridges","dont_filter_internal_bridges", "max_bridge_length", "print_sequence", "print_order", "support_remove_small_overhang",
|
||||||
"filename_format", "wall_filament", "support_bottom_z_distance",
|
"filename_format", "wall_filament", "support_bottom_z_distance",
|
||||||
"sparse_infill_filament", "solid_infill_filament", "support_filament", "support_interface_filament","support_interface_not_for_body",
|
"sparse_infill_filament", "solid_infill_filament", "support_filament", "support_interface_filament","support_interface_not_for_body",
|
||||||
"ooze_prevention", "standby_temperature_delta", "interface_shells", "line_width", "initial_layer_line_width",
|
"ooze_prevention", "standby_temperature_delta", "preheat_time","preheat_steps", "interface_shells", "line_width", "initial_layer_line_width",
|
||||||
"inner_wall_line_width", "outer_wall_line_width", "sparse_infill_line_width", "internal_solid_infill_line_width",
|
"inner_wall_line_width", "outer_wall_line_width", "sparse_infill_line_width", "internal_solid_infill_line_width",
|
||||||
"top_surface_line_width", "support_line_width", "infill_wall_overlap","top_bottom_infill_wall_overlap", "bridge_flow", "internal_bridge_flow",
|
"top_surface_line_width", "support_line_width", "infill_wall_overlap","top_bottom_infill_wall_overlap", "bridge_flow", "internal_bridge_flow",
|
||||||
"elefant_foot_compensation", "elefant_foot_compensation_layers", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower",
|
"elefant_foot_compensation", "elefant_foot_compensation_layers", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower",
|
||||||
|
|
|
@ -161,6 +161,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
||||||
"use_firmware_retraction",
|
"use_firmware_retraction",
|
||||||
"slow_down_layer_time",
|
"slow_down_layer_time",
|
||||||
"standby_temperature_delta",
|
"standby_temperature_delta",
|
||||||
|
"preheat_time",
|
||||||
|
"preheat_steps",
|
||||||
"machine_start_gcode",
|
"machine_start_gcode",
|
||||||
"filament_start_gcode",
|
"filament_start_gcode",
|
||||||
"change_filament_gcode",
|
"change_filament_gcode",
|
||||||
|
|
|
@ -4079,6 +4079,26 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionInt(-5));
|
def->set_default_value(new ConfigOptionInt(-5));
|
||||||
|
|
||||||
|
def = this->add("preheat_time", coFloat);
|
||||||
|
def->label = L("Preheat time");
|
||||||
|
def->tooltip = L("To reduce the waiting time after tool change, Orca can preheat the next tool while the current tool is still in use. "
|
||||||
|
"This setting specifies the time in seconds to preheat the next tool. Orca will insert a M104 command to preheat the tool in advance.");
|
||||||
|
def->sidetext = "s";
|
||||||
|
def->min = 0;
|
||||||
|
def->max = 120;
|
||||||
|
def->mode = comAdvanced;
|
||||||
|
def->set_default_value(new ConfigOptionFloat(30.0));
|
||||||
|
|
||||||
|
def = this->add("preheat_steps", coInt);
|
||||||
|
def->label = L("Preheat steps");
|
||||||
|
def->tooltip = L("Insert multiple preheat commands(e.g. M104.1). Only useful for Prusa XL. For other printers, please set it to 1.");
|
||||||
|
// def->sidetext = "";
|
||||||
|
def->min = 1;
|
||||||
|
def->max = 10;
|
||||||
|
def->mode = comDevelop;
|
||||||
|
def->set_default_value(new ConfigOptionInt(1));
|
||||||
|
|
||||||
|
|
||||||
def = this->add("machine_start_gcode", coString);
|
def = this->add("machine_start_gcode", coString);
|
||||||
def->label = L("Start G-code");
|
def->label = L("Start G-code");
|
||||||
def->tooltip = L("Start G-code when start the whole printing");
|
def->tooltip = L("Start G-code when start the whole printing");
|
||||||
|
|
|
@ -1225,6 +1225,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||||
((ConfigOptionBool, spiral_mode_smooth))
|
((ConfigOptionBool, spiral_mode_smooth))
|
||||||
((ConfigOptionFloatOrPercent, spiral_mode_max_xy_smoothing))
|
((ConfigOptionFloatOrPercent, spiral_mode_max_xy_smoothing))
|
||||||
((ConfigOptionInt, standby_temperature_delta))
|
((ConfigOptionInt, standby_temperature_delta))
|
||||||
|
((ConfigOptionFloat, preheat_time))
|
||||||
|
((ConfigOptionInt, preheat_steps))
|
||||||
((ConfigOptionInts, nozzle_temperature))
|
((ConfigOptionInts, nozzle_temperature))
|
||||||
((ConfigOptionBools, wipe))
|
((ConfigOptionBools, wipe))
|
||||||
// BBS
|
// BBS
|
||||||
|
|
|
@ -667,7 +667,10 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
|
||||||
toggle_field("print_order", !have_sequential_printing);
|
toggle_field("print_order", !have_sequential_printing);
|
||||||
|
|
||||||
bool have_ooze_prevention = config->opt_bool("ooze_prevention");
|
bool have_ooze_prevention = config->opt_bool("ooze_prevention");
|
||||||
toggle_field("standby_temperature_delta", have_ooze_prevention);
|
toggle_line("standby_temperature_delta", have_ooze_prevention);
|
||||||
|
toggle_line("preheat_time", have_ooze_prevention);
|
||||||
|
int preheat_steps = config->opt_int("preheat_steps");
|
||||||
|
toggle_line("preheat_steps", have_ooze_prevention && (preheat_steps > 0));
|
||||||
|
|
||||||
bool have_prime_tower = config->opt_bool("enable_prime_tower");
|
bool have_prime_tower = config->opt_bool("enable_prime_tower");
|
||||||
for (auto el : { "prime_tower_width", "prime_tower_brim_width"})
|
for (auto el : { "prime_tower_width", "prime_tower_brim_width"})
|
||||||
|
|
|
@ -2299,6 +2299,8 @@ void TabPrint::build()
|
||||||
optgroup = page->new_optgroup(L("Ooze prevention"));
|
optgroup = page->new_optgroup(L("Ooze prevention"));
|
||||||
optgroup->append_single_option_line("ooze_prevention");
|
optgroup->append_single_option_line("ooze_prevention");
|
||||||
optgroup->append_single_option_line("standby_temperature_delta");
|
optgroup->append_single_option_line("standby_temperature_delta");
|
||||||
|
optgroup->append_single_option_line("preheat_time");
|
||||||
|
optgroup->append_single_option_line("preheat_steps");
|
||||||
|
|
||||||
optgroup = page->new_optgroup(L("Flush options"), L"param_flush");
|
optgroup = page->new_optgroup(L("Flush options"), L"param_flush");
|
||||||
optgroup->append_single_option_line("flush_into_infill", "reduce-wasting-during-filament-change#wipe-into-infill");
|
optgroup->append_single_option_line("flush_into_infill", "reduce-wasting-during-filament-change#wipe-into-infill");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue