Renamed tower/tilt profile to speed (back end only)

This commit is contained in:
YuSanka 2024-05-02 16:35:49 +02:00 committed by Lukas Matena
parent 41f891c196
commit b0cf024a03
6 changed files with 251 additions and 230 deletions

View File

@ -19,6 +19,7 @@
#include "libslic3r/miniz_extension.hpp"
#include "libslic3r/LocalesUtils.hpp"
#include "libslic3r/GCode/ThumbnailData.hpp"
#include "libslic3r/Utils/JsonUtils.hpp"
#include "SLAArchiveReader.hpp"
#include "SLAArchiveFormatRegistry.hpp"
@ -52,23 +53,43 @@ std::string to_ini(const ConfMap &m)
return ret;
}
namespace pt = boost::property_tree;
static std::string write_json_with_post_process(const pt::ptree& ptree)
static std::string get_key(const std::string& opt_key)
{
std::stringstream oss;
pt::write_json(oss, ptree);
static const std::set<std::string> ms_opts = {
"delay_before_exposure"
, "delay_after_exposure"
, "tilt_down_offset_delay"
, "tilt_up_offset_delay"
, "tilt_down_delay"
, "tilt_up_delay"
};
static const std::set<std::string> nm_opts = {
"tower_hop_height"
};
static const std::set<std::string> speed_opts = {
"tower_speed"
, "tilt_down_initial_speed"
, "tilt_down_finish_speed"
, "tilt_up_initial_speed"
, "tilt_up_finish_speed"
};
// fix json-out to show node values as a string just for string nodes
std::regex reg("\\\"([0-9]+\\.{0,1}[0-9]*)\\\""); // code is borrowed from https://stackoverflow.com/questions/2855741/why-does-boost-property-tree-write-json-save-everything-as-string-is-it-possibl
std::string result = std::regex_replace(oss.str(), reg, "$1");
if (ms_opts.find(opt_key) != ms_opts.end())
return opt_key + "_ms";
boost::replace_all(result, "\"true\"", "true");
boost::replace_all(result, "\"false\"", "false");
if (nm_opts.find(opt_key) != nm_opts.end())
return opt_key + "_nm";
return result;
if (speed_opts.find(opt_key) != speed_opts.end())
return boost::replace_all_copy(opt_key, "_speed", "_profile");
return opt_key;
}
namespace pt = boost::property_tree;
std::string to_json(const SLAPrint& print, const ConfMap &m)
{
auto& cfg = print.full_print_config();
@ -76,8 +97,8 @@ std::string to_json(const SLAPrint& print, const ConfMap &m)
pt::ptree below_node;
pt::ptree above_node;
const t_config_enum_names& tilt_enum_names = ConfigOptionEnum<TiltProfiles>::get_enum_names();
const t_config_enum_names& tower_enum_names = ConfigOptionEnum<TowerProfiles>::get_enum_names();
const t_config_enum_names& tilt_enum_names = ConfigOptionEnum< TiltSpeeds>::get_enum_names();
const t_config_enum_names& tower_enum_names = ConfigOptionEnum<TowerSpeeds>::get_enum_names();
for (const std::string& opt_key : tilt_options()) {
const ConfigOption* opt = cfg.option(opt_key);
@ -87,28 +108,28 @@ std::string to_json(const SLAPrint& print, const ConfMap &m)
case coFloats: {
auto values = static_cast<const ConfigOptionFloats*>(opt);
// those options have to be exported in ms instead of s
below_node.put<double>(opt_key, int(1000 * values->get_at(0)));
above_node.put<double>(opt_key, int(1000 * values->get_at(1)));
below_node.put<double>(get_key(opt_key), int(1000 * values->get_at(0)));
above_node.put<double>(get_key(opt_key), int(1000 * values->get_at(1)));
}
break;
case coInts: {
auto values = static_cast<const ConfigOptionInts*>(opt);
int koef = opt_key == "tower_hop_height_nm" ? 1000000 : 1;
below_node.put<int>(opt_key, koef * values->get_at(0));
above_node.put<int>(opt_key, koef * values->get_at(1));
int koef = opt_key == "tower_hop_height" ? 1000000 : 1;
below_node.put<int>(get_key(opt_key), koef * values->get_at(0));
above_node.put<int>(get_key(opt_key), koef * values->get_at(1));
}
break;
case coBools: {
auto values = static_cast<const ConfigOptionBools*>(opt);
below_node.put<bool>(opt_key, values->get_at(0));
above_node.put<bool>(opt_key, values->get_at(1));
below_node.put<bool>(get_key(opt_key), values->get_at(0));
above_node.put<bool>(get_key(opt_key), values->get_at(1));
}
break;
case coEnums: {
const t_config_enum_names& enum_names = opt_key == "tower_profile" ? tower_enum_names : tilt_enum_names;
auto values = static_cast<const ConfigOptionEnums<TiltProfiles>*>(opt);
below_node.put(opt_key, enum_names[values->get_at(0)]);
above_node.put(opt_key, enum_names[values->get_at(1)]);
const t_config_enum_names& enum_names = opt_key == "tower_speed" ? tower_enum_names : tilt_enum_names;
auto values = static_cast<const ConfigOptionEnums<TiltSpeeds>*>(opt);
below_node.put(get_key(opt_key), enum_names[values->get_at(0)]);
above_node.put(get_key(opt_key), enum_names[values->get_at(1)]);
}
break;
case coNone:

View File

@ -265,38 +265,38 @@ static t_config_enum_values s_keys_map_TopOnePerimeterType {
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TopOnePerimeterType)
static const t_config_enum_values s_keys_map_TowerProfiles{
{ "layer1", tpLayer1 },
{ "layer2", tpLayer2 },
{ "layer3", tpLayer3 },
{ "layer4", tpLayer4 },
{ "layer5", tpLayer5 },
{ "layer8", tpLayer8 },
{ "layer11", tpLayer11 },
{ "layer14", tpLayer14 },
{ "layer18", tpLayer18 },
{ "layer22", tpLayer22 },
{ "layer24", tpLayer24 },
static const t_config_enum_values s_keys_map_TowerSpeeds{
{ "layer1", tsLayer1 },
{ "layer2", tsLayer2 },
{ "layer3", tsLayer3 },
{ "layer4", tsLayer4 },
{ "layer5", tsLayer5 },
{ "layer8", tsLayer8 },
{ "layer11", tsLayer11 },
{ "layer14", tsLayer14 },
{ "layer18", tsLayer18 },
{ "layer22", tsLayer22 },
{ "layer24", tsLayer24 },
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TowerProfiles)
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TowerSpeeds)
static const t_config_enum_values s_keys_map_TiltProfiles{
{ "move120", tpMove120 },
{ "layer200", tpLayer200 },
{ "move300", tpMove300 },
{ "layer400", tpLayer400 },
{ "layer600", tpLayer600 },
{ "layer800", tpLayer800 },
{ "layer1000", tpLayer1000 },
{ "layer1250", tpLayer1250 },
{ "layer1500", tpLayer1500 },
{ "layer1750", tpLayer1750 },
{ "layer2000", tpLayer2000 },
{ "layer2250", tpLayer2250 },
{ "move5120", tpMove5120 },
{ "move8000", tpMove8000 },
static const t_config_enum_values s_keys_map_TiltSpeeds{
{ "move120", tsMove120 },
{ "layer200", tsLayer200 },
{ "move300", tsMove300 },
{ "layer400", tsLayer400 },
{ "layer600", tsLayer600 },
{ "layer800", tsLayer800 },
{ "layer1000", tsLayer1000 },
{ "layer1250", tsLayer1250 },
{ "layer1500", tsLayer1500 },
{ "layer1750", tsLayer1750 },
{ "layer2000", tsLayer2000 },
{ "layer2250", tsLayer2250 },
{ "move5120", tsMove5120 },
{ "move8000", tsMove8000 },
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TiltProfiles)
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TiltSpeeds)
static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology)
{
@ -4509,7 +4509,7 @@ void PrintConfigDef::init_sla_tilt_params()
{
ConfigOptionDef* def;
def = this->add("delay_before_exposure_ms", coFloats);
def = this->add("delay_before_exposure", coFloats);
def->full_label = L("Delay before exposure");
def->tooltip = L("Delay before exposure after previous layer separation.");
def->sidetext = L("s");
@ -4518,7 +4518,7 @@ void PrintConfigDef::init_sla_tilt_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloats({ 3., 3.}));
def = this->add("delay_after_exposure_ms", coFloats);
def = this->add("delay_after_exposure", coFloats);
def->full_label = L("Delay after exposure");
def->tooltip = L("Delay after exposure before layer separation.");
def->sidetext = L("s");
@ -4527,7 +4527,7 @@ void PrintConfigDef::init_sla_tilt_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloats({ 0., 0.}));
def = this->add("tower_hop_height_nm", coInts);
def = this->add("tower_hop_height", coInts);
def->full_label = L("Tower hop height");
def->tooltip = L("The height of the tower raise.");
def->sidetext = L("mm");
@ -4536,12 +4536,12 @@ void PrintConfigDef::init_sla_tilt_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionInts({ 0, 0}));
def = this->add("tower_profile", coEnums);
def = this->add("tower_speed", coEnums);
def->full_label = L("Tower speed");
def->tooltip = L("Tower speed used for tower raise.");
def->mode = comExpert;
def->sidetext = L("mm/s");
def->set_enum<TowerProfiles>({
def->set_enum<TowerSpeeds>({
{ "layer1", "1" },
{ "layer2", "2" },
{ "layer3", "3" },
@ -4554,9 +4554,9 @@ void PrintConfigDef::init_sla_tilt_params()
{ "layer22", "22" },
{ "layer24", "24" },
});
def->set_default_value(new ConfigOptionEnums<TowerProfiles>({ tpLayer22, tpLayer22 }));
def->set_default_value(new ConfigOptionEnums<TowerSpeeds>({ tsLayer22, tsLayer22 }));
const std::initializer_list<std::pair<std::string_view, std::string_view>> tilt_profiles_il = {
const std::initializer_list<std::pair<std::string_view, std::string_view>> tilt_speeds_il = {
{ "move120", "120" },
{ "layer200", "200" },
{ "move300", "300" },
@ -4573,37 +4573,37 @@ void PrintConfigDef::init_sla_tilt_params()
{ "move8000", "8000" },
};
def = this->add("tilt_down_initial_profile", coEnums);
def = this->add("tilt_down_initial_speed", coEnums);
def->full_label = L("Tilt down initial speed");
def->tooltip = L("Tilt speed used for an initial portion of tilt down move.");
def->mode = comExpert;
def->sidetext = L("μ-steps/s");
def->set_enum<TiltProfiles>(tilt_profiles_il);
def->set_default_value(new ConfigOptionEnums<TiltProfiles>({ tpLayer1750, tpLayer1750 }));
def->set_enum<TiltSpeeds>(tilt_speeds_il);
def->set_default_value(new ConfigOptionEnums<TiltSpeeds>({ tsLayer1750, tsLayer1750 }));
def = this->add("tilt_down_finish_profile", coEnums);
def = this->add("tilt_down_finish_speed", coEnums);
def->full_label = L("Tilt down finish speed");
def->tooltip = L("Tilt speed used for the rest of the tilt down move.");
def->mode = comExpert;
def->sidetext = L("μ-steps/s");
def->set_enum<TiltProfiles>(tilt_profiles_il);
def->set_default_value(new ConfigOptionEnums<TiltProfiles>({ tpLayer1750, tpLayer1750 }));
def->set_enum<TiltSpeeds>(tilt_speeds_il);
def->set_default_value(new ConfigOptionEnums<TiltSpeeds>({ tsLayer1750, tsLayer1750 }));
def = this->add("tilt_up_initial_profile", coEnums);
def = this->add("tilt_up_initial_speed", coEnums);
def->full_label = L("Tilt up initial speed");
def->tooltip = L("Tilt speed used for an initial portion of tilt up move.");
def->mode = comExpert;
def->sidetext = L("μ-steps/s");
def->set_enum<TiltProfiles>(tilt_profiles_il);
def->set_default_value(new ConfigOptionEnums<TiltProfiles>({ tpMove8000, tpMove8000 }));
def->set_enum<TiltSpeeds>(tilt_speeds_il);
def->set_default_value(new ConfigOptionEnums<TiltSpeeds>({ tsMove8000, tsMove8000 }));
def = this->add("tilt_up_finish_profile", coEnums);
def = this->add("tilt_up_finish_speed", coEnums);
def->full_label = L("Tilt up finish speed");
def->tooltip = L("Tilt speed used for the rest of the tilt-up.");
def->mode = comExpert;
def->sidetext = L("μ-steps/s");
def->set_enum<TiltProfiles>(tilt_profiles_il);
def->set_default_value(new ConfigOptionEnums<TiltProfiles>({ tpLayer1750, tpLayer1750 }));
def->set_enum<TiltSpeeds>(tilt_speeds_il);
def->set_default_value(new ConfigOptionEnums<TiltSpeeds>({ tsLayer1750, tsLayer1750 }));
def = this->add("use_tilt", coBools);
def->full_label = L("Use tilt");
@ -4620,7 +4620,7 @@ void PrintConfigDef::init_sla_tilt_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionInts({ 0, 0 }));
def = this->add("tilt_down_offset_delay_ms", coFloats);
def = this->add("tilt_down_offset_delay", coFloats);
def->full_label = L("Tilt down offset delay");
def->tooltip = L("Delay after the tilt reaches 'tilt_down_offset_steps' position.");
def->sidetext = L("s");
@ -4637,7 +4637,7 @@ void PrintConfigDef::init_sla_tilt_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionInts({ 1, 1 }));
def = this->add("tilt_down_delay_ms", coFloats);
def = this->add("tilt_down_delay", coFloats);
def->full_label = L("Tilt down delay");
def->tooltip = L("The delay between tilt-down cycles.");
def->sidetext = L("s");
@ -4655,7 +4655,7 @@ void PrintConfigDef::init_sla_tilt_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionInts({ 1200, 1200 }));
def = this->add("tilt_up_offset_delay_ms", coFloats);
def = this->add("tilt_up_offset_delay", coFloats);
def->full_label = L("Tilt up offset delay");
def->tooltip = L("Delay after the tilt reaches 'tilt_up_offset_steps' position.");
def->sidetext = L("s");
@ -4672,7 +4672,7 @@ void PrintConfigDef::init_sla_tilt_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionInts({ 1, 1 }));
def = this->add("tilt_up_delay_ms", coFloats);
def = this->add("tilt_up_delay", coFloats);
def->full_label = L("Tilt up delay");
def->tooltip = L("The delay between tilt-up cycles.");
def->sidetext = L("s");
@ -4959,23 +4959,23 @@ void DynamicPrintConfig::normalize_fdm()
}
static std::vector<std::string> s_Preset_sla_tilt_options{
"delay_before_exposure_ms"
,"delay_after_exposure_ms"
,"tower_hop_height_nm"
,"tower_profile"
"delay_before_exposure"
,"delay_after_exposure"
,"tower_hop_height"
,"tower_speed"
,"use_tilt"
,"tilt_down_initial_profile"
,"tilt_down_initial_speed"
,"tilt_down_offset_steps"
,"tilt_down_offset_delay_ms"
,"tilt_down_finish_profile"
,"tilt_down_offset_delay"
,"tilt_down_finish_speed"
,"tilt_down_cycles"
,"tilt_down_delay_ms"
,"tilt_up_initial_profile"
,"tilt_down_delay"
,"tilt_up_initial_speed"
,"tilt_up_offset_steps"
,"tilt_up_offset_delay_ms"
,"tilt_up_finish_profile"
,"tilt_up_offset_delay"
,"tilt_up_finish_speed"
,"tilt_up_cycles"
,"tilt_up_delay_ms"
,"tilt_up_delay"
};
const std::vector<std::string>& tilt_options() { return s_Preset_sla_tilt_options; }
@ -4985,21 +4985,21 @@ const std::vector<std::string>& tilt_options() { return s_Preset_sla_tilt_option
const std::map<std::string, ConfigOptionFloats> tilt_options_floats_defs =
{
{"delay_before_exposure_ms", ConfigOptionFloats({ 3., 3., 0., 1., 3.5, 3.5, 0., 0. }) } ,
{"delay_after_exposure_ms", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_down_offset_delay_ms", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_down_delay_ms", ConfigOptionFloats({ 0., 0., 0., 0.5, 0., 0., 0., 0. }) } ,
{"tilt_up_offset_delay_ms", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_up_delay_ms", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"delay_before_exposure", ConfigOptionFloats({ 3., 3., 0., 1., 3.5, 3.5, 0., 0. }) } ,
{"delay_after_exposure", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_down_offset_delay", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_down_delay", ConfigOptionFloats({ 0., 0., 0., 0.5, 0., 0., 0., 0. }) } ,
{"tilt_up_offset_delay", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_up_delay", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
};
const std::map<std::string, ConfigOptionInts> tilt_options_ints_defs =
{
{"tower_hop_height_nm", ConfigOptionInts({ 0, 0, 0, 0, 5, 5, 0, 0 }) } ,
{"tilt_down_offset_steps", ConfigOptionInts({ 0, 0, 0, 0, 2200, 2200, 0, 0 }) } ,
{"tilt_down_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } ,
{"tilt_up_offset_steps", ConfigOptionInts({ 1200, 1200, 600, 600, 2200, 2200, 0, 0 }) } ,
{"tilt_up_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } ,
{"tower_hop_height", ConfigOptionInts({ 0, 0, 0, 0, 5, 5, 0, 0 }) } ,
{"tilt_down_offset_steps", ConfigOptionInts({ 0, 0, 0, 0, 2200, 2200, 0, 0 }) } ,
{"tilt_down_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } ,
{"tilt_up_offset_steps", ConfigOptionInts({ 1200, 1200, 600, 600, 2200, 2200, 0, 0 }) } ,
{"tilt_up_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } ,
};
const std::map<std::string, ConfigOptionBools> tilt_options_bools_defs =
@ -5007,17 +5007,17 @@ const std::map<std::string, ConfigOptionBools> tilt_options_bools_defs =
{"use_tilt", ConfigOptionBools({ true, true, true, true, true, true, false, false })} ,
};
const std::map<std::string, ConfigOptionEnums<TowerProfiles>> tower_tilt_options_enums_defs =
const std::map<std::string, ConfigOptionEnums<TowerSpeeds>> tower_tilt_options_enums_defs =
{
{"tower_profile", ConfigOptionEnums<TowerProfiles>({ tpLayer22, tpLayer22, tpLayer22, tpLayer22, tpLayer2, tpLayer2, tpLayer1, tpLayer1 })} ,
{"tower_speed", ConfigOptionEnums<TowerSpeeds>({ tsLayer22, tsLayer22, tsLayer22, tsLayer22, tsLayer2, tsLayer2, tsLayer1, tsLayer1 })} ,
};
const std::map<std::string, ConfigOptionEnums<TiltProfiles>> tilt_options_enums_defs =
const std::map<std::string, ConfigOptionEnums<TiltSpeeds>> tilt_options_enums_defs =
{
{"tilt_down_initial_profile", ConfigOptionEnums<TiltProfiles>({ tpLayer1750, tpLayer1750, tpLayer1750, tpLayer1750, tpLayer800, tpLayer800, tpMove120, tpMove120 }) } ,
{"tilt_down_finish_profile", ConfigOptionEnums<TiltProfiles>({ tpLayer1750, tpLayer1750, tpMove8000, tpLayer1750, tpLayer1750, tpLayer1750, tpMove120, tpMove120 }) } ,
{"tilt_up_initial_profile", ConfigOptionEnums<TiltProfiles>({ tpMove8000, tpMove8000, tpMove8000, tpMove8000, tpLayer1750, tpLayer1750, tpMove120, tpMove120 }) } ,
{"tilt_up_finish_profile", ConfigOptionEnums<TiltProfiles>({ tpLayer1750, tpLayer1750, tpLayer1750, tpLayer1750, tpLayer800, tpLayer800, tpMove120, tpMove120 }) } ,
{"tilt_down_initial_speed", ConfigOptionEnums<TiltSpeeds>({ tsLayer1750, tsLayer1750, tsLayer1750, tsLayer1750, tsLayer800, tsLayer800, tsMove120, tsMove120 }) } ,
{"tilt_down_finish_speed", ConfigOptionEnums<TiltSpeeds>({ tsLayer1750, tsLayer1750, tsMove8000, tsLayer1750, tsLayer1750, tsLayer1750, tsMove120, tsMove120 }) } ,
{"tilt_up_initial_speed", ConfigOptionEnums<TiltSpeeds>({ tsMove8000, tsMove8000, tsMove8000, tsMove8000, tsLayer1750, tsLayer1750, tsMove120, tsMove120 }) } ,
{"tilt_up_finish_speed", ConfigOptionEnums<TiltSpeeds>({ tsLayer1750, tsLayer1750, tsLayer1750, tsLayer1750, tsLayer800, tsLayer800, tsMove120, tsMove120 }) } ,
};
// Default values containe option pair of values (Below and Above) for each titl modes
@ -5025,21 +5025,21 @@ const std::map<std::string, ConfigOptionEnums<TiltProfiles>> tilt_options_enums_
const std::map<std::string, ConfigOptionFloats> tilt_options_floats_sl1_defs =
{
{"delay_before_exposure_ms", ConfigOptionFloats({ 3., 3., 0., 1., 3.5, 3.5, 0., 0. }) } ,
{"delay_after_exposure_ms", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_down_offset_delay_ms", ConfigOptionFloats({ 1., 1., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_down_delay_ms", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_up_offset_delay_ms", ConfigOptionFloats({ 0., 0., 0., 0., 1., 1., 0., 0. }) } ,
{"tilt_up_delay_ms", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"delay_before_exposure", ConfigOptionFloats({ 3., 3., 0., 1., 3.5, 3.5, 0., 0. }) } ,
{"delay_after_exposure", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_down_offset_delay", ConfigOptionFloats({ 1., 1., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_down_delay", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
{"tilt_up_offset_delay", ConfigOptionFloats({ 0., 0., 0., 0., 1., 1., 0., 0. }) } ,
{"tilt_up_delay", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } ,
};
const std::map<std::string, ConfigOptionInts> tilt_options_ints_sl1_defs =
{
{"tower_hop_height_nm", ConfigOptionInts({ 0, 0, 0, 0, 5, 5, 0, 0 }) } ,
{"tilt_down_offset_steps", ConfigOptionInts({ 650, 650, 0, 0, 2200, 2200, 0, 0 }) } ,
{"tilt_down_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } ,
{"tilt_up_offset_steps", ConfigOptionInts({ 400, 400, 400, 400, 2200, 2200, 0, 0 }) } ,
{"tilt_up_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } ,
{"tower_hop_height", ConfigOptionInts({ 0, 0, 0, 0, 5, 5, 0, 0 }) } ,
{"tilt_down_offset_steps", ConfigOptionInts({ 650, 650, 0, 0, 2200, 2200, 0, 0 }) } ,
{"tilt_down_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } ,
{"tilt_up_offset_steps", ConfigOptionInts({ 400, 400, 400, 400, 2200, 2200, 0, 0 }) } ,
{"tilt_up_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } ,
};
const std::map<std::string, ConfigOptionBools> tilt_options_bools_sl1_defs =
@ -5048,17 +5048,17 @@ const std::map<std::string, ConfigOptionBools> tilt_options_bools_sl1_defs =
};
const std::map<std::string, ConfigOptionEnums<TowerProfiles>> tower_tilt_options_enums_sl1_defs =
const std::map<std::string, ConfigOptionEnums<TowerSpeeds>> tower_tilt_options_enums_sl1_defs =
{
{"tower_profile", ConfigOptionEnums<TowerProfiles>({ tpLayer22, tpLayer22, tpLayer22, tpLayer22, tpLayer2, tpLayer2, tpLayer1, tpLayer1 })} ,
{"tower_speed", ConfigOptionEnums<TowerSpeeds>({ tsLayer22, tsLayer22, tsLayer22, tsLayer22, tsLayer2, tsLayer2, tsLayer1, tsLayer1 })} ,
};
const std::map<std::string, ConfigOptionEnums<TiltProfiles>> tilt_options_enums_sl1_defs =
const std::map<std::string, ConfigOptionEnums<TiltSpeeds>> tilt_options_enums_sl1_defs =
{
{"tilt_down_initial_profile", ConfigOptionEnums<TiltProfiles>({ tpLayer400, tpLayer400, tpLayer400, tpLayer400, tpLayer600, tpLayer600, tpMove120, tpMove120 }) } ,
{"tilt_down_finish_profile", ConfigOptionEnums<TiltProfiles>({ tpLayer1500, tpLayer1500, tpLayer1750, tpLayer1500, tpLayer1500, tpLayer1500, tpMove120, tpMove120 }) } ,
{"tilt_up_initial_profile", ConfigOptionEnums<TiltProfiles>({ tpMove5120, tpMove5120, tpMove5120, tpMove5120, tpLayer1500, tpLayer1500, tpMove120, tpMove120 }) } ,
{"tilt_up_finish_profile", ConfigOptionEnums<TiltProfiles>({ tpLayer400, tpLayer400, tpLayer400, tpLayer400, tpLayer600, tpLayer600, tpMove120, tpMove120 }) } ,
{"tilt_down_initial_speed", ConfigOptionEnums<TiltSpeeds>({ tsLayer400, tsLayer400, tsLayer400, tsLayer400, tsLayer600, tsLayer600, tsMove120, tsMove120 }) } ,
{"tilt_down_finish_speed", ConfigOptionEnums<TiltSpeeds>({ tsLayer1500, tsLayer1500, tsLayer1750, tsLayer1500, tsLayer1500, tsLayer1500, tsMove120, tsMove120 }) } ,
{"tilt_up_initial_speed", ConfigOptionEnums<TiltSpeeds>({ tsMove5120, tsMove5120, tsMove5120, tsMove5120, tsLayer1500, tsLayer1500, tsMove120, tsMove120 }) } ,
{"tilt_up_finish_speed", ConfigOptionEnums<TiltSpeeds>({ tsLayer400, tsLayer400, tsLayer400, tsLayer400, tsLayer600, tsLayer600, tsMove120, tsMove120 }) } ,
};
void handle_legacy_sla(DynamicPrintConfig &config)
@ -5085,7 +5085,7 @@ void handle_legacy_sla(DynamicPrintConfig &config)
// Load default tilt options in config in respect to the print speed, if config is loaded from old PS
if (config.has("material_print_speed") &&
!config.has("tilt_down_offset_delay_ms") // Config from old PS doesn't contain any of tilt options, so check it
!config.has("tilt_down_offset_delay") // Config from old PS doesn't contain any of tilt options, so check it
) {
int tilt_mode = config.option("material_print_speed")->getInt();
@ -5094,8 +5094,8 @@ void handle_legacy_sla(DynamicPrintConfig &config)
const std::map<std::string, ConfigOptionFloats> floats_defs = is_sl1_model ? tilt_options_floats_sl1_defs : tilt_options_floats_defs;
const std::map<std::string, ConfigOptionInts> ints_defs = is_sl1_model ? tilt_options_ints_sl1_defs : tilt_options_ints_defs;
const std::map<std::string, ConfigOptionBools> bools_defs = is_sl1_model ? tilt_options_bools_sl1_defs : tilt_options_bools_defs;
const std::map<std::string, ConfigOptionEnums<TowerProfiles>> tower_enums_defs = is_sl1_model ? tower_tilt_options_enums_sl1_defs : tower_tilt_options_enums_defs;
const std::map<std::string, ConfigOptionEnums<TiltProfiles>> tilt_enums_defs = is_sl1_model ? tilt_options_enums_sl1_defs : tilt_options_enums_defs;
const std::map<std::string, ConfigOptionEnums<TowerSpeeds>> tower_enums_defs = is_sl1_model ? tower_tilt_options_enums_sl1_defs : tower_tilt_options_enums_defs;
const std::map<std::string, ConfigOptionEnums<TiltSpeeds>> tilt_enums_defs = is_sl1_model ? tilt_options_enums_sl1_defs : tilt_options_enums_defs;
for (const std::string& opt_key : s_Preset_sla_tilt_options) {
switch (config.def()->get(opt_key)->type) {
@ -5122,7 +5122,7 @@ void handle_legacy_sla(DynamicPrintConfig &config)
break;
case coEnums: {
int val1, val2;
if (opt_key == "tower_profile") {
if (opt_key == "tower_speed") {
auto values = tower_enums_defs.at(opt_key);
val1 = values.get_at(2 * tilt_mode);
val2 = values.get_at(2 * tilt_mode + 1);

View File

@ -171,35 +171,35 @@ enum class GCodeThumbnailsFormat {
PNG, JPG, QOI
};
enum TowerProfiles : int {
tpLayer1,
tpLayer2,
tpLayer3,
tpLayer4,
tpLayer5,
tpLayer8,
tpLayer11,
tpLayer14,
tpLayer18,
tpLayer22,
tpLayer24,
enum TowerSpeeds : int {
tsLayer1,
tsLayer2,
tsLayer3,
tsLayer4,
tsLayer5,
tsLayer8,
tsLayer11,
tsLayer14,
tsLayer18,
tsLayer22,
tsLayer24,
};
enum TiltProfiles : int {
tpMove120,
tpLayer200,
tpMove300,
tpLayer400,
tpLayer600,
tpLayer800,
tpLayer1000,
tpLayer1250,
tpLayer1500,
tpLayer1750,
tpLayer2000,
tpLayer2250,
tpMove5120,
tpMove8000,
enum TiltSpeeds : int {
tsMove120,
tsLayer200,
tsMove300,
tsLayer400,
tsLayer600,
tsLayer800,
tsLayer1000,
tsLayer1250,
tsLayer1500,
tsLayer1750,
tsLayer2000,
tsLayer2250,
tsMove5120,
tsMove8000,
};
#define CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(NAME) \
@ -1190,23 +1190,23 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, area_fill))
//tilt params
((ConfigOptionFloats, delay_before_exposure_ms))
((ConfigOptionFloats, delay_after_exposure_ms))
((ConfigOptionInts, tower_hop_height_nm))
((ConfigOptionEnums<TowerProfiles>, tower_profile))
((ConfigOptionFloats, delay_before_exposure))
((ConfigOptionFloats, delay_after_exposure))
((ConfigOptionInts, tower_hop_height))
((ConfigOptionEnums<TowerSpeeds>, tower_speed))
((ConfigOptionBools, use_tilt))
((ConfigOptionEnums<TiltProfiles>, tilt_down_initial_profile))
((ConfigOptionEnums<TiltSpeeds>, tilt_down_initial_speed))
((ConfigOptionInts, tilt_down_offset_steps))
((ConfigOptionFloats, tilt_down_offset_delay_ms))
((ConfigOptionEnums<TiltProfiles>, tilt_down_finish_profile))
((ConfigOptionFloats, tilt_down_offset_delay))
((ConfigOptionEnums<TiltSpeeds>, tilt_down_finish_speed))
((ConfigOptionInts, tilt_down_cycles))
((ConfigOptionFloats, tilt_down_delay_ms))
((ConfigOptionEnums<TiltProfiles>, tilt_up_initial_profile))
((ConfigOptionFloats, tilt_down_delay))
((ConfigOptionEnums<TiltSpeeds>, tilt_up_initial_speed))
((ConfigOptionInts, tilt_up_offset_steps))
((ConfigOptionFloats, tilt_up_offset_delay_ms))
((ConfigOptionEnums<TiltProfiles>, tilt_up_finish_profile))
((ConfigOptionFloats, tilt_up_offset_delay))
((ConfigOptionEnums<TiltSpeeds>, tilt_up_finish_speed))
((ConfigOptionInts, tilt_up_cycles))
((ConfigOptionFloats, tilt_up_delay_ms))
((ConfigOptionFloats, tilt_up_delay))
)
PRINT_CONFIG_CLASS_DEFINE(

View File

@ -685,8 +685,8 @@ std::string SLAPrint::validate(std::vector<std::string>*) const
}
}
if (!m_material_config.use_tilt.get_at(0) && m_material_config.tower_hop_height_nm.get_at(0) == 0
|| !m_material_config.use_tilt.get_at(1) && m_material_config.tower_hop_height_nm.get_at(1) == 0)
if (!m_material_config.use_tilt.get_at(0) && m_material_config.tower_hop_height.get_at(0) == 0
|| !m_material_config.use_tilt.get_at(1) && m_material_config.tower_hop_height.get_at(1) == 0)
return _u8L("Disabling the 'Use tilt' function causes the object to separate away from the film in the "
"vertical direction only. Therefore, it is necessary to set the 'Tower hop height' parameter "
" to a reasonable minimum value.");
@ -846,23 +846,23 @@ bool SLAPrint::invalidate_state_by_config_options(const std::vector<t_config_opt
"elefant_foot_min_width"sv,
"gamma_correction"sv,
// tilt params
"delay_before_exposure_ms"sv,
"delay_after_exposure_ms"sv,
"tower_hop_height_nm"sv,
"tower_profile"sv,
"delay_before_exposure"sv,
"delay_after_exposure"sv,
"tower_hop_height"sv,
"tower_speed"sv,
"use_tilt"sv,
"tilt_down_initial_profile"sv,
"tilt_down_initial_speed"sv,
"tilt_down_offset_steps"sv,
"tilt_down_offset_delay_ms"sv,
"tilt_down_finish_profile"sv,
"tilt_down_offset_delay"sv,
"tilt_down_finish_speed"sv,
"tilt_down_cycles"sv,
"tilt_down_delay_ms"sv,
"tilt_up_initial_profile"sv,
"tilt_down_delay"sv,
"tilt_up_initial_speed"sv,
"tilt_up_offset_steps"sv,
"tilt_up_offset_delay_ms"sv,
"tilt_up_finish_profile"sv,
"tilt_up_offset_delay"sv,
"tilt_up_finish_speed"sv,
"tilt_up_cycles"sv,
"tilt_up_delay_ms"sv,
"tilt_up_delay"sv,
};
// Cache the plenty of parameters, which influence the final rasterization only,

View File

@ -949,39 +949,39 @@ static int count_move_time(const std::string& axis_name, double length, int step
struct ExposureProfile {
// map of internal TowerProfiles to maximum_steprates (usteps/s)
// map of internal TowerSpeeds to maximum_steprates (usteps/s)
// this values was provided in default_tower_moving_profiles.json by SLA-team
std::map<TowerProfiles, int> tower_speeds = {
{ tpLayer1 , 800 },
{ tpLayer2 , 1600 },
{ tpLayer3 , 2400 },
{ tpLayer4 , 3200 },
{ tpLayer5 , 4000 },
{ tpLayer8 , 6400 },
{ tpLayer11, 8800 },
{ tpLayer14, 11200 },
{ tpLayer18, 14400 },
{ tpLayer22, 17600 },
{ tpLayer24, 19200 },
std::map<TowerSpeeds, int> tower_speeds = {
{ tsLayer1 , 800 },
{ tsLayer2 , 1600 },
{ tsLayer3 , 2400 },
{ tsLayer4 , 3200 },
{ tsLayer5 , 4000 },
{ tsLayer8 , 6400 },
{ tsLayer11, 8800 },
{ tsLayer14, 11200 },
{ tsLayer18, 14400 },
{ tsLayer22, 17600 },
{ tsLayer24, 19200 },
};
// map of internal TiltProfiles to maximum_steprates (usteps/s)
// map of internal TiltSpeeds to maximum_steprates (usteps/s)
// this values was provided in default_tilt_moving_profiles.json by SLA-team
std::map<TiltProfiles, int> tilt_speeds = {
{ tpMove120 , 120 },
{ tpLayer200 , 200 },
{ tpMove300 , 300 },
{ tpLayer400 , 400 },
{ tpLayer600 , 600 },
{ tpLayer800 , 800 },
{ tpLayer1000, 1000 },
{ tpLayer1250, 1250 },
{ tpLayer1500, 1500 },
{ tpLayer1750, 1750 },
{ tpLayer2000, 2000 },
{ tpLayer2250, 2250 },
{ tpMove5120 , 5120 },
{ tpMove8000 , 8000 },
std::map<TiltSpeeds, int> tilt_speeds = {
{ tsMove120 , 120 },
{ tsLayer200 , 200 },
{ tsMove300 , 300 },
{ tsLayer400 , 400 },
{ tsLayer600 , 600 },
{ tsLayer800 , 800 },
{ tsLayer1000, 1000 },
{ tsLayer1250, 1250 },
{ tsLayer1500, 1500 },
{ tsLayer1750, 1750 },
{ tsLayer2000, 2000 },
{ tsLayer2250, 2250 },
{ tsMove5120 , 5120 },
{ tsMove8000 , 8000 },
};
int delay_before_exposure_ms { 0 };
@ -1006,23 +1006,23 @@ struct ExposureProfile {
ExposureProfile(const SLAMaterialConfig& config, int opt_id)
{
delay_before_exposure_ms = int(1000 * config.delay_before_exposure_ms.get_at(opt_id));
delay_after_exposure_ms = int(1000 * config.delay_after_exposure_ms.get_at(opt_id));
tilt_down_offset_delay_ms = int(1000 * config.tilt_down_offset_delay_ms.get_at(opt_id));
tilt_down_delay_ms = int(1000 * config.tilt_down_delay_ms.get_at(opt_id));
tilt_up_offset_delay_ms = int(1000 * config.tilt_up_offset_delay_ms.get_at(opt_id));
tilt_up_delay_ms = int(1000 * config.tilt_up_delay_ms.get_at(opt_id));
tower_hop_height_nm = config.tower_hop_height_nm.get_at(opt_id) * 1000000;
delay_before_exposure_ms = int(1000 * config.delay_before_exposure.get_at(opt_id));
delay_after_exposure_ms = int(1000 * config.delay_after_exposure.get_at(opt_id));
tilt_down_offset_delay_ms = int(1000 * config.tilt_down_offset_delay.get_at(opt_id));
tilt_down_delay_ms = int(1000 * config.tilt_down_delay.get_at(opt_id));
tilt_up_offset_delay_ms = int(1000 * config.tilt_up_offset_delay.get_at(opt_id));
tilt_up_delay_ms = int(1000 * config.tilt_up_delay.get_at(opt_id));
tower_hop_height_nm = config.tower_hop_height.get_at(opt_id) * 1000000;
tilt_down_offset_steps = config.tilt_down_offset_steps.get_at(opt_id);
tilt_down_cycles = config.tilt_down_cycles.get_at(opt_id);
tilt_up_offset_steps = config.tilt_up_offset_steps.get_at(opt_id);
tilt_up_cycles = config.tilt_up_cycles.get_at(opt_id);
use_tilt = config.use_tilt.get_at(opt_id);
tower_speed = tower_speeds.at(static_cast<TowerProfiles>(config.tower_profile.getInts()[opt_id]));
tilt_down_initial_speed = tilt_speeds.at(static_cast<TiltProfiles>(config.tilt_down_initial_profile.getInts()[opt_id]));
tilt_down_finish_speed = tilt_speeds.at(static_cast<TiltProfiles>(config.tilt_down_finish_profile.getInts()[opt_id]));
tilt_up_initial_speed = tilt_speeds.at(static_cast<TiltProfiles>(config.tilt_up_initial_profile.getInts()[opt_id]));
tilt_up_finish_speed = tilt_speeds.at(static_cast<TiltProfiles>(config.tilt_up_finish_profile.getInts()[opt_id]));
tower_speed = tower_speeds.at(static_cast<TowerSpeeds>(config.tower_speed.getInts()[opt_id]));
tilt_down_initial_speed = tilt_speeds.at(static_cast<TiltSpeeds>(config.tilt_down_initial_speed.getInts()[opt_id]));
tilt_down_finish_speed = tilt_speeds.at(static_cast<TiltSpeeds>(config.tilt_down_finish_speed.getInts()[opt_id]));
tilt_up_initial_speed = tilt_speeds.at(static_cast<TiltSpeeds>(config.tilt_up_initial_speed.getInts()[opt_id]));
tilt_up_finish_speed = tilt_speeds.at(static_cast<TiltSpeeds>(config.tilt_up_finish_speed.getInts()[opt_id]));
}
};

View File

@ -5463,18 +5463,18 @@ static boost::any get_def_config_value(const DynamicPrintConfig& config, const s
}
std::vector<std::string> disable_tilt_options = {
"tilt_down_initial_profile"
"tilt_down_initial_speed"
,"tilt_down_offset_steps"
,"tilt_down_offset_delay_ms"
,"tilt_down_finish_profile"
,"tilt_down_offset_delay"
,"tilt_down_finish_speed"
,"tilt_down_cycles"
,"tilt_down_delay_ms"
,"tilt_up_initial_profile"
,"tilt_down_delay"
,"tilt_up_initial_speed"
,"tilt_up_offset_steps"
,"tilt_up_offset_delay_ms"
,"tilt_up_finish_profile"
,"tilt_up_offset_delay"
,"tilt_up_finish_speed"
,"tilt_up_cycles"
,"tilt_up_delay_ms"
,"tilt_up_delay"
};
void TabSLAMaterial::toggle_tilt_options(bool is_above)