public void Connect(SerialPortAddress port, string configurationPath) { ArmConfiguration config = ArmConfiguration.LoadArmConfig(configurationPath); Arm = new Arm(port, config); Arm.SetServoSpeed(20); }
private async void SelectorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { SerialPortAddress address = e.AddedItems[0] as SerialPortAddress; _roverConnector?.Close(); //_roverConnector = await Task.Run(() => new RoverConnector(address)); _roverConnector = await Task.Run(() => new NewRoverConnector(address, _configJson)); }
public RoverConnector(SerialPortAddress address) { _port = new SerialPort(address.Name); _port.Encoding = Encoding.ASCII; _port.Open(); readerThread = new Thread(() => { while (_keepreading) { try { System.Diagnostics.Debug.WriteLine(_port.ReadLine()); } catch { } } }); readerThread.Start(); }
public NewRoverConnector(SerialPortAddress address, string json) { _rover = Controller.Rover.FromJson(json); _rover.NewMessage += _rover_NewMessage; _port = new SerialPort(address.Name); _port.Encoding = Encoding.ASCII; _port.Open(); readerThread = new Thread(() => { while (_keepreading) { try { System.Diagnostics.Debug.WriteLine(_port.ReadLine()); } catch { } } }); readerThread.Start(); }
public Arm(SerialPortAddress portAddress, ArmConfiguration configuration) : this(portAddress.Name, configuration) { }
public Arm(SerialPortAddress portAddress, string configurationFilePath) : this(portAddress.Name, ArmConfiguration.LoadArmConfig(configurationFilePath)) { }