feat(pkg/sensor): new support for sensor bme280

This commit is contained in:
2019-06-30 14:34:13 +02:00
parent 96eb1f4036
commit 289aaf2093
20 changed files with 309 additions and 87 deletions

View File

@ -16,7 +16,7 @@ import (
)
// Start the daemon
func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compression bool, logger logger.Logger) {
func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compression bool, round float64, logger logger.Logger) {
// Info
logger.Info("Use clean-cache-interval: %v", cleanCacheInterval.String())
@ -33,7 +33,7 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
ctx := context.Background()
childContext, cancel := context.WithCancel(ctx)
logfile := logfile.New(cnf.Device.Logfile)
measuredValuesLogfile := logfile.New(cnf.Device.Logfile)
measuredValuesCache := make([]types.MeasuredValue, 0)
@ -66,7 +66,7 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
logger.Error("Can not turn on blue info light: %v", err)
}
err = logfile.Append(compression, measuredValuesCache)
err = logfile.Append(measuredValuesLogfile, compression, round, measuredValuesCache)
if err != nil {
err = rgbled.Error(rgbLEDs)
@ -92,8 +92,8 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
logger.Error("Can not turn on red info light: %v", err)
}
logger.Warn("Save remaining data from the cache: %v", len(measuredValuesCache))
err = logfile.Append(compression, measuredValuesCache)
logger.Warn("Save remaining data from the cache")
err = logfile.Append(measuredValuesLogfile, compression, round, measuredValuesCache)
if err != nil {
logger.Fatal("%v", err)
}