fix(pkg/daemon): compression and rounding

This commit is contained in:
Markus Pesch 2019-10-11 12:44:04 +02:00
parent 25dd99cd3d
commit afe55b3d33
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -11,6 +11,7 @@ import (
"github.com/go-flucky/flucky/pkg/config" "github.com/go-flucky/flucky/pkg/config"
"github.com/go-flucky/flucky/pkg/rgbled" "github.com/go-flucky/flucky/pkg/rgbled"
"github.com/go-flucky/flucky/pkg/sensor" "github.com/go-flucky/flucky/pkg/sensor"
"github.com/go-flucky/flucky/pkg/storage"
"github.com/go-flucky/flucky/pkg/storage/db" "github.com/go-flucky/flucky/pkg/storage/db"
"github.com/go-flucky/flucky/pkg/storage/logfile" "github.com/go-flucky/flucky/pkg/storage/logfile"
"github.com/go-flucky/flucky/pkg/types" "github.com/go-flucky/flucky/pkg/types"
@ -102,6 +103,14 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
flogger.Error("Can not turn on blue info light: %v", err) flogger.Error("Can not turn on blue info light: %v", err)
} }
if round != 0 {
storage.Round(measuredValuesCache, round)
}
if compression {
measuredValuesCache = storage.Compression(measuredValuesCache)
}
if err := logfile.Append(measuredValuesLogfile, measuredValuesCache); err != nil { if err := logfile.Append(measuredValuesLogfile, measuredValuesCache); err != nil {
err2 := rgbled.Error(rgbLEDs) err2 := rgbled.Error(rgbLEDs)
if err2 != nil { if err2 != nil {