Community news, upcoming events and general discussions
Threads: 30 Posts: 77
Get technical support from the community
Threads: 935 Posts: 5083
Threads: 15 Posts: 54
Tell us how to make XDK better!
Threads: 35 Posts: 117
Share and discuss community member projects
Threads: 41 Posts: 195
after attaching a timestamp to the sensor value of the accelerometer, I can identify that this sensor is called every 100 ms with the function SensorDeviceAccelerometer_Update in the file SensorDeviceAccelerometer.c . Now I want to increase this inbuild rate from 100 ms to every 1 to 2 ms if possible.
Does anybody has knowledge about that issue.
Hello Ismail, To change sensor settings and the timer interval for updating sensor values, the first part is quite straight-forward. The settings for individual sensors are in the implementation files, located in the project's source folder, which are aptly named SensorDevice[Sensor].c. Each of these files is quite similar, containing only two functions. For example, SensorDeviceAccelerometer.c has a function called SensorDeviceAccelerometer_Activate(), which initializes and configures the Accelerometer sensor. In the original version of the examlpe, nothing is set, but this would be the best place to configure the accelerometer sensor. Preferably, right after the function-call Accelerometer_init() and its return-code check. To change the Lwm2m update-timer's frequency, go to BoschXDKCloudConnectivity > source > Lwm2mObjects > Lwm2mObject_SensorDevice.c. The interval between two notifications (i.e. updates for sensor values in Lwm2m) is defined by line 71 #define DEFAULT_SENSOR_TRANSPORT_INTERVAL. Per default, this is 15000. To change how often sensor values are updated, change the line 74 #define SENSORS_READ_INTERVAL, which is set to 100 by default. Keep in mind, while this macro defines how often values are updated, they have to be requested manually. The previously mentioned macro for the transport interval defines how often notifications for observers are sent. Please tell me if this was helpful, and do not hesitate to ask further questions. Kind regards, Franjo