NUC-32: Round sensor readings to two decimal points
This commit is contained in:
parent
644d5f36c1
commit
f50a81a030
2 changed files with 7 additions and 3 deletions
|
@ -127,9 +127,9 @@ namespace NucuCar.Sensors.Environment
|
|||
_bme680.TryReadPressure(out var pressure);
|
||||
_bme680.TryReadGasResistance(out var gasResistance);
|
||||
|
||||
_lastMeasurement.Temperature = temp.Celsius;
|
||||
_lastMeasurement.Pressure = pressure.Hectopascal;
|
||||
_lastMeasurement.Humidity = humidity;
|
||||
_lastMeasurement.Temperature = Math.Round(temp.Celsius, 2);
|
||||
_lastMeasurement.Pressure = Math.Round(pressure.Hectopascal, 2);
|
||||
_lastMeasurement.Humidity = Math.Round(humidity, 2);
|
||||
_lastMeasurement.VolatileOrganicCompounds = Math.Round(gasResistance / 1000, 2);
|
||||
|
||||
Logger?.LogDebug($"{DateTimeOffset.Now}:BME680: reading");
|
||||
|
|
|
@ -54,6 +54,10 @@ namespace NucuCar.Sensors.Health
|
|||
CurrentState = SensorStateEnum.Error;
|
||||
_lastTemperatureCelsius = double.NaN;
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastTemperatureCelsius = Math.Round(_lastTemperatureCelsius, 2);
|
||||
}
|
||||
}
|
||||
Logger?.LogDebug($"{DateTimeOffset.Now}:HealthSensor: reading");
|
||||
Logger?.LogInformation($"CPU Temperature {_lastTemperatureCelsius}");
|
||||
|
|
Loading…
Reference in a new issue