private void DataReceivesEvent(object sender, SerialDataReceivedEventArgs e) { SerialPort sp = (sender as SerialPort); countReceivesByte++; if (sp.IsOpen) { try { PPoints p = DecodStreamPSP.Decoding(Program.settings.ChartDisplay.VisiblePointsOnChart, view.ValueScrollChart); if (countReceivesByte >= 24) { countReceivesByte = 0; view.SyncContext.Post((obj) => view.MainChart = (PPoints)obj, p); } //DecodStreamPSP.Decoding(Program.settings.ChartDisplay.VisiblePointsOnChart, view.ValueScrollChart); } catch (Exception) { } //Debug.Print(sp.BytesToRead.ToString()); //while (sp.BytesToRead>0) //{ // ms.WriteByte((byte)sp.ReadByte()); // countReceivesByte++; //} //Debug.Print(countReceivesByte.ToString()); //countReceivesByte = 0; //view.SyncContext.Post((obj) => view.MainChart = (MPoints)obj, decodingStream.Decode(streamControl.ReadStream(Program.settings.ChartDisplay.VisiblePointsOnChart))); //ms = new MemoryStream(); //if (countReceivesByte == 24) //{ // //view.SyncContext.Post((obj) => view.MainChart = (MPoints)obj, decoding.DecodingBlock(Program.settings.ChartDisplay.VisiblePointsOnChart)); // //view.SyncContext.Post((obj) => view.MainChart = (MPoints)obj, decodingStream.Decode(streamControl.ReadStream(Program.settings.ChartDisplay.VisiblePointsOnChart))); // countReceivesByte = 0; //} //else //{ // //decoding.DecodingBlock(Program.settings.ChartDisplay.VisiblePointsOnChart); // // decodingStream.Decode(streamControl.ReadStream(Program.settings.ChartDisplay.VisiblePointsOnChart)); //} } countReceivesByte++; // IsComPortConnUpdate(); }
private void DataReceivesEvent(object sender, SerialDataReceivedEventArgs e) { SerialPort sp = (sender as SerialPort); countReceivesByte++; if (sp.IsOpen) { try { PPoints p = DecodStreamPSP.Decoding(Program.settings.ChartDisplay.VisiblePointsOnChart, view.ValueScrollChart); if (countReceivesByte >= 96) { countReceivesByte = 0; view.SyncContext.Post((obj) => view.MainChart = (PPoints)obj, p); } } catch (Exception) { } } countReceivesByte++; }