Exemplo n.º 1
0
		public BabyStepsStream(GCodeStream internalStream)
			: base(null)
		{
			maxLengthStream = new MaxLengthStream(internalStream, 1);
			offsetStream = new OffsetStream(maxLengthStream, new Vector3(0, 0, 0));
			base.internalStream = offsetStream;
		}
Exemplo n.º 2
0
        private double maxSecondsPerSegment = 1.0/20.0; // 20 instruction per second

        public MaxLengthStream(GCodeStream internalStream, double maxSegmentLength)
            : base(internalStream)
        {
            this.MaxSegmentLength = maxSegmentLength;
        }
Exemplo n.º 3
0
 public QueuedCommandsStream(PrinterConfig printer, GCodeStream internalStream)
     : base(printer, internalStream)
 {
 }
Exemplo n.º 4
0
 public PrintLevelingStream(GCodeStream internalStream, bool activePrinting)
     : base(internalStream)
 {
     this.activePrinting = activePrinting;
 }
Exemplo n.º 5
0
 public ProcessWriteRegexStream(PrinterConfig printer, GCodeStream internalStream, QueuedCommandsStream queueStream)
     : base(printer, internalStream)
 {
     this.queueStream = queueStream;
 }
 public PrintLevelingStream(GCodeStream internalStream)
     : base(internalStream)
 {
 }
 public FeedRateMultiplierStream(PrinterConfig printer, GCodeStream internalStream)
     : base(printer, internalStream)
 {
     FeedRateRatio = printer.Settings.GetValue <double>(SettingsKey.feedrate_ratio);
 }
Exemplo n.º 8
0
 public QueuedCommandsStream(GCodeStream internalStream)
     : base(internalStream)
 {
 }
		public ExtrusionMultiplierStream(PrinterConfig printer, GCodeStream internalStream)
			: base(printer, internalStream)
		{
			ExtrusionRatio = printer.Settings.GetValue<double>(SettingsKey.extrusion_ratio);
		}
Exemplo n.º 10
0
 public MaxLengthStream(PrinterConfig printer, GCodeStream internalStream, double maxSegmentLength)
     : base(printer, internalStream)
 {
     this.MaxSegmentLength = maxSegmentLength;
 }
		private void LoadGCodeToPrint(string gcodeFilename)
		{
			totalGCodeStream?.Dispose();

			loadedGCode = GCodeFile.Load(gcodeFilename);

			gCodeFileStream0 = new GCodeFileStream(loadedGCode);
			if(activePrintTask != null) // We are resuming a failed print (do lots of interesting stuff).
			{
				pauseHandlingStream1 = new PauseHandlingStream(new ResumePrintingStream(gCodeFileStream0, activePrintTask.PercentDone));
			}
			else
			{
				pauseHandlingStream1 = new PauseHandlingStream(gCodeFileStream0);
			}
			queuedCommandStream2 = new QueuedCommandsStream(pauseHandlingStream1);
			relativeToAbsoluteStream3 = new RelativeToAbsoluteStream(queuedCommandStream2);
			printLevelingStream4 = new PrintLevelingStream(relativeToAbsoluteStream3);
			waitForTempStream5 = new WaitForTempStream(printLevelingStream4);
			babyStepsStream6 = new BabyStepsStream(waitForTempStream5);
			if(activePrintTask != null)
			{
				// make sure we are in the position we were when we stopped printing
				babyStepsStream6.Offset = new Vector3(activePrintTask.PrintingOffsetX, activePrintTask.PrintingOffsetY, activePrintTask.PrintingOffsetZ);
			}
			extrusionMultiplyerStream7 = new ExtrusionMultiplyerStream(babyStepsStream6);
			feedrateMultiplyerStream8 = new FeedRateMultiplyerStream(extrusionMultiplyerStream7);
			requestTemperaturesStream9 = new RequestTemperaturesStream(feedrateMultiplyerStream8);
			totalGCodeStream = requestTemperaturesStream9;
		}
Exemplo n.º 12
0
 public WaitForTempStream(GCodeStream internalStream)
     : base(internalStream)
 {
 }
 public RequestTemperaturesStream(GCodeStream internalStream)
     : base(internalStream)
 {
     nextReadTimeMs = UiThread.CurrentTimerMs + 1000;
 }
Exemplo n.º 14
0
		public PrintLevelingStream(GCodeStream internalStream)
			: base(internalStream)
		{
		}
Exemplo n.º 15
0
 public SendProgressStream(GCodeStream internalStream, PrinterConfig printer)
     : base(printer, internalStream)
 {
 }
Exemplo n.º 16
0
		public PauseHandlingStream(GCodeStream internalStream)
			: base(internalStream)
		{
			relativeToAbsoluteConverter = new RelativeToAbsoluteStream(internalStream);
			internalStream = relativeToAbsoluteConverter;
		}
		public PauseHandlingStream(GCodeStream internalStream)
			: base(internalStream)
		{
		}
		public FeedRateMultiplyerStream(GCodeStream internalStream)
			: base(internalStream)
		{
		}
