예제 #1
0
 public PosEventArgs(xyzPoint world, xyzPoint machine, grblState stat, mState msg, pState last, string sraw)
 {
     posWorld   = world;
     posMachine = machine;
     status     = stat;
     statMsg    = msg;
     lastCmd    = last;
     raw        = sraw;
 }
예제 #2
0
        /// <summary>
        /// set parser state
        /// </summary>
        private static void setParserState(char cmd, double value, ref pState myParserState)
        {
            myParserState.changed = false;
            switch (Char.ToUpper(cmd))
            {
            case 'G':
                if (value <= 3)
                {
                    myParserState.motion = (byte)value;
                    break;
                }
                if ((value >= 17) && (value <= 19))
                {
                    myParserState.plane_select = (byte)value;
                }
                if ((value == 20) || (value == 21))
                {
                    myParserState.units = (byte)value;
                }
                if ((value >= 54) && (value <= 59))
                {
                    myParserState.coord_select = (byte)value;
                }
                if ((value == 90) || (value == 91))
                {
                    myParserState.distance = (byte)value;
                }
                if ((value == 93) || (value == 94))
                {
                    myParserState.feed_rate = (byte)value;
                }
                myParserState.changed = true;
                break;

            case 'M':
                if ((value <= 2) || (value == 30))
                {
                    myParserState.program_flow = (byte)value;        // M0, M1 pause, M2, M30 stop
                }
                if ((value >= 3) && (value <= 5))
                {
                    myParserState.spindle = (byte)value;        // M3, M4 start, M5 stop
                }
                if ((value >= 7) && (value <= 9))
                {
                    myParserState.coolant = (byte)value;        // M7, M8 on   M9 coolant off
                }
                if (value == 6)
                {
                    myParserState.toolchange = true;
                }
                myParserState.changed = true;
                break;

            case 'F':
                myParserState.FR      = value;
                myParserState.changed = true;
                break;

            case 'S':
                myParserState.SS      = value;
                myParserState.changed = true;
                break;

            case 'T':
                myParserState.tool    = (byte)value;
                myParserState.changed = true;
                break;
            }
        }