示例#1
0
        public void GoTo(MotionSystemMotorPosition[] positions)
        {
            SerialOutMessage cmd = new SerialOutMessage();

            foreach (var pos in positions)
            {
                cmd.Add(pos.Channel, pos.Value, pos.StepSize);
            }
            Send(cmd);
        }
示例#2
0
 public void Add(SerialOutMessage moreData)
 {
     lock (_servoData) {
         moreData._servoData.Keys.ToList().ForEach(k => {
             if (_servoData.ContainsKey(k))
             {
                 _servoData[k] = moreData._servoData[k];
             }
             else
             {
                 _servoData.Add(k, moreData._servoData[k]);
             }
         });
     }
 }
示例#3
0
 private void Send(SerialOutMessage data)
 {
     if (_serialPort != null && _serialPort.IsOpen)
     {
         lock (_lockObject) {
             //var seroutbytes = data.Data;
             //_serialPort.Write(seroutbytes, 0, seroutbytes.Length);
             //_timer.Change(5000, 5000);
             _sendBuffer.Add(data);
         }
     }
     else
     {
         LogOutput?.Invoke(this, new LogOutputEventArgs {
             Text = "Send failed since Serial Port is not open."
         });
     }
 }