Put in validation_threshold

This commit is contained in:
Lars Brubaker 2020-11-04 16:53:30 -08:00
parent 91d5e14e6f
commit 57f9f65ed0
6 changed files with 37 additions and 4 deletions

View file

@ -239,6 +239,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
SettingsKey.unload_filament_length,
SettingsKey.use_z_probe,
SettingsKey.validate_leveling,
SettingsKey.validation_threshold,
SettingsKey.validate_layer_height,
SettingsKey.write_regex,
SettingsKey.xy_offsets_have_been_calibrated,

View file

@ -261,6 +261,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public const string use_z_probe = nameof(use_z_probe);
public const string validate_layer_height = nameof(validate_layer_height);
public const string validate_leveling = nameof(validate_leveling);
public const string validation_threshold = nameof(validation_threshold);
public const string vibration_limit = nameof(vibration_limit);
public const string windows_driver = nameof(windows_driver);
public const string wipe_shield_distance = nameof(wipe_shield_distance);

View file

@ -526,7 +526,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
Units = "g/cm³".Localize(),
DefaultValue = "1.24",
RebuildGCodeOnChange = false,
QuickMenuSettings = { { "PLA", "1.24" }, { "PET", "1.27" }, { "ABS","1.04" } },
QuickMenuSettings = { { "PLA", "1.24" }, { "PET", "1.27" }, { "ABS", "1.04" } },
},
new SliceSettingData()
{
@ -1039,9 +1039,22 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
ShowAsOverride = true,
ShowIfSet = "!has_hardware_leveling&has_z_probe&use_z_probe",
RebuildGCodeOnChange = false,
ReloadUiWhenChanged = true,
DefaultValue = "0"
},
new SliceSettingData()
{
SlicerConfigName = SettingsKey.validation_threshold,
PresentationName = "Validation Threshold".Localize(),
HelpText = "The deviation from the last measured value allowed without re-calculating the leveling solution.".Localize(),
DataEditType = DataEditTypes.POSITIVE_DOUBLE,
Units = "mm".Localize(),
ShowAsOverride = true,
ShowIfSet = "!sla_printer&!has_hardware_leveling&has_z_probe&use_z_probe&validate_leveling",
RebuildGCodeOnChange = false,
DefaultValue = ".05"
},
new SliceSettingData()
{
SlicerConfigName = SettingsKey.probe_offset,
PresentationName = "Probe Offset".Localize(),
@ -1130,7 +1143,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{ "Value", "[current_value]" }
}
},
SlicerConfigName = SettingsKey.solid_shell,
SlicerConfigName = SettingsKey.solid_shell,
PresentationName = "Width".Localize(),
HelpText = "Sets the size of the outer solid surface (perimeter) for the entire print.".Localize(),
DataEditType = DataEditTypes.POSITIVE_DOUBLE,
@ -2288,7 +2301,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
DataEditType = DataEditTypes.CHECK_BOX,
SetSettingsOnChange = new List<Dictionary<string, string>>
{
new Dictionary<string, string>
new Dictionary<string, string>
{
{ "TargetSetting", SettingsKey.driver_type },
{ "OnValue", "TCPIP" },

View file

@ -264,6 +264,23 @@ namespace MatterHackers.MatterControl
});
}
if (levelingEnabled
&& !settings.GetValue<bool>(SettingsKey.has_hardware_leveling)
&& settings.GetValue<bool>(SettingsKey.has_z_probe)
&& settings.GetValue<bool>(SettingsKey.use_z_probe)
&& settings.GetValue<bool>(SettingsKey.validate_leveling)
&& (settings.GetValue<double>(SettingsKey.validation_threshold) < .001
|| settings.GetValue<double>(SettingsKey.validation_threshold) > .5))
{
var threshold = settings.GetValue<double>(SettingsKey.validation_threshold);
errors.Add(
new SettingsValidationError(SettingsKey.validation_threshold)
{
Error = "The Validation Threshold mush be greater than 0 and less than .5mm. It is currently {0}.".Localize().FormatWith(threshold),
ValueDetails = "{0} = {1}".FormatWith(GetSettingsName(SettingsKey.validation_threshold), threshold),
});
}
// check if the leveling data has too large a range
if (printer.Settings.Helpers.PrintLevelingData.SampledPositions.Count > 3)
{

View file

@ -231,7 +231,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
var delta = sampledPositions[activeProbeIndex].Position.Z - levelingData.SampledPositions[activeProbeIndex].Z;
if (levelingData.SampledPositions.Count == sampledPositions.Count
&& Math.Abs(delta) < printer.Settings.GetValue<double>(SettingsKey.nozzle_diameter) / 10.0)
&& Math.Abs(delta) < printer.Settings.GetValue<double>(SettingsKey.validation_threshold))
{
// the last leveling is still good abort this new calibration and start printing
CancelValidation();

View file

@ -154,6 +154,7 @@ Printer
print_leveling_probe_start
use_z_probe
validate_leveling
validation_threshold
z_probe_samples
probe_offset
z_servo_depolyed_angle