More work on printer sd card support
Made single panel mode not ever load data into the second panel (memory optimization) Made the thumbnail widget let go of the memory of the model when the window is closed. Put in an explicit DeletFileFromSdCard
This commit is contained in:
parent
31f4a9ffd4
commit
4703b7b2a6
6 changed files with 61 additions and 19 deletions
|
|
@ -1968,6 +1968,23 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
switch (CommunicationState)
|
||||
{
|
||||
case CommunicationStates.PrintingToSd:
|
||||
using (TimedLock.Lock(this, "CancelingPrint"))
|
||||
{
|
||||
// get rid of all the gcode we have left to print
|
||||
ClearQueuedGCode();
|
||||
// let the process know we canceled not ended normaly.
|
||||
printWasCanceled = true;
|
||||
// close the file
|
||||
//M29: // Stop writing to SD card
|
||||
// and delete it from the sd card
|
||||
//30: // Delete a file on the SD card
|
||||
}
|
||||
break;
|
||||
|
||||
case CommunicationStates.PrintingFromSd:
|
||||
break;
|
||||
|
||||
case CommunicationStates.Printing:
|
||||
{
|
||||
using (TimedLock.Lock(this, "CancelingPrint"))
|
||||
|
|
@ -2280,5 +2297,23 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
SendLineToPrinterNow("M114");
|
||||
}
|
||||
|
||||
public void DeleteFileFromSdCard(string fileName)
|
||||
{
|
||||
// Register to detect the file deleted confirmation.
|
||||
// This should have worked without this by getting the normal 'ok' on the next line. But the ok is not on its own line.
|
||||
ReadLineStartCallBacks.AddCallBackToKey("File deleted:", FileDelteConfirmed);
|
||||
// and send the line to delete the file
|
||||
SendLineToPrinterNow("M30 {0}".FormatWith(fileName.ToLower()));
|
||||
}
|
||||
|
||||
void FileDelteConfirmed(object sender, EventArgs e)
|
||||
{
|
||||
UiThread.RunOnIdle((state) =>
|
||||
{
|
||||
ReadLineStartCallBacks.RemoveCallBackFromKey("File deleted:", FileDelteConfirmed);
|
||||
});
|
||||
PrintingCanContinue(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue