Input Shaping Calib: Types, RepRap + Improvements (#10913)
Some checks are pending
Build all / Build All (push) Waiting to run
Build all / Flatpak (push) Waiting to run
Publish docs to Wiki / Publish docs to Wiki (push) Waiting to run

* IS Freq duplicated as Base

* IS jerk to 5

* JD jerk to 0

* Base 1 layer + MINIMUM_CRUISE_RATIO=0

* Tab

* Remove IS BASE

* Update Plater.cpp

* Klipper Jerk 5, Others 10

* JD in Marlin2

* Types

* Horizontal

* Different lists

* RepRap IS writer

* Smart Flavors and axis

* RepRap values lowercase

* Hide Y axix for RepRap

* Max Jerk or JD

* Reorder

* Removed dual list + Default

* RepRap show UpperCase use LowerCase

* RepRap P"type" Type of input shaping to use, not case sensitive.

* RepRap DAA

* Reorder Klipper

* Custom Firmware Note

* Better Display

Co-Authored-By: yw4z <28517890+yw4z@users.noreply.github.com>

* Better notes

* Update + Clean Wiki

Co-Authored-By: gregmatic <60957555+gregmatic@users.noreply.github.com>

* Wiki Update

Update Images
Improve guide

Co-Authored-By: Cameron D <30559428+cdunn95@users.noreply.github.com>

* Fix G-code generation issue and refine input shaping calibration documentation

---------

Co-authored-by: yw4z <28517890+yw4z@users.noreply.github.com>
Co-authored-by: gregmatic <60957555+gregmatic@users.noreply.github.com>
Co-authored-by: Cameron D <30559428+cdunn95@users.noreply.github.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Ian Bassi 2025-10-19 13:31:51 -03:00 committed by GitHub
parent a754387566
commit d786aec255
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 384 additions and 138 deletions

View file

@ -352,8 +352,10 @@ std::string GCodeWriter::set_pressure_advance(double pa) const
return gcode.str();
}
std::string GCodeWriter::set_input_shaping(char axis, float damp, float freq) const
std::string GCodeWriter::set_input_shaping(char axis, float damp, float freq, std::string type) const
{
if (FLAVOR_IS(gcfMarlinLegacy))
throw std::runtime_error("Input shaping is not supported by Marlin < 2.1.2.\nCheck your firmware version and update your G-code flavor to ´Marlin 2´");
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));
@ -361,14 +363,17 @@ std::string GCodeWriter::set_input_shaping(char axis, float damp, float freq) co
std::ostringstream gcode;
if (FLAVOR_IS(gcfKlipper)) {
gcode << "SET_INPUT_SHAPER";
if (!type.empty() && type != "Default") {
gcode << " SHAPER_TYPE=" << type;
}
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;
}
gcode << " DAMPING_RATIO_" << axis << "=" << std::fixed << std::setprecision(3) << 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;
@ -377,7 +382,18 @@ std::string GCodeWriter::set_input_shaping(char axis, float damp, float freq) co
gcode << " DAMPING_RATIO_X=" << std::fixed << std::setprecision(3) << damp << " DAMPING_RATIO_Y=" << std::fixed << std::setprecision(3) << damp;
}
}
} else {
} else if (FLAVOR_IS(gcfRepRapFirmware)) {
gcode << "M593";
if (!type.empty() && type != "Default" && type != "DAA") {
gcode << " P\"" << type << "\"";
}
if (freq > 0.0f) {
gcode << " F" << std::fixed << std::setprecision(2) << freq;
}
if (damp > 0.0f){
gcode << " S" << std::fixed << std::setprecision(3) << damp;
}
} else if (FLAVOR_IS(gcfMarlinFirmware)) {
gcode << "M593";
if (axis != 'A')
{
@ -391,6 +407,8 @@ std::string GCodeWriter::set_input_shaping(char axis, float damp, float freq) co
{
gcode << " D" << std::fixed << std::setprecision(3) << damp;
}
} else {
throw std::runtime_error("Input shaping is only supported by Klipper, RepRapFirmware and Marlin 2");
}
if (GCodeWriter::full_gcode_comment){
gcode << " ; Override input shaping";