mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-05 11:17:58 -05:00
Validate Only the Edited Variant's Adaptive PA Model and Accept Spaces in It (#16978)
* Validate Only the Edited Variant's Adaptive PA Model and Accept Spaces in It
Since pressure advance became a per-variant filament setting, the Filament
tab validated every variant column of the adaptive pressure advance model
whenever one was edited. The columns the user never touched still hold the
default placeholder, which the validator rejects, so every edit of a
multi-variant filament ended in a "Line 1: flow value must be greater than PA
value" dialog about a column the user could not see. The check now covers the
variant being edited only, as the nozzle temperature checks on the same tab do.
The validator also rejected whitespace between the values, which the model
parser accepts, so a model typed as "0.027, 8.1416, 2000.0" sliced correctly
but warned on every slice. Whitespace is now ignored before the values are
checked.
Enabling adaptive pressure advance before entering a model warned that the
model "may contain invalid values", which only meant that the placeholder is
all zeros. That case now gets its own warning saying that no measurements
have been entered.
* Keep the Empty Adaptive PA Model a Single Filament Column in Its Test
Deserializing an empty string into the model option leaves it with no
entries, and get_at on an empty vector aborts on a libstdc++ built with
assertions, as the Flatpak unit-test lanes are. Presets always hold one
column per filament, so set the value directly.
(cherry picked from commit 2cb2f0d2e7)
This commit is contained in:
1 parent
e8924f30d7
commit
a02f6ed9be
7 files changed
+138
-26
No files matched your search
@@ -174,22 +174,18 @@ void ConfigManipulation::check_nozzle_temperature_initial_layer_range(DynamicPri
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigManipulation::check_adaptive_pressure_advance_model(DynamicPrintConfig* config)
|
||||
void ConfigManipulation::check_adaptive_pressure_advance_model(DynamicPrintConfig* config, unsigned int variant_index)
|
||||
{
|
||||
if (is_msg_dlg_already_exist || !config->has("adaptive_pressure_advance_model"))
|
||||
return;
|
||||
|
||||
const auto* model = config->option<ConfigOptionStrings>("adaptive_pressure_advance_model");
|
||||
if (model == nullptr)
|
||||
if (model == nullptr || model->values.empty())
|
||||
return;
|
||||
|
||||
// Each extruder variant holds its own model.
|
||||
std::string error;
|
||||
for (const std::string& variant_model : model->values) {
|
||||
error = AdaptivePAProcessor::validate_adaptive_pa_model(variant_model);
|
||||
if (!error.empty())
|
||||
break;
|
||||
}
|
||||
// Each extruder variant holds its own model; only the one being edited is checked, the
|
||||
// others may still hold the default placeholder.
|
||||
const std::string error = AdaptivePAProcessor::validate_adaptive_pa_model(model->get_at(variant_index));
|
||||
if (!error.empty()) {
|
||||
wxString msg_text = _L("Adaptive Pressure Advance model validation failed:\n");
|
||||
msg_text += from_u8(error);
|
||||
|
||||
Reference in new issue
Block a user