Calibration Cornering Jerk Test + Generic interpolator + Fix (#10962)

This commit is contained in:
Ian Bassi
2025-10-26 09:44:19 -03:00
committed by GitHub
parent e922411371
commit a839b81fdf
25 changed files with 431 additions and 197 deletions

View File

@@ -50,7 +50,7 @@ static wxString get_default_name(wxString filament_name, CalibMode mode){
break;
case Slic3r::CalibMode::Calib_Input_shaping_damp:
break;
case Slic3r::CalibMode::Calib_Junction_Deviation:
case Slic3r::CalibMode::Calib_Cornering:
break;
default:
break;

View File

@@ -663,12 +663,27 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
"top_surface_acceleration", "travel_acceleration", "bridge_acceleration", "sparse_infill_acceleration", "internal_solid_infill_acceleration"})
toggle_field(el, have_default_acceleration);
bool have_default_jerk = config->opt_float("default_jerk") > 0;
for (auto el : { "outer_wall_jerk", "inner_wall_jerk", "initial_layer_jerk", "top_surface_jerk", "travel_jerk", "infill_jerk"})
toggle_field(el, have_default_jerk);
bool machine_supports_junction_deviation = false;
if (gcflavor == gcfMarlinFirmware) {
if (const auto *machine_jd = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("machine_max_junction_deviation")) {
machine_supports_junction_deviation = !machine_jd->values.empty() && machine_jd->values.front() > 0.0;
}
}
toggle_line("default_junction_deviation", gcflavor == gcfMarlinFirmware);
if (machine_supports_junction_deviation) {
toggle_field("default_junction_deviation", true);
toggle_field("default_jerk", false);
for (auto el : { "outer_wall_jerk", "inner_wall_jerk", "initial_layer_jerk", "top_surface_jerk", "travel_jerk", "infill_jerk"})
toggle_line(el, false);
} else {
toggle_field("default_junction_deviation", false);
toggle_field("default_jerk", true);
bool have_default_jerk = config->has("default_jerk") && config->opt_float("default_jerk") > 0;
for (auto el : { "outer_wall_jerk", "inner_wall_jerk", "initial_layer_jerk", "top_surface_jerk", "travel_jerk", "infill_jerk"}) {
toggle_line(el, true);
toggle_field(el, have_default_jerk);
}
}
bool have_skirt = config->opt_int("skirt_loops") > 0;
toggle_field("skirt_height", have_skirt && config->opt_enum<DraftShield>("draft_shield") != dsEnabled);

View File

