Fix filament syncing by fixing nozzle diameter guards (#13330)

* Remove unused `get_printer_preset` calls.

* `Plater::check_printer_initialized` should skip nozzle flow type checks if nozzle is unknown.

Also remove unnecessary `is_multi_extruders` check.

* Remove unused `CalibUtils::is_same_nozzle_diameters()` fn.

* Simplify `CalibUtils::check_printable_status_before_cali`.

The single-arity can delegate to the vectorized arity.

* Add `DevExtruderSystem::NozzleDiameterMatchesOrUnknown` to simply checks.

* Update `CalibrationPresetPage::update_sync_button_status()` to use `NozzleDiameterMatchesOrUnknown`.

Simplify logic by iterating over each extruder and checking for diameter and volume type match.

The previous code had several mistakes (from what I could tell):

- `curr_obj->is_multi_extruders()` doesn't imply exactly 2 extruders
- the single/multi branch served no purpose
- the single branch failed to check the volume type

* Specify `std::fabs` and add explicit import.

Ref: https://github.com/OrcaSlicer/OrcaSlicer/pull/13330#discussion_r3133613736

Not sure how idiomatic this is in C++ / OrcaSlicer codebase, but CoPilot suggested it and it seems reasonable.

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Kevin J. Lynagh
2026-05-16 13:13:40 +02:00
committed by GitHub
parent 427d0f7a9f
commit 8dd1dd8921
5 changed files with 50 additions and 157 deletions

View File

@@ -6,6 +6,7 @@
#include <wx/string.h>
#include "DevDefs.h"
#include <cmath>
namespace Slic3r
{
@@ -145,6 +146,15 @@ public:
float GetNozzleDiameter(int extder_id) const { return GetExtderById(extder_id) ? GetExtderById(extder_id)->GetNozzleDiameter() : 0.0; }
int GetNozzleTempCurrent(int extder_id) const { return GetExtderById(extder_id) ? GetExtderById(extder_id)->GetCurrentTemp() : 0; }
int GetNozzleTempTarget(int extder_id) const { return GetExtderById(extder_id) ? GetExtderById(extder_id)->GetTargetTemp() : 0; }
bool NozzleDiameterMatchesOrUnknown(int extder_id, float target_diameter) const
{
float diameter = GetNozzleDiameter(extder_id);
if (diameter == 0.0f) {
return true;
} else {
return std::fabs(diameter - target_diameter) < 1e-3;
}
}
// get slot info which is connected to the extruder
std::string GetCurrentAmsId() const;