mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-02 20:51:23 -07:00
ENH: refine global bed type config logic
Add default type to plate bed types. Signed-off-by: yifan.wu <yifan.wu@bambulab.com> Change-Id: I26f3a64dba4a19b0d882b828f1ee54c84df1879c (cherry picked from commit 1ebed465d2b3bcd482dd4ba7a5930b721c79fc13)
This commit is contained in:
parent
3b3ad1b390
commit
d152b4d235
11 changed files with 109 additions and 100 deletions
|
|
@ -2037,17 +2037,11 @@ void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
|
|||
}
|
||||
|
||||
// BBS
|
||||
void GCode::get_bed_temperature(const int extruder_id, const bool is_first_layer, std::vector<int>& temps_per_bed, int& default_temp) const
|
||||
int GCode::get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const
|
||||
{
|
||||
temps_per_bed.resize((int)BedType::btCount, 0);
|
||||
for (int bed_type = 0; bed_type < BedType::btCount; bed_type++) {
|
||||
std::string bed_temp_key = is_first_layer ? get_bed_temp_1st_layer_key((BedType)bed_type) : get_bed_temp_key((BedType)bed_type);
|
||||
const ConfigOptionInts* bed_temp_opt = m_config.option<ConfigOptionInts>(bed_temp_key);
|
||||
|
||||
temps_per_bed[bed_type] = bed_temp_opt->get_at(extruder_id);
|
||||
if (bed_type == m_config.curr_bed_type)
|
||||
default_temp = temps_per_bed[bed_type];
|
||||
}
|
||||
std::string bed_temp_key = is_first_layer ? get_bed_temp_1st_layer_key(bed_type) : get_bed_temp_key(bed_type);
|
||||
const ConfigOptionInts* bed_temp_opt = m_config.option<ConfigOptionInts>(bed_temp_key);
|
||||
return bed_temp_opt->get_at(extruder_id);
|
||||
}
|
||||
|
||||
// Write 1st layer bed temperatures into the G-code.
|
||||
|
|
@ -2059,8 +2053,7 @@ void GCode::_print_first_layer_bed_temperature(GCodeOutputStream &file, Print &p
|
|||
// Initial bed temperature based on the first extruder.
|
||||
// BBS
|
||||
std::vector<int> temps_per_bed;
|
||||
int default_temp = 0;
|
||||
get_bed_temperature(first_printing_extruder_id, true, temps_per_bed, default_temp);
|
||||
int bed_temp = get_bed_temperature(first_printing_extruder_id, true, print.config().curr_bed_type);
|
||||
|
||||
// Is the bed temperature set by the provided custom G-code?
|
||||
int temp_by_gcode = -1;
|
||||
|
|
@ -2073,7 +2066,7 @@ void GCode::_print_first_layer_bed_temperature(GCodeOutputStream &file, Print &p
|
|||
|
||||
// Always call m_writer.set_bed_temperature() so it will set the internal "current" state of the bed temp as if
|
||||
// the custom start G-code emited these.
|
||||
std::string set_temp_gcode = m_writer.set_bed_temperature(temps_per_bed, default_temp, wait);
|
||||
std::string set_temp_gcode = m_writer.set_bed_temperature(bed_temp, wait);
|
||||
if (! temp_set_by_gcode)
|
||||
file.write(set_temp_gcode);
|
||||
}
|
||||
|
|
@ -2528,10 +2521,8 @@ GCode::LayerResult GCode::process_layer(
|
|||
}
|
||||
|
||||
// BBS
|
||||
std::vector<int> temps_per_bed;
|
||||
int default_temp = 0;
|
||||
get_bed_temperature(first_extruder_id, false, temps_per_bed, default_temp);
|
||||
gcode += m_writer.set_bed_temperature(temps_per_bed, default_temp);
|
||||
int bed_temp = get_bed_temperature(first_extruder_id, false, print.config().curr_bed_type);
|
||||
gcode += m_writer.set_bed_temperature(bed_temp);
|
||||
// Mark the temperature transition from 1st to 2nd layer to be finished.
|
||||
m_second_layer_things_done = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ private:
|
|||
static bool gcode_label_objects;
|
||||
|
||||
// BBS
|
||||
void get_bed_temperature(const int extruder_id, const bool is_first_layer, std::vector<int>& temps_per_bed, int& default_temp) const;
|
||||
int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const;
|
||||
|
||||
std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1);
|
||||
void print_machine_envelope(GCodeOutputStream &file, Print &print);
|
||||
|
|
|
|||
|
|
@ -120,13 +120,12 @@ std::string GCodeWriter::set_temperature(unsigned int temperature, bool wait, in
|
|||
}
|
||||
|
||||
// BBS
|
||||
std::string GCodeWriter::set_bed_temperature(std::vector<int> temps_per_bed, int default_temp, bool wait)
|
||||
std::string GCodeWriter::set_bed_temperature(int temperature, bool wait)
|
||||
{
|
||||
if (temps_per_bed == m_last_bed_temperature && (! wait || m_last_bed_temperature_reached))
|
||||
if (temperature == m_last_bed_temperature && (! wait || m_last_bed_temperature_reached))
|
||||
return std::string();
|
||||
|
||||
bool target_temp_changed = (temps_per_bed != m_last_bed_temperature);
|
||||
m_last_bed_temperature = temps_per_bed;
|
||||
m_last_bed_temperature = temperature;
|
||||
m_last_bed_temperature_reached = wait;
|
||||
|
||||
std::string code, comment;
|
||||
|
|
@ -141,7 +140,7 @@ std::string GCodeWriter::set_bed_temperature(std::vector<int> temps_per_bed, int
|
|||
comment = "set bed temperature";
|
||||
}
|
||||
|
||||
gcode << code << " S" << default_temp << " ; " << comment << "\n";
|
||||
gcode << code << " S" << temperature << " ; " << comment << "\n";
|
||||
return gcode.str();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,7 @@ public:
|
|||
std::string preamble();
|
||||
std::string postamble() const;
|
||||
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const;
|
||||
// BBS
|
||||
std::string set_bed_temperature(std::vector<int> temps_per_bed, int default_temp, bool wait = false);
|
||||
std::string set_bed_temperature(int temperature, bool wait = false);
|
||||
std::string set_acceleration(unsigned int acceleration);
|
||||
std::string reset_e(bool force = false);
|
||||
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false) const;
|
||||
|
|
@ -106,8 +105,7 @@ private:
|
|||
unsigned int m_max_acceleration;
|
||||
//BBS
|
||||
unsigned int m_last_additional_fan_speed;
|
||||
// BBS
|
||||
std::vector<int> m_last_bed_temperature;
|
||||
int m_last_bed_temperature;
|
||||
bool m_last_bed_temperature_reached;
|
||||
double m_lifted;
|
||||
|
||||
|
|
|
|||
|
|
@ -269,10 +269,11 @@ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(OverhangFanThreshold)
|
|||
|
||||
// BBS
|
||||
static const t_config_enum_values s_keys_map_BedType = {
|
||||
{ "Default Plate", btDefault },
|
||||
{ "Cool Plate", btPC },
|
||||
{ "Engineering Plate", btEP },
|
||||
{ "High Temp Plate", btPEI },
|
||||
{ "Textured PEI Plate", btPTE }
|
||||
{ "Textured PEI Plate", btPTE }
|
||||
};
|
||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(BedType)
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,8 @@ enum OverhangFanThreshold {
|
|||
|
||||
// BBS
|
||||
enum BedType {
|
||||
btPC = 0,
|
||||
btDefault = 0,
|
||||
btPC,
|
||||
btEP,
|
||||
btPEI,
|
||||
btPTE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue