Show the accurate time for load and unload filament

increase loading filament grab time to 5 mins
make text wrap on dialog page if too long

issue: MatterHackers/MCCentral#3868
Filament loading timed out (90 seconds)

issue: MatterHackers/MCCentral#3644
Load Filament Wizard: Loading time remaining is not accurate

issue: MatterHackers/MCCentral#3867
wizard Text Wrapping
This commit is contained in:
Lars Brubaker 2018-07-16 18:50:29 -07:00
parent 3873a68ef3
commit b941184509
5 changed files with 86 additions and 29 deletions

View file

@ -44,7 +44,7 @@ namespace MatterHackers.MatterControl
protected FlowLayoutWidget contentRow;
protected FlowLayoutWidget footerRow;
private TextWidget headerLabel;
private WrappedTextWidget headerLabel;
private GuiWidget cancelButton;
public Vector2 WindowSize { get; set; }
@ -99,7 +99,7 @@ namespace MatterHackers.MatterControl
this.AddChild(headerRow);
headerLabel = new TextWidget("Setup Wizard".Localize(), pointSize: 24, textColor: theme.Colors.PrimaryAccentColor)
headerLabel = new WrappedTextWidget("Setup Wizard".Localize(), pointSize: 24, textColor: theme.Colors.PrimaryAccentColor)
{
HAnchor = HAnchor.Stretch
};
@ -128,7 +128,7 @@ namespace MatterHackers.MatterControl
#if !__ANDROID__
headerRow.Padding = new BorderDouble(0, 3, 0, 3);
headerLabel.PointSize = 14;
headerLabel.TextWidget.PointSize = 14;
headerLabel.TextColor = theme.Colors.PrimaryTextColor;
contentRow.Padding = new BorderDouble(5);

View file