@@ -3071,36 +3071,32 @@ void MainFrame::init_menubar_as_editor()
}, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
// Cornering (with submenu)
auto cornering_menu = new wxMenu();
append_menu_item(
cornering_menu, wxID_ANY, _L("Junction Deviation"), _L("Junction Deviation calibration"),
// Cornering
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Cornering"), _L("Cornering calibration"),
[this](wxCommandEvent&) {
if (!m_junction_deviation_calib_dlg)
m_junction_deviation_calib_dlg = new Junction_Deviation_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
m_junction_deviation_calib_dlg->ShowModal();
},
"", nullptr,
auto dlg = new Cornering_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
dlg->ShowModal();
dlg->Destroy();
}, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
m_topbar->GetCalibMenu()->AppendSubMenu(cornering_menu, _L("Cornering"));
// Input Shaping (with submenu)
auto input_shaping_menu = new wxMenu();
append_menu_item(
input_shaping_menu, wxID_ANY, _L("Input Shaping Frequency"), _L("Input Shaping Frequency"),
[this](wxCommandEvent&) {
if (!m_IS_freq_calib_dlg)
m_IS_freq_calib_dlg = new Input_Shaping_Freq_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
m_IS_freq_calib_dlg->ShowModal();
auto dlg = new Input_Shaping_Freq_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
dlg->ShowModal();
dlg->Destroy();
},
"", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(
input_shaping_menu, wxID_ANY, _L("Input Shaping Damping/zeta factor"), _L("Input Shaping Damping/zeta factor"),
[this](wxCommandEvent&) {
if (!m_IS_damp_calib_dlg)
m_IS_damp_calib_dlg = new Input_Shaping_Damp_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
m_IS_damp_calib_dlg->ShowModal();
auto dlg = new Input_Shaping_Damp_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
dlg->ShowModal();
dlg->Destroy();
},
"", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
@@ -3193,36 +3189,32 @@ void MainFrame::init_menubar_as_editor()
}, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
// Cornering (with submenu)
auto cornering_menu = new wxMenu();
append_menu_item(
cornering_menu, wxID_ANY, _L("Junction Deviation"), _L("Junction Deviation calibration"),
// Cornering
append_menu_item(calib_menu, wxID_ANY, _L("Cornering"), _L("Cornering calibration"),
[this](wxCommandEvent&) {
if (!m_junction_deviation_calib_dlg)
m_junction_deviation_calib_dlg = new Junction_Deviation_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
m_junction_deviation_calib_dlg->ShowModal();
},
"", nullptr,
auto dlg = new Cornering_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
dlg->ShowModal();
dlg->Destroy();
}, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
calib_menu->AppendSubMenu(cornering_menu, _L("Cornering"));
// Input Shaping (with submenu)
auto input_shaping_menu = new wxMenu();
append_menu_item(
input_shaping_menu, wxID_ANY, _L("Input Shaping Frequency"), _L("Input Shaping Frequency"),
[this](wxCommandEvent&) {
if (!m_IS_freq_calib_dlg)
m_IS_freq_calib_dlg = new Input_Shaping_Freq_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
m_IS_freq_calib_dlg->ShowModal();
auto dlg = new Input_Shaping_Freq_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
dlg->ShowModal();
dlg->Destroy();
},
"", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(
input_shaping_menu, wxID_ANY, _L("Input Shaping Damping/zeta factor"), _L("Input Shaping Damping/zeta factor"),
[this](wxCommandEvent&) {
if (!m_IS_damp_calib_dlg)
m_IS_damp_calib_dlg = new Input_Shaping_Damp_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
m_IS_damp_calib_dlg->ShowModal();
auto dlg = new Input_Shaping_Damp_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
dlg->ShowModal();
dlg->Destroy();
},
"", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);

View File

@@ -364,7 +364,7 @@ public:
Retraction_Test_Dlg* m_retraction_calib_dlg{ nullptr };
Input_Shaping_Freq_Test_Dlg* m_IS_freq_calib_dlg{ nullptr };
Input_Shaping_Damp_Test_Dlg* m_IS_damp_calib_dlg{ nullptr };
Junction_Deviation_Test_Dlg* m_junction_deviation_calib_dlg{ nullptr };
Cornering_Test_Dlg* m_cornering_calib_dlg{ nullptr };
// BBS. Replace title bar and menu bar with top bar.
BBLTopbar* m_topbar{ nullptr };

View File

@@ -853,6 +853,20 @@ struct DynamicFilamentList1Based : DynamicFilamentList
};
// Check if the machine supports Junction Deviation (Marlin firmware with machine_max_junction_deviation > 0)
static bool has_junction_deviation(const DynamicPrintConfig* printer_config)
{
if (!printer_config) {
return false;
}
const auto gcode_flavor = printer_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor");
const auto junction_dev = printer_config->option<ConfigOptionFloats>("machine_max_junction_deviation");
return gcode_flavor &&
gcode_flavor->value == GCodeFlavor::gcfMarlinFirmware &&
junction_dev &&
!junction_dev->values.empty() &&
junction_dev->values.front() > 0.0;
}
static DynamicFilamentList dynamic_filament_list;
static DynamicFilamentList1Based dynamic_filament_list_1_based;
@@ -11635,7 +11649,7 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
print_config.set_key_value( "print_sequence", new ConfigOptionEnum(PrintSequence::ByLayer));
//Orca: find jerk value to use in the test
if(print_config.option<ConfigOptionFloat>("default_jerk")->value > 0){ // we have set a jerk value
if(!has_junction_deviation(printer_config) && print_config.option<ConfigOptionFloat>("default_jerk")->value > 0){ // we have set a jerk value
auto jerk = print_config.option<ConfigOptionFloat>("outer_wall_jerk")->value; // get outer wall jerk
if (jerk == 0) // if outer wall jerk is not defined, get inner wall jerk
jerk = print_config.option<ConfigOptionFloat>("inner_wall_jerk")->value;
@@ -11651,7 +11665,11 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
print_config.set_key_value( "infill_jerk", new ConfigOptionFloat(jerk));
print_config.set_key_value( "travel_jerk", new ConfigOptionFloat(jerk));
}
if (has_junction_deviation(printer_config)){
print_config.set_key_value("default_junction_deviation", new ConfigOptionFloat(0));
}
for (const auto& opt : SuggestedConfigCalibPAPattern().float_pairs) {
print_config.set_key_value(
opt.first,
@@ -12313,27 +12331,15 @@ void Plater::calib_input_shaping_freq(const Calib_Params& params)
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
const auto gcode_flavor_option = printer_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor");
float junction_deviation_value = 0.f;
if (gcode_flavor_option && gcode_flavor_option->value == GCodeFlavor::gcfMarlinFirmware) {
const auto machine_junction_option = printer_config->option<ConfigOptionFloats>("machine_max_junction_deviation");
const float current = (machine_junction_option && !machine_junction_option->values.empty())
? machine_junction_option->values.front()
: 0.f;
junction_deviation_value = std::max(current, 0.25f);
if (has_junction_deviation(printer_config)) {
printer_config->set_key_value("machine_max_junction_deviation", new ConfigOptionFloats {(std::max(printer_config->option<ConfigOptionFloats>("machine_max_junction_deviation")->values.front(), 0.25))});
print_config->set_key_value("default_junction_deviation", new ConfigOptionFloat(0));
} else {
const double jerk_value = (gcode_flavor_option && gcode_flavor_option->value == GCodeFlavor::gcfKlipper) ? 5.0 : 10.0;
printer_config->set_key_value("machine_max_jerk_x", new ConfigOptionFloats{std::max(printer_config->option<ConfigOptionFloats>("machine_max_jerk_x")->values.front(), jerk_value)});
printer_config->set_key_value("machine_max_jerk_y", new ConfigOptionFloats{std::max(printer_config->option<ConfigOptionFloats>("machine_max_jerk_y")->values.front(), jerk_value)});
print_config->set_key_value("default_jerk", new ConfigOptionFloat(0));
}
float machine_max_jerk_x = 0.f;
if (const auto option = printer_config->option<ConfigOptionFloats>("machine_max_jerk_x");
option != nullptr && !option->values.empty()) {
machine_max_jerk_x = option->values.front();
}
float machine_max_jerk_y = 0.f;
if (const auto option = printer_config->option<ConfigOptionFloats>("machine_max_jerk_y");
option != nullptr && !option->values.empty()) {
machine_max_jerk_y = option->values.front();
}
const float jerk_value = std::max((gcode_flavor_option && gcode_flavor_option->value == GCodeFlavor::gcfKlipper) ? 5.f : 10.f,
std::min(machine_max_jerk_x, machine_max_jerk_y));
printer_config->set_key_value("machine_max_junction_deviation", new ConfigOptionFloats {junction_deviation_value});
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats { 0.0 });
filament_config->set_key_value("slow_down_min_speed", new ConfigOptionFloats { 0.0 });
@@ -12355,9 +12361,6 @@ void Plater::calib_input_shaping_freq(const Calib_Params& params)
print_config->set_key_value("outer_wall_speed", new ConfigOptionFloat(200));
print_config->set_key_value("default_acceleration", new ConfigOptionFloat(20000));
print_config->set_key_value("outer_wall_acceleration", new ConfigOptionFloat(20000));
print_config->set_key_value("default_jerk", new ConfigOptionFloat(jerk_value));
print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat(jerk_value));
print_config->set_key_value("default_junction_deviation", new ConfigOptionFloat(junction_deviation_value));
model().objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterOnly));
model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(3.0));
model().objects[0]->config.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0));
@@ -12384,27 +12387,15 @@ void Plater::calib_input_shaping_damp(const Calib_Params& params)
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
const auto gcode_flavor_option = printer_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor");
float junction_deviation_value = 0.f;
if (gcode_flavor_option && gcode_flavor_option->value == GCodeFlavor::gcfMarlinFirmware) {
const auto machine_junction_option = printer_config->option<ConfigOptionFloats>("machine_max_junction_deviation");
const float current = (machine_junction_option && !machine_junction_option->values.empty())
? machine_junction_option->values.front()
: 0.f;
junction_deviation_value = std::max(current, 0.25f);
if (has_junction_deviation(printer_config)) {
printer_config->set_key_value("machine_max_junction_deviation", new ConfigOptionFloats {(std::max(printer_config->option<ConfigOptionFloats>("machine_max_junction_deviation")->values.front(), 0.25))});
print_config->set_key_value("default_junction_deviation", new ConfigOptionFloat(0));
} else {
const double jerk_value = (gcode_flavor_option && gcode_flavor_option->value == GCodeFlavor::gcfKlipper) ? 5.0 : 10.0;
printer_config->set_key_value("machine_max_jerk_x", new ConfigOptionFloats{std::max(printer_config->option<ConfigOptionFloats>("machine_max_jerk_x")->values.front(), jerk_value)});
printer_config->set_key_value("machine_max_jerk_y", new ConfigOptionFloats{std::max(printer_config->option<ConfigOptionFloats>("machine_max_jerk_y")->values.front(), jerk_value)});
print_config->set_key_value("default_jerk", new ConfigOptionFloat(0));
}
float machine_max_jerk_x = 0.f;
if (const auto option = printer_config->option<ConfigOptionFloats>("machine_max_jerk_x");
option != nullptr && !option->values.empty()) {
machine_max_jerk_x = option->values.front();
}
float machine_max_jerk_y = 0.f;
if (const auto option = printer_config->option<ConfigOptionFloats>("machine_max_jerk_y");
option != nullptr && !option->values.empty()) {
machine_max_jerk_y = option->values.front();
}
const float jerk_value = std::max((gcode_flavor_option && gcode_flavor_option->value == GCodeFlavor::gcfKlipper) ? 5.f : 10.f,
std::min(machine_max_jerk_x, machine_max_jerk_y));
printer_config->set_key_value("machine_max_junction_deviation", new ConfigOptionFloats{junction_deviation_value});
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats { 0.0 });
filament_config->set_key_value("slow_down_min_speed", new ConfigOptionFloats { 0.0 });
@@ -12426,9 +12417,6 @@ void Plater::calib_input_shaping_damp(const Calib_Params& params)
print_config->set_key_value("outer_wall_speed", new ConfigOptionFloat(200));
print_config->set_key_value("default_acceleration", new ConfigOptionFloat(20000));
print_config->set_key_value("outer_wall_acceleration", new ConfigOptionFloat(20000));
print_config->set_key_value("default_jerk", new ConfigOptionFloat(jerk_value));
print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat(jerk_value));
print_config->set_key_value("default_junction_deviation", new ConfigOptionFloat(junction_deviation_value));
model().objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterOnly));
model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(3.0));
model().objects[0]->config.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0));
@@ -12442,19 +12430,29 @@ void Plater::calib_input_shaping_damp(const Calib_Params& params)
p->background_process.fff_print()->set_calib_params(params);
}
void Plater::calib_junction_deviation(const Calib_Params& params)
void Plater::Calib_Cornering(const Calib_Params& params)
{
const auto calib_junction_deviation = wxString::Format(L"Junction Deviation test");
new_project(false, false, calib_junction_deviation);
const auto Calib_Cornering = wxString::Format(L"Cornering test");
new_project(false, false, Calib_Cornering);
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if (params.mode != CalibMode::Calib_Junction_Deviation)
if (params.mode != CalibMode::Calib_Cornering)
return;
add_model(false, Slic3r::resources_dir() + (params.test_model < 1 ? "/calib/input_shaping/ringing_tower.stl" : "/calib/input_shaping/fast_tower_test.stl"));
const std::string cornering_model_path = params.test_model == 0
? "/calib/input_shaping/ringing_tower.stl"
: (params.test_model == 1 ? "/calib/input_shaping/fast_tower_test.stl" : "/calib/cornering/SCV-V2.stl");
add_model(false, Slic3r::resources_dir() + cornering_model_path);
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
printer_config->set_key_value("machine_max_junction_deviation", new ConfigOptionFloats{1.0});
if (has_junction_deviation(printer_config)) {
printer_config->set_key_value("machine_max_junction_deviation", new ConfigOptionFloats{params.end});
print_config->set_key_value("default_junction_deviation", new ConfigOptionFloat(0.0));
} else {
printer_config->set_key_value("machine_max_jerk_x", new ConfigOptionFloats{params.end});
printer_config->set_key_value("machine_max_jerk_y", new ConfigOptionFloats{params.end});
print_config->set_key_value("default_jerk", new ConfigOptionFloat(0));
}
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats { 0.0 });
filament_config->set_key_value("slow_down_min_speed", new ConfigOptionFloats { 0.0 });
@@ -12477,8 +12475,6 @@ void Plater::calib_junction_deviation(const Calib_Params& params)
print_config->set_key_value("outer_wall_speed", new ConfigOptionFloat(200));
print_config->set_key_value("default_acceleration", new ConfigOptionFloat(2000));
print_config->set_key_value("outer_wall_acceleration", new ConfigOptionFloat(2000));
print_config->set_key_value("default_jerk", new ConfigOptionFloat(0));
print_config->set_key_value("default_junction_deviation", new ConfigOptionFloat(0.0));
model().objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterOnly));
model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(3.0));
model().objects[0]->config.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0));
@@ -12488,7 +12484,7 @@ void Plater::calib_junction_deviation(const Calib_Params& params)
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_dirty();
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_ui_from_settings();
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_ui_from_settings();
p->background_process.fff_print()->set_calib_params(params);
}

