示例#1
0
        void CreateGraphs()
        {
            int         FrameRateOffset       = -15;
            RGBA_Floats FrameRateControlColor = new RGBA_Floats(1, 1, 1, 1);

            m_PotentialDrawsBudgetPosition            = new Vector2(10, (double)Height + FrameRateOffset);
            m_ShowPotentialDrawsBudgetGraph           = new MatterHackers.Agg.UI.CheckBox(m_PotentialDrawsBudgetPosition.x, m_PotentialDrawsBudgetPosition.y, "D:000.000");
            m_ShowPotentialDrawsBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes();
            //m_ShowPotentialDrawsBudgetGraph.inactive_color(FrameRateControlColor);
            AddChild(m_ShowPotentialDrawsBudgetGraph);
            m_PotentialDrawsBudgetGraph = new DataViewGraph(m_PotentialDrawsBudgetPosition, 100, 100);

            m_PotentialUpdatesBudgetPosition            = new Vector2(115, (double)Height + FrameRateOffset);
            m_ShowPotentialUpdatesBudgetGraph           = new MatterHackers.Agg.UI.CheckBox(m_PotentialUpdatesBudgetPosition.x, m_PotentialUpdatesBudgetPosition.y, "U:000.000");
            m_ShowPotentialUpdatesBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes();
            //m_ShowPotentialUpdatesBudgetGraph.inactive_color(FrameRateControlColor);
            AddChild(m_ShowPotentialUpdatesBudgetGraph);
            m_PotentialUpdatesBudgetGraph = new DataViewGraph(m_PotentialUpdatesBudgetPosition, 100, 100);

            m_ActualDrawsBudgetPosition            = new Vector2(220, (double)Height + FrameRateOffset);
            m_ShowActualDrawsBudgetGraph           = new MatterHackers.Agg.UI.CheckBox(m_ActualDrawsBudgetPosition.x, m_ActualDrawsBudgetPosition.y, "A:000.000");
            m_ShowActualDrawsBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes();
            //m_ShowActualDrawsBudgetGraph.inactive_color(FrameRateControlColor);
            AddChild(m_ShowActualDrawsBudgetGraph);
            m_ActualDrawsBudgetGraph = new DataViewGraph(m_ActualDrawsBudgetPosition, 100, 100);
        }
