Open Muny opened 5 years ago
All sensors have their own minimal supported update rate. The option -d 10
means to update sensor value each 10 milliseconds which is really fast and may not be supported.
Try to increase value to 50
or even 100
.
Termux:API execution takes longer time, so 10 ms delay is pointless.
I understand this, but the problem I'm having is that the sensor updates are not synchronized with the timer that runs the SensorOutputWriter.
Even if my sensor updates at 10Hz, and I set my delay to 100ms, I can get duplicate values because of how the values are being sent.
And for the execution time, when doing continuous updates the command is only executed once. I am getting what seem to be 10ms updates with -d 10.
Problem description When subscribing to continuous sensor updates, SensorOutputWriter sleeps for a fixed amount of time, then sends out the most recent sensor data. This sensor data may be exactly the same as was sent out previously.
Steps to reproduce
Notice the duplicate values.
Expected behavior No duplicate values.
I'm not sure what the intention was with the -d flag.
Android allows you to configure a sensor's update rate, and it notifies you when a sensor's value changes.
I think SensorAPI should:
I think this would be a much more useful behavior. I'm currently trying to automate logging of sensor values, and I want to squeeze the maximum performance out of my device's sensors. However, the updates termux-sensors produces are not in-sync with the actual sensor updates.
Additional information