View File

@@ -333,7 +333,7 @@ public:
void calib_VFA(const Calib_Params& params);
void calib_input_shaping_freq(const Calib_Params& params);
void calib_input_shaping_damp(const Calib_Params& params);
void calib_junction_deviation(const Calib_Params& params);
void Calib_Cornering(const Calib_Params& params);
BuildVolume_Type get_build_volume_type() const;

View File

@@ -56,6 +56,8 @@
#include <commctrl.h>
#endif // WIN32
#include <algorithm>
namespace Slic3r {
t_config_option_keys deep_diff(const ConfigBase &config_this, const ConfigBase &config_other, bool strict = true);
@@ -2504,6 +2506,7 @@ void TabPrint::build()
optgroup->append_single_option_line("accel_to_decel_factor", "speed_settings_acceleration");
optgroup = page->new_optgroup(L("Jerk(XY)"), L"param_jerk", 15);
optgroup->append_single_option_line("default_junction_deviation", "speed_settings_jerk_xy#junction-deviation");
optgroup->append_single_option_line("default_jerk", "speed_settings_jerk_xy#default");
optgroup->append_single_option_line("outer_wall_jerk", "speed_settings_jerk_xy#outer-wall");
optgroup->append_single_option_line("inner_wall_jerk", "speed_settings_jerk_xy#inner-wall");
@@ -2511,7 +2514,6 @@ void TabPrint::build()
optgroup->append_single_option_line("top_surface_jerk", "speed_settings_jerk_xy#top-surface");
optgroup->append_single_option_line("initial_layer_jerk", "speed_settings_jerk_xy#initial-layer");
optgroup->append_single_option_line("travel_jerk", "speed_settings_jerk_xy#travel");
optgroup->append_single_option_line("default_junction_deviation", "speed_settings_jerk_xy#junction-deviation");
optgroup = page->new_optgroup(L("Advanced"), L"param_advanced", 15);
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope", "speed_settings_advanced");
@@ -4603,12 +4605,12 @@ PageShp TabPrinter::build_kinematics_page()
append_option_line(optgroup, "machine_max_acceleration_travel");
optgroup = page->new_optgroup(L("Jerk limitation"), "param_jerk");
// machine max junction deviation
append_option_line(optgroup, "machine_max_junction_deviation");
for (const std::string &axis : axes) {
append_option_line(optgroup, "machine_max_jerk_" + axis);
}
// machine max junction deviation
append_option_line(optgroup, "machine_max_junction_deviation");
//optgroup = page->new_optgroup(L("Minimum feedrates"));
// append_option_line(optgroup, "machine_min_extruding_rate");
// append_option_line(optgroup, "machine_min_travel_rate");
@@ -5186,6 +5188,24 @@ void TabPrinter::toggle_options()
toggle_option("machine_max_junction_deviation", gcf == gcfMarlinFirmware, i);
toggle_line("machine_max_junction_deviation", gcf == gcfMarlinFirmware);
// Check if junction deviation value is non-zero and firmware is Marlin
bool enable_jerk = gcf != gcfMarlinFirmware;
if (gcf == gcfMarlinFirmware) {
const auto *junction_deviation = m_config->option<ConfigOptionFloats>("machine_max_junction_deviation");
if (junction_deviation != nullptr) {
const auto &values = junction_deviation->values;
enable_jerk = std::all_of(values.begin(), values.end(), [](double val) { return val == 0.0; });
} else {
enable_jerk = true;
}
}
for (int i = 0; i < max_field; ++i) {
toggle_option("machine_max_jerk_x", enable_jerk, i);
toggle_option("machine_max_jerk_y", enable_jerk, i);
toggle_option("machine_max_jerk_z", enable_jerk, i);
toggle_option("machine_max_jerk_e", enable_jerk, i);
}
bool resonance_avoidance = m_config->opt_bool("resonance_avoidance");
toggle_option("min_resonance_avoidance_speed", resonance_avoidance);
toggle_option("max_resonance_avoidance_speed", resonance_avoidance);

View File

@@ -173,6 +173,20 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
// Help links
auto help_sizer = new wxBoxSizer(wxVERTICAL);
auto help_link_pa = new wxHyperlinkCtrl(this, wxID_ANY, _L("Pressure Advance Guide"),
"https://github.com/SoftFever/OrcaSlicer/wiki/pressure-advance-calib");
help_link_pa->SetForegroundColour(wxColour("#1890FF"));
help_sizer->Add(help_link_pa, 0, wxALL, FromDIP(5));
auto help_link_apa = new wxHyperlinkCtrl(this, wxID_ANY, _L("Adaptive Pressure Advance Guide"),
"https://github.com/SoftFever/OrcaSlicer/wiki/adaptive-pressure-advance-calib");
help_link_apa->SetForegroundColour(wxColour("#1890FF"));
help_sizer->Add(help_link_apa, 0, wxALL, FromDIP(5));
v_sizer->Add(help_sizer, 0, wxALL, FromDIP(10));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
@@ -372,6 +386,11 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto help_link = new wxHyperlinkCtrl(this, wxID_ANY, _L("Wiki Guide: Temperature Calibration"),
"https://github.com/SoftFever/OrcaSlicer/wiki/temp-calib");
help_link->SetForegroundColour(wxColour("#1890FF"));
v_sizer->Add(help_link, 0, wxALL, FromDIP(10));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
@@ -546,6 +565,11 @@ MaxVolumetricSpeed_Test_Dlg::MaxVolumetricSpeed_Test_Dlg(wxWindow* parent, wxWin
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto help_link = new wxHyperlinkCtrl(this, wxID_ANY, _L("Wiki Guide: Volumetric Speed Calibration"),
"https://github.com/SoftFever/OrcaSlicer/wiki/volumetric-speed-calib");
help_link->SetForegroundColour(wxColour("#1890FF"));
v_sizer->Add(help_link, 0, wxALL, FromDIP(10));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
@@ -647,6 +671,11 @@ VFA_Test_Dlg::VFA_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto help_link = new wxHyperlinkCtrl(this, wxID_ANY, _L("Wiki Guide: VFA"),
"https://github.com/SoftFever/OrcaSlicer/wiki/vfa-calib");
help_link->SetForegroundColour(wxColour("#1890FF"));
v_sizer->Add(help_link, 0, wxALL, FromDIP(10));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
@@ -749,6 +778,11 @@ Retraction_Test_Dlg::Retraction_Test_Dlg(wxWindow* parent, wxWindowID id, Plater
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto help_link = new wxHyperlinkCtrl(this, wxID_ANY, _L("Wiki Guide: Retraction Calibration"),
"https://github.com/SoftFever/OrcaSlicer/wiki/retraction-calib");
help_link->SetForegroundColour(wxColour("#1890FF"));
v_sizer->Add(help_link, 0, wxALL, FromDIP(10));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
@@ -921,6 +955,11 @@ Input_Shaping_Freq_Test_Dlg::Input_Shaping_Freq_Test_Dlg(wxWindow* parent, wxWin
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto help_link = new wxHyperlinkCtrl(this, wxID_ANY, _L("Wiki Guide: Input Shaping Calibration"),
"https://github.com/SoftFever/OrcaSlicer/wiki/input-shaping-calib");
help_link->SetForegroundColour(wxColour("#1890FF"));
v_sizer->Add(help_link, 0, wxALL, FromDIP(10));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
@@ -1113,6 +1152,11 @@ Input_Shaping_Damp_Test_Dlg::Input_Shaping_Damp_Test_Dlg(wxWindow* parent, wxWin
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto help_link = new wxHyperlinkCtrl(this, wxID_ANY, _L("Wiki Guide: Input Shaping Calibration"),
"https://github.com/SoftFever/OrcaSlicer/wiki/input-shaping-calib");
help_link->SetForegroundColour(wxColour("#1890FF"));
v_sizer->Add(help_link, 0, wxALL, FromDIP(10));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
@@ -1185,11 +1229,11 @@ void Input_Shaping_Damp_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
Fit();
}
// Junction_Deviation_Test_Dlg
// Cornering_Test_Dlg
//
Junction_Deviation_Test_Dlg::Junction_Deviation_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("Junction Deviation test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE), m_plater(plater)
Cornering_Test_Dlg::Cornering_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("Cornering test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE), m_plater(plater)
{
SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
SetForegroundColour(wxColour("#363636"));
@@ -1202,56 +1246,112 @@ Junction_Deviation_Test_Dlg::Junction_Deviation_Test_Dlg(wxWindow* parent, wxWin
auto labeled_box_model = new LabeledStaticBox(this, _L("Test model"));
auto model_box = new wxStaticBoxSizer(labeled_box_model, wxHORIZONTAL);
m_rbModel = new RadioGroup(this, { _L("Ringing Tower"), _L("Fast Tower") }, wxHORIZONTAL);
m_rbModel = new RadioGroup(this, { _L("Ringing Tower"), _L("Fast Tower"), _L("SCV-V2") }, wxHORIZONTAL);
model_box->Add(m_rbModel, 0, wxALL | wxEXPAND, FromDIP(4));
v_sizer->Add(model_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
// Settings
wxString start_jd_str = _L("Start junction deviation: ");
wxString end_jd_str = _L("End junction deviation: ");
int text_max = GetTextMax(this, std::vector<wxString>{start_jd_str, end_jd_str});
wxString start_jd_str = _L("Start: ");
wxString end_jd_str = _L("End: ");
auto st_size = FromDIP(wxSize(text_max, -1));
auto ti_size = FromDIP(wxSize(120, -1));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Junction Deviation settings"));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Cornering settings"));
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
settings_sizer->AddSpacer(FromDIP(5));
// Start junction deviation
// Detect GCode Flavor and set appropriate values and units
const auto* preset_bundle = wxGetApp().preset_bundle;
const auto* gcode_flavor_option = (preset_bundle != nullptr)
? preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")
: nullptr;
wxString start_value_str;
wxString end_value_str;
wxString units_str;
if (gcode_flavor_option &&
gcode_flavor_option->value == GCodeFlavor::gcfMarlinFirmware &&
preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("machine_max_junction_deviation") &&
!preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("machine_max_junction_deviation")->values.empty() &&
preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("machine_max_junction_deviation")->values[0] > 0) {
// Using Junction Deviation (mm)
start_value_str = wxString::Format("%.3f", 0.000);
end_value_str = wxString::Format("%.3f", 0.250);
units_str = "mm";
} else {
// Using Classic Jerk (mm/s)
start_value_str = wxString::Format("%.3f", 1.0);
end_value_str = wxString::Format("%.3f", 15.0);
units_str = "mm/s";
}
auto ti_size = FromDIP(wxSize(120, -1));
// Start and End cornering on same row
auto cornering_row_sizer = new wxBoxSizer(wxHORIZONTAL);
// Start cornering
auto start_jd_sizer = new wxBoxSizer(wxHORIZONTAL);
auto start_jd_text = new wxStaticText(this, wxID_ANY, start_jd_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiJDStart = new TextInput(this, wxString::Format("%.3f", 0.000), "mm", "", wxDefaultPosition, ti_size);
auto start_jd_text = new wxStaticText(this, wxID_ANY, start_jd_str, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
m_tiJDStart = new TextInput(this, start_value_str, units_str, "", wxDefaultPosition, ti_size);
m_tiJDStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
start_jd_sizer->Add(start_jd_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
start_jd_sizer->Add(m_tiJDStart , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(start_jd_sizer, 0, wxLEFT, FromDIP(3));
cornering_row_sizer->Add(start_jd_sizer, 0, wxLEFT, FromDIP(3));
// End junction deviation
// End cornering
auto end_jd_sizer = new wxBoxSizer(wxHORIZONTAL);
auto end_jd_text = new wxStaticText(this, wxID_ANY, end_jd_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiJDEnd = new TextInput(this, wxString::Format("%.3f", 0.250), "mm", "", wxDefaultPosition, ti_size);
auto end_jd_text = new wxStaticText(this, wxID_ANY, end_jd_str, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
m_tiJDEnd = new TextInput(this, end_value_str, units_str, "", wxDefaultPosition, ti_size);
m_tiJDEnd->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
end_jd_sizer->Add(end_jd_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
end_jd_sizer->Add(m_tiJDEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(end_jd_sizer, 0, wxLEFT, FromDIP(3));
end_jd_sizer->Add(m_tiJDEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
cornering_row_sizer->Add(end_jd_sizer, 0, wxLEFT, FromDIP(3));
settings_sizer->Add(cornering_row_sizer, 0, wxLEFT, FromDIP(3));
settings_sizer->AddSpacer(FromDIP(5));
// Add note about junction deviation
auto note_text = new wxStaticText(this, wxID_ANY, _L("Note: Lower values = sharper corners but slower speeds"),
// Add note about cornering based on GCode Flavor
wxString note_msg = _L("Note: Lower values = sharper corners but slower speeds.\n");
if (gcode_flavor_option) {
switch (gcode_flavor_option->value) {
case GCodeFlavor::gcfMarlinFirmware: {
// Check if machine_max_junction_deviation is set and > 0
const auto* max_jd_option = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("machine_max_junction_deviation");
if (max_jd_option && !max_jd_option->values.empty() && max_jd_option->values[0] > 0) {
note_msg += _L("Marlin 2 Junction Deviation detected:\nTo test Classic Jerk, set 'Maximum Junction Deviation' in Motion ability to 0.");
} else {
note_msg += _L("Marlin 2 Classic Jerk detected:\nTo test Junction Deviation, set 'Maximum Junction Deviation' in Motion ability to a value > 0.");
}
break;
}
case GCodeFlavor::gcfRepRapFirmware:
note_msg += _L("RepRap detected: Jerk in mm/s.\nOrcaSlicer will convert the values to mm/min when necessary.");
break;
default:
break;
}
}
auto note_text = new wxStaticText(this, wxID_ANY, note_msg,
wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
note_text->SetForegroundColour(wxColour(128, 128, 128));
note_text->Wrap(FromDIP(300));
settings_sizer->Add(note_text, 0, wxALL, FromDIP(5));
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto help_link = new wxHyperlinkCtrl(this, wxID_ANY, _L("Wiki Guide: Cornering Calibration"),
"https://github.com/SoftFever/OrcaSlicer/wiki/cornering-calib");
help_link->SetForegroundColour(wxColour("#1890FF"));
v_sizer->Add(help_link, 0, wxALL, FromDIP(10));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Junction_Deviation_Test_Dlg::on_start, this);
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Cornering_Test_Dlg::on_start, this);
wxGetApp().UpdateDlgDarkUI(this);
@@ -1259,34 +1359,54 @@ Junction_Deviation_Test_Dlg::Junction_Deviation_Test_Dlg(wxWindow* parent, wxWin
Fit();
}
Junction_Deviation_Test_Dlg::~Junction_Deviation_Test_Dlg() {
Cornering_Test_Dlg::~Cornering_Test_Dlg() {
// Disconnect Events
}
void Junction_Deviation_Test_Dlg::on_start(wxCommandEvent& event) {
void Cornering_Test_Dlg::on_start(wxCommandEvent& event) {
bool read_double = false;
read_double = m_tiJDStart->GetTextCtrl()->GetValue().ToDouble(&m_params.start);
read_double = read_double && m_tiJDEnd->GetTextCtrl()->GetValue().ToDouble(&m_params.end);
if (!read_double || m_params.start < 0 || m_params.end >= 1 || m_params.start >= m_params.end) {
MessageDialog msg_dlg(nullptr, _L("Please input valid values:\n(0 <= Junction Deviation < 1)"), wxEmptyString, wxICON_WARNING | wxOK);
// Get max values based on GCode Flavor
double max_end_value = 100.0;
double warning_threshold = 20.0;
const auto* preset_bundle = wxGetApp().preset_bundle;
const auto* gcode_flavor_option = (preset_bundle != nullptr)
? preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")
: nullptr;
if (gcode_flavor_option &&
gcode_flavor_option->value == GCodeFlavor::gcfMarlinFirmware &&
preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("machine_max_junction_deviation") &&
!preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("machine_max_junction_deviation")->values.empty() &&
preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("machine_max_junction_deviation")->values[0] > 0) {
// Using Junction Deviation (mm)
max_end_value = 1.0;
warning_threshold = 0.3;
}
if (!read_double || m_params.start < 0 || m_params.end > max_end_value || m_params.start >= m_params.end) {
wxString error_msg = wxString::Format(_L("Please input valid values:\n(0 <= Cornering <= %s)"), wxString::Format("%.3f", max_end_value));
MessageDialog msg_dlg(nullptr, error_msg, wxEmptyString, wxICON_WARNING | wxOK);
msg_dlg.ShowModal();
return;
} else if (m_params.end > 0.3) {
MessageDialog msg_dlg(nullptr, _L("NOTE: High values may cause Layer shift"), wxEmptyString, wxICON_WARNING | wxOK);
} else if (m_params.end > warning_threshold) {
wxString warning_msg = wxString::Format(_L("NOTE: High values may cause Layer shift (>%s)"), wxString::Format("%.3f", warning_threshold));
MessageDialog msg_dlg(nullptr, warning_msg, wxEmptyString, wxICON_WARNING | wxOK);
msg_dlg.ShowModal();
}
m_params.mode = CalibMode::Calib_Junction_Deviation;
m_params.mode = CalibMode::Calib_Cornering;
// Set model type based on selection
m_params.test_model = m_rbModel->GetSelection() == 0 ? 0 : 1; // 0 = Ringing Tower, 1 = Fast Tower
m_plater->calib_junction_deviation(m_params);
m_params.test_model = m_rbModel->GetSelection();
m_plater->Calib_Cornering(m_params);
EndModal(wxID_OK);
}
void Junction_Deviation_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
void Cornering_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
this->Refresh();
Fit();
}

View File

@@ -164,11 +164,11 @@ protected:
Plater* m_plater;
};
class Junction_Deviation_Test_Dlg : public DPIDialog
class Cornering_Test_Dlg : public DPIDialog
{
public:
Junction_Deviation_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater);
~Junction_Deviation_Test_Dlg();
Cornering_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater);
~Cornering_Test_Dlg();
void on_dpi_changed(const wxRect& suggested_rect) override;
protected: