fctom1215
2020-02-14 7c5b25c8617807635e9f272ebe9e98304d07cf2f
lib/src/main/cpp/test_items/turn_a90.cpp
@@ -21,9 +21,9 @@
static bool TA90Testing;
static int azimuth;
static int enterAreaHeading;
static bool turnLeftFinished;
static uint64_t stopTimepoint = 0;
static uint32_t stopTimepoint = 0;
static bool reportStopCarTimeout;
static int prevMoveDirect;
@@ -34,11 +34,11 @@
void StartTurnA90(int moveDirect, double heading, const struct RtkTime *rtkTime)
{
    azimuth = (int) heading;
    DEBUG("进入直角转弯场地");
    enterAreaHeading = (int) heading;
    prevMoveDirect = moveDirect;
    if (moveDirect == 0) {
        stopTimepoint = TimeMakeComposite(2000 + rtkTime->YY, rtkTime->MM, rtkTime->DD, rtkTime->hh, rtkTime->mm, rtkTime->ss);
        stopTimepoint = stopTimepoint * 1000 + rtkTime->mss*10;
        stopTimepoint = TimeMakeComposite(rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss*10);
    }
    reportStopCarTimeout = false;
    crashRedLine = false;
@@ -66,8 +66,7 @@
    if (moveDirect != prevMoveDirect) {
        if (moveDirect == 0) {
            stopTimepoint = TimeMakeComposite(2000 + rtkTime->YY, rtkTime->MM, rtkTime->DD, rtkTime->hh, rtkTime->mm, rtkTime->ss);
            stopTimepoint = stopTimepoint * 1000 + rtkTime->mss*10;
            stopTimepoint = TimeMakeComposite(rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss*10);
            reportStopCarTimeout = false;
            DEBUG("停车了 %d %d %d %d %d %d %d", rtkTime->YY, rtkTime->MM, rtkTime->DD, rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss);
@@ -76,8 +75,7 @@
        }
        prevMoveDirect = moveDirect;
    } else if (moveDirect == 0) {
        uint64_t tp = TimeMakeComposite(2000 + rtkTime->YY, rtkTime->MM, rtkTime->DD, rtkTime->hh, rtkTime->mm, rtkTime->ss);
        tp = tp * 1000 + rtkTime->mss * 10;
        uint32_t tp = TimeMakeComposite(rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss*10);
        if (tp - stopTimepoint >= STOP_CAR_TIME && !reportStopCarTimeout) {
            // 停车超2秒,每次扣5分
@@ -90,14 +88,21 @@
    // 检查转向状态
    int az = (int) heading;
    if (ABS(az - azimuth) > 180) {
        az = 360 - ABS(az-azimuth);
    if (ABS(az - enterAreaHeading) > 180) {
        az = 360 - ABS(az-enterAreaHeading);
    } else {
        az = ABS(az - azimuth);
        az = ABS(az - enterAreaHeading);
    }
    if (az >= 30) {
        if (!turnLeftFinished) {
            if((( ((int)heading) + 360 - enterAreaHeading) % 360) < 180) {
                DEBUG("右转");
            } else {
                DEBUG("左转");
            }
            // 转向灯未开启,扣10分
            AddExamFault(30, rtkTime);
            DEBUG("转向灯未开启");