示例#2
0
        private void CreateGraphs()
        {
            int    FrameRateOffset       = -15;
            ColorF FrameRateControlColor = new ColorF(1, 1, 1, 1);

            potentialDrawsBudgetPosition            = new Vector2(10, (double)Height + FrameRateOffset);
            showPotentialDrawsBudgetGraph           = new MatterHackers.Agg.UI.CheckBox(potentialDrawsBudgetPosition.X, potentialDrawsBudgetPosition.Y, "D:000.000");
            showPotentialDrawsBudgetGraph.TextColor = FrameRateControlColor.ToColor();
            //showPotentialDrawsBudgetGraph.inactive_color(FrameRateControlColor);
            AddChild(showPotentialDrawsBudgetGraph);
            potentialDrawsBudgetGraph = new DataViewGraph(potentialDrawsBudgetPosition, 100, 100);

            potentialUpdatesBudgetPosition            = new Vector2(115, (double)Height + FrameRateOffset);
            showPotentialUpdatesBudgetGraph           = new MatterHackers.Agg.UI.CheckBox(potentialUpdatesBudgetPosition.X, potentialUpdatesBudgetPosition.Y, "U:000.000");
            showPotentialUpdatesBudgetGraph.TextColor = FrameRateControlColor.ToColor();
            //showPotentialUpdatesBudgetGraph.inactive_color(FrameRateControlColor);
            AddChild(showPotentialUpdatesBudgetGraph);
            potentialUpdatesBudgetGraph = new DataViewGraph(potentialUpdatesBudgetPosition, 100, 100);

            actualDrawsBudgetPosition            = new Vector2(220, (double)Height + FrameRateOffset);
            showActualDrawsBudgetGraph           = new MatterHackers.Agg.UI.CheckBox(actualDrawsBudgetPosition.X, actualDrawsBudgetPosition.Y, "A:000.000");
            showActualDrawsBudgetGraph.TextColor = FrameRateControlColor.ToColor();
            //showActualDrawsBudgetGraph.inactive_color(FrameRateControlColor);
            AddChild(showActualDrawsBudgetGraph);
            actualDrawsBudgetGraph = new DataViewGraph(actualDrawsBudgetPosition, 100, 100);
        }
		private void WriteRawToPrinter(string lineToWrite, string lineWithoutChecksum)
		{
			if (PrinterIsConnected || CommunicationState == CommunicationStates.AttemptingToConnect)
			{
				if (serialPort != null && serialPort.IsOpen)
				{
					FoundStringEventArgs foundStringEvent = new FoundStringEventArgs(lineWithoutChecksum);

					// If we get a home command, ask the printer where it is after sending it.
					if (lineWithoutChecksum.StartsWith("G28") // is a home
						|| lineWithoutChecksum.StartsWith("G29") // is a bed level
						|| lineWithoutChecksum.StartsWith("G92") // is a reset of printer position
						|| (lineWithoutChecksum.StartsWith("T") && !lineWithoutChecksum.StartsWith("T:"))) // is a switch extruder (verify this is the right time to ask this)
					{
						SendLineToPrinterNow("M114");
					}

					// write data to communication
					{
						StringEventArgs currentEvent = new StringEventArgs(lineToWrite);
						if (PrinterIsPrinting)
						{
							string lineWidthoutCR = lineToWrite.TrimEnd();
							CommunicationUnconditionalToPrinter.CallEvents(this, new StringEventArgs("{0} [{1:0.000}]\n".FormatWith(lineWidthoutCR, timeSinceStartedPrint.Elapsed.TotalSeconds)));
						}
						else
						{
							CommunicationUnconditionalToPrinter.CallEvents(this, currentEvent);
						}

						if (lineWithoutChecksum != null)
						{
							WriteLineStartCallBacks.CheckForKeys(foundStringEvent);
							WriteLineContainsCallBacks.CheckForKeys(foundStringEvent);

							if (foundStringEvent.SendToDelegateFunctions)
							{
								WroteLine.CallEvents(this, currentEvent);
							}
						}
					}

					try
					{
						lock (locker)
						{
							serialPort.Write(lineToWrite);
							if (false) // this is for debugging. Eventually it could be hooked up to a user config option so it can be turned on in the field.
							{
								timeSinceRecievedOk.Stop();
								if (!haveHookedDrawing)
								{
									sendTimeAfterOkGraph = new DataViewGraph(150, 150, 0, 30);
									MatterControlApplication.Instance.AddChild(sendTimeAfterOkGraph);
									haveHookedDrawing = true;
								}
								sendTimeAfterOkGraph.AddData("ok->send", timeSinceRecievedOk.ElapsedMilliseconds);
							}
							timeSinceLastWrite.Restart();
							timeHaveBeenWaitingForOK.Restart();
						}
						//Debug.Write("w: " + lineToWrite);
					}
					catch (IOException ex)
					{
						GuiWidget.BreakInDebugger(ex.Message);
						Trace.WriteLine("Error writing to printer: " + ex.Message);

						// Handle hardware disconnects by relaying the failure reason and shutting down open resources
						AbortConnectionAttempt("Connection Lost - " + ex.Message);
					}
					catch (TimeoutException e2)
					{
						GuiWidget.BreakInDebugger(e2.Message);
					}
					catch (UnauthorizedAccessException e3)
					{
						AbortConnectionAttempt(e3.Message);
					}
					catch (Exception e)
					{
						GuiWidget.BreakInDebugger(e.Message);
					}
				}
				else
				{
					OnConnectionFailed(null);
				}
			}
		}
示例#4
0
		private void CreateGraphs()
		{
			int FrameRateOffset = -15;
			RGBA_Floats FrameRateControlColor = new RGBA_Floats(1, 1, 1, 1);

			m_PotentialDrawsBudgetPosition = new Vector2(10, (double)Height + FrameRateOffset);
			m_ShowPotentialDrawsBudgetGraph = new MatterHackers.Agg.UI.CheckBox(m_PotentialDrawsBudgetPosition.x, m_PotentialDrawsBudgetPosition.y, "D:000.000");
			m_ShowPotentialDrawsBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes();
			//m_ShowPotentialDrawsBudgetGraph.inactive_color(FrameRateControlColor);
			AddChild(m_ShowPotentialDrawsBudgetGraph);
			m_PotentialDrawsBudgetGraph = new DataViewGraph(m_PotentialDrawsBudgetPosition, 100, 100);

			m_PotentialUpdatesBudgetPosition = new Vector2(115, (double)Height + FrameRateOffset);
			m_ShowPotentialUpdatesBudgetGraph = new MatterHackers.Agg.UI.CheckBox(m_PotentialUpdatesBudgetPosition.x, m_PotentialUpdatesBudgetPosition.y, "U:000.000");
			m_ShowPotentialUpdatesBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes();
			//m_ShowPotentialUpdatesBudgetGraph.inactive_color(FrameRateControlColor);
			AddChild(m_ShowPotentialUpdatesBudgetGraph);
			m_PotentialUpdatesBudgetGraph = new DataViewGraph(m_PotentialUpdatesBudgetPosition, 100, 100);

			m_ActualDrawsBudgetPosition = new Vector2(220, (double)Height + FrameRateOffset);
			m_ShowActualDrawsBudgetGraph = new MatterHackers.Agg.UI.CheckBox(m_ActualDrawsBudgetPosition.x, m_ActualDrawsBudgetPosition.y, "A:000.000");
			m_ShowActualDrawsBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes();
			//m_ShowActualDrawsBudgetGraph.inactive_color(FrameRateControlColor);
			AddChild(m_ShowActualDrawsBudgetGraph);
			m_ActualDrawsBudgetGraph = new DataViewGraph(m_ActualDrawsBudgetPosition, 100, 100);
		}