exp/sensor: fix nsec to usec conversion.

Also remove an unnecessary constant type conversion.

Change-Id: Iff466553fac450bd531785f4fb4e2be97a991a52
Reviewed-on: https://go-review.googlesource.com/13715
Reviewed-by: Burcu Dogan <jbd@google.com>
This commit is contained in:
Nigel Tao
2015-08-19 20:29:28 +10:00
parent 3a0fcd575e
commit f4bcb3cc2e

View File

@ -79,12 +79,12 @@ func (m *manager) initialize() {
v := <-m.inout
switch s := v.in.(type) {
case initSignal:
id := atomic.AddInt64(&nextLooperID, int64(1))
id := atomic.AddInt64(&nextLooperID, 1)
var mgr C.GoAndroid_SensorManager
C.GoAndroid_createManager(C.int(id), &mgr)
m.m = &mgr
case enableSignal:
usecsDelay := s.delay.Nanoseconds() * 1000
usecsDelay := s.delay.Nanoseconds() / 1000
code := int(C.GoAndroid_enableSensor(m.m.queue, typeToInt(s.t), C.int32_t(usecsDelay)))
if code != 0 {
*s.err = fmt.Errorf("sensor: no default %v sensor on the device", s.t)