Fixed a problem with exporting to SD card when print leveling is enabled.
Checked that the files loaded from sd card have a gcode extension.
This commit is contained in:
parent
e801528a7e
commit
37ebc4ce9b
2 changed files with 15 additions and 5 deletions
|
|
@ -198,17 +198,18 @@ namespace MatterHackers.MatterControl
|
|||
string Get8Name(string longName)
|
||||
{
|
||||
longName.Replace(' ', '_');
|
||||
return longName.Substring(0, 8);
|
||||
return longName.Substring(0, Math.Min(longName.Length, 8));
|
||||
}
|
||||
|
||||
bool levelingEnabledStateBeforeSdOutput;
|
||||
void ExportToSdCard_Click(object state)
|
||||
{
|
||||
if (applyLeveling.Checked) // check if the user wants that output leveled
|
||||
if (applyLeveling != null && applyLeveling.Checked) // check if the user wants that output leveled
|
||||
{
|
||||
// Check if the printer needs to run calibration to print
|
||||
PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter);
|
||||
if (levelingData.needsPrintLeveling
|
||||
if (levelingData != null
|
||||
&& levelingData.needsPrintLeveling
|
||||
&& levelingData.sampledPosition0.z == 0
|
||||
&& levelingData.sampledPosition1.z == 0
|
||||
&& levelingData.sampledPosition2.z == 0)
|
||||
|
|
@ -230,7 +231,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
// check if we need to turn off the print leveling
|
||||
levelingEnabledStateBeforeSdOutput = ActivePrinterProfile.Instance.DoPrintLeveling;
|
||||
if (!applyLeveling.Checked)
|
||||
if (applyLeveling != null && !applyLeveling.Checked)
|
||||
{
|
||||
ActivePrinterProfile.Instance.DoPrintLeveling = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
if(gotBeginFileList)
|
||||
{
|
||||
bool sdCardItemInQueue = false;
|
||||
bool validSdCardItem = false;
|
||||
|
||||
foreach (PrintItem item in CreateReadOnlyPartList())
|
||||
{
|
||||
|
|
@ -228,9 +229,17 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
sdCardItemInQueue = true;
|
||||
break;
|
||||
}
|
||||
|
||||
string sdCardFileExtension = currentEvent.Data.ToUpper();
|
||||
|
||||
if (sdCardFileExtension.Contains(".GCO")
|
||||
|| sdCardFileExtension.Contains(".GCODE"))
|
||||
{
|
||||
validSdCardItem = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sdCardItemInQueue)
|
||||
if (!sdCardItemInQueue && validSdCardItem)
|
||||
{
|
||||
// If there is not alread an sd card item in the queue with this name then add it.
|
||||
AddItem(new PrintItemWrapper(new PrintItem(currentEvent.Data, QueueData.SdCardFileName)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue