| | |
| | | #include "../utils/xconvert.h" |
| | | |
| | | static double odoGraph; |
| | | static struct drive_timer odoTimer; |
| | | static struct RtkTime odoTimer; |
| | | static double odoPrevSpeed; |
| | | static int odoCnt; |
| | | |
| | |
| | | if (odoCnt == 0 && moveDirect == 1) { |
| | | odoPrevSpeed = speed; |
| | | odoCnt = 1; |
| | | Rtk2DriveTimer(odoTimer, rtkTime); |
| | | odoTimer = *rtkTime; |
| | | } else if (odoCnt == 1) { |
| | | if (moveDirect == 1) { |
| | | uint32_t tm = TimeGetDiff(rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss * 10, |
| | | odoTimer.hour, odoTimer.min, odoTimer.sec, |
| | | odoTimer.msec * 10); |
| | | uint32_t tm = TimeGetDiff(rtkTime, &odoTimer); |
| | | if (tm >= D_SEC(1)) { |
| | | odoGraph += ((double) tm) * (odoPrevSpeed + speed) / 2.0 / 1000.0; |
| | | Rtk2DriveTimer(odoTimer, rtkTime); |
| | | odoTimer = *rtkTime; |
| | | odoPrevSpeed = speed; |
| | | } |
| | | } else { |