示例#1
0
        public override JobCreateResult Create(PrinterInfo printerInfo)
        {
            try
            {
                m_sGCodeFileOnSDCard = Details.jobParams.gcodefile;
            }
            catch (Exception ex)
            {
                return(new JobCreateResult(this, ProcessReturn.FAILURE, null));
            }
            FilamentSpool.TypeEnum filamentTypeFromName = FirmwareSDPrintJob.GetFilamentTypeFromName(Details.jobParams.gcodefile);
            switch (filamentTypeFromName)
            {
            case FilamentSpool.TypeEnum.NoFilament:
            case FilamentSpool.TypeEnum.OtherOrUnknown:
                return(new JobCreateResult(this, ProcessReturn.SUCCESS, null));

            default:
                if (FilamentProfile.CreateFilamentProfile(printerInfo.filament_info, MyPrinterProfile).Type != filamentTypeFromName)
                {
                    return(new JobCreateResult(null, ProcessReturn.FAILURE_FILAMENT_MISMATCH, null));
                }

                goto case FilamentSpool.TypeEnum.NoFilament;
            }
        }
示例#2
0
        public JobController.Result InitPrintJob(JobParams jobParams, string user, ulong ulFastForward = 0)
        {
            if (MyJobImplementation != null)
            {
                return(JobController.Result.FAILED_JobAlreadyStarted);
            }

            Processed    = false;
            Printing     = false;
            IsSavingToSD = false;
            ClearAllWarnings();
            m_sGcodeFile = jobParams.gcodefile;
            Mode         = jobParams.jobMode;
            PrinterInfo currentPrinterInfo = m_oParentFirmwareController.CurrentPrinterInfo;
            AbstractJob abstractJob;

            if (Mode == JobParams.Mode.SaveToBinaryGCodeFile)
            {
                abstractJob = new SaveGCodeToFileJob(jobParams, user, m_oParentFirmwareController.MyPrinterProfile);
            }
            else if (Mode != JobParams.Mode.FirmwarePrintingFromSDCard)
            {
                if (Mode == JobParams.Mode.SavingToSDCard || Mode == JobParams.Mode.SavingToSDCardAutoStartPrint)
                {
                    m_sGcodeFile = GetFilenameForSDCard(jobParams.jobname, currentPrinterInfo.filament_info);
                }

                IsSimultaneousPrint = false;
                IsSavingToSD        = Mode != JobParams.Mode.DirectPrinting;
                abstractJob         = new SpoolerHostedJob(jobParams, user, m_oParentFirmwareController.MyPrinterProfile, IsSavingToSD && !IsSimultaneousPrint, ulFastForward);
            }
            else
            {
                if (Mode != JobParams.Mode.FirmwarePrintingFromSDCard)
                {
                    throw new NotImplementedException("Software does not support printing from the SD card.");
                }

                abstractJob = new FirmwareSDPrintJob(jobParams, user, m_oParentFirmwareController.MyPrinterProfile);
            }
            m_oJobImplementation.Value = abstractJob;
            JobCreateResult jobCreateResult = abstractJob.Create(currentPrinterInfo);

            if (jobCreateResult.Result == ProcessReturn.SUCCESS)
            {
                m_olWarnings = jobCreateResult.Warnings;
                Processed    = true;
                return(JobController.Result.Success);
            }
            m_oJobImplementation.Value = null;
            if (jobCreateResult.Result == ProcessReturn.FAILURE_OUT_OF_BOUNDS)
            {
                return(JobController.Result.FAILED_OutOfBounds);
            }

            return(jobCreateResult.Result == ProcessReturn.FAILURE_FILAMENT_MISMATCH ? JobController.Result.FAILED_IncompatibleFilament : JobController.Result.FAILED_Create);
        }
示例#3
0
        public void ConnectToRunningSDPrint(string user)
        {
            PrinterInfo currentPrinterInfo = m_oParentFirmwareController.CurrentPrinterInfo;
            JobParams   jobParams          = currentPrinterInfo.persistantData.SavedJobInformation == null ? new JobParams(null, "Print From SD", null, FilamentSpool.TypeEnum.OtherOrUnknown, 0.0f, 0.0f) : currentPrinterInfo.persistantData.SavedJobInformation.Params;

            ClearAllWarnings();
            m_sGcodeFile = "";
            Mode         = JobParams.Mode.FirmwarePrintingFromSDCard;
            var firmwareSdPrintJob = new FirmwareSDPrintJob(jobParams, user, m_oParentFirmwareController.MyPrinterProfile);

            m_oJobImplementation.Value = firmwareSdPrintJob;
            firmwareSdPrintJob.ConnectToRunningSDPrint();
            Processed = true;
            Printing  = true;
            SaveJobState();
        }