private void saveAndSendAck(object sender, EventArgs e)
        {
            byte[] instruction, sendAckNak, dataWithoutHeader_1, dataWithoutHeader_2, dataWithoutHeader_3;

            if (!UartCom.RxHandshake_16byte(InByte_16, out instruction))
            {
                UartCom.TxHandshake_16byte(out sendAckNak);
                sPort.Write(sendAckNak, 0, 7);
                return;
            }
            UartCom.DataHeader header = UartCom.classifyHeader_16byte(instruction, out dataWithoutHeader_1, out dataWithoutHeader_2, out dataWithoutHeader_3);
            Realtime = UartCom.uARTBytetoFloat(dataWithoutHeader_1); //realtime
            Measure  = UartCom.uARTBytetoFloat(dataWithoutHeader_2); //measure
            PWM      = UartCom.uARTBytetoFloat(dataWithoutHeader_3); //PWM

            UartCom.TxHandshake_16byte(out sendAckNak);
            sPort.Write(sendAckNak, 0, 7);

            if (status == GraphStatus.GraphRun)
            {
                graphUpdate();
            }

            if (cBoxLog.Checked == true)
            {
                logTable.Rows.Add(Realtime, Setpoint, Measure, PWM);
            }
        }
示例#2
0
        private void saveAndSendAck(object sender, EventArgs e)
        {
            byte[] instruction, dataWithoutHeader_1, dataWithoutHeader_2, dataWithoutHeader_3;

            if (!UartCom.RxHandshake_16byte(InByte_16, out instruction))
            {
                return;
            }
            UartCom.DataHeader header = UartCom.classifyHeader_16byte(instruction, out dataWithoutHeader_1, out dataWithoutHeader_2, out dataWithoutHeader_3);
            float displayValue1       = UartCom.uARTBytetoFloat(dataWithoutHeader_1); //realtime
            float displayValue2       = UartCom.uARTBytetoFloat(dataWithoutHeader_2); //measure
            float displayValue3       = UartCom.uARTBytetoFloat(dataWithoutHeader_3); //PWM

            Realtime = displayValue1;
            Measure  = displayValue2;
            PWM      = displayValue3;

            if (status == GraphStatus.GraphRun)
            {
                graphUpdate();
            }

            if (cBoxLog.Checked == true)
            {
                logTable.Rows.Add(Setpoint, Measure);
            }
        }