Fix acceleration in % of machine_max_acceleration_x

supermerill/SuperSlicer#1829
This commit is contained in:
supermerill 2021-11-08 21:30:10 +01:00
parent 65bb95cd81
commit 521bd256a9
2 changed files with 9 additions and 9 deletions

View File

@ -735,25 +735,25 @@ double ConfigBase::get_computed_value(const t_config_option_key &opt_key, int ex
}
if (idx >= 0) {
if (raw_opt->type() == coFloats || raw_opt->type() == coInts || raw_opt->type() == coBools)
return vector_opt->getFloat(extruder_id);
return vector_opt->getFloat(idx);
if (raw_opt->type() == coFloatsOrPercents) {
const ConfigOptionFloatsOrPercents* opt_fl_per = static_cast<const ConfigOptionFloatsOrPercents*>(raw_opt);
if (!opt_fl_per->values[extruder_id].percent)
return opt_fl_per->values[extruder_id].value;
if (!opt_fl_per->values[idx].percent)
return opt_fl_per->values[idx].value;
if (opt_def->ratio_over.empty())
return opt_fl_per->get_abs_value(extruder_id, 1);
return opt_fl_per->get_abs_value(idx, 1);
if (opt_def->ratio_over != "depends")
return opt_fl_per->get_abs_value(extruder_id, this->get_computed_value(opt_def->ratio_over, extruder_id));
return opt_fl_per->get_abs_value(idx, this->get_computed_value(opt_def->ratio_over, idx));
std::stringstream ss; ss << "ConfigBase::get_abs_value(): " << opt_key << " has no valid ratio_over to compute of";
throw ConfigurationError(ss.str());
}
if (raw_opt->type() == coPercents) {
const ConfigOptionPercents* opt_per = static_cast<const ConfigOptionPercents*>(raw_opt);
if (opt_def->ratio_over.empty())
return opt_per->get_abs_value(extruder_id, 1);
return opt_per->get_abs_value(idx, 1);
if (opt_def->ratio_over != "depends")
return opt_per->get_abs_value(extruder_id, this->get_computed_value(opt_def->ratio_over, extruder_id));
return opt_per->get_abs_value(idx, this->get_computed_value(opt_def->ratio_over, idx));
std::stringstream ss; ss << "ConfigBase::get_abs_value(): " << opt_key << " has no valid ratio_over to compute of";
throw ConfigurationError(ss.str());
}

View File

@ -659,10 +659,10 @@ void PrintConfigDef::init_fff_params()
def->full_label = L("Default acceleration");
def->tooltip = L("This is the acceleration your printer will be reset to after "
"the role-specific acceleration values are used (perimeter/infill). "
"\nYou can set it as a % of the max of the X/Y machine acceleration limit."
"\nYou can set it as a % of the max of the X machine acceleration limit."
"\nSet zero to prevent resetting acceleration at all.");
def->sidetext = L("mm/s² or %");
def->ratio_over = "machine_max_acceleration_X";
def->ratio_over = "machine_max_acceleration_x";
def->min = 0;
def->max_literal = { -200, false };
def->mode = comExpert;