androidthings / contrib-drivers

Open source peripheral drivers
Apache License 2.0
558 stars 174 forks source link

Continuously report temperature - No sensor reported #103

Open paul-matthews opened 6 years ago

paul-matthews commented 6 years ago

Using the code snippet for Continuously reporting temperature sensor, no ambient temperature sensor is connected. However reading a single temperature value works fine. Is this library registering the driver for the Bmx280 on the board, because the sample doesn't cover it.

Repro steps:

1) Copy code snippet into onCreate. 2) Run activity on a Pi 3 (with working other functions)

Expected:

3) Observe logging of temperature sensor

Actual:

3) Observed logging only includes: "I/SensorManager: DYNS Register dynamic sensor callback"

On further inspection (attempting to use the getDefaultSensor() ) no sensors exist.

jdkoren commented 6 years ago

It seems the snippet you linked to is missing a call to registerTemperatureSensor(). For now, please refer to the Activity code in the Bmx280 driver sample, which demonstrates the same use case.

plattysoft commented 6 years ago

Maybe a duplicate? https://github.com/androidthings/contrib-drivers/issues/102

jdkoren commented 6 years ago

@plattysoft Not quite a duplicate (at least I don't think so), I think @paul-matthews issue is the code snippet is missing a call to registerTemperatureSensor(), so the sensor never actually becomes available.