语言

Menu
Sites
Language
sensor interval can't be re-set

I'm using the Sensor API to record accelerometer and gyroscope data. When I first set up my sensor callbacks, I pass in an interval in ms, e.g:

sensor_listener_set_event_cb(m_listener, interval, cb, this);

where interval is either 10 (for 100Hz data) or 20 (for 50Hz data).  When I'm done recording, I stop the listener and unset the callback with sensor_listener_unset_event_cb().

This works the first time through, but I'm finding that after I call this once, in any future calls, the value of the interval is ignored.  So for example, if the first time I want to record data, I do it at 50Hz, then any time I record data after that, it will also be at 50Hz, even if I explicitly set the interval to 10 to record at 100 Hz.  Likewise, if I record at 100Hz the first time, I can never record at 50Hz after that.

I've tried also calling sensor_listener_set_interval(), but this also has no effect.

This is on a Gear S2 running Tizen 2.3.1.

Has anyone else seen this behavior?  Is this a bug in the SDK?

编辑者为: Steven Merel 25 9月, 2017

响应

1 回复
GEUNSOO KIM

There are few possibilities about your symptom.

1. the minimum interval of sensor listening can be vary and there is no guarrenty of running on exact interval. I think you'd better check the possible minimum interval of the sensor using 'sensor_get_min_interval()' function.

2. the wearable device can enter sleep state anytime unless you lock down cpu power. In this case, the intreval will be not predictable. you can verify this by lock cpu power always on and check your interval.

good luck.