@ -54,6 +54,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
new MappedSetting("max_fan_speed","max_fan_speed"),
new MappedSetting("min_fan_speed","min_fan_speed"),
new MappedSetting("retract_length","retract_length"),
new LoadTimeFromSpeedAndLength("load_filament_time", "load_filament_length", "load_filament_speed"),
new LoadTimeFromSpeedAndLength("unload_filament_time", "unload_filament_length", "load_filament_speed"),
new MappedSetting(SettingsKey.temperature,SettingsKey.temperature),
new MappedSetting("z_offset","z_offset"),
new MappedSetting(SettingsKey.bed_temperature,SettingsKey.bed_temperature),
@ -76,15 +78,19 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
foreach (MappedSetting mappedSetting in replaceWithSettingsStrings)
{
// do the replacement with {} (curly brackets)
// first check if this setting is anywhere in the line
if (gcodeWithMacros.Contains(mappedSetting.CanonicalSettingsName))
{
string thingToReplace = "{" + "{0}".FormatWith(mappedSetting.CanonicalSettingsName) + "}";
gcodeWithMacros = gcodeWithMacros.Replace(thingToReplace, mappedSetting.Value);
}
// do the replacement with [] (square brackets) Slic3r uses only square brackets
{
string thingToReplace = "[" + "{0}".FormatWith(mappedSetting.CanonicalSettingsName) + "]";
gcodeWithMacros = gcodeWithMacros.Replace(thingToReplace, mappedSetting.Value);
{
// do the replacement with {} (curly brackets)
string thingToReplace = "{" + "{0}".FormatWith(mappedSetting.CanonicalSettingsName) + "}";
gcodeWithMacros = gcodeWithMacros.Replace(thingToReplace, mappedSetting.Value);
}
// do the replacement with [] (square brackets) Slic3r uses only square brackets
{
string thingToReplace = "[" + "{0}".FormatWith(mappedSetting.CanonicalSettingsName) + "]";
gcodeWithMacros = gcodeWithMacros.Replace(thingToReplace, mappedSetting.Value);
}
}
}
@ -144,9 +150,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
: base(canonicalSettingsName, exportedName, keyToUseAsDenominatorForCount)
{
}
public override string Value {
get {
if (ActiveSliceSettings.Instance.GetValue<bool>("create_brim")) {
public override string Value
{
get
{
if (ActiveSliceSettings.Instance.GetValue<bool>("create_brim"))
{
return base.Value;
}
@ -161,9 +170,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
: base(canonicalSettingsName, exportedName, keyToUseAsDenominatorForCount)
{
}
public override string Value {
get {
if (ActiveSliceSettings.Instance.GetValue<bool>("create_skirt")) {
public override string Value
{
get
{
if (ActiveSliceSettings.Instance.GetValue<bool>("create_skirt"))
{
return base.Value;
}
@ -195,18 +207,18 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
bool first = true;
for (int i = 0; i < numPoints; i++)
{
if(!first)
if (!first)
{
bedString += ",";
}
double x = Math.Cos(angle*i);
double y = Math.Sin(angle*i);
double x = Math.Cos(angle * i);
double y = Math.Sin(angle * i);
bedString += $"{printCenter.X + x * bedSize.X / 2:0.####}x{printCenter.Y + y * bedSize.Y / 2:0.####}";
first = false;
}
return bedString;
}
//bed_shape = 99.4522x10.4528,97.8148x20.7912,95.1057x30.9017,91.3545x40.6737,86.6025x50,80.9017x58.7785,74.3145x66.9131,66.9131x74.3145,58.7785x80.9017,50x86.6025,40.6737x91.3545,30.9017x95.1057,20.7912x97.8148,10.4528x99.4522,0x100,-10.4528x99.4522,-20.7912x97.8148,-30.9017x95.1057,-40.6737x91.3545,-50x86.6025,-58.7785x80.9017,-66.9131x74.3145,-74.3145x66.9131,-80.9017x58.7785,-86.6025x50,-91.3545x40.6737,-95.1057x30.9017,-97.8148x20.7912,-99.4522x10.4528,-100x0,-99.4522x - 10.4528,-97.8148x - 20.7912,-95.1057x - 30.9017,-91.3545x - 40.6737,-86.6025x - 50,-80.9017x - 58.7785,-74.3145x - 66.9131,-66.9131x - 74.3145,-58.7785x - 80.9017,-50x - 86.6025,-40.6737x - 91.3545,-30.9017x - 95.1057,-20.7912x - 97.8148,-10.4528x - 99.4522,0x - 100,10.4528x - 99.4522,20.7912x - 97.8148,30.9017x - 95.1057,40.6737x - 91.3545,50x - 86.6025,58.7785x - 80.9017,66.9131x - 74.3145,74.3145x - 66.9131,80.9017x - 58.7785,86.6025x - 50,91.3545x - 40.6737,95.1057x - 30.9017,97.8148x - 20.7912,99.4522x - 10.4528,100x0
//bed_shape = 99.4522x10.4528,97.8148x20.7912,95.1057x30.9017,91.3545x40.6737,86.6025x50,80.9017x58.7785,74.3145x66.9131,66.9131x74.3145,58.7785x80.9017,50x86.6025,40.6737x91.3545,30.9017x95.1057,20.7912x97.8148,10.4528x99.4522,0x100,-10.4528x99.4522,-20.7912x97.8148,-30.9017x95.1057,-40.6737x91.3545,-50x86.6025,-58.7785x80.9017,-66.9131x74.3145,-74.3145x66.9131,-80.9017x58.7785,-86.6025x50,-91.3545x40.6737,-95.1057x30.9017,-97.8148x20.7912,-99.4522x10.4528,-100x0,-99.4522x - 10.4528,-97.8148x - 20.7912,-95.1057x - 30.9017,-91.3545x - 40.6737,-86.6025x - 50,-80.9017x - 58.7785,-74.3145x - 66.9131,-66.9131x - 74.3145,-58.7785x - 80.9017,-50x - 86.6025,-40.6737x - 91.3545,-30.9017x - 95.1057,-20.7912x - 97.8148,-10.4528x - 99.4522,0x - 100,10.4528x - 99.4522,20.7912x - 97.8148,30.9017x - 95.1057,40.6737x - 91.3545,50x - 86.6025,58.7785x - 80.9017,66.9131x - 74.3145,74.3145x - 66.9131,80.9017x - 58.7785,86.6025x - 50,91.3545x - 40.6737,95.1057x - 30.9017,97.8148x - 20.7912,99.4522x - 10.4528,100x0
case BedShape.Rectangular:
default:
@ -271,7 +283,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
get
{
string macroReplaced = base.Value;
if (!macroReplaced.Contains("; LAYER:")
if (!macroReplaced.Contains("; LAYER:")
&& !macroReplaced.Contains(";LAYER:"))
{
macroReplaced += "; LAYER:[layer_num]\n";
@ -428,7 +440,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
if (materialTemperature != 0)
{
// always heat the extruders that are used beyond extruder 0
postStartGCode.Add($"M104 T{extruderIndex0Based} S{materialTemperature} ; Start heating extruder{extruderIndex0Based+1}");
postStartGCode.Add($"M104 T{extruderIndex0Based} S{materialTemperature} ; Start heating extruder{extruderIndex0Based + 1}");
}
}
}
@ -464,7 +476,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
}
public override string Value => (base.Value == "1") ? "True" : "False";
public override string Value => (base.Value == "1") ? "True" : "False";
}
public class ScaledSingleNumber : MapFirstValue
@ -564,7 +576,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
get
{
if(ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.enable_retractions))
if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.enable_retractions))
{
return base.Value;
}
@ -652,4 +664,31 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
}
}
}
public class LoadTimeFromSpeedAndLength : MappedSetting
{
string lengthSettingName;
string speedSettingName;
public LoadTimeFromSpeedAndLength(string canonicalSettingsName, string lengthSettingName, string speedSettingName)
: base(canonicalSettingsName, "")
{
this.lengthSettingName = lengthSettingName;
this.speedSettingName = speedSettingName;
}
public override string Value
{
get
{
string lengthString = ActiveSliceSettings.Instance.GetValue(lengthSettingName);
double length = ParseDouble(lengthString);
string speedString = ActiveSliceSettings.Instance.GetValue(speedSettingName);
double speed = ParseDouble(speedString);
return (length / speed).ToString();
}
}
}
}

View file

@ -60,6 +60,24 @@
"ShowIfSet": "!sla_printer",
"DefaultValue": "100%"
},
{
"SlicerConfigName": "load_filament_time",
"PresentationName": "Load Filament Time",
"HelpText": "The time it will take to load the filament",
"DataEditType": "POSITIVE_DOUBLE",
"Units": "s",
"ShowIfSet": "!sla_printer",
"DefaultValue": "5"
},
{
"SlicerConfigName": "unload_filament_time",
"PresentationName": "Unload Filament Time",
"HelpText": "The time it will take to unload the filament",
"DataEditType": "POSITIVE_DOUBLE",
"Units": "s",
"ShowIfSet": "!sla_printer",
"DefaultValue": "5"
},
{
"SlicerConfigName": "unload_filament_length",
"PresentationName": "Unload Filament Length",

View file

@ -7,9 +7,9 @@ M104 S[temperature] ; start heating up the extruder
M302 S0 ; Allow extrusion at any temperature
G91 ; Relative positioning
; host.show_message(title:"Put filament into extruder until you feel it start to feed and then click Continue.", repeat_gcode:"G1 E.1 F150|G4 P10", expire:"90", image:"[insert_image]")
; host.show_message(title:"Put filament into extruder until you feel it start to feed and then click Continue.", repeat_gcode:"G1 E.1 F150|G4 P10", expire:"300", image:"[insert_image]")
G90 ; Absolute positioning
; host.show_message(title:"Loading filament...", count_down:"28")
; host.show_message(title:"Loading filament...", count_down:"[load_filament_time]")
G92 E0 ; reset the extruder position to 0
G91 ; Relative positioning
G1 E[load_filament_length_over_six] F[load_filament_speed] ; extrude the filament (pulse was 598)

View file

@ -6,7 +6,7 @@ G4 S1 ; wait message to display
M109 S[temperature] ; heat up the extruder
M302 S0 ; Allow extrusion at any temperature
; host.show_message(title:"Unloading filament..." count_down:28)
; host.show_message(title:"Unloading filament..." count_down:"[unload_filament_time]")
G92 E0 ; reset the extruder position to 0
G91 ; Relative positioning
G1 E15 F600 ; push some out first