Parameter tower_hop_height type changed from int to float

This commit is contained in:
Lukas Matena 2025-02-03 12:50:56 +01:00
parent 9896788693
commit 0968ffee65
5 changed files with 13 additions and 14 deletions

View File

@ -107,16 +107,15 @@ std::string to_json(const SLAPrint& print, const ConfMap &m)
switch (opt->type()) {
case coFloats: {
auto values = static_cast<const ConfigOptionFloats*>(opt);
// those options have to be exported in ms instead of s
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)));
double koef = opt_key == "tower_hop_height" ? 1000000. : 1000.; // export in nm (instead of mm), resp. in ms (instead of s)
below_node.put<double>(get_key(opt_key), int(koef * values->get_at(0)));
above_node.put<double>(get_key(opt_key), int(koef * values->get_at(1)));
}
break;
case coInts: {
auto values = static_cast<const ConfigOptionInts*>(opt);
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));
below_node.put<int>(get_key(opt_key), values->get_at(0));
above_node.put<int>(get_key(opt_key), values->get_at(1));
}
break;
case coBools: {

View File

@ -4758,14 +4758,14 @@ void PrintConfigDef::init_sla_tilt_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats({ 0., 0.}));
def = this->add("tower_hop_height", coInts);
def = this->add("tower_hop_height", coFloats);
def->full_label = L("Tower hop height");
def->tooltip = L("The height of the tower raise.");
def->sidetext = L("mm");
def->min = 0;
def->max = 100;
def->mode = comExpert;
def->set_default_value(new ConfigOptionInts({ 0, 0}));
def->set_default_value(new ConfigOptionFloats({ 0., 0.}));
def = this->add("tower_speed", coEnums);
def->full_label = L("Tower speed");
@ -5202,11 +5202,11 @@ const std::map<std::string, ConfigOptionFloats> tilt_options_floats_defs =
{"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. }) } ,
{"tower_hop_height", ConfigOptionFloats({ 0., 0., 0., 0., 5., 5., 0., 0. }) } ,
};
const std::map<std::string, ConfigOptionInts> tilt_options_ints_defs =
{
{"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 }) } ,
@ -5242,11 +5242,11 @@ const std::map<std::string, ConfigOptionFloats> tilt_options_floats_sl1_defs =
{"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. }) } ,
{"tower_hop_height", ConfigOptionFloats({ 0., 0., 0., 0., 5., 5., 0., 0. }) } ,
};
const std::map<std::string, ConfigOptionInts> tilt_options_ints_sl1_defs =
{
{"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 }) } ,

View File

@ -1248,7 +1248,7 @@ PRINT_CONFIG_CLASS_DEFINE(
//tilt params
((ConfigOptionFloats, delay_before_exposure))
((ConfigOptionFloats, delay_after_exposure))
((ConfigOptionInts, tower_hop_height))
((ConfigOptionFloats, tower_hop_height))
((ConfigOptionEnums<TowerSpeeds>, tower_speed))
((ConfigOptionBools, use_tilt))
((ConfigOptionEnums<TiltSpeeds>, tilt_down_initial_speed))

View File

@ -695,8 +695,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.get_at(0) == 0)
|| (!m_material_config.use_tilt.get_at(1) && m_material_config.tower_hop_height.get_at(1) == 0))
if ((!m_material_config.use_tilt.get_at(0) && is_approx(m_material_config.tower_hop_height.get_at(0), 0.))
|| (!m_material_config.use_tilt.get_at(1) && is_approx(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 reasonable value. The recommended value is 5 mm.");

View File

@ -1041,7 +1041,7 @@ struct ExposureProfile {
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;
tower_hop_height_nm = int(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);