Improved retract handling on bowden extruders:

Separated deretract speed from a retract speed,
allowed a partial retract before wipe.
This commit is contained in:
bubnikv 2017-05-19 19:24:21 +02:00
parent 8bd3dec331
commit 70db88dd90
20 changed files with 246 additions and 108 deletions

View file

@ -57,6 +57,7 @@ class ConfigOptionSingle : public ConfigOption {
class ConfigOptionVectorBase : public ConfigOption {
public:
virtual ~ConfigOptionVectorBase() {};
// Currently used only to initialize the PlaceholderParser.
virtual std::vector<std::string> vserialize() const = 0;
};
@ -257,6 +258,46 @@ class ConfigOptionPercent : public ConfigOptionFloat
};
};
class ConfigOptionPercents : public ConfigOptionFloats
{
public:
std::string serialize() const {
std::ostringstream ss;
for (const auto &v : this->values) {
if (&v != &this->values.front()) ss << ",";
ss << v << "%";
}
std::string str = ss.str();
return str;
};
std::vector<std::string> vserialize() const {
std::vector<std::string> vv;
vv.reserve(this->values.size());
for (const auto v : this->values) {
std::ostringstream ss;
ss << v;
std::string sout = ss.str() + "%";
vv.push_back(sout);
}
return vv;
};
bool deserialize(std::string str) {
this->values.clear();
std::istringstream is(str);
std::string item_str;
while (std::getline(is, item_str, ',')) {
std::istringstream iss(item_str);
double value;
// don't try to parse the trailing % since it's optional
iss >> value;
this->values.push_back(value);
}
return true;
};
};
class ConfigOptionFloatOrPercent : public ConfigOptionPercent
{
public:
@ -488,6 +529,8 @@ enum ConfigOptionType {
coStrings,
// percent value. Currently only used for infill.
coPercent,
// percents value. Currently used for retract before wipe only.
coPercents,
// a fraction or an absolute value
coFloatOrPercent,
// single 2d point. Currently not used.