Merge pull request #2971 from larsbrubaker/design_tools

Design tools
This commit is contained in:
Lars Brubaker 2018-02-02 09:47:17 -08:00 committed by GitHub
commit aa35fd268b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View file

@ -2449,6 +2449,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication
}
}
public int TurnOffHeatDelay { get; set; } = 60;
public void TurnOffBedAndExtruders(bool now)
{
if (now)
@ -2461,9 +2463,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication
}
else
{
int secondsToWait = 60;
bool currentlyWaiting = ContinuWaitingToTurnOffHeaters && TimeHaveBeenWaitingToTurnOffHeaters.IsRunning && TimeHaveBeenWaitingToTurnOffHeaters.Elapsed.TotalSeconds < secondsToWait;
SecondsUntilTurnOffHeaters = secondsToWait;
bool currentlyWaiting = ContinuWaitingToTurnOffHeaters && TimeHaveBeenWaitingToTurnOffHeaters.IsRunning && TimeHaveBeenWaitingToTurnOffHeaters.Elapsed.TotalSeconds < TurnOffHeatDelay;
SecondsUntilTurnOffHeaters = TurnOffHeatDelay;
ContinuWaitingToTurnOffHeaters = true;
TimeHaveBeenWaitingToTurnOffHeaters = Stopwatch.StartNew();
if (!currentlyWaiting)
@ -2472,10 +2473,10 @@ namespace MatterHackers.MatterControl.PrinterCommunication
// wait secondsToWait and turn off the heaters
Task.Run(() =>
{
while (TimeHaveBeenWaitingToTurnOffHeaters.Elapsed.TotalSeconds < secondsToWait
while (TimeHaveBeenWaitingToTurnOffHeaters.Elapsed.TotalSeconds < TurnOffHeatDelay
&& ContinuWaitingToTurnOffHeaters)
{
SecondsUntilTurnOffHeaters = ContinuWaitingToTurnOffHeaters ? Math.Max(0, secondsToWait - TimeHaveBeenWaitingToTurnOffHeaters.Elapsed.TotalSeconds) : 0;
SecondsUntilTurnOffHeaters = ContinuWaitingToTurnOffHeaters ? Math.Max(0, TurnOffHeatDelay - TimeHaveBeenWaitingToTurnOffHeaters.Elapsed.TotalSeconds) : 0;
Thread.Sleep(100);
}

View file

@ -35,13 +35,16 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.AddItemToBedplate();
// Sorten the delay so the test runs in a reasonable time
ApplicationController.Instance.ActivePrinter.Connection.TurnOffHeatDelay = 5;
testRunner.StartPrint();
// Wait for print to finish
testRunner.WaitForPrintFinished();
// Wait for expected temp
testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0) <= 0);
testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0) <= 0, 10);
Assert.Less(ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0), 30);
// Wait for expected temp
@ -55,7 +58,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.WaitForPrintFinished();
// Wait for expected temp
testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0) <= 0);
testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0) <= 0, 10);
Assert.Less(ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0), 30);
// Wait for expected temp
@ -64,7 +67,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
}
return Task.CompletedTask;
}, maxTimeToRun: 70);
}, maxTimeToRun: 95);
}
[Test, Category("Emulator")]