Fixed a bug where the temp could get in a state of ping-ponging between values.
Working on better cache cleaning. Added a heat extruder before homing config option Made 3D Stuffmaker use the new setting
This commit is contained in:
parent
428473203f
commit
fd094f25af
15 changed files with 129 additions and 50 deletions
|
|
@ -311,24 +311,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public static void DeleteCacheData()
|
||||
{
|
||||
// delete everything in the GCodeOutputPath
|
||||
// AppData\Local\MatterControl\data\gcode
|
||||
// delete everything in the temp data that is not in use
|
||||
// AppData\Local\MatterControl\data\temp
|
||||
// plateImages
|
||||
// project-assembly
|
||||
// project-extract
|
||||
// stl
|
||||
|
||||
// first AppData\Local\MatterControl\data\gcode
|
||||
string gcodeOutputPath = DataStorage.ApplicationDataStorage.Instance.GCodeOutputPath;
|
||||
try
|
||||
{
|
||||
Directory.Delete(gcodeOutputPath, true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
MatterControlApplication.DeleteCacheData();
|
||||
}
|
||||
|
||||
#if false // kevin code 2014 04 22
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ namespace MatterHackers.MatterControl
|
|||
return;
|
||||
}
|
||||
|
||||
string stlHashCode = thumbnailWidget.PrintItem.StlFileHashCode.ToString();
|
||||
string stlHashCode = thumbnailWidget.PrintItem.FileHashCode.ToString();
|
||||
|
||||
Point2D bigRenderSize = new Point2D(460, 460);
|
||||
ImageBuffer bigRender = LoadImageFromDisk(thumbnailWidget, stlHashCode, bigRenderSize);
|
||||
|
|
@ -304,7 +304,7 @@ namespace MatterHackers.MatterControl
|
|||
private static ImageBuffer LoadImageFromDisk(PartThumbnailWidget thumbnailWidget, string stlHashCode, Point2D size)
|
||||
{
|
||||
ImageBuffer tempImage = new ImageBuffer(size.x, size.y, 32, new BlenderBGRA());
|
||||
string imageFileName = GetFilenameForSize(stlHashCode, ref size);
|
||||
string imageFileName = GetFilenameForSize(stlHashCode, size);
|
||||
|
||||
if (File.Exists(imageFileName))
|
||||
{
|
||||
|
|
@ -327,7 +327,12 @@ namespace MatterHackers.MatterControl
|
|||
return null;
|
||||
}
|
||||
|
||||
private static string GetFilenameForSize(string stlHashCode, ref Point2D size)
|
||||
public static string GetImageFilenameForItem(PrintItemWrapper item)
|
||||
{
|
||||
return GetFilenameForSize(item.FileHashCode.ToString(), new Point2D(460, 460));
|
||||
}
|
||||
|
||||
private static string GetFilenameForSize(string stlHashCode, Point2D size)
|
||||
{
|
||||
string folderToSaveThumbnailsTo = ThumbnailPath();
|
||||
string imageFileName = Path.Combine(folderToSaveThumbnailsTo, Path.ChangeExtension("{0}_{1}x{2}".FormatWith(stlHashCode, size.x, size.y), partExtension));
|
||||
|
|
@ -384,9 +389,8 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
// and save it to disk
|
||||
string applicationUserDataPath = ApplicationDataStorage.Instance.ApplicationUserDataPath;
|
||||
string folderToSavePrintsTo = Path.Combine(applicationUserDataPath, "data", "temp", "thumbnails");
|
||||
string imageFileName = Path.Combine(folderToSavePrintsTo, Path.ChangeExtension("{0}_{1}x{2}".FormatWith(stlHashCode, size.x, size.y),partExtension));
|
||||
string imageFileName = GetFilenameForSize(stlHashCode, size);
|
||||
string folderToSavePrintsTo = Path.GetDirectoryName(imageFileName);
|
||||
|
||||
if (!Directory.Exists(folderToSavePrintsTo))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -548,5 +548,54 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteCacheData()
|
||||
{
|
||||
// delete everything in the GCodeOutputPath
|
||||
// AppData\Local\MatterControl\data\gcode
|
||||
// delete everything in the temp data that is not in use
|
||||
// AppData\Local\MatterControl\data\temp
|
||||
// plateImages
|
||||
// project-assembly
|
||||
// project-extract
|
||||
// stl
|
||||
// delete all unreference models in Library
|
||||
// AppData\Local\MatterControl\Library
|
||||
// delete all old update downloads
|
||||
// AppData\updates
|
||||
|
||||
// start cleaning out unused data
|
||||
// MatterControl\data\gcode
|
||||
RemoveDirectory(DataStorage.ApplicationDataStorage.Instance.GCodeOutputPath);
|
||||
|
||||
RemoveDirectory(Path.Combine(DataStorage.ApplicationDataStorage.Instance.ApplicationUserDataPath, "updates"));
|
||||
|
||||
HashSet<string> referencedMeshFilePaths = new HashSet<string>();
|
||||
HashSet<string> referencedThumbnailFiles = new HashSet<string>();
|
||||
// Get a list of all the stl and amf files referenced in the queue or library.
|
||||
foreach (PrintItemWrapper printItem in QueueData.Instance.PrintItems)
|
||||
{
|
||||
string fileLocation = printItem.FileLocation;
|
||||
if (!referencedMeshFilePaths.Contains(fileLocation))
|
||||
{
|
||||
referencedMeshFilePaths.Add(fileLocation);
|
||||
referencedThumbnailFiles.Add(PartThumbnailWidget.GetImageFilenameForItem(printItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void RemoveDirectory(string directoryToRemove)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(directoryToRemove))
|
||||
{
|
||||
Directory.Delete(directoryToRemove, true);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
public PrintItem PrintItem { get; set; }
|
||||
String fileType;
|
||||
|
||||
int stlFileHashCode;
|
||||
int fileHashCode;
|
||||
long writeTime = 0;
|
||||
|
||||
public bool CurrentlySlicing { get; set; }
|
||||
|
|
@ -152,7 +152,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
set { this.PrintItem.FileLocation = value; }
|
||||
}
|
||||
|
||||
public int StlFileHashCode
|
||||
public int FileHashCode
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -160,7 +160,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
bool fileExists = System.IO.File.Exists(this.FileLocation);
|
||||
if (fileExists)
|
||||
{
|
||||
if (this.stlFileHashCode == 0 || writeTime != currentWriteTime)
|
||||
if (this.fileHashCode == 0 || writeTime != currentWriteTime)
|
||||
{
|
||||
writeTime = currentWriteTime;
|
||||
using (FileStream fileStream = new FileStream(this.FileLocation, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
|
|
@ -189,12 +189,12 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
|
||||
int hashCode = agg_basics.ComputeHash(readData);
|
||||
int fileSizeInt = (int)sizeOfFile;
|
||||
this.stlFileHashCode = new { hashCode, currentWriteTime, fileSizeInt }.GetHashCode();
|
||||
this.fileHashCode = new { hashCode, currentWriteTime, fileSizeInt }.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.stlFileHashCode;
|
||||
return this.fileHashCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
|
||||
string engineString = ((int)ActivePrinterProfile.Instance.ActiveSliceEngineType).ToString();
|
||||
|
||||
string gcodeFileName = this.StlFileHashCode.ToString() + "_" + engineString + "_" + ActiveSliceSettings.Instance.GetHashCode().ToString();
|
||||
string gcodeFileName = this.FileHashCode.ToString() + "_" + engineString + "_" + ActiveSliceSettings.Instance.GetHashCode().ToString();
|
||||
string gcodePathAndFileName = Path.Combine(DataStorage.ApplicationDataStorage.Instance.GCodeOutputPath, gcodeFileName + ".gcode");
|
||||
return gcodePathAndFileName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
public static readonly string SdCardFileName = "SD_CARD";
|
||||
|
||||
private List<PrintItemWrapper> printItems = new List<PrintItemWrapper>();
|
||||
private List<PrintItemWrapper> PrintItems
|
||||
public List<PrintItemWrapper> PrintItems
|
||||
{
|
||||
get { return printItems; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1063,13 +1063,15 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
double exturderIndex = 0;
|
||||
if (GCodeFile.GetFirstNumberAfter("T", foundStringEventArgs.LineToCheck, ref exturderIndex))
|
||||
{
|
||||
SetTargetExtruderTemperature((int)exturderIndex, tempBeingSet);
|
||||
// we set the private variable so that we don't get the callbacks called and get in a loop of setting the temp
|
||||
int extruderIndex0Based = Math.Min((int)exturderIndex, MAX_EXTRUDERS - 1);
|
||||
SetTargetExtruderTemperature(extruderIndex0Based, tempBeingSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we set the private variable so that we don't get the callbacks called and get in a loop of setting the temp
|
||||
SetTargetExtruderTemperature(0, tempBeingSet);
|
||||
}
|
||||
SetTargetExtruderTemperature(0, tempBeingSet);
|
||||
}
|
||||
OnExtruderTemperatureSet(e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public class SliceSettingsDetailControl : FlowLayoutWidget
|
||||
{
|
||||
const string SliceSettingsShowHelpEntry = "SliceSettingsShowHelp";
|
||||
|
|
|
|||
|
|
@ -234,6 +234,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
//startCode=M109 S210
|
||||
new MapStartGCode("startCode", "start_gcode", true),
|
||||
|
||||
new NotPassedItem("", "heat_extruder_before_homing"),
|
||||
|
||||
//supportExtruder=1
|
||||
new ValuePlusConstant("supportExtruder", "support_material_extruder", -1),
|
||||
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
numberOfHeatedExtruders = ActiveSliceSettings.Instance.ExtruderCount;
|
||||
}
|
||||
|
||||
// Start heating all the extruder that we are going to use.
|
||||
for (int i = 0; i < numberOfHeatedExtruders; i++)
|
||||
{
|
||||
if (extrudersUsed.Count > i
|
||||
|
|
@ -159,12 +160,30 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
string materialTemperature = ActiveSliceSettings.Instance.GetMaterialValue("temperature", i);
|
||||
if (materialTemperature != "0")
|
||||
{
|
||||
string setTempString = "M104 T{0} S{1}".FormatWith(i, materialTemperature);
|
||||
string setTempString = "M104 T{0} S{1}".FormatWith(i, materialTemperature);
|
||||
AddDefaultIfNotPresent(preStartGCode, setTempString, preStartGCodeLines, string.Format("start heating extruder {0}", i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we need to wait for the heaters to heat up before homing then set them to M109 (heat and wait).
|
||||
if (ActiveSliceSettings.Instance.GetActiveValue("heat_extruder_before_homing") == "1")
|
||||
{
|
||||
for (int i = 0; i < numberOfHeatedExtruders; i++)
|
||||
{
|
||||
if (extrudersUsed.Count > i
|
||||
&& extrudersUsed[i])
|
||||
{
|
||||
string materialTemperature = ActiveSliceSettings.Instance.GetMaterialValue("temperature", i);
|
||||
if (materialTemperature != "0")
|
||||
{
|
||||
string setTempString = "M109 T{0} S{1}".FormatWith(i, materialTemperature);
|
||||
AddDefaultIfNotPresent(preStartGCode, setTempString, preStartGCodeLines, string.Format("wait for extruder {0}", i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SwitchToFirstActiveExtruder(extrudersUsed, preStartGCodeLines, preStartGCode);
|
||||
preStartGCode.Add("; settings from start_gcode");
|
||||
|
||||
|
|
@ -199,19 +218,23 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
numberOfHeatedExtruders = ActiveSliceSettings.Instance.ExtruderCount;
|
||||
}
|
||||
|
||||
for (int i = 0; i < numberOfHeatedExtruders; i++)
|
||||
{
|
||||
if (extrudersUsed.Count > i
|
||||
&& extrudersUsed[i])
|
||||
{
|
||||
string materialTemperature = ActiveSliceSettings.Instance.GetMaterialValue("temperature", i + 1);
|
||||
if (materialTemperature != "0")
|
||||
{
|
||||
string setTempString = "M109 T{0} S{1}".FormatWith(i, materialTemperature);
|
||||
AddDefaultIfNotPresent(postStartGCode, setTempString, postStartGCodeLines, string.Format("wait for extruder {0} to reach temperature", i));
|
||||
}
|
||||
}
|
||||
}
|
||||
// don't set the extrudes to heating if we alread waited for them to reach temp
|
||||
if (ActiveSliceSettings.Instance.GetActiveValue("heat_extruder_before_homing") != "1")
|
||||
{
|
||||
for (int i = 0; i < numberOfHeatedExtruders; i++)
|
||||
{
|
||||
if (extrudersUsed.Count > i
|
||||
&& extrudersUsed[i])
|
||||
{
|
||||
string materialTemperature = ActiveSliceSettings.Instance.GetMaterialValue("temperature", i + 1);
|
||||
if (materialTemperature != "0")
|
||||
{
|
||||
string setTempString = "M109 T{0} S{1}".FormatWith(i, materialTemperature);
|
||||
AddDefaultIfNotPresent(postStartGCode, setTempString, postStartGCodeLines, string.Format("wait for extruder {0} to reach temperature", i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SwitchToFirstActiveExtruder(extrudersUsed, postStartGCodeLines, postStartGCode);
|
||||
AddDefaultIfNotPresent(postStartGCode, "G90", postStartGCodeLines, "use absolute coordinates");
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ gcode_output_type = REPRAP
|
|||
has_fan = 1
|
||||
has_heated_bed = 0
|
||||
has_sd_card_reader = 0
|
||||
heat_extruder_before_homing = 1
|
||||
infill_acceleration = 0
|
||||
infill_every_layers = 1
|
||||
infill_extruder = 1
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ gcode_output_type = REPRAP
|
|||
has_fan = 1
|
||||
has_heated_bed = 0
|
||||
has_sd_card_reader = 0
|
||||
heat_extruder_before_homing = 1
|
||||
infill_acceleration = 0
|
||||
infill_every_layers = 1
|
||||
infill_extruder = 1
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ has_fan = 1
|
|||
has_hardware_leveling = 0
|
||||
has_heated_bed = 1
|
||||
has_sd_card_reader = 0
|
||||
heat_extruder_before_homing = 0
|
||||
infill_acceleration = 0
|
||||
infill_every_layers = 1
|
||||
infill_extruder = 1
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ Advanced
|
|||
has_heated_bed
|
||||
has_sd_card_reader
|
||||
extruder_count
|
||||
heat_extruder_before_homing
|
||||
extruders_share_temperature
|
||||
Firmware
|
||||
z_can_be_negative
|
||||
|
|
|
|||
|
|
@ -230,6 +230,13 @@
|
|||
"DataEditType": "CHECK_BOX",
|
||||
"ExtraSettings": ""
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "heat_extruder_before_homing",
|
||||
"PresentationName": "Heat Before Homing",
|
||||
"HelpText": "Normally while printing the printer will home before heating the extruder(s). Set this to cause the heating to happen before the homing. This can help with printers that touch the bed while homing.",
|
||||
"DataEditType": "CHECK_BOX",
|
||||
"ExtraSettings": ""
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "extrusion_axis",
|
||||
"PresentationName": "Extrusion Axis",
|
||||
|
|
|
|||
|
|
@ -3113,3 +3113,9 @@ Translated:Reboots the firmware on the controller
|
|||
English:Please wait. Slicing files {0} of {1}
|
||||
Translated:Please wait. Slicing files {0} of {1}
|
||||
|
||||
English:Normally while printing the printer will home before heating the extruder(s). Set this to cause the heating to happen before the homing. This can help with printers that touch the bed while homing.
|
||||
Translated:Normally while printing the printer will home before heating the extruder(s). Set this to cause the heating to happen before the homing. This can help with printers that touch the bed while homing.
|
||||
|
||||
English:Heat Before Homing
|
||||
Translated:Heat Before Homing
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue