fix(pkg/config): use storage endpoints
changes: - Only one storage endpoint can be defined. This consists of a URL which can be used to specify whether the data is to be stored in a file or in a database.
This commit is contained in:
@ -94,7 +94,7 @@ func (s *BME280) Read() ([]*types.MeasuredValue, error) {
|
||||
|
||||
// ReadChannel reads the measured values from the sensor and writes them to a
|
||||
// channel.
|
||||
func (s *BME280) ReadChannel(measuredValuesChannel chan<- []*types.MeasuredValue, errorChannel chan<- error, wg *sync.WaitGroup) {
|
||||
func (s *BME280) ReadChannel(measuredValueChannel chan<- *types.MeasuredValue, errorChannel chan<- error, wg *sync.WaitGroup) {
|
||||
if wg != nil {
|
||||
defer wg.Done()
|
||||
}
|
||||
@ -105,20 +105,22 @@ func (s *BME280) ReadChannel(measuredValuesChannel chan<- []*types.MeasuredValue
|
||||
return
|
||||
}
|
||||
|
||||
measuredValuesChannel <- measuredValues
|
||||
for _, measuredValue := range measuredValues {
|
||||
measuredValueChannel <- measuredValue
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ReadContinously reads the measured values continously from the sensor and
|
||||
// writes them to a channel.
|
||||
func (s *BME280) ReadContinously(ctx context.Context, measuredValuesChannel chan<- []*types.MeasuredValue, errorChannel chan<- error) {
|
||||
func (s *BME280) ReadContinously(ctx context.Context, measuredValueChannel chan<- *types.MeasuredValue, errorChannel chan<- error) {
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
errorChannel <- fmt.Errorf("%v: Context closed: %v", s.SensorName, ctx.Err())
|
||||
return
|
||||
default:
|
||||
s.ReadChannel(measuredValuesChannel, errorChannel, nil)
|
||||
s.ReadChannel(measuredValueChannel, errorChannel, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user