public override void DoWork(I2C thisSensor) { I2cSensordata thisReading = new I2cSensordata(); Sup.LogTraceInfoMessage($"I2cSensorDevice {SensorUsed}: DoWork routine entry"); try { lock ( Response ) { thisConnect.Write(SHT31SingleShotCommand); Response = thisConnect.Read(6); } // For debugging, normally not on Sup.LogTraceInfoMessage($"I2cSensorDevice {SensorUsed} data read: {Response[ 0 ]}; {Response[ 1 ]}; {Response[ 2 ]}; {Response[ 3 ]}; {Response[ 4 ]}; {Response[ 5 ]}; "); // {Response[6]}; {Response[7]}; thisReading.Humidity = 100 * (double)(Response[3] * 0x100 + Response[4]) / 65535; // BitConverter.ToUInt16(Response, 3) / 65535; thisReading.TemperatureF = -49 + 315 * (double)(Response[0] * 0x100 + Response[1]) / 65535; // Must be in Fahrenheit for the Davis simulation thisReading.TemperatureC = -45 + 175 * (double)(Response[0] * 0x100 + Response[1]) / 65535; // This is the same in Celsius thisSensor.ObservationList.Add(thisReading); } catch (Exception e) { Sup.LogTraceWarningMessage($"I2cSensorDevice Exception {SensorUsed}:...{e.Message}"); } return; }