refac(pkg/sensor): temperature measurement unit

This commit is contained in:
2019-06-23 14:17:57 +02:00
parent 3bb10a4f78
commit 5e03d987c5
19 changed files with 91 additions and 76 deletions

View File

@ -16,12 +16,13 @@ import (
)
// Start the daemon
func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compression bool, round float64, logger logger.Logger) {
func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compression bool, degree types.TemperatureUnit, round float64, logger logger.Logger) {
// Info
logger.Info("Use clean-cache-interval: %v", cleanCacheInterval.String())
logger.Info("Use compression: %v", compression)
logger.Info("Round values: %v", round)
logger.Info("Temperature unit: %v", degree)
temperatureLogfile := logfile.New(cnf.Device.TemperatureLogfile)
@ -38,7 +39,7 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
childContext, cancel := context.WithCancel(ctx)
// go sensor.ReadHumiditiesContinuously(cnf.GetHumiditySensors(config.ENABLED), humidityChannel, errorChannel)
go sensor.ReadTemperaturesContinuously(childContext, cnf.GetTemperatureSensors(config.ENABLED), types.DegreeCelsius, round, temperatureChannel, errorChannel)
go sensor.ReadTemperaturesContinuously(childContext, cnf.GetTemperatureSensors(config.ENABLED), degree, round, temperatureChannel, errorChannel)
temperatureCache := make([]*types.Temperature, 0)