示例#1
0
        private void SaveJobState()
        {
            AbstractJob jobImplementation = MyJobImplementation;
            var         parameters        = (PersistantJobData)null;

            if (jobImplementation != null)
            {
                parameters = new PersistantJobData(jobImplementation.CurrentFileLineNumber, jobImplementation.Details.jobParams);
            }

            m_oParentFirmwareController.SaveJobParamsToPersistantData(parameters);
        }
示例#2
0
        public bool Pause(out List <string> pause_gcode, FilamentSpool spool)
        {
            pause_gcode = null;
            AbstractJob jobImplementation = MyJobImplementation;

            if (jobImplementation == null || jobImplementation.Status == JobStatus.Paused || IsSavingToSD)
            {
                return(false);
            }

            job_timer.Stop();
            var flag = jobImplementation.Pause(out pause_gcode, spool);

            if (flag)
            {
                if (pause_gcode == null)
                {
                    pause_gcode = new List <string>();
                }

                var      num1 = 90f;
                var      num2 = 1800f;
                Vector2D cornerPositionBoxTop = m_oParentFirmwareController.MyPrinterProfile.PrinterSizeConstants.BackCornerPositionBoxTop;
                string   str;
                if (m_oParentFirmwareController.CurrentPrinterInfo.extruder.Temperature > 0.0)
                {
                    m_fRetractionAtPause = !(null != spool) || spool.filament_type == FilamentSpool.TypeEnum.NoFilament ? 10f : FilamentProfile.CreateFilamentProfile(spool, (PrinterProfile)m_oParentFirmwareController.MyPrinterProfile).preprocessor.initialPrint.PrimeAmount;
                    str = PrinterCompatibleString.Format("G0 Z{0} F{1} E-{2}", 8f, num1, m_fRetractionAtPause);
                }
                else
                {
                    m_fRetractionAtPause = 0.0f;
                    str = PrinterCompatibleString.Format("G0 Z{0} F{1}", 8f, num1);
                }
                pause_gcode.AddRange(new string[7]
                {
                    "G4 S0",
                    "M114",
                    "G91",
                    str,
                    "G90",
                    PrinterCompatibleString.Format("G0 X{0} Y{1} F{2}", (object)cornerPositionBoxTop.x, (object)cornerPositionBoxTop.y, (object)num2),
                    "M104 S0"
                });
                m_oParentFirmwareController.OnGotUpdatedPosition += new ScriptCallback(OnReceivedUpdatedPosition);
                m_bUpdatedDataReceivedAfterPause = false;
            }
            return(flag);
        }
示例#3
0
        public JobController.Result StopJob(out List <string> end_gcode)
        {
            AbstractJob jobImplementation = MyJobImplementation;

            end_gcode = null;
            if (MyJobImplementation == null)
            {
                return(JobController.Result.FAILED_JobNotStarted);
            }

            FinalizeEndOfJob(out end_gcode);
            job_timer.Stop();
            Printing = false;
            return(JobController.Result.Success);
        }
示例#4
0
        public JobController.Result ForceShutdownNow()
        {
            AbstractJob jobImplementation = MyJobImplementation;

            if (MyJobImplementation == null)
            {
                return(JobController.Result.FAILED_JobNotStarted);
            }

            SaveJobState();
            MyJobImplementation.Stop();
            job_timer.Stop();
            m_oJobImplementation.Value = null;
            Printing = false;
            return(JobController.Result.Success);
        }
示例#5
0
        public void Update()
        {
            AbstractJob jobImplementation  = MyJobImplementation;
            PrinterInfo currentPrinterInfo = m_oParentFirmwareController.CurrentPrinterInfo;

            if (jobImplementation == null)
            {
                return;
            }

            jobImplementation.Update(currentPrinterInfo);
            if (!jobImplementation.Done || !SwitchToFirmwarePrintWhenDone)
            {
                return;
            }

            m_lsAdditionalTimeRemaining = 0.0f;
            var jobParams = new JobParams(jobImplementation.Details.jobParams)
            {
                preview_image_file_name = jobImplementation.PreviewImageFileName,
                jobMode = JobParams.Mode.FirmwarePrintingFromSDCard
            };

            Mode = JobParams.Mode.FirmwarePrintingFromSDCard;
            jobParams.gcodefile = m_sGcodeFile;
            var abstractJob = (AbstractJob) new FirmwareSDPrintJob(jobParams, User, jobImplementation.MyPrinterProfile);

            abstractJob.Create(currentPrinterInfo);
            FinalizeEndOfJob(out List <string> end_gcode);
            if (end_gcode != null && end_gcode.Count > 0)
            {
                var num1 = (int)m_oParentFirmwareController.WriteManualCommands(end_gcode.ToArray());
            }
            IsSimultaneousPrint        = false;
            IsSavingToSD               = false;
            m_oJobImplementation.Value = abstractJob;
            var num2 = (int)Start(out List <string> start_gcode);

            if (start_gcode == null || start_gcode.Count <= 0)
            {
                return;
            }

            var num3 = (int)m_oParentFirmwareController.WriteManualCommands(start_gcode.ToArray());
        }
示例#6
0
        public JobController.Result Resume(out List <string> resume_gcode, FilamentSpool spool)
        {
            resume_gcode = null;
            AbstractJob jobImplementation = MyJobImplementation;

            if (jobImplementation == null)
            {
                return(JobController.Result.FAILED_Create);
            }

            JobController.Result result = jobImplementation.Resume(out List <string> resume_gcode1, spool);
            if (result == JobController.Result.Success)
            {
                var num1 = !(null != spool) || spool.filament_type == FilamentSpool.TypeEnum.NoFilament ? byte.MaxValue : FilamentProfile.CreateFilamentProfile(spool, m_oParentFirmwareController.MyPrinterProfile).preprocessor.initialPrint.StartingFanValue;
                var num2 = 90f;
                resume_gcode = new List <string>()
                {
                    PrinterCompatibleString.Format("M106 S{0}", (object)num1),
                    PrinterCompatibleString.Format("M109 S{0}", (object)spool.filament_temperature)
                };
                if (m_bUpdatedDataReceivedAfterPause)
                {
                    resume_gcode.Add("G90");
                    resume_gcode.Add(PrinterCompatibleString.Format("G0 X{0} Y{1} F{2}", m_v3DeExtruderLocationAtPause.pos.x, m_v3DeExtruderLocationAtPause.pos.y, num2));
                    resume_gcode.Add(PrinterCompatibleString.Format("G0 Z{0} F{1}", m_v3DeExtruderLocationAtPause.pos.z, num2));
                    resume_gcode.Add(PrinterCompatibleString.Format("G92 E{0}", (object)(float)(m_v3DeExtruderLocationAtPause.e - (double)m_fRetractionAtPause)));
                }
                if (resume_gcode1 != null && resume_gcode1.Count > 0)
                {
                    resume_gcode.AddRange(resume_gcode1);
                }

                job_timer.Start();
            }
            return(result);
        }
示例#7
0
 public JobCreateResult(AbstractJob job, ProcessReturn result, List <MessageType> warnings)
 {
     Warnings = warnings;
     Result   = result;
     Job      = job;
 }