public Radio_Series1(Robot robo, string portName) { robot = robo; UIAnalogVals = new int[(int)INTERFACEPACKET.ANALOG_BYTES]; UIDigitalVals = new bool[(int)INTERFACEPACKET.DIGITAL_BYTES * 8]; state = RadioState.IDLE; port = new SerialPort(portName, 9600, Parity.None, 8, StopBits.One); port.ReadTimeout = 2; port.Open(); data = new InterfacePacket((byte)INTERFACEPACKET.IDENT, (int)INTERFACEPACKET.ANALOG_BYTES, (int)INTERFACEPACKET.DIGITAL_BYTES); telemetry = new TelemetryPacket((byte)TELEMETRYPACKET.IDENT, (int)TELEMETRYPACKET.ANALOG_BYTES, (int)TELEMETRYPACKET.DIGITAL_BYTES); buffer = new byte[512]; receiver = new XBeeInterfaceReceiver(this); frame = 0; }
public Radio(Robot robo, string portName) { robot = robo; UIAnalogVals = new int[(int)INTERFACEPACKET.ANALOG_BYTES]; UIDigitalVals = new bool[(int)INTERFACEPACKET.DIGITAL_BYTES]; FieldAnalogVals = new int[(int)FIELDPACKET.ANALOG_BYTES]; FieldDigitalVals = new bool[(int)FIELDPACKET.DIGITAL_BYTES]; state = RadioState.IDLE; port = new SerialPort(portName, 9600, Parity.None, 8, StopBits.One); port.ReadTimeout = 2; port.Open(); data = new InterfacePacket((byte)INTERFACEPACKET.IDENT, (int)INTERFACEPACKET.ANALOG_BYTES, (int)INTERFACEPACKET.DIGITAL_BYTES); telemetry = new TelemetryPacket((byte)TELEMETRYPACKET.IDENT, (int)TELEMETRYPACKET.ANALOG_BYTES, (int)TELEMETRYPACKET.DIGITAL_BYTES); buffer = new byte[128]; telemetryThread = new Thread(new ThreadStart(this.Telemetry)); receiver = new XBeeReceiver(this); frame = 0; Debug.Print(" **** Radio constructor ****"); radioThread = new Thread(new ThreadStart(this.Poll)); radioThread.Start(); }