Merge branch 'master' into booleans
This commit is contained in:
commit
3c45f54bbc
3 changed files with 38 additions and 66 deletions
|
|
@ -294,57 +294,19 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
private void SetVisibleControls()
|
||||
{
|
||||
if (ActivePrinterProfile.Instance.ActivePrinter == null)
|
||||
|
||||
var currentStatus = PrinterConnectionAndCommunication.Instance.CommunicationState;
|
||||
var connected =
|
||||
currentStatus == PrinterConnectionAndCommunication.CommunicationStates.Connected ||
|
||||
currentStatus == PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint;
|
||||
|
||||
if (ActivePrinterProfile.Instance.ActivePrinter == null || !connected)
|
||||
{
|
||||
// no printer selected
|
||||
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
//cloudMonitorContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
}
|
||||
else // we at least have a printer selected
|
||||
else
|
||||
{
|
||||
//cloudMonitorContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnecting:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnected:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect:
|
||||
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Connected:
|
||||
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd:
|
||||
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
switch (PrinterConnectionAndCommunication.Instance.PrintingState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HomingAxis:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.Printing:
|
||||
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
public class PrintLevelingData
|
||||
{
|
||||
public List<Vector3> SampledPositions = new List<Vector3>();
|
||||
private static bool activelyLoading = false;
|
||||
|
||||
private static Printer activePrinter = null;
|
||||
|
|
@ -28,11 +29,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum LevelingSystem { Probe3Points, Probe2Points, Probe7PointRadial, Probe13PointRadial }
|
||||
|
||||
public List<Vector3> SampledPositions = new List<Vector3>();
|
||||
|
||||
public LevelingSystem CurrentPrinterLevelingSystem
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
switch (ActiveSliceSettings.Instance.GetActiveValue("print_leveling_solution"))
|
||||
{
|
||||
|
|
@ -135,6 +134,20 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
return instance;
|
||||
}
|
||||
|
||||
public void Commit()
|
||||
{
|
||||
if (!activelyLoading)
|
||||
{
|
||||
string newLevelingInfo = Newtonsoft.Json.JsonConvert.SerializeObject(this);
|
||||
|
||||
// clear the legacy value
|
||||
activePrinter.PrintLevelingProbePositions = "";
|
||||
// set the new value
|
||||
activePrinter.PrintLevelingJsonData = newLevelingInfo;
|
||||
activePrinter.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateFromJsonOrLegacy(string jsonData, string depricatedPositionsCsv3ByXYZ)
|
||||
{
|
||||
if (jsonData != null)
|
||||
|
|
@ -154,20 +167,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
}
|
||||
}
|
||||
|
||||
public void Commit()
|
||||
{
|
||||
if (!activelyLoading)
|
||||
{
|
||||
string newLevelingInfo = Newtonsoft.Json.JsonConvert.SerializeObject(this);
|
||||
|
||||
// clear the legacy value
|
||||
activePrinter.PrintLevelingProbePositions = "";
|
||||
// set the new value
|
||||
activePrinter.PrintLevelingJsonData = newLevelingInfo;
|
||||
activePrinter.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the 9 {3 * (x, y, z)} positions that were probed during the print leveling setup.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
// put in the movement edit controls
|
||||
PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter);
|
||||
if (levelingData.SampledPositions.Count > 0)
|
||||
if (EditSamplePositionList(levelingData))
|
||||
{
|
||||
for (int i = 0; i < levelingData.SampledPositions.Count; i++)
|
||||
{
|
||||
|
|
@ -190,11 +190,22 @@ namespace MatterHackers.MatterControl
|
|||
UiThread.RunOnIdle(DoSave_Click);
|
||||
}
|
||||
|
||||
bool EditSamplePositionList(PrintLevelingData levelingData)
|
||||
{
|
||||
if (levelingData.CurrentPrinterLevelingSystem == PrintLevelingData.LevelingSystem.Probe7PointRadial
|
||||
|| levelingData.CurrentPrinterLevelingSystem == PrintLevelingData.LevelingSystem.Probe13PointRadial)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void DoSave_Click()
|
||||
{
|
||||
PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter);
|
||||
|
||||
if (levelingData.SampledPositions.Count > 0)
|
||||
if (EditSamplePositionList(levelingData))
|
||||
{
|
||||
for (int i = 0; i < levelingData.SampledPositions.Count; i++)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue