Skip to content

Commit

Permalink
Correct worker flow
Browse files Browse the repository at this point in the history
  • Loading branch information
mrverrall committed Feb 24, 2021
1 parent 8ea9723 commit 5f4ac06
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions go-row.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ func btWorker(done chan bool) {
}
ble.SetDefaultDevice(d)

log.Printf("searching for PM5...")
rower, err := pm5.NewClient()

if err != nil {
log.Printf("PM5 error: %s", err)
continue
}

sensors := peripheral.Sensors{
peripheral.NewCyclePower(deviceName),
peripheral.NewRunningSpeed(deviceName),
Expand All @@ -52,15 +60,6 @@ func btWorker(done chan bool) {

log.Println("advertising sensor services")
go ble.AdvertiseNameAndServices(context.Background(), deviceName, sensors.UUIDs()...)
<-done

log.Printf("searching for PM5...")
rower, err := pm5.NewClient()

if err != nil {
log.Printf("PM5 error: %s", err)
continue
}

for data := range rower.StatusCh {
for _, s := range sensors {
Expand Down

0 comments on commit 5f4ac06

Please sign in to comment.