示例#1
0
        private void _serialPort_Received(object sender, DataEventArgs e)
        {
            // Read all bytes in the buffer
            _dataReceived += SerialPort.AsciiByteArrayToString(e.Buffer);

            if (Showform != null)
            {
                _showcom.AddReceived = _dataReceived;
            }

            switch (Gcode)
            {
            case "INIT":
                ParseInit();
                break;

            case "G28":
                ParseG28();
                break;

            case "G29":
                ParseG29();
                break;

            case "G30":
                ParseG30();
                break;

            case "M114":
                ParseM114();
                break;

            case "M119":
                ParseM119();
                break;

            case "M48":
                ParseM48();
                break;

            case "M301":
                ParseM301();
                break;


            case "M303":
                ParseM303();
                break;

            case "M304":
                ParseM304();
                break;

            case "M500":
                ParseM500();
                break;

            case "M501":
                ParseM501();
                break;

            default:
                ParseDefault();
                break;
            }
        }