コード例 #1
0
 public static async Task ResetTach(string tachCommPort)
 {
     //Reset Tach setting
     if (!string.IsNullOrEmpty(tachCommPort))
     {
         using (var tach = new TachometerCommunicator(tachCommPort))
         {
             await tach.ResetTach();
         }
     }
 }
コード例 #2
0
        public static async Task <int> ReadTachometer(string tachCommPort)
        {
            if (!string.IsNullOrEmpty(tachCommPort))
            {
                using (var tach = new TachometerCommunicator(tachCommPort))
                {
                    try
                    {
                        var value = await tach?.ReadTach();

                        Log.Info("Tachometer reading: {0}", value);
                        return(value);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "An error occured");
                    }
                }
            }
            return(0);
        }