Example #1
0
 private void Run()
 {
     try
     {
         ControllerFTDI controller = new ControllerFTDI(Properties.Settings.Default.Description, Properties.Settings.Default.SerialNumber);
         tbPropList.Text += controller.ShowDevicesInfo();
         string sensorData = "";
         tbPropList.Text += controller.ShowConnectedSensors();
         //foreach (var sensor in controller.SensorsList)
         //{
         //    sensorData += $"address: {sensor.Address}\npressure: {sensor.P_SI} kgs/sm2, temperature: {sensor.T_SI} C\n";
         //}
         //tbPropList.Text += sensorData;
     }
     catch (Exception e)
     {
         tbPropList.Text += $"\n{e.Message}";
     }
 }
Example #2
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            ControllerFTDI controller = new ControllerFTDI(Properties.Settings.Default.Description, Properties.Settings.Default.SerialNumber);

            cont = true;
            List <Sensor> ls = new List <Sensor>();

            while (cont)
            {
                controller.Cycle();
                ls = controller.SensorsList;
                ((BackgroundWorker)sender).ReportProgress(1, ls);
            }
            //string sensorData = "";

            //foreach (var sensor in controller.SensorsList)
            //{
            //    sensorData += $"address: {sensor.Address}\npressure: {sensor.P_SI} kgs/sm2, temperature: {sensor.T_SI} C\n";
            //}
            //((BackgroundWorker)sender).ReportProgress(1, sensorData);
        }