fix(pkg/daemon): behavior of the rgbled

This commit is contained in:
Markus Pesch 2019-06-23 21:07:53 +02:00
parent d42d67c271
commit 45e6c30220
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -44,21 +44,24 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
temperatureCache := make([]*types.Temperature, 0) temperatureCache := make([]*types.Temperature, 0)
rgbLEDs := cnf.GetRGBLEDs(config.ENABLED) rgbLEDs := cnf.GetRGBLEDs(config.ENABLED)
err := rgbled.Green(rgbLEDs)
if err != nil {
logger.Error("Can not turn on green info light: %v", err)
}
for { for {
err := rgbled.Green(rgbLEDs)
if err != nil {
logger.Error("Can not turn on green info light: %v", err)
}
select { select {
case err, _ := <-errorChannel: case err, _ := <-errorChannel:
logger.Error("%v", err)
err = rgbled.Red(rgbLEDs) err = rgbled.Red(rgbLEDs)
if err != nil { if err != nil {
logger.Error("Can not turn on red info light: %v", err) logger.Error("Can not turn on red info light: %v", err)
} }
logger.Error("%v", err)
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
case <-ticker: case <-ticker:
@ -80,11 +83,6 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
} }
temperatureCache = make([]*types.Temperature, 0) temperatureCache = make([]*types.Temperature, 0)
err = rgbled.Green(rgbLEDs)
if err != nil {
logger.Error("Can not turn on green info light: %v", err)
}
case temperature, _ := <-temperatureChannel: case temperature, _ := <-temperatureChannel:
temperatureCache = append(temperatureCache, temperature) temperatureCache = append(temperatureCache, temperature)