Machine Input Shaping (#11202)

* Base IS Machine

* Toggle line

* Rebase

* Intento 1

* Wiki IS

* Flavorized

* Tooltips

* Calibration using the same list

* max

* Reorder JD validation

* Refactor set input shaping

* Calibrations IS

* Default values

* Axis

* Orca comments

* Rename input_shaping_enable to input_shaping_emit

Refactor all references of the input shaping configuration option from 'input_shaping_enable' to 'input_shaping_emit' across the codebase. This improves clarity by better reflecting the option's purpose of controlling whether input shaping commands are emitted in the generated G-code.

Restore DONT EMIT FOR KLIPPER

* Refactor input shaping option toggling logic

Simplifies and consolidates the logic for toggling input shaping related options in TabPrinter::toggle_options(). Uses a loop to handle enabling/disabling lines based on GCode flavor compatibility, and refines the conditions for toggling individual options.

* Improve input shaping option toggling logic in TabPrinter

* GrayOut Emit to gcode limits for klipper

* Typo

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Typo

* Skip Y input-shaper when type is Disable

If marlin2 and disabled it will be already disabled at X.

* IS expert

Co-Authored-By: SoftFever <softfeverever@gmail.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Ian Bassi
2026-05-11 08:38:40 -03:00
committed by GitHub
parent c8be7fb708
commit ec424fb674
10 changed files with 427 additions and 67 deletions

View File

@@ -91,6 +91,25 @@ size_t get_extruder_index(const GCodeConfig& config, unsigned int filament_id)
return 0;
}
// Orca: input shaping values types by flavor
std::vector<std::string> get_shaper_type_values_for_flavor(GCodeFlavor flavor)
{
switch (flavor) {
case GCodeFlavor::gcfKlipper:
return {"Default", "MZV", "ZV", "ZVD", "EI", "2HUMP_EI", "3HUMP_EI"};
case GCodeFlavor::gcfRepRapFirmware:
return {"Default", "MZV", "ZV", "ZVD", "ZVDD", "ZVDDD", "EI2", "EI3", "DAA"};
case GCodeFlavor::gcfMarlinFirmware:
return {"ZV"};
case GCodeFlavor::gcfMarlinLegacy:
return {};
default:
break;
}
return {"Default"};
}
static t_config_enum_names enum_names_from_keys_map(const t_config_enum_values &enum_keys_map)
{
t_config_enum_names names;
@@ -481,6 +500,23 @@ static t_config_enum_values s_keys_map_PrinterStructure {
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PrinterStructure)
static t_config_enum_values s_keys_map_InputShaperType {
{"Default", int(InputShaperType::Default)},
{"MZV", int(InputShaperType::MZV)},
{"ZV", int(InputShaperType::ZV)},
{"ZVD", int(InputShaperType::ZVD)},
{"ZVDD", int(InputShaperType::ZVDD)},
{"ZVDDD", int(InputShaperType::ZVDDD)},
{"EI", int(InputShaperType::EI)},
{"EI2", int(InputShaperType::EI2)},
{"2HUMP_EI",int(InputShaperType::TwoHumpEI)},
{"EI3", int(InputShaperType::EI3)},
{"3HUMP_EI",int(InputShaperType::ThreeHumpEI)},
{"DAA", int(InputShaperType::DAA)},
{"Disable", int(InputShaperType::Disable)}
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(InputShaperType)
static t_config_enum_values s_keys_map_PerimeterGeneratorType{
{ "classic", int(PerimeterGeneratorType::Classic) },
{ "arachne", int(PerimeterGeneratorType::Arachne) }
@@ -4243,8 +4279,8 @@ void PrintConfigDef::init_fff_params()
def = this->add("emit_machine_limits_to_gcode", coBool);
def->label = L("Emit limits to G-code");
def->category = L("Machine limits");
def->tooltip = L("If enabled, the machine limits will be emitted to G-code file.\nThis option will be ignored if the G-code flavor is "
"set to Klipper.");
def->tooltip = L("If enabled, the machine limits will be emitted to G-code file.\nThis option will be ignored if the G-code flavor is "
"set to Klipper.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
@@ -4455,6 +4491,56 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(120));
// Orca: Input Shaping support
def = this->add("input_shaping_emit", coBool);
def->label = L("Emit input shaping");
def->tooltip = L("Override firmware input shaping settings.\nIf disabled, firmware settings are used.");
def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("input_shaping_type", coEnum);
def->label = L("Input shaper type");
def->tooltip = L("Choose the input shaper algorithm.\nDefault uses the firmware default settings.\nDisable turns off input shaping in the firmware.");
def->enum_keys_map = &ConfigOptionEnum<InputShaperType>::get_enum_values();
def->enum_values = {"Default", "MZV", "ZV", "ZVD", "ZVDD", "ZVDDD", "EI", "EI2", "2HUMP_EI", "EI3", "3HUMP_EI", "DAA", "Disable"};
def->enum_labels = {L("Default"), L("MZV"), L("ZV"), L("ZVD"), L("ZVDD"), L("ZVDDD"), L("EI"), L("EI2"), L("2HUMP_EI"), L("EI3"), L("3HUMP_EI"), L("DAA"), L("Disable")};
def->mode = comExpert;
def->set_default_value(new ConfigOptionEnum<InputShaperType>(InputShaperType::Default));
def = this->add("input_shaping_freq_x", coFloat);
def->label = L("X");
def->tooltip = L("Resonant frequency for the X axis input shaper.\nZero will use the firmware frequency.\nTo disable input shaping, use the Disable type.\nRRF: X and Y values are equal.");
def->sidetext = "Hz";
def->min = 0;
def->max = 1000;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0));
def = this->add("input_shaping_freq_y", coFloat);
def->label = L("Y");
def->tooltip = L("Resonant frequency for the Y axis input shaper.\nZero will use the firmware frequency.\nTo disable input shaping, use the Disable type.");
def->sidetext = "Hz";
def->min = 0;
def->max = 1000;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0));
def = this->add("input_shaping_damp_x", coFloat);
def->label = L("X");
def->tooltip = L("Damping ratio for the X axis input shaper.\nZero will use the firmware damping ratio.\nTo disable input shaping, use the Disable type.\nRRF: X and Y values are equal.");
def->min = 0;
def->max = 1;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0.1));
def = this->add("input_shaping_damp_y", coFloat);
def->label = L("Y");
def->tooltip = L("Damping ratio for the Y axis input shaper.\nZero will use the firmware damping ratio.\nTo disable input shaping, use the Disable type.");
def->min = 0;
def->max = 1;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0.1));
def = this->add("fan_max_speed", coFloats);
def->label = L("Fan speed");
def->tooltip = L("Part cooling fan speed may be increased when auto cooling is enabled. "