mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-25 00:58:35 -07:00
FIX: wrong bed temp in placeholder
1.Also add a new field to mark whether enable high low temp mix jira: NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I208e0e7a4ce75feccc8659ecf940447e591d9505 (cherry picked from commit e79ba2f1ec64953100319a3d86ef9105cc7c3567)
This commit is contained in:
parent
3f72cc15df
commit
dd3c63bef0
2 changed files with 22 additions and 10 deletions
|
|
@ -2594,18 +2594,25 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
max_chamber_temp = std::max(max_chamber_temp, m_config.chamber_temperature.get_at(extruder.id()));
|
||||
}
|
||||
{
|
||||
int curr_bed_type = m_config.curr_bed_type.getInt();
|
||||
BedType curr_bed_type = m_config.curr_bed_type;
|
||||
|
||||
std::string first_layer_bed_temp_str;
|
||||
const ConfigOptionInts* first_bed_temp_opt = m_config.option<ConfigOptionInts>(get_bed_temp_1st_layer_key((BedType)curr_bed_type));
|
||||
const ConfigOptionInts* bed_temp_opt = m_config.option<ConfigOptionInts>(get_bed_temp_key((BedType)curr_bed_type));
|
||||
int target_bed_temp=0;
|
||||
if (m_config.bed_temperature_formula == BedTempFormula::btfHighestTemp)
|
||||
target_bed_temp = get_highest_bed_temperature(true, print);
|
||||
else
|
||||
target_bed_temp = get_bed_temperature(initial_extruder_id, true,curr_bed_type);
|
||||
|
||||
this->placeholder_parser().set("bbl_bed_temperature_gcode", new ConfigOptionBool(false));
|
||||
this->placeholder_parser().set("bed_temperature_initial_layer", new ConfigOptionInts(*first_bed_temp_opt));
|
||||
this->placeholder_parser().set("bed_temperature", new ConfigOptionInts(*bed_temp_opt));
|
||||
this->placeholder_parser().set("bed_temperature_initial_layer_single", new ConfigOptionInt(first_bed_temp_opt->get_at(initial_extruder_id)));
|
||||
this->placeholder_parser().set("bed_temperature_initial_layer_single", new ConfigOptionInt(target_bed_temp));
|
||||
this->placeholder_parser().set("bed_temperature_initial_layer_vector", new ConfigOptionString());
|
||||
this->placeholder_parser().set("chamber_temperature",new ConfigOptionInts(m_config.chamber_temperature));
|
||||
this->placeholder_parser().set("overall_chamber_temperature", new ConfigOptionInt(max_chamber_temp));
|
||||
this->placeholder_parser().set("enable_high_low_temp_mix", new ConfigOptionBool(!print.need_check_multi_filaments_compatibility()));
|
||||
|
||||
// SoftFever: support variables `first_layer_temperature` and `first_layer_bed_temperature`
|
||||
this->placeholder_parser().set("first_layer_bed_temperature", new ConfigOptionInts(*first_bed_temp_opt));
|
||||
|
|
@ -3497,6 +3504,15 @@ int GCode::get_bed_temperature(const int extruder_id, const bool is_first_layer,
|
|||
return bed_temp_opt->get_at(extruder_id);
|
||||
}
|
||||
|
||||
int GCode::get_highest_bed_temperature(const bool is_first_layer, const Print& print) const
|
||||
{
|
||||
auto bed_type = m_config.curr_bed_type;
|
||||
int bed_temp = 0;
|
||||
for (auto fidx : print.get_slice_used_filaments(is_first_layer)) {
|
||||
bed_temp = std::max(bed_temp, get_bed_temperature(fidx, is_first_layer, bed_type));
|
||||
}
|
||||
return bed_temp;
|
||||
}
|
||||
|
||||
// Write 1st layer bed temperatures into the G-code.
|
||||
// Only do that if the start G-code does not already contain any M-code controlling an extruder temperature.
|
||||
|
|
@ -3509,9 +3525,7 @@ void GCode::_print_first_layer_bed_temperature(GCodeOutputStream &file, Print &p
|
|||
std::vector<int> temps_per_bed;
|
||||
int bed_temp = 0;
|
||||
if (m_config.bed_temperature_formula.value == BedTempFormula::btfHighestTemp) {
|
||||
for (auto fidx : print.get_slice_used_filaments(true)) {
|
||||
bed_temp = std::max(bed_temp, get_bed_temperature(fidx, true, print.config().curr_bed_type));
|
||||
}
|
||||
bed_temp = get_highest_bed_temperature(true, print);
|
||||
}
|
||||
else {
|
||||
bed_temp = get_bed_temperature(first_printing_extruder_id, true, print.config().curr_bed_type);
|
||||
|
|
@ -4207,11 +4221,8 @@ LayerResult GCode::process_layer(
|
|||
|
||||
// BBS
|
||||
int bed_temp = 0;
|
||||
if (m_config.bed_temperature_formula == BedTempFormula::btfHighestTemp) {
|
||||
for (auto fidx : print.get_slice_used_filaments(false)) {
|
||||
bed_temp = std::max(bed_temp, get_bed_temperature(fidx, false, m_config.curr_bed_type));
|
||||
}
|
||||
}
|
||||
if (m_config.bed_temperature_formula == BedTempFormula::btfHighestTemp)
|
||||
bed_temp = get_highest_bed_temperature(false,print);
|
||||
else
|
||||
bed_temp = get_bed_temperature(first_extruder_id, false, m_config.curr_bed_type);
|
||||
gcode += m_writer.set_bed_temperature(bed_temp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue