Exemplo n.º 1
0
        protected virtual void OnRaisePosEvent(PosEventArgs e)
        {
            EventHandler <PosEventArgs> handler = RaisePosEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 2
0
        // handle position events from serial form
        private void OnRaisePosEvent(object sender, PosEventArgs e)
        {
            posWorld      = e.PosWorld;
            posMachine    = e.PosMachine;
            machineStatus = e.Status;

            label_mx.Text          = string.Format("{0:0.000}", posMachine.X);
            label_my.Text          = string.Format("{0:0.000}", posMachine.Y);
            label_mz.Text          = string.Format("{0:0.000}", posMachine.Z);
            label_wx.Text          = string.Format("{0:0.000}", posWorld.X);
            label_wy.Text          = string.Format("{0:0.000}", posWorld.Y);
            label_wz.Text          = string.Format("{0:0.000}", posWorld.Z);
            label_status.Text      = grbl.statusToText(machineStatus);
            label_status.BackColor = grbl.grblStateColor(machineStatus);
        }
Exemplo n.º 3
0
        /************************************************************
        * handle status report and position event from serial form
        * processStatus()
        ************************************************************/
        private void OnRaisePosEvent(object sender, PosEventArgs e)
        {
            //  if (logPosEvent)  Logger.Trace("OnRaisePosEvent  {0}  connect {1}  status {2}", e.Status.ToString(), _serial_form.serialPortOpen, e.Status.ToString());
            machineStatus        = e.Status;
            machineStatusMessage = e.StatMsg;
            machineParserState   = e.parserState;

/***** Restore saved position after reset and set initial feed rate: *****/
            if (flagResetOffset || (e.Status == grblState.reset))
            {
                processReset();
            }

/***** process grblState {idle, run, hold, home, alarm, check, door} *****/
            processStatus(e.Raw);

/***** check and submit override values, set labels, checkbox *****/
            processStatusMessage(e.StatMsg);

/***** set DRO digital-read-out labels with machine and work coordinates *****/
            if (!simuEnabled)
            {
                updateDRO();
            }

/***** parser state Spinde/Coolant on/off, on other Forms: FeedRate, SpindleSpeed, G54-Coord *****/
            processParserState(e.parserState);

/***** update 2D view *****/
            if (grbl.posChanged)
            {
                VisuGCode.createMarkerPath();
                VisuGCode.updatePathPositions();
                checkMachineLimit();
                pictureBox1.Invalidate();
                if (Properties.Settings.Default.flowCheckRegistryChange && !isStreaming)
                {
                    gui.writePositionToRegistry();
                }
                grbl.posChanged = false;
            }
            if (grbl.wcoChanged)
            {
                checkMachineLimit();
                grbl.wcoChanged = false;
            }
            if (((isStreaming || isStreamingRequestStop)) && Properties.Settings.Default.guiProgressShow)
            {
                VisuGCode.ProcessedPath.processedPathDraw(grbl.posWork);
            }


            if (_diyControlPad != null)
            {
                if (oldRaw != e.Raw)
                {
                    _diyControlPad.sendFeedback(e.Raw);     //hand over original grbl text
                    oldRaw = e.Raw;
                }
            }
        }