From f04a938963df50d8c2f37f6603b9d6eef00dcb65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Thu, 21 Aug 2025 10:00:49 +0800 Subject: [PATCH 1/3] 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/hdi_service_3.0/sensor_callback_vdi.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sensor/hdi_service_3.0/sensor_callback_vdi.cpp b/sensor/hdi_service_3.0/sensor_callback_vdi.cpp index 4650fbe639..fd0296599b 100644 --- a/sensor/hdi_service_3.0/sensor_callback_vdi.cpp +++ b/sensor/hdi_service_3.0/sensor_callback_vdi.cpp @@ -205,7 +205,9 @@ void SensorCallbackVdi::PrintCount(const SensorHandle& sensorHandle, lastRecordTime += std::chrono::milliseconds(ONE_SECOND); lastDataCount = currentDataCount; - + if (std::chrono::duration_cast(currentTime - lastRecordTime).count() >= ONE_SECOND) { + lastRecordTime = currentTime; // Reset lastRecordTime if it exceeds one second + } if (perSecondCount >= targetCount - acceptablError && perSecondCount <= targetCount + acceptablError) { return; // Skip logging if the count is within acceptable range } -- Gitee From bfd182b2c15136176df67e93792352f6f862efce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Thu, 21 Aug 2025 10:03:29 +0800 Subject: [PATCH 2/3] 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/hdi_service_3.0/sensor_callback_vdi.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sensor/hdi_service_3.0/sensor_callback_vdi.cpp b/sensor/hdi_service_3.0/sensor_callback_vdi.cpp index fd0296599b..51f27d4b17 100644 --- a/sensor/hdi_service_3.0/sensor_callback_vdi.cpp +++ b/sensor/hdi_service_3.0/sensor_callback_vdi.cpp @@ -205,6 +205,7 @@ void SensorCallbackVdi::PrintCount(const SensorHandle& sensorHandle, lastRecordTime += std::chrono::milliseconds(ONE_SECOND); lastDataCount = currentDataCount; + if (std::chrono::duration_cast(currentTime - lastRecordTime).count() >= ONE_SECOND) { lastRecordTime = currentTime; // Reset lastRecordTime if it exceeds one second } -- Gitee From edbef9724c3d39953a22ba8de81c3dc05390baf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Thu, 21 Aug 2025 10:05:31 +0800 Subject: [PATCH 3/3] 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/hdi_service_3.0/sensor_callback_vdi.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sensor/hdi_service_3.0/sensor_callback_vdi.cpp b/sensor/hdi_service_3.0/sensor_callback_vdi.cpp index 51f27d4b17..422d2a163e 100644 --- a/sensor/hdi_service_3.0/sensor_callback_vdi.cpp +++ b/sensor/hdi_service_3.0/sensor_callback_vdi.cpp @@ -208,6 +208,7 @@ void SensorCallbackVdi::PrintCount(const SensorHandle& sensorHandle, if (std::chrono::duration_cast(currentTime - lastRecordTime).count() >= ONE_SECOND) { lastRecordTime = currentTime; // Reset lastRecordTime if it exceeds one second + return; } if (perSecondCount >= targetCount - acceptablError && perSecondCount <= targetCount + acceptablError) { return; // Skip logging if the count is within acceptable range -- Gitee