Klipper compatible

Klipper freq & damp test

Klipper guide separation from the Marlin guide

Co-Authored-By: Shane Delmore <shane@delmore.io>
This commit is contained in:
Ian Bassi
2025-04-03 11:40:56 -03:00
parent 4376f8ba3c
commit a66bc06b2d
4 changed files with 90 additions and 43 deletions

View File

@@ -345,27 +345,43 @@ std::string GCodeWriter::set_pressure_advance(double pa) const
std::string GCodeWriter::set_input_shaping(char axis, float damp, float freq) const
{
std::ostringstream gcode;
if (FLAVOR_IS(gcfKlipper))
{
throw std::runtime_error("M593 - ZV Input Shaping is NOT supported by Klipper");
}
if (freq < 0.0f || damp < 0.f || damp > 1.0f || (axis != 'X' && axis != 'Y' && axis != 'Z' && axis != 'A'))// A = all axis
{
throw std::runtime_error("Invalid input shaping parameters: freq=" + std::to_string(freq) + ", damp=" + std::to_string(damp));
}
gcode << "M593";
if (axis != 'A')
{
gcode << " " << axis;
}
if (freq > 0.0f)
{
gcode << " F" << std::fixed << std::setprecision(2) << freq;
}
if (damp > 0.0f)
{
gcode << " D" << std::fixed << std::setprecision(2) << damp;
std::ostringstream gcode;
if (FLAVOR_IS(gcfKlipper)) {
gcode << "SET_INPUT_SHAPER";
if (axis != 'A')
{
if (freq > 0.0f) {
gcode << " SHAPER_FREQ_" << axis << "=" << std::fixed << std::setprecision(2) << freq;
}
if (damp > 0.0f){
gcode << " DAMPING_RATIO_" << axis << "=" << damp;
}
} else {
if (freq > 0.0f) {
gcode << " SHAPER_FREQ_X=" << std::fixed << std::setprecision(2) << freq << " SHAPER_FREQ_Y=" << std::fixed << std::setprecision(2) << freq;
}
if (damp > 0.0f) {
gcode << " DAMPING_RATIO_X=" << damp << " DAMPING_RATIO_Y=" << damp;
}
}
} else {
gcode << "M593";
if (axis != 'A')
{
gcode << " " << axis;
}
if (freq > 0.0f)
{
gcode << " F" << std::fixed << std::setprecision(2) << freq;
}
if (damp > 0.0f)
{
gcode << " D" << std::fixed << std::setprecision(2) << damp;
}
}
gcode << "; Override input shaping value\n";
return gcode.str();

View File

@@ -10167,8 +10167,6 @@ void Plater::calib_input_shaping_freq(const Calib_Params& params)
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats { 200 });
filament_config->set_key_value("enable_pressure_advance", new ConfigOptionBools {false });
filament_config->set_key_value("pressure_advance", new ConfigOptionFloats { 0.0 });
print_config->set_key_value("default_jerk", new ConfigOptionFloat { 20.0 });
print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat { 20.0 });
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool { false });
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));
@@ -10208,8 +10206,6 @@ void Plater::calib_input_shaping_damp(const Calib_Params& params)
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats { 200 });
filament_config->set_key_value("enable_pressure_advance", new ConfigOptionBools{false});
filament_config->set_key_value("pressure_advance", new ConfigOptionFloats{0.0});
print_config->set_key_value("default_jerk", new ConfigOptionFloat { 20.0 });
print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat { 20.0 });
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool{false});
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));
@@ -10249,8 +10245,6 @@ void Plater::calib_junction_deviation(const Calib_Params& params)
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{200});
filament_config->set_key_value("enable_pressure_advance", new ConfigOptionBools{false});
filament_config->set_key_value("pressure_advance", new ConfigOptionFloats{0.0});
print_config->set_key_value("default_jerk", new ConfigOptionFloat { 20.0 });
print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat { 20.0 });
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool{false});
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));

View File

@@ -863,8 +863,7 @@ Input_Shaping_Freq_Test_Dlg::Input_Shaping_Freq_Test_Dlg(wxWindow* parent, wxWin
settings_sizer->Add(damping_factor_sizer);
// Add a note explaining that 0 means use default value
auto note_text = new wxStaticText(this, wxID_ANY, _L("Note: 0 Damp = Printer default"),
wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
auto note_text = new wxStaticText(this, wxID_ANY, _L("Note: 0 Damp = Printer default."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
note_text->SetForegroundColour(wxColour(128, 128, 128));
settings_sizer->Add(note_text, 0, wxALL, 5);
@@ -997,8 +996,10 @@ Input_Shaping_Damp_Test_Dlg::Input_Shaping_Damp_Test_Dlg(wxWindow* parent, wxWin
settings_sizer->Add(damp_sizer);
// Add a note to explain users to use their previously calculated frequency
auto note_text = new wxStaticText(this, wxID_ANY, _L("Note: Set frequencies to the previously calculated values"),
wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
auto note_text = new wxStaticText(this, wxID_ANY, _L("Note: Use previously calculated frequencies."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
note_text->SetForegroundColour(wxColour(128, 128, 128));
settings_sizer->Add(note_text, 0, wxALL, 5);
note_text->SetForegroundColour(wxColour(128, 128, 128));
settings_sizer->Add(note_text, 0, wxALL, 5);