Allow default_bed_type to be defined in machine profile

update some profiles
This commit is contained in:
SoftFever
2025-08-09 10:17:00 +08:00
parent b84fe5561a
commit aacbcab468
22 changed files with 27 additions and 59 deletions

View File

@@ -754,8 +754,17 @@ BedType Preset::get_default_bed_type(PresetBundle* preset_bundle)
if (config.has("default_bed_type") && !config.opt_string("default_bed_type").empty()) {
try {
std::string str_bed_type = config.opt_string("default_bed_type");
// Try parsing as integer first (legacy format)
int bed_type_value = atoi(str_bed_type.c_str());
return BedType(bed_type_value);
if (bed_type_value > 0) {
return BedType(bed_type_value);
}
else {
BOOST_LOG_TRIVIAL(error) << "default_bed_type: invalid bed type: " << str_bed_type;
}
return BedType::btPEI;
} catch(...) {
;
}
@@ -766,8 +775,6 @@ BedType Preset::get_default_bed_type(PresetBundle* preset_bundle)
return BedType::btPC;
} else if (model_id == "C11") {
return BedType::btPEI;
}else if (model_id == "Elegoo-CC" || model_id == "Elegoo-C") {//set default bed type to PTE for Elegoo-CC
return BedType::btPTE;
}
return BedType::btPEI;
}
@@ -906,7 +913,7 @@ static std::vector<std::string> s_Preset_printer_options {
"cooling_tube_retraction",
"cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "purge_in_prime_tower", "enable_filament_ramming",
"z_offset",
"disable_m73", "preferred_orientation", "emit_machine_limits_to_gcode", "pellet_modded_printer", "support_multi_bed_types","bed_mesh_min","bed_mesh_max","bed_mesh_probe_distance", "adaptive_bed_mesh_margin", "enable_long_retraction_when_cut","long_retractions_when_cut","retraction_distances_when_cut"
"disable_m73", "preferred_orientation", "emit_machine_limits_to_gcode", "pellet_modded_printer", "support_multi_bed_types", "default_bed_type", "bed_mesh_min","bed_mesh_max","bed_mesh_probe_distance", "adaptive_bed_mesh_margin", "enable_long_retraction_when_cut","long_retractions_when_cut","retraction_distances_when_cut"
};
static std::vector<std::string> s_Preset_sla_print_options {

View File

@@ -839,6 +839,14 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.emplace_back(L("Cool Plate (SuperTack)"));
def->set_default_value(new ConfigOptionEnum<BedType>(btPC));
// Orca: allow profile maker to set default bed type in machine profile
// This option won't be shown in the UI
def = this->add("default_bed_type", coString);
def->label = L("Default bed type");
def->tooltip = L("Default bed type for the printer (supports both numeric and string format).");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionString());
// BBS
def = this->add("first_layer_print_sequence", coInts);
def->label = L("First layer print sequence");

View File

@@ -727,27 +727,6 @@ void ConfigOptionsGroup::on_kill_focus(const std::string& opt_key)
void ConfigOptionsGroup::reload_config()
{
#if 0
// BBS
auto bed_type_field = this->get_field("bed_type");
int default_bed_type = BedType::btPC;
if (bed_type_field != nullptr) {
auto iter = m_opt_map.find("bed_temperature");
const ConfigOptionDef& option = m_options.at("bed_temperature").opt;
if (iter != m_opt_map.end()) {
for (int bed_type = BedType::btPC; bed_type < BedType::btCount; bed_type++) {
int bed_temp = boost::any_cast<int>(config_value("bed_temperature", bed_type, option.gui_flags == "serialized"));
if (bed_temp != 0) {
default_bed_type = bed_type;
break;
}
}
}
bed_type_field->set_value(default_bed_type, false);
}
#endif
for (auto &kvp : m_opt_map) {
// Name of the option field (name of the configuration key, possibly suffixed with '#' and the index of a scalar inside a vector.
const std::string &opt_id = kvp.first;
@@ -756,11 +735,6 @@ void ConfigOptionsGroup::reload_config()
// index in the vector option, zero for scalars
int opt_index = kvp.second.second;
const ConfigOptionDef &option = m_options.at(opt_id).opt;
#if 0
// BBS
if ((opt_id == "bed_temperature" || opt_id == "bed_temperature_initial_layer") && bed_type_field != nullptr)
opt_index = default_bed_type;
#endif
this->set_value(opt_id, config_value(opt_key, opt_index, option.gui_flags == "serialized"));
}
}