Say who is the owner of executing tasks. This allows us to filter running tasks displays
issue: MatterHackers/MCCentral#4660 Not printing printer tab showing print progress from printing printer tab
This commit is contained in:
parent
273e20be89
commit
8de283dbfe
20 changed files with 87 additions and 63 deletions
|
|
@ -1345,7 +1345,7 @@ namespace MatterHackers.MatterControl
|
|||
if (printerConnection.AnyHeatIsOn)
|
||||
{
|
||||
var paused = false;
|
||||
Tasks.Execute("", (reporter, cancellationToken) =>
|
||||
Tasks.Execute("", printerConnection.Printer, (reporter, cancellationToken) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
|
||||
|
|
@ -2190,6 +2190,7 @@ If you experience adhesion problems, please re-run leveling."
|
|||
|
||||
this.Tasks.Execute(
|
||||
"Printing".Localize(),
|
||||
printer,
|
||||
(reporterB, cancellationTokenB) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
|
|
@ -2324,7 +2325,7 @@ If you experience adhesion problems, please re-run leveling."
|
|||
// Slice
|
||||
bool slicingSucceeded = false;
|
||||
|
||||
await this.Tasks.Execute("Slicing".Localize(), async (reporter, cancellationToken) =>
|
||||
await this.Tasks.Execute("Slicing".Localize(), printer, async (reporter, cancellationToken) =>
|
||||
{
|
||||
slicingSucceeded = await Slicer.SliceItem(
|
||||
object3D,
|
||||
|
|
@ -2368,7 +2369,7 @@ If you experience adhesion problems, please re-run leveling."
|
|||
}
|
||||
}
|
||||
|
||||
await this.Tasks.Execute("Loading GCode".Localize(), (innerProgress, token) =>
|
||||
await this.Tasks.Execute("Loading GCode".Localize(), printer, (innerProgress, token) =>
|
||||
{
|
||||
var status = new ProgressStatus();
|
||||
|
||||
|
|
@ -2556,6 +2557,7 @@ If you experience adhesion problems, please re-run leveling."
|
|||
}
|
||||
|
||||
public string Title { get; set; }
|
||||
public object Owner { get; set; }
|
||||
|
||||
public RunningTaskOptions Options { get; internal set; }
|
||||
|
||||
|
|
@ -2649,14 +2651,15 @@ If you experience adhesion problems, please re-run leveling."
|
|||
};
|
||||
}
|
||||
|
||||
public Task Execute(string taskTitle, Func<IProgress<ProgressStatus>, CancellationToken, Task> func, RunningTaskOptions taskActions = null)
|
||||
public Task Execute(string taskTitle, object owner, Func<IProgress<ProgressStatus>, CancellationToken, Task> func, RunningTaskOptions taskActions = null)
|
||||
{
|
||||
var tokenSource = new CancellationTokenSource();
|
||||
|
||||
var taskDetails = new RunningTaskDetails(tokenSource)
|
||||
{
|
||||
Options = taskActions,
|
||||
Title = taskTitle
|
||||
Title = taskTitle,
|
||||
Owner = owner,
|
||||
};
|
||||
|
||||
executingTasks.Add(taskDetails);
|
||||
|
|
@ -3151,6 +3154,7 @@ If you experience adhesion problems, please re-run leveling."
|
|||
// Batch startup actions
|
||||
await applicationController.Tasks.Execute(
|
||||
"Finishing Startup".Localize(),
|
||||
null,
|
||||
(progress, cancellationToken) =>
|
||||
{
|
||||
var status = new ProgressStatus();
|
||||
|
|
@ -3174,6 +3178,7 @@ If you experience adhesion problems, please re-run leveling."
|
|||
|
||||
await applicationController.Tasks.Execute(
|
||||
"Restoring Printers".Localize(),
|
||||
null,
|
||||
async (progress, cancellationToken) =>
|
||||
{
|
||||
await applicationController.OpenAllPrinters();
|
||||
|
|
@ -3182,7 +3187,7 @@ If you experience adhesion problems, please re-run leveling."
|
|||
// Batch startup tasks
|
||||
foreach (var task in ApplicationController.StartupTasks.OrderByDescending(t => t.Priority))
|
||||
{
|
||||
await applicationController.Tasks.Execute(task.Title, task.Action);
|
||||
await applicationController.Tasks.Execute(task.Title, null, task.Action);
|
||||
}
|
||||
|
||||
if (ApplicationSettings.Instance.get(ApplicationSettingsKey.ShownWelcomeMessage) != "false")
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public async Task LoadGCodeContent(Stream stream)
|
||||
{
|
||||
await ApplicationController.Instance.Tasks.Execute("Loading G-Code".Localize(), (reporter, cancellationToken) =>
|
||||
await ApplicationController.Instance.Tasks.Execute("Loading G-Code".Localize(), Printer, (reporter, cancellationToken) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
reporter.Report(progressStatus);
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ namespace MatterHackers.MatterControl
|
|||
case DetailedPrintingState.HeatingBed:
|
||||
ApplicationController.Instance.Tasks.Execute(
|
||||
"Heating Bed".Localize(),
|
||||
this,
|
||||
(reporter, cancellationToken) =>
|
||||
{
|
||||
waitingForBedHeat = true;
|
||||
|
|
@ -335,6 +336,7 @@ namespace MatterHackers.MatterControl
|
|||
case DetailedPrintingState.HeatingExtruder:
|
||||
ApplicationController.Instance.Tasks.Execute(
|
||||
"Heating Extruder".Localize(),
|
||||
this,
|
||||
(reporter, cancellationToken) =>
|
||||
{
|
||||
waitingForBedHeat = false;
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
ApplicationController.Instance.Tasks.Execute(
|
||||
"Saving".Localize() + "...",
|
||||
printer,
|
||||
async (reporter, cancellationToken) =>
|
||||
{
|
||||
string path = openParams.FolderPath;
|
||||
|
|
@ -216,6 +217,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
ApplicationController.Instance.Tasks.Execute(
|
||||
"Exporting".Localize() + "...",
|
||||
printer,
|
||||
async (reporter, cancellationToken) =>
|
||||
{
|
||||
string extension = Path.GetExtension(savePath);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace MatterHackers.MatterControl.Plugins.Lithophane
|
|||
this.DebugDepth("Rebuild");
|
||||
var activeImage = AggContext.ImageIO.LoadImage(this.Image.AssetPath);
|
||||
|
||||
ApplicationController.Instance.Tasks.Execute("Generating Lithophane".Localize(), (reporter, cancellationToken) =>
|
||||
ApplicationController.Instance.Tasks.Execute("Generating Lithophane".Localize(), null, (reporter, cancellationToken) =>
|
||||
{
|
||||
var generatedMesh = Lithophane.Generate(
|
||||
new Lithophane.ImageBufferImageData(activeImage, this.Width),
|
||||
|
|
|
|||
|
|
@ -365,6 +365,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
// now create a long running task to process the image
|
||||
ApplicationController.Instance.Tasks.Execute(
|
||||
"Calculate Path".Localize(),
|
||||
null,
|
||||
(reporter, cancellationToken) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ namespace MatterHackers.MatterControl.Library.Export
|
|||
else if (firstItem.AssetPath == printer.Bed.EditContext.SourceFilePath)
|
||||
{
|
||||
// If item is bedplate, save any pending changes before starting the print
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer.Bed.SaveChanges);
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer, printer.Bed.SaveChanges);
|
||||
loadedItem = printer.Bed.Scene;
|
||||
CenterOnBed = false;
|
||||
}
|
||||
|
|
@ -212,6 +212,7 @@ namespace MatterHackers.MatterControl.Library.Export
|
|||
|
||||
await ApplicationController.Instance.Tasks.Execute(
|
||||
"Slicing Item".Localize() + " " + loadedItem.Name,
|
||||
printer,
|
||||
(reporter, cancellationToken2) =>
|
||||
{
|
||||
return Slicer.SliceItem(loadedItem, gcodePath, printer, reporter, cancellationToken2);
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
splitContainer.AddChild(gcodeContainer);
|
||||
|
||||
view3DContainer.AddChild(new RunningTasksWidget(theme)
|
||||
view3DContainer.AddChild(new RunningTasksWidget(theme, printer)
|
||||
{
|
||||
MinimumSize = new Vector2(100, 0),
|
||||
Margin = new BorderDouble(top: printerActionsBar.Height + 1, left: favoritesBar.LocalBounds.Width + favoritesBar.DeviceMarginAndBorder.Width + 1),
|
||||
|
|
@ -550,7 +550,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
bottomRow.Name = printer.Bed.EditContext.GCodeFilePath(printer);
|
||||
}
|
||||
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer.Bed.SaveChanges);
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer, printer.Bed.SaveChanges);
|
||||
|
||||
// start up a new slice on a background thread
|
||||
await ApplicationController.Instance.SliceItemLoadOutput(
|
||||
|
|
|
|||
|
|
@ -40,9 +40,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private ThemeConfig theme;
|
||||
private Color borderColor;
|
||||
private FlowLayoutWidget pendingTasksList;
|
||||
private object owner;
|
||||
|
||||
public RunningTasksWidget(ThemeConfig theme)
|
||||
public RunningTasksWidget(ThemeConfig theme, object owner)
|
||||
{
|
||||
this.owner = owner;
|
||||
this.theme = theme;
|
||||
|
||||
if (theme.IsDarkTheme)
|
||||
|
|
@ -95,16 +97,25 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
// Add new items
|
||||
foreach (var taskItem in tasks.RunningTasks.Where(t => !displayedTasks.Contains(t)))
|
||||
{
|
||||
var taskRow = new RunningTaskRow("", taskItem, theme)
|
||||
// show tasks that are unfiltered (owner == null) or are owned by us
|
||||
if (taskItem.Owner == null
|
||||
|| taskItem.Owner == owner)
|
||||
{
|
||||
HAnchor = HAnchor.Stretch,
|
||||
BackgroundColor = theme.AccentMimimalOverlay,
|
||||
Border = new BorderDouble(1, 1, 1, 0),
|
||||
BorderColor = borderColor,
|
||||
ProgressBackgroundColor = progressBackgroundColor
|
||||
};
|
||||
var taskRow = new RunningTaskRow("", taskItem, theme)
|
||||
{
|
||||
HAnchor = HAnchor.Stretch,
|
||||
BackgroundColor = theme.AccentMimimalOverlay,
|
||||
Border = new BorderDouble(1, 1, 1, 0),
|
||||
BorderColor = borderColor,
|
||||
ProgressBackgroundColor = progressBackgroundColor
|
||||
};
|
||||
|
||||
pendingTasksList.AddChild(taskRow);
|
||||
pendingTasksList.AddChild(taskRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.Visible = pendingTasksList.Children.Count > 0;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
// spin up a task to remove holes from the objects in the group
|
||||
ApplicationController.Instance.Tasks.Execute(
|
||||
"Combine".Localize(),
|
||||
null,
|
||||
(reporter, cancellationToken) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
var rebuildLock = RebuildLock();
|
||||
ResetMeshWrapperMeshes(Object3DPropertyFlags.All, CancellationToken.None);
|
||||
|
||||
ApplicationController.Instance.Tasks.Execute("Intersection".Localize(), (reporter, cancellationToken) =>
|
||||
ApplicationController.Instance.Tasks.Execute("Intersection".Localize(), null, (reporter, cancellationToken) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
ResetMeshWrapperMeshes(Object3DPropertyFlags.All, CancellationToken.None);
|
||||
|
||||
// spin up a task to calculate the paint
|
||||
ApplicationController.Instance.Tasks.Execute("Subtract".Localize(), (reporter, cancellationToken) =>
|
||||
ApplicationController.Instance.Tasks.Execute("Subtract".Localize(), null, (reporter, cancellationToken) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
|
||||
|
|
|
|||
|
|
@ -297,6 +297,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
// spin up a task to remove holes from the objects in the group
|
||||
ApplicationController.Instance.Tasks.Execute(
|
||||
"Subtract".Localize(),
|
||||
null,
|
||||
(reporter, cancellationToken) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
UiThread.RunOnIdle(async () =>
|
||||
{
|
||||
// Save any pending changes before starting print operation
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving Changes".Localize(), printer.Bed.SaveChanges);
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving Changes".Localize(), printer, printer.Bed.SaveChanges);
|
||||
|
||||
await ApplicationController.Instance.PrintPart(
|
||||
printer.Bed.EditContext,
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
try
|
||||
{
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer.Bed.SaveChanges);
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer, printer.Bed.SaveChanges);
|
||||
|
||||
await ApplicationController.Instance.SliceItemLoadOutput(
|
||||
printer,
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
await ApplicationController.Instance.Tasks.Execute(
|
||||
"Ungroup".Localize(),
|
||||
null,
|
||||
(reporter, cancellationToken) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Shortcut = "Ctrl+S",
|
||||
Action = () =>
|
||||
{
|
||||
ApplicationController.Instance.Tasks.Execute("Saving".Localize(), sceneContext.SaveChanges).ConfigureAwait(false);
|
||||
ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer, sceneContext.SaveChanges).ConfigureAwait(false);
|
||||
},
|
||||
IsEnabled = () => sceneContext.EditableScene
|
||||
}
|
||||
|
|
@ -660,7 +660,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (this.Printer != null)
|
||||
{
|
||||
// Save any pending changes before starting print operation
|
||||
ApplicationController.Instance.Tasks.Execute("Saving Changes".Localize(), printer.Bed.SaveChanges).ContinueWith(task =>
|
||||
ApplicationController.Instance.Tasks.Execute("Saving Changes".Localize(), printer, printer.Bed.SaveChanges).ContinueWith(task =>
|
||||
{
|
||||
ApplicationController.Instance.PrintPart(
|
||||
printer.Bed.EditContext,
|
||||
|
|
@ -735,7 +735,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving".Localize(), sceneContext.SaveChanges);
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer, sceneContext.SaveChanges);
|
||||
|
||||
// Clear bed to get new MCX on disk for this item
|
||||
printer.Bed.ClearPlate();
|
||||
|
|
@ -778,7 +778,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ApplicationController.Instance.MainView.TabControl.SelectedTabKey = printer.Settings.GetValue(SettingsKey.printer_name);
|
||||
|
||||
// Save any pending changes before starting print operation
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving Changes".Localize(), printer.Bed.SaveChanges);
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving Changes".Localize(), printer, printer.Bed.SaveChanges);
|
||||
|
||||
// Slice and print
|
||||
await ApplicationController.Instance.PrintPart(
|
||||
|
|
@ -1920,7 +1920,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public void Save()
|
||||
{
|
||||
ApplicationController.Instance.Tasks.Execute("Saving".Localize(), sceneContext.SaveChanges);
|
||||
ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer, sceneContext.SaveChanges);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
UiThread.RunOnIdle(async () =>
|
||||
{
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving changes".Localize() + "...", sceneContext.SaveChanges);
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving changes".Localize() + "...", sceneContext.Printer, sceneContext.SaveChanges);
|
||||
|
||||
await sceneContext.LoadLibraryContent(item);
|
||||
|
||||
|
|
@ -671,7 +671,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
iconButton.Click += (s, e) =>
|
||||
{
|
||||
ApplicationController.Instance.Tasks.Execute("Saving".Localize(), async(progress, cancellationToken) =>
|
||||
ApplicationController.Instance.Tasks.Execute("Saving".Localize(), sceneContext.Printer, async(progress, cancellationToken) =>
|
||||
{
|
||||
saveButton.Enabled = false;
|
||||
|
||||
|
|
@ -827,7 +827,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
IObject3D object3D = null;
|
||||
|
||||
await ApplicationController.Instance.Tasks.Execute("Loading".Localize() + " " + Path.GetFileName(filePath), async (progressReporter, cancellationToken) =>
|
||||
await ApplicationController.Instance.Tasks.Execute("Loading".Localize() + " " + Path.GetFileName(filePath), sceneContext.Printer, async (progressReporter, cancellationToken) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
public PrinterConnection(PrinterConfig printer)
|
||||
{
|
||||
this.printer = printer;
|
||||
this.Printer = printer;
|
||||
|
||||
TerminalLog = new TerminalLog(this);
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
// Set this early as we always want our functions to know the state we are in.
|
||||
communicationState = value;
|
||||
timeSinceStartedPrint.Stop();
|
||||
PrintFinished?.Invoke(this, new NamedItemEventArgs(printer.Bed.EditContext.SourceItem.Name));
|
||||
PrintFinished?.Invoke(this, new NamedItemEventArgs(Printer.Bed.EditContext.SourceItem.Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -523,9 +523,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
gCodeFileSwitcher0.SwitchTo(gCodeFilePath);
|
||||
}
|
||||
|
||||
public string ComPort => printer.Settings?.Helpers.ComPort();
|
||||
public string ComPort => Printer.Settings?.Helpers.ComPort();
|
||||
|
||||
public string DriverType => (this.ComPort == "Emulator") ? "Emulator" : printer.Settings?.GetValue("driver_type");
|
||||
public string DriverType => (this.ComPort == "Emulator") ? "Emulator" : Printer.Settings?.GetValue("driver_type");
|
||||
|
||||
public bool AtxPowerEnabled
|
||||
{
|
||||
|
|
@ -787,8 +787,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
}
|
||||
}
|
||||
|
||||
// HACK: PrinterConnection must be revised to take a constructor that receives and stores a reference to its parent PrinterConfig - this
|
||||
private PrinterConfig printer { get; set; }
|
||||
public PrinterConfig Printer { get; }
|
||||
|
||||
public void ReleaseAndReportFailedConnection(ConnectionFailure reason, string details = null)
|
||||
{
|
||||
|
|
@ -882,7 +881,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
var portFactory = FrostedSerialPortFactory.GetAppropriateFactory(this.DriverType);
|
||||
|
||||
bool serialPortIsAvailable = portFactory.SerialPortIsAvailable(serialPortName, printer.Settings);
|
||||
bool serialPortIsAvailable = portFactory.SerialPortIsAvailable(serialPortName, Printer.Settings);
|
||||
bool serialPortIsAlreadyOpen = this.ComPort != "Emulator" &&
|
||||
portFactory.SerialPortAlreadyOpen(serialPortName);
|
||||
|
||||
|
|
@ -892,7 +891,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
try
|
||||
{
|
||||
serialPort = portFactory.CreateAndOpen(serialPortName, printer.Settings, baudRate, true);
|
||||
serialPort = portFactory.CreateAndOpen(serialPortName, Printer.Settings, baudRate, true);
|
||||
#if __ANDROID__
|
||||
ToggleHighLowHigh(serialPort);
|
||||
#endif
|
||||
|
|
@ -1368,9 +1367,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
// TODO: Ideally we would shutdown the printer connection when this method is called and we're connected. The
|
||||
// current approach results in unpredictable behavior if the caller fails to close the connection
|
||||
if (serialPort == null && this.printer.Settings != null)
|
||||
if (serialPort == null && this.Printer.Settings != null)
|
||||
{
|
||||
IFrostedSerialPort resetSerialPort = FrostedSerialPortFactory.GetAppropriateFactory(this.DriverType).Create(this.ComPort, printer.Settings);
|
||||
IFrostedSerialPort resetSerialPort = FrostedSerialPortFactory.GetAppropriateFactory(this.DriverType).Create(this.ComPort, Printer.Settings);
|
||||
resetSerialPort.Open();
|
||||
|
||||
Thread.Sleep(500);
|
||||
|
|
@ -1583,7 +1582,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
try
|
||||
{
|
||||
if (printer.Settings.PrinterSelected)
|
||||
if (Printer.Settings.PrinterSelected)
|
||||
{
|
||||
// first make sure we are not printing if possible (cancel slicing)
|
||||
if (serialPort != null) // we still have a serial port
|
||||
|
|
@ -1611,7 +1610,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
// We reset the board while attempting to connect, so now we don't have a serial port.
|
||||
// Create one and do the DTR to reset
|
||||
var resetSerialPort = FrostedSerialPortFactory.GetAppropriateFactory(this.DriverType).Create(this.ComPort, printer.Settings);
|
||||
var resetSerialPort = FrostedSerialPortFactory.GetAppropriateFactory(this.DriverType).Create(this.ComPort, Printer.Settings);
|
||||
resetSerialPort.Open();
|
||||
|
||||
Thread.Sleep(500);
|
||||
|
|
@ -1857,7 +1856,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
case CommunicationStates.PreparingToPrint:
|
||||
{
|
||||
var activePrintItem = printer.Bed.EditContext.printItem;
|
||||
var activePrintItem = Printer.Bed.EditContext.printItem;
|
||||
if (activePrintItem.PrintItem.Id == 0)
|
||||
{
|
||||
activePrintItem.PrintItem.Commit();
|
||||
|
|
@ -1869,7 +1868,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
activePrintTask = new PrintTask
|
||||
{
|
||||
PrintStart = DateTime.Now,
|
||||
PrinterId = this.printer.Settings.ID.GetHashCode(),
|
||||
PrinterId = this.Printer.Settings.ID.GetHashCode(),
|
||||
PrintName = activePrintItem.PrintItem.Name,
|
||||
PrintItemId = activePrintItem.PrintItem.Id,
|
||||
PrintingGCodeFileName = gcodeFilename,
|
||||
|
|
@ -2084,45 +2083,45 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
GCodeStream firstStreamToRead = null;
|
||||
if (gcodeFilename != null)
|
||||
{
|
||||
gCodeFileSwitcher0 = new GCodeSwitcher(gcodeFilename, printer);
|
||||
gCodeFileSwitcher0 = new GCodeSwitcher(gcodeFilename, Printer);
|
||||
|
||||
if (this.RecoveryIsEnabled
|
||||
&& activePrintTask != null) // We are resuming a failed print (do lots of interesting stuff).
|
||||
{
|
||||
sendProgressStream1 = new SendProgressStream(new PrintRecoveryStream(gCodeFileSwitcher0, printer, activePrintTask.PercentDone), printer);
|
||||
sendProgressStream1 = new SendProgressStream(new PrintRecoveryStream(gCodeFileSwitcher0, Printer, activePrintTask.PercentDone), Printer);
|
||||
// And increment the recovery count
|
||||
activePrintTask.RecoveryCount++;
|
||||
activePrintTask.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
sendProgressStream1 = new SendProgressStream(gCodeFileSwitcher0, printer);
|
||||
sendProgressStream1 = new SendProgressStream(gCodeFileSwitcher0, Printer);
|
||||
}
|
||||
|
||||
pauseHandlingStream2 = new PauseHandlingStream(printer, sendProgressStream1);
|
||||
pauseHandlingStream2 = new PauseHandlingStream(Printer, sendProgressStream1);
|
||||
firstStreamToRead = pauseHandlingStream2;
|
||||
}
|
||||
else
|
||||
{
|
||||
gCodeFileSwitcher0 = null;
|
||||
firstStreamToRead = new NotPrintingStream(printer);
|
||||
firstStreamToRead = new NotPrintingStream(Printer);
|
||||
}
|
||||
|
||||
queuedCommandStream3 = new QueuedCommandsStream(printer, firstStreamToRead);
|
||||
relativeToAbsoluteStream4 = new RelativeToAbsoluteStream(printer, queuedCommandStream3);
|
||||
bool enableLineSpliting = gcodeFilename != null && printer.Settings.GetValue<bool>(SettingsKey.enable_line_splitting);
|
||||
babyStepsStream5 = new BabyStepsStream(printer, relativeToAbsoluteStream4, enableLineSpliting ? 1 : 2000);
|
||||
queuedCommandStream3 = new QueuedCommandsStream(Printer, firstStreamToRead);
|
||||
relativeToAbsoluteStream4 = new RelativeToAbsoluteStream(Printer, queuedCommandStream3);
|
||||
bool enableLineSpliting = gcodeFilename != null && Printer.Settings.GetValue<bool>(SettingsKey.enable_line_splitting);
|
||||
babyStepsStream5 = new BabyStepsStream(Printer, relativeToAbsoluteStream4, enableLineSpliting ? 1 : 2000);
|
||||
if (activePrintTask != null)
|
||||
{
|
||||
// make sure we are in the position we were when we stopped printing
|
||||
babyStepsStream5.Offset = new Vector3(activePrintTask.PrintingOffsetX, activePrintTask.PrintingOffsetY, activePrintTask.PrintingOffsetZ);
|
||||
}
|
||||
printLevelingStream6 = new PrintLevelingStream(printer, babyStepsStream5, true);
|
||||
waitForTempStream7 = new WaitForTempStream(printer, printLevelingStream6);
|
||||
extrusionMultiplyerStream8 = new ExtrusionMultiplyerStream(printer, waitForTempStream7);
|
||||
feedrateMultiplyerStream9 = new FeedRateMultiplyerStream(printer, extrusionMultiplyerStream8);
|
||||
requestTemperaturesStream10 = new RequestTemperaturesStream(printer, feedrateMultiplyerStream9);
|
||||
processWriteRegExStream11 = new ProcessWriteRegexStream(printer, requestTemperaturesStream10, queuedCommandStream3);
|
||||
printLevelingStream6 = new PrintLevelingStream(Printer, babyStepsStream5, true);
|
||||
waitForTempStream7 = new WaitForTempStream(Printer, printLevelingStream6);
|
||||
extrusionMultiplyerStream8 = new ExtrusionMultiplyerStream(Printer, waitForTempStream7);
|
||||
feedrateMultiplyerStream9 = new FeedRateMultiplyerStream(Printer, extrusionMultiplyerStream8);
|
||||
requestTemperaturesStream10 = new RequestTemperaturesStream(Printer, feedrateMultiplyerStream9);
|
||||
processWriteRegExStream11 = new ProcessWriteRegexStream(Printer, requestTemperaturesStream10, queuedCommandStream3);
|
||||
totalGCodeStream = processWriteRegExStream11;
|
||||
|
||||
// Force a reset of the printer checksum state (but allow it to be write regexed)
|
||||
|
|
|
|||
|
|
@ -308,13 +308,13 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
if (printer != PrinterConfig.EmptyPrinter)
|
||||
{
|
||||
await application.Tasks.Execute("Saving Print Bed".Localize() + "...", printer.Bed.SaveChanges);
|
||||
await application.Tasks.Execute("Saving Print Bed".Localize() + "...", printer, printer.Bed.SaveChanges);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var workspace in application.Workspaces)
|
||||
{
|
||||
await application.Tasks.Execute("Saving Print Bed".Localize() + "...", workspace.SceneContext.SaveChanges);
|
||||
await application.Tasks.Execute("Saving Print Bed".Localize() + "...", workspace, workspace.SceneContext.SaveChanges);
|
||||
}
|
||||
|
||||
application.ApplicationExiting = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue