fix(cmd/temperature/read): use measured values instaed own type
This commit is contained in:
@ -11,15 +11,15 @@ import (
|
||||
)
|
||||
|
||||
// Read measured values from sensors
|
||||
func Read(ctx context.Context, sensors []Sensor) ([]types.MeasuredValue, error) {
|
||||
measuredValueChannel := make(chan types.MeasuredValue, len(sensors))
|
||||
errorChannel := make(chan error, len(sensors))
|
||||
func Read(sensors []Sensor) ([]types.MeasuredValue, error) {
|
||||
measuredValueChannel := make(chan types.MeasuredValue, 0)
|
||||
errorChannel := make(chan error, 0)
|
||||
|
||||
wg := new(sync.WaitGroup)
|
||||
wg.Add(len(sensors))
|
||||
|
||||
for _, sensor := range sensors {
|
||||
go sensor.ReadContinously(ctx, measuredValueChannel, errorChannel)
|
||||
go sensor.ReadChannel(measuredValueChannel, errorChannel, wg)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
Reference in New Issue
Block a user