Skip to content

Commit

Permalink
Support more than two devices
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecat authored and cliviu74 committed Oct 4, 2020
1 parent 2f511c9 commit 7ba331b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type sensor struct {
}

var (
sensors = make([]sensor, 1, 2)
sensors []sensor
onewireDevicePath = "/sys/bus/w1/devices/"
onewireDeviceList []string
hostname, _ = os.Hostname()
Expand Down Expand Up @@ -138,5 +138,8 @@ func createOnewireDeviceList() error {
log.Infof("Device found: %s", device.Name())
}
}

sensors = make([]sensor, len(onewireDeviceList))

return nil
}

0 comments on commit 7ba331b

Please sign in to comment.