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

@@ -11,6 +11,7 @@
#include "libslic3r/PrintConfig.hpp"
#include <regex>
#include <cstdint>
#include <wx/numformatter.h>
#include <wx/tooltip.h>
#include <wx/notebook.h>
@@ -1626,18 +1627,45 @@ void Choice::set_value(const boost::any& value, bool change_event)
}
case coEnum:
// BBS
case coEnums: {
case coEnums: {
int val = boost::any_cast<int>(value);
int selection = val;
// Support ThirdPartyPrinter
if (m_opt_id.compare("host_type") == 0 && val != 0 &&
m_opt.enum_values.size() > field->GetCount()) // for case, when PrusaLink isn't used as a HostType
val--;
if (m_opt_id == "top_surface_pattern" || m_opt_id == "bottom_surface_pattern" ||
m_opt_id == "internal_solid_infill_pattern" || m_opt_id == "sparse_infill_pattern" ||
m_opt_id == "support_base_pattern" || m_opt_id == "support_interface_pattern" ||
m_opt_id == "ironing_pattern" || m_opt_id == "support_ironing_pattern" ||
m_opt_id == "support_style" || m_opt_id == "curr_bed_type" || m_opt_id == "wipe_tower_wall_type")
if (m_opt_id == "input_shaping_type") {
if (field != nullptr) {
const unsigned int count = field->GetCount();
int match_index = -1;
for (unsigned int idx = 0; idx < count; ++idx) {
if (void* data = field->GetClientData(idx)) {
int stored = static_cast<int>(reinterpret_cast<uintptr_t>(data));
if (stored == val) {
match_index = static_cast<int>(idx);
break;
}
}
}
if (match_index >= 0)
selection = match_index;
else if (val >= 0 && val < static_cast<int>(count))
selection = val;
else if (count > 0)
selection = 0;
else
selection = -1;
}
} else {
// Support ThirdPartyPrinter
if (m_opt_id.compare("host_type") == 0 && val != 0 &&
m_opt.enum_values.size() > field->GetCount()) // for case, when PrusaLink isn't used as a HostType
selection = val - 1;
else
selection = val;
if (m_opt_id == "top_surface_pattern" || m_opt_id == "bottom_surface_pattern" ||
m_opt_id == "internal_solid_infill_pattern" || m_opt_id == "sparse_infill_pattern" ||
m_opt_id == "support_base_pattern" || m_opt_id == "support_interface_pattern" ||
m_opt_id == "ironing_pattern" || m_opt_id == "support_ironing_pattern" ||
m_opt_id == "support_style" || m_opt_id == "curr_bed_type" || m_opt_id == "wipe_tower_wall_type")
{
std::string key;
const t_config_enum_values& map_names = *m_opt.enum_keys_map;
@@ -1649,15 +1677,16 @@ void Choice::set_value(const boost::any& value, bool change_event)
const std::vector<std::string>& values = m_opt.enum_values;
auto it = std::find(values.begin(), values.end(), key);
val = it == values.end() ? 0 : it - values.begin();
selection = it == values.end() ? 0 : static_cast<int>(it - values.begin());
}
}
if (m_opt.nullable) {
if (val != ConfigOptionEnumsGenericNullable::nil_value())
m_last_meaningful_value = value;
else
val = -1;
selection = -1;
}
field->SetSelection(val);
field->SetSelection(selection);
break;
}
default:
@@ -1724,6 +1753,17 @@ boost::any& Choice::get_value()
{
if (m_opt.nullable && field->GetSelection() == -1)
m_value = ConfigOptionEnumsGenericNullable::nil_value();
else if (m_opt_id == "input_shaping_type")
{
int selection = field->GetSelection();
if (selection >= 0) {
if (void* data = field->GetClientData(selection))
m_value = static_cast<int>(reinterpret_cast<uintptr_t>(data));
else
m_value = selection;
} else
m_value = 0;
}
else if ( m_opt_id == "top_surface_pattern" || m_opt_id == "bottom_surface_pattern" ||
m_opt_id == "internal_solid_infill_pattern" || m_opt_id == "sparse_infill_pattern" ||
m_opt_id == "support_base_pattern" || m_opt_id == "support_interface_pattern" ||