Exemplo n.º 19
0
		public QueuedCommandsStream(GCodeStream internalStream)
            : base(internalStream)
        {
        }
 public ExtrusionMultiplyerStream(GCodeStream internalStream)
     : base(internalStream)
 {
 }
Exemplo n.º 21
0
 public WaitForTempStream(PrinterConfig printer, GCodeStream internalStream)
     : base(printer, internalStream)
 {
     state = State.Passthrough;
 }
		private void loadGCodeWorker_DoWork(object sender, DoWorkEventArgs e)
		{
			totalGCodeStream?.Dispose();

			string gcodeFilename = e.Argument as string;
			loadedGCode = GCodeFile.Load(gcodeFilename);

			gCodeFileStream0 = new GCodeFileStream(loadedGCode);
			pauseHandlingStream1 = new PauseHandlingStream(gCodeFileStream0);
			queuedCommandStream2 = new QueuedCommandsStream(pauseHandlingStream1);
			relativeToAbsoluteStream3 = new RelativeToAbsoluteStream(queuedCommandStream2);
			printLevelingStream4 = new PrintLevelingStream(relativeToAbsoluteStream3);
			waitForTempStream5 = new WaitForTempStream(printLevelingStream4);
			babyStepsStream6 = new BabyStepsStream(waitForTempStream5);
			extrusionMultiplyerStream7 = new ExtrusionMultiplyerStream(babyStepsStream6);
			feedrateMultiplyerStream8 = new FeedRateMultiplyerStream(extrusionMultiplyerStream7);
			requestTemperaturesStream9 = new RequestTemperaturesStream(feedrateMultiplyerStream8);
			totalGCodeStream = requestTemperaturesStream9;
		}
Exemplo n.º 23
0
 public ToolChangeStream(PrinterConfig printer, GCodeStream internalStream)
     : base(printer, internalStream)
 {
     extruderCount       = printer.Settings.GetValue <int>(SettingsKey.extruder_count);
     activeExtruderIndex = printer.Connection.ActiveExtruderIndex;
 }
Exemplo n.º 24
0
 public PauseHandlingStream(GCodeStream internalStream)
     : base(internalStream)
 {
 }
Exemplo n.º 25
0
 public GCodeStreamProxy(GCodeStream internalStream)
 {
     this.internalStream = internalStream;
 }
 public FeedRateMultiplyerStream(PrinterConfig printer, GCodeStream internalStream)
     : base(printer, internalStream)
 {
 }
 public RequestTemperaturesStream(GCodeStream internalStream)
     : base(internalStream)
 {
     nextReadTimeMs = UiThread.CurrentTimerMs + 1000;
 }
Exemplo n.º 28
0
 public RelativeToAbsoluteStream(GCodeStream internalStream)
     : base(internalStream)
 {
 }
Exemplo n.º 29
0
 public MaxLengthStream(GCodeStream internalStream, double maxSegmentLength)
     : base(internalStream)
 {
     this.MaxSegmentLength = maxSegmentLength;
 }
Exemplo n.º 30
0
 public FeedRateMultiplyerStream(GCodeStream internalStream)
     : base(internalStream)
 {
 }
 public RelativeToAbsoluteStream(PrinterConfig printer, GCodeStream internalStream)
     : base(printer, internalStream)
 {
 }
Exemplo n.º 32
0
 public WaitForTempStream(GCodeStream internalStream)
     : base(internalStream)
 {
     state = State.passthrough;
 }
 public RelativeToAbsoluteStream(GCodeStream internalStream)
     : base(internalStream)
 {
 }
Exemplo n.º 34
0
 public RequestTemperaturesStream(PrinterConfig printer, GCodeStream internalStream)
     : base(printer, internalStream)
 {
     nextReadTimeMs = UiThread.CurrentTimerMs + 1000;
 }
Exemplo n.º 35
0
 public OffsetStream(GCodeStream internalStream, Vector3 offset)
     : base(internalStream)
 {
     this.offset = offset;
 }
