diff options
-rw-r--r-- | libsensors_iio/src/HWSensorBase.cpp | 10 | ||||
-rw-r--r-- | libsensors_iio/src/SWSensorBase.cpp | 2 |
2 files changed, 2 insertions, 10 deletions
diff --git a/libsensors_iio/src/HWSensorBase.cpp b/libsensors_iio/src/HWSensorBase.cpp index e569c2a..43f7fbb 100644 --- a/libsensors_iio/src/HWSensorBase.cpp +++ b/libsensors_iio/src/HWSensorBase.cpp @@ -446,15 +446,7 @@ void HWSensorBaseWithPollrate::WriteDataToPipe() if (!GetStatusOfHandle(sensor_t_data.handle)) return; - /** Actually, the actual ODR would be slightly bigger than the requested, - * Eg: for lsm6ds3, real ODR is 26, 52, 104..., so the actual ODR is 104Hz - * when 100Hz is requested. - * As a result, the reporting time interval between two adjacent events - * would be smaller than that from GetDelay(). - * To guarantee the requested ODR in all cases, the reporting time interval - * should be greater than GetDelay()/2. - */ - if (sensor_event.timestamp > (last_data_timestamp + GetDelay() / 2)) { + if (sensor_event.timestamp >= (last_data_timestamp + real_pollrate)) { err = write(android_pipe_fd, &sensor_event, sizeof(sensor_event)); if (err < 0) { ALOGE("%s: Failed to write sensor data to pipe.", android_name); diff --git a/libsensors_iio/src/SWSensorBase.cpp b/libsensors_iio/src/SWSensorBase.cpp index 320752e..0acd26d 100644 --- a/libsensors_iio/src/SWSensorBase.cpp +++ b/libsensors_iio/src/SWSensorBase.cpp @@ -136,7 +136,7 @@ void SWSensorBaseWithPollrate::WriteDataToPipe() if (!GetStatusOfHandle(sensor_t_data.handle)) return; - if (sensor_event.timestamp > (last_data_timestamp + GetDelay())) { + if (sensor_event.timestamp >= (last_data_timestamp + real_pollrate)) { err = write(android_pipe_fd, &sensor_event, sizeof(sensor_event)); if (err < 0) { ALOGE("%s: Failed to write sensor data to pipe.", android_name); |