mirror of
https://github.com/kidoman/embd
synced 2025-07-03 03:47:33 +02:00
- use glog instead of Debug flag
- use glog instead of log - make code conform to the Go code guidelines
This commit is contained in:
parent
ca17879e6e
commit
9ab49745bc
23 changed files with 554 additions and 703 deletions
|
@ -2,11 +2,11 @@
|
|||
package lsm303
|
||||
|
||||
import (
|
||||
"log"
|
||||
"math"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd"
|
||||
)
|
||||
|
||||
|
@ -53,8 +53,6 @@ type LSM303 struct {
|
|||
headings chan float64
|
||||
|
||||
quit chan struct{}
|
||||
|
||||
Debug bool
|
||||
}
|
||||
|
||||
// New creates a new LSM303 interface. The bus variable controls
|
||||
|
@ -118,15 +116,13 @@ func (d *LSM303) Heading() (float64, error) {
|
|||
case heading := <-d.headings:
|
||||
return heading, nil
|
||||
default:
|
||||
if d.Debug {
|
||||
log.Print("lsm303: no headings available... measuring")
|
||||
}
|
||||
glog.V(2).Infof("lsm303: no headings available... measuring")
|
||||
return d.measureHeading()
|
||||
}
|
||||
}
|
||||
|
||||
// Run starts the sensor data acquisition loop.
|
||||
func (d *LSM303) Run() (err error) {
|
||||
func (d *LSM303) Run() error {
|
||||
go func() {
|
||||
d.quit = make(chan struct{})
|
||||
|
||||
|
@ -153,7 +149,7 @@ func (d *LSM303) Run() (err error) {
|
|||
}
|
||||
}()
|
||||
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close the sensor data acquisition loop and put the LSM303 into sleep mode.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue