Fix issues with supertack bed type (#8468)
- Fix crash when selected bed type is not supported by current version. This could happen if you downgrade Orca to old version that does not have that bed type. - For example, if you ever run 2.3.0-beta and having current bed type set to the last one from the drop down, then if you use 2.2 again the app will crash during startup. - This PR fix this by falling back to default bed type if current value is out of range. - This PR also fixes issue that current bed type is changed after upgrading to 2.3 from previous version, due to adding the supertack in the wrong place in the enum.
This commit is contained in:
commit
be8bf54884
3 changed files with 7 additions and 5 deletions
|
@ -804,18 +804,18 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->mode = comSimple;
|
def->mode = comSimple;
|
||||||
def->enum_keys_map = &s_keys_map_BedType;
|
def->enum_keys_map = &s_keys_map_BedType;
|
||||||
// Orca: make sure the order of the values is the same as the BedType enum
|
// Orca: make sure the order of the values is the same as the BedType enum
|
||||||
def->enum_values.emplace_back("Supertack Plate");
|
|
||||||
def->enum_values.emplace_back("Cool Plate");
|
def->enum_values.emplace_back("Cool Plate");
|
||||||
def->enum_values.emplace_back("Engineering Plate");
|
def->enum_values.emplace_back("Engineering Plate");
|
||||||
def->enum_values.emplace_back("High Temp Plate");
|
def->enum_values.emplace_back("High Temp Plate");
|
||||||
def->enum_values.emplace_back("Textured PEI Plate");
|
def->enum_values.emplace_back("Textured PEI Plate");
|
||||||
def->enum_values.emplace_back("Textured Cool Plate");
|
def->enum_values.emplace_back("Textured Cool Plate");
|
||||||
def->enum_labels.emplace_back(L("Cool Plate (SuperTack)"));
|
def->enum_values.emplace_back("Supertack Plate");
|
||||||
def->enum_labels.emplace_back(L("Smooth Cool Plate"));
|
def->enum_labels.emplace_back(L("Smooth Cool Plate"));
|
||||||
def->enum_labels.emplace_back(L("Engineering Plate"));
|
def->enum_labels.emplace_back(L("Engineering Plate"));
|
||||||
def->enum_labels.emplace_back(L("Smooth High Temp Plate"));
|
def->enum_labels.emplace_back(L("Smooth High Temp Plate"));
|
||||||
def->enum_labels.emplace_back(L("Textured PEI Plate"));
|
def->enum_labels.emplace_back(L("Textured PEI Plate"));
|
||||||
def->enum_labels.emplace_back(L("Textured Cool Plate"));
|
def->enum_labels.emplace_back(L("Textured Cool Plate"));
|
||||||
|
def->enum_labels.emplace_back(L("Cool Plate (SuperTack)"));
|
||||||
def->set_default_value(new ConfigOptionEnum<BedType>(btPC));
|
def->set_default_value(new ConfigOptionEnum<BedType>(btPC));
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
|
|
|
@ -268,12 +268,12 @@ enum OverhangFanThreshold {
|
||||||
// BBS
|
// BBS
|
||||||
enum BedType {
|
enum BedType {
|
||||||
btDefault = 0,
|
btDefault = 0,
|
||||||
btSuperTack,
|
|
||||||
btPC,
|
btPC,
|
||||||
btEP,
|
btEP,
|
||||||
btPEI,
|
btPEI,
|
||||||
btPTE,
|
btPTE,
|
||||||
btPCT,
|
btPCT,
|
||||||
|
btSuperTack,
|
||||||
btCount
|
btCount
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1298,8 +1298,10 @@ void Sidebar::update_all_preset_comboboxes()
|
||||||
"curr_bed_type");
|
"curr_bed_type");
|
||||||
if (!str_bed_type.empty()) {
|
if (!str_bed_type.empty()) {
|
||||||
int bed_type_value = atoi(str_bed_type.c_str());
|
int bed_type_value = atoi(str_bed_type.c_str());
|
||||||
if (bed_type_value == 0)
|
if (bed_type_value <= 0 || bed_type_value >= btCount) {
|
||||||
bed_type_value = 1;
|
bed_type_value = preset_bundle.printers.get_edited_preset().get_default_bed_type(&preset_bundle);
|
||||||
|
}
|
||||||
|
|
||||||
m_bed_type_list->SelectAndNotify(bed_type_value - 1);
|
m_bed_type_list->SelectAndNotify(bed_type_value - 1);
|
||||||
} else {
|
} else {
|
||||||
BedType bed_type = preset_bundle.printers.get_edited_preset().get_default_bed_type(&preset_bundle);
|
BedType bed_type = preset_bundle.printers.get_edited_preset().get_default_bed_type(&preset_bundle);
|
||||||
|
|
Loading…
Reference in a new issue