Fix: Nozzle list (#11836)

* Fix extruder_id out-of-bounds in switch_excluder

Added a check to reset extruder_id to 0 if it exceeds the size of nozzle_volumes or extruders, preventing potential out-of-bounds access.

Co-Authored-By: Christopher R. Palmer <1305033+crpalmer@users.noreply.github.com>

* Add custom nozzle diameter option in sidebar

Ensures that if the actual nozzle diameter is not present in the list, it is added as a custom option. This improves user experience by allowing selection of non-standard nozzle diameters.

Refactor nozzle diameter selection logic in Sidebar

Simplified the logic for updating the extruder nozzle diameter combo box by removing redundant checks and streamlining the addition of custom nozzle diameters. This improves code clarity and ensures the actual nozzle diameter from the printer config is always considered.

Co-Authored-By: yw4z <yw4z@outlook.com>

* Prevent profile switch if selected diameter matches nozzle

Adds a check in Sidebar::priv::switch_diameter to avoid switching printer profiles when the selected diameter matches the current nozzle diameter in the configuration. This prevents unnecessary profile changes and improves user experience.

---------

Co-authored-by: Christopher R. Palmer <1305033+crpalmer@users.noreply.github.com>
Co-authored-by: yw4z <yw4z@outlook.com>
This commit is contained in:
Ian Bassi
2026-02-13 01:24:24 -03:00
committed by GitHub
parent 6c900535e5
commit f38324d521
2 changed files with 21 additions and 6 deletions

View File

@@ -6961,6 +6961,8 @@ void Tab::switch_excluder(int extruder_id)
{}, {"", "filament_extruder_variant"}, // Preset::TYPE_FILAMENT filament don't use id anymore
{}, {"printer_extruder_id", "printer_extruder_variant"}, // Preset::TYPE_PRINTER
};
if (extruder_id >= nozzle_volumes->size() || extruder_id >= extruders->size())
extruder_id = 0;
if (m_extruder_switch && m_type != Preset::TYPE_PRINTER) {
int current_extruder = m_extruder_switch->GetValue() ? 1 : 0;
if (extruder_id == -1)