Exemplo n.º 36
0
        public PauseHandlingStream(PrinterConfig printer, GCodeStream internalStream)
            : base(printer, internalStream)
        {
            // if we have a runout sensor, register to listen for lines to check it
            if (printer.Settings.GetValue <bool>(SettingsKey.filament_runout_sensor))
            {
                printer.Connection.LineReceived += (s, line) =>
                {
                    if (line != null)
                    {
                        if (line.Contains("ros_"))
                        {
                            if (line.Contains("TRIGGERED"))
                            {
                                readOutOfFilament = true;
                            }
                        }

                        if (line.Contains("pos_"))
                        {
                            double sensorDistance  = 0;
                            double stepperDistance = 0;
                            if (GCodeFile.GetFirstNumberAfter("SENSOR:", line, ref sensorDistance))
                            {
                                if (sensorDistance < -1 || sensorDistance > 1)
                                {
                                    printer.Connection.FilamentPositionSensorDetected = true;
                                }

                                if (printer.Connection.FilamentPositionSensorDetected)
                                {
                                    GCodeFile.GetFirstNumberAfter("STEPPER:", line, ref stepperDistance);

                                    var stepperDelta = Math.Abs(stepperDistance - positionSensorData.LastStepperDistance);

                                    // if we think we should have move the filament by more than 1mm
                                    if (stepperDelta > 1)
                                    {
                                        var sensorDelta = Math.Abs(sensorDistance - positionSensorData.LastSensorDistance);
                                        // check if the sensor data is within a tolerance of the stepper data

                                        var deltaRatio = sensorDelta / stepperDelta;
                                        if (deltaRatio < .5 || deltaRatio > 2)
                                        {
                                            // we have a repartable discrepency set a runout state
                                            positionSensorData.ExtrusionDiscrepency++;
                                            if (positionSensorData.ExtrusionDiscrepency > 2)
                                            {
                                                readOutOfFilament = true;
                                                positionSensorData.ExtrusionDiscrepency = 0;
                                            }
                                        }
                                        else
                                        {
                                            positionSensorData.ExtrusionDiscrepency = 0;
                                        }

                                        // and recard this position
                                        positionSensorData.LastSensorDistance  = sensorDistance;
                                        positionSensorData.LastStepperDistance = stepperDistance;
                                    }
                                }
                            }
                        }
                    }
                };
            }
        }
Exemplo n.º 37
0
 public OffsetStream(GCodeStream internalStream, PrinterConfig printer, Vector3 offset)
     : base(printer, internalStream)
 {
     this.Offset = offset;
 }
		public WaitForTempStream(GCodeStream internalStream)
			: base(internalStream)
		{
		}
Exemplo n.º 39
0
 public ExtrusionMultiplyerStream(GCodeStream internalStream)
     : base(internalStream)
 {
 }
 public ValidatePrintLevelingStream(PrinterConfig printer, GCodeStream internalStream)
     : base(printer, internalStream)
 {
     printer.Connection.CanceleRequested += Connection_PrintCanceled;
 }
 public RequestTemperaturesStream(PrinterConnection printerConnection, GCodeStream internalStream)
     : base(internalStream)
 {
     this.printerConnection = printerConnection;
     nextReadTimeMs         = UiThread.CurrentTimerMs + 1000;
 }
Exemplo n.º 42
0
		public OffsetStream(GCodeStream internalStream, Vector3 offset)
			: base(internalStream)
		{
			this.offset = offset;
		}
 public ExtrusionMultiplyerStream(PrinterConfig printer, GCodeStream internalStream)
     : base(printer, internalStream)
 {
 }
		void CreateStreamProcessors(string gcodeFilename, bool recoveryEnabled)
		{
			totalGCodeStream?.Dispose();

			GCodeStream firstStream = null;
			if (gcodeFilename != null)
			{
				loadedGCode = GCodeFile.Load(gcodeFilename);
				gCodeFileStream0 = new GCodeFileStream(loadedGCode);

				if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.recover_is_enabled)
					&& activePrintTask != null) // We are resuming a failed print (do lots of interesting stuff).
				{
					pauseHandlingStream1 = new PauseHandlingStream(new PrintRecoveryStream(gCodeFileStream0, activePrintTask.PercentDone));
				}
				else
				{
					pauseHandlingStream1 = new PauseHandlingStream(gCodeFileStream0);
				}

				firstStream = pauseHandlingStream1;
			}
			else
			{
				firstStream = new NotPrintingStream();
			}

			queuedCommandStream2 = new QueuedCommandsStream(firstStream);
			relativeToAbsoluteStream3 = new RelativeToAbsoluteStream(queuedCommandStream2);
			printLevelingStream4 = new PrintLevelingStream(relativeToAbsoluteStream3, true);
			waitForTempStream5 = new WaitForTempStream(printLevelingStream4);
			babyStepsStream6 = new BabyStepsStream(waitForTempStream5);
			if (activePrintTask != null)
			{
				// make sure we are in the position we were when we stopped printing
				babyStepsStream6.Offset = new Vector3(activePrintTask.PrintingOffsetX, activePrintTask.PrintingOffsetY, activePrintTask.PrintingOffsetZ);
			}
			extrusionMultiplyerStream7 = new ExtrusionMultiplyerStream(babyStepsStream6);
			feedrateMultiplyerStream8 = new FeedRateMultiplyerStream(extrusionMultiplyerStream7);
			requestTemperaturesStream9 = new RequestTemperaturesStream(feedrateMultiplyerStream8);
			totalGCodeStream = requestTemperaturesStream9;
		}
Exemplo n.º 45
0
		public GCodeStreamProxy(GCodeStream internalStream)
		{
			this.internalStream = internalStream;
		}
		public PrintLevelingStream(GCodeStream internalStream, bool activePrinting)
			: base(internalStream)
		{
			this.activePrinting = activePrinting;
		}
Exemplo n.º 47
0
 public WaitForTempStream(PrinterConnection printerConnection, GCodeStream internalStream)
     : base(internalStream)
 {
     this.printerConnection = printerConnection;
     state = State.passthrough;
 }