mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-16 05:27:50 +00:00
Partial fix of accl & jerk check
This commit is contained in:
+13
-15
@@ -1732,11 +1732,11 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
|||||||
// check if print speed/accel/jerk is higher than the maximum speed of the printer
|
// check if print speed/accel/jerk is higher than the maximum speed of the printer
|
||||||
if (warning) {
|
if (warning) {
|
||||||
try {
|
try {
|
||||||
/* TODO: Orca: fix it
|
auto check_extruder = [&](const int extruder_id) {
|
||||||
auto check_motion_ability_object_setting = [&](const std::vector<std::string>& keys_to_check, double limit) -> std::string {
|
auto check_motion_ability_object_setting = [&](const std::vector<std::string>& keys_to_check, double limit) -> std::string {
|
||||||
std::string warning_key;
|
std::string warning_key;
|
||||||
for (const auto& key : keys_to_check) {
|
for (const auto& key : keys_to_check) {
|
||||||
if (m_default_object_config.get_abs_value(key) > limit) {
|
if (m_default_object_config.get_abs_value_at(key, extruder_id) > limit) {
|
||||||
warning_key = key;
|
warning_key = key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1746,7 +1746,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
|||||||
auto check_motion_ability_region_setting = [&](const std::vector<std::string>& keys_to_check, double limit) -> std::string {
|
auto check_motion_ability_region_setting = [&](const std::vector<std::string>& keys_to_check, double limit) -> std::string {
|
||||||
std::string warning_key;
|
std::string warning_key;
|
||||||
for (const auto& key : keys_to_check) {
|
for (const auto& key : keys_to_check) {
|
||||||
if (m_default_region_config.get_abs_value(key) > limit) {
|
if (m_default_region_config.get_abs_value_at(key, extruder_id) > limit) {
|
||||||
warning_key = key;
|
warning_key = key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1755,20 +1755,17 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
|||||||
};
|
};
|
||||||
std::string warning_key;
|
std::string warning_key;
|
||||||
|
|
||||||
const auto max_junction_deviation = m_config.machine_max_junction_deviation.values[0];
|
const auto max_junction_deviation = m_config.machine_max_junction_deviation.values[0]; // TODO: fix this
|
||||||
const bool ignore_jerk_validation = m_config.gcode_flavor == gcfMarlinFirmware && max_junction_deviation > 0;
|
const bool ignore_jerk_validation = m_config.gcode_flavor == gcfMarlinFirmware && max_junction_deviation > 0;
|
||||||
|
|
||||||
// check jerk
|
// check jerk
|
||||||
if (!ignore_jerk_validation) {
|
if (!ignore_jerk_validation) {
|
||||||
auto is_jerk_too_low = [](const ConfigOptionFloatsNullable& cfg) {
|
if (m_default_object_config.default_jerk.get_at(extruder_id) == 1 || m_default_object_config.outer_wall_jerk.get_at(extruder_id) == 1 ||
|
||||||
return std::any_of(cfg.values.begin(), cfg.values.end(), [](const float v) { return v == 1; });
|
m_default_object_config.inner_wall_jerk.get_at(extruder_id) == 1) {
|
||||||
};
|
|
||||||
if (is_jerk_too_low(m_default_object_config.default_jerk) || is_jerk_too_low(m_default_object_config.outer_wall_jerk) ||
|
|
||||||
is_jerk_too_low(m_default_object_config.inner_wall_jerk)) {
|
|
||||||
warning->string = L("Setting the jerk speed too low could lead to artifacts on curved surfaces");
|
warning->string = L("Setting the jerk speed too low could lead to artifacts on curved surfaces");
|
||||||
if (is_jerk_too_low(m_default_object_config.outer_wall_jerk))
|
if (m_default_object_config.outer_wall_jerk.get_at(extruder_id) == 1)
|
||||||
warning_key = "outer_wall_jerk";
|
warning_key = "outer_wall_jerk";
|
||||||
else if (is_jerk_too_low(m_default_object_config.inner_wall_jerk))
|
else if (m_default_object_config.inner_wall_jerk.get_at(extruder_id) == 1)
|
||||||
warning_key = "inner_wall_jerk";
|
warning_key = "inner_wall_jerk";
|
||||||
else
|
else
|
||||||
warning_key = "default_jerk";
|
warning_key = "default_jerk";
|
||||||
@@ -1776,7 +1773,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
|||||||
warning->opt_key = warning_key;
|
warning->opt_key = warning_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (warning_key.empty() && m_default_object_config.default_jerk > 0) {
|
if (warning_key.empty() && m_default_object_config.default_jerk.get_at(extruder_id) > 0) {
|
||||||
std::vector<std::string> jerk_to_check = {"default_jerk", "outer_wall_jerk", "inner_wall_jerk", "infill_jerk",
|
std::vector<std::string> jerk_to_check = {"default_jerk", "outer_wall_jerk", "inner_wall_jerk", "infill_jerk",
|
||||||
"top_surface_jerk", "initial_layer_jerk", "travel_jerk"};
|
"top_surface_jerk", "initial_layer_jerk", "travel_jerk"};
|
||||||
const auto max_jerk = std::min(m_config.machine_max_jerk_x.values[0], m_config.machine_max_jerk_y.values[0]);
|
const auto max_jerk = std::min(m_config.machine_max_jerk_x.values[0], m_config.machine_max_jerk_y.values[0]);
|
||||||
@@ -1795,7 +1792,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
|||||||
// Check junction deviation
|
// Check junction deviation
|
||||||
// Orca: Only marlin FW supports max junction deviation. Dont display warning if firmware is not supporting it.
|
// Orca: Only marlin FW supports max junction deviation. Dont display warning if firmware is not supporting it.
|
||||||
const bool support_max_junction_deviation = ( m_config.gcode_flavor == gcfMarlinFirmware);
|
const bool support_max_junction_deviation = ( m_config.gcode_flavor == gcfMarlinFirmware);
|
||||||
if (warning_key.empty() && m_default_object_config.default_junction_deviation.value > max_junction_deviation && support_max_junction_deviation) {
|
if (warning_key.empty() && m_default_object_config.default_junction_deviation.get_at(extruder_id) > max_junction_deviation && support_max_junction_deviation) {
|
||||||
warning->string = L( "Junction deviation setting exceeds the printer's maximum value (machine_max_junction_deviation).\n"
|
warning->string = L( "Junction deviation setting exceeds the printer's maximum value (machine_max_junction_deviation).\n"
|
||||||
"Orca will automatically cap the junction deviation to ensure it doesn't surpass the printer's capabilities.\n"
|
"Orca will automatically cap the junction deviation to ensure it doesn't surpass the printer's capabilities.\n"
|
||||||
"You can adjust the machine_max_junction_deviation value in your printer's configuration to get higher limits.");
|
"You can adjust the machine_max_junction_deviation value in your printer's configuration to get higher limits.");
|
||||||
@@ -1804,7 +1801,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
|||||||
|
|
||||||
// check acceleration
|
// check acceleration
|
||||||
const auto max_accel = m_config.machine_max_acceleration_extruding.values[0];
|
const auto max_accel = m_config.machine_max_acceleration_extruding.values[0];
|
||||||
if (warning_key.empty() && m_default_object_config.default_acceleration > 0 && max_accel > 0) {
|
if (warning_key.empty() && m_default_object_config.default_acceleration.get_at(extruder_id) > 0 && max_accel > 0) {
|
||||||
const bool support_travel_acc = (m_config.gcode_flavor == gcfRepetier || m_config.gcode_flavor == gcfMarlinFirmware ||
|
const bool support_travel_acc = (m_config.gcode_flavor == gcfRepetier || m_config.gcode_flavor == gcfMarlinFirmware ||
|
||||||
m_config.gcode_flavor == gcfRepRapFirmware);
|
m_config.gcode_flavor == gcfRepRapFirmware);
|
||||||
|
|
||||||
@@ -1860,7 +1857,6 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// check speed
|
// check speed
|
||||||
// Orca: disable the speed check for now as we don't cap the speed
|
// Orca: disable the speed check for now as we don't cap the speed
|
||||||
@@ -1880,6 +1876,8 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
|||||||
// warning->opt_key = warning_key;
|
// warning->opt_key = warning_key;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
};
|
||||||
|
check_extruder(0); // TODO: check used extruder variants
|
||||||
|
|
||||||
// check wall sequence and precise outer wall
|
// check wall sequence and precise outer wall
|
||||||
if (m_default_region_config.precise_outer_wall && m_default_region_config.wall_sequence != WallSequence::InnerOuter) {
|
if (m_default_region_config.precise_outer_wall && m_default_region_config.wall_sequence != WallSequence::InnerOuter) {
|
||||||
|
|||||||
Reference in New Issue
Block a user