Added SetInterval to uithread
Make sure we don't show time to turn of temps if already off Make sure tumble cube is build before putting textures on it
This commit is contained in:
parent
bd9f985c3a
commit
9139345012
13 changed files with 64 additions and 110 deletions
|
|
@ -130,7 +130,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
public override void PageIsBecomingActive()
|
||||
{
|
||||
startingTemp = printer.Connection.ActualBedTemperature;
|
||||
UiThread.RunOnIdle(ShowTempChangeProgress);
|
||||
|
||||
UiThread.SetInterval(ShowTempChangeProgress, 1, () => !HasBeenClosed);
|
||||
|
||||
// start heating the bed and show our progress
|
||||
printer.Connection.TargetBedTemperature = printer.Settings.GetValue<double>(SettingsKey.bed_temperature);
|
||||
|
|
@ -176,10 +177,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
double ratioDone = totalDelta != 0 ? (currentDelta / totalDelta) : 1;
|
||||
progressBar.RatioComplete = Math.Min(Math.Max(0, ratioDone), 1);
|
||||
progressBarText.Text = $"Temperature: {actualTemp:0} / {targetTemp:0}";
|
||||
if (!HasBeenClosed)
|
||||
{
|
||||
UiThread.RunOnIdle(ShowTempChangeProgress, 1);
|
||||
}
|
||||
|
||||
// if we are within 1 degree of our target
|
||||
if (Math.Abs(targetTemp - actualTemp) < 1
|
||||
|
|
@ -434,14 +431,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
VAnchor = VAnchor.Center,
|
||||
Margin = new BorderDouble(10, 0),
|
||||
};
|
||||
Action<TextWidget> updateUntilClose = null;
|
||||
updateUntilClose = (tw) =>
|
||||
|
||||
UiThread.SetInterval(() =>
|
||||
{
|
||||
Vector3 destinationPosition = printer.Connection.CurrentDestination;
|
||||
zPosition.Text = "Z: {0:0.00}".FormatWith(destinationPosition.Z);
|
||||
UiThread.RunOnIdle(() => updateUntilClose(zPosition), .3);
|
||||
};
|
||||
updateUntilClose(zPosition);
|
||||
}, .3, () => !HasBeenClosed);
|
||||
|
||||
zButtonsAndInfo.AddChild(zPosition);
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,10 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
{
|
||||
timeToWaitMs = (long)(macroData.countDown * 1000);
|
||||
startTimeMs = UiThread.CurrentTimerMs;
|
||||
UiThread.RunOnIdle(CountDownTime);
|
||||
UiThread.SetInterval(CountDownTime, .2, () =>
|
||||
{
|
||||
return (!HasBeenClosed && progressBar.RatioComplete < 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -152,10 +155,6 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
progressBar.RatioComplete = timeToWaitMs == 0 ? 1 : Math.Max(0, Math.Min(1, ((double)timeSinceStartMs / (double)timeToWaitMs)));
|
||||
int seconds = (int)((timeToWaitMs - (timeToWaitMs * (progressBar.RatioComplete))) / 1000);
|
||||
progressBarText.Text = $"Time Remaining: {seconds / 60:#0}:{seconds % 60:00}";
|
||||
if (!HasBeenClosed && progressBar.RatioComplete < 1)
|
||||
{
|
||||
UiThread.RunOnIdle(CountDownTime, .2);
|
||||
}
|
||||
}
|
||||
|
||||
double startingTemp;
|
||||
|
|
@ -166,23 +165,17 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
&& stringEvent.Data.Contains("M104"))
|
||||
{
|
||||
startingTemp = printer.Connection.GetActualHotendTemperature(0);
|
||||
UiThread.RunOnIdle(ShowTempChangeProgress);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowTempChangeProgress()
|
||||
{
|
||||
progressBar.Visible = true;
|
||||
double targetTemp = printer.Connection.GetTargetHotendTemperature(0);
|
||||
double actualTemp = printer.Connection.GetActualHotendTemperature(0);
|
||||
double totalDelta = targetTemp - startingTemp;
|
||||
double currentDelta = actualTemp - startingTemp;
|
||||
double ratioDone = totalDelta != 0 ? (currentDelta / totalDelta) : 1;
|
||||
progressBar.RatioComplete = Math.Min(Math.Max(0, ratioDone), 1);
|
||||
progressBarText.Text = $"Temperature: {actualTemp:0} / {targetTemp:0}";
|
||||
if (!HasBeenClosed && ratioDone < 1)
|
||||
{
|
||||
UiThread.RunOnIdle(ShowTempChangeProgress, 1);
|
||||
UiThread.SetInterval(() =>
|
||||
{
|
||||
progressBar.Visible = true;
|
||||
double targetTemp = printer.Connection.GetTargetHotendTemperature(0);
|
||||
double actualTemp = printer.Connection.GetActualHotendTemperature(0);
|
||||
double totalDelta = targetTemp - startingTemp;
|
||||
double currentDelta = actualTemp - startingTemp;
|
||||
double ratioDone = totalDelta != 0 ? (currentDelta / totalDelta) : 1;
|
||||
progressBar.RatioComplete = Math.Min(Math.Max(0, ratioDone), 1);
|
||||
progressBarText.Text = $"Temperature: {actualTemp:0} / {targetTemp:0}";
|
||||
}, 1, () => !HasBeenClosed && progressBar.RatioComplete < 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue