fix(pkg/rgbled): use action maps to turn on/off led colors

This commit is contained in:
2019-06-24 22:57:29 +02:00
parent 02fa0cc931
commit c8a1dd2935
9 changed files with 284 additions and 157 deletions

View File

@ -47,7 +47,7 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
for {
err := rgbled.Green(rgbLEDs)
err := rgbled.Run(rgbLEDs)
if err != nil {
logger.Error("Can not turn on green info light: %v", err)
}
@ -57,7 +57,7 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
logger.Error("%v", err)
err = rgbled.Red(rgbLEDs)
err = rgbled.Error(rgbLEDs)
if err != nil {
logger.Error("Can not turn on red info light: %v", err)
}
@ -65,7 +65,7 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
time.Sleep(time.Second * 2)
case <-ticker:
err := rgbled.Blue(rgbLEDs)
err := rgbled.Logfile(rgbLEDs)
if err != nil {
logger.Error("Can not turn on blue info light: %v", err)
}
@ -73,7 +73,7 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
err = logfile.AppendTemperatures(temperatureLogfile, compression, temperatureCache)
if err != nil {
err = rgbled.Red(rgbLEDs)
err = rgbled.Error(rgbLEDs)
if err != nil {
logger.Error("Can not turn on red info light: %v", err)
}
@ -91,7 +91,7 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
cancel()
err := rgbled.Red(rgbLEDs)
err := rgbled.Error(rgbLEDs)
if err != nil {
logger.Error("Can not turn on red info light: %v", err)
}