Преглед на файлове

fix(grpc_BS):fix mileage incorrect

fujiankuan преди 3 години
родител
ревизия
8548bc2ba5
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      src/driver/driver_cloud_grpc_client_BS/vehicle_upload.cpp

+ 4 - 1
src/driver/driver_cloud_grpc_client_BS/vehicle_upload.cpp

@@ -636,12 +636,15 @@ void DataExchangeClient::run()
     }
 
     int lastTime = xTime.elapsed();
+    int realLastTime = xTime.elapsed();
     uint64_t interval = std::atoi(gstruploadInterval.c_str());
     while (!QThread::isInterruptionRequested())
     {
         if(abs(xTime.elapsed() - lastTime)>=interval)
         {
-            updateData(abs(xTime.elapsed() - lastTime));
+            int realInterval = abs(xTime.elapsed() - realLastTime);
+            realLastTime = xTime.elapsed();
+            updateData(realInterval);
             std::string reply = uploadVehicleInfo();
 //            std::cout<< reply <<std::endl;
 //            std::cout<<std::setprecision(12)<<destinationPosition.latitude()<<","<<destinationPosition.longitude()<<std::endl;