|
@@ -35,12 +35,9 @@ uint32_t CANRecv_Consumer::Trans_From_CANRaw(const iv::can::canraw &xraw) //only
|
|
this->Clear_CAN_PrivateTempVariable();
|
|
this->Clear_CAN_PrivateTempVariable();
|
|
CAN_ID = xraw.id();
|
|
CAN_ID = xraw.id();
|
|
CAN_DLC = xraw.len();
|
|
CAN_DLC = xraw.len();
|
|
- char tempData[8];
|
|
|
|
- int tempLen = (xraw.data().size() > 8) ? 8 : xraw.data().size();
|
|
|
|
- strncpy(tempData,xraw.data().data(),tempLen);
|
|
|
|
- for(int i=0;i<tempLen;i++)
|
|
|
|
|
|
+ for(int i=0;i<CAN_DLC;i++)
|
|
{
|
|
{
|
|
- CAN_data[i] = (uint8_t)tempData[i];
|
|
|
|
|
|
+ CAN_data[i] = xraw.data()[i];
|
|
}
|
|
}
|
|
|
|
|
|
return CAN_ID;
|
|
return CAN_ID;
|
|
@@ -94,12 +91,12 @@ void CANRecv_Consumer::run()
|
|
sensorStatus.fill(false,NUM_OF_SENSOR_MAX);
|
|
sensorStatus.fill(false,NUM_OF_SENSOR_MAX);
|
|
tempSensorID = 0;
|
|
tempSensorID = 0;
|
|
}
|
|
}
|
|
-// if(tempLastResult <= 2000)
|
|
|
|
-// emit Enable_Ask(true,tempSensorID,2);
|
|
|
|
-// else if(tempLastResult <= 3800)
|
|
|
|
-// emit Enable_Ask(true,tempSensorID,1);
|
|
|
|
-// else
|
|
|
|
-// emit Enable_Ask(true,tempSensorID,0);
|
|
|
|
|
|
+ if(tempLastResult <= 2000)
|
|
|
|
+ emit Enable_Ask(true,tempSensorID,2);
|
|
|
|
+ else if(tempLastResult <= 3800)
|
|
|
|
+ emit Enable_Ask(true,tempSensorID,1);
|
|
|
|
+ else
|
|
|
|
+ emit Enable_Ask(true,tempSensorID,0);
|
|
decodeTimer.restart();
|
|
decodeTimer.restart();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -108,7 +105,7 @@ void CANRecv_Consumer::run()
|
|
if(CAN_ID == setupConfig.sonarCAN_ID && CAN_DLC == 2)
|
|
if(CAN_ID == setupConfig.sonarCAN_ID && CAN_DLC == 2)
|
|
{
|
|
{
|
|
tempDist = (CAN_data[0] << 8) | CAN_data[1];
|
|
tempDist = (CAN_data[0] << 8) | CAN_data[1];
|
|
- if(tempDist <= 0x1650 && tempDist >= 0xD0)
|
|
|
|
|
|
+ if(tempDist <= 5720 && tempDist >= 200)
|
|
{
|
|
{
|
|
decodeEnableFlag = false;
|
|
decodeEnableFlag = false;
|
|
objDist[decodeSensorID] = tempDist;
|
|
objDist[decodeSensorID] = tempDist;
|
|
@@ -143,12 +140,13 @@ void CANRecv_Consumer::run()
|
|
sensorStatus.fill(false,NUM_OF_SENSOR_MAX);
|
|
sensorStatus.fill(false,NUM_OF_SENSOR_MAX);
|
|
tempSensorID = 0;
|
|
tempSensorID = 0;
|
|
}
|
|
}
|
|
-// if(tempLastResult <= 2000)
|
|
|
|
-// emit Enable_Ask(true,tempSensorID,2);
|
|
|
|
-// else if(tempLastResult <= 3800)
|
|
|
|
-// emit Enable_Ask(true,tempSensorID,1);
|
|
|
|
-// else
|
|
|
|
-// emit Enable_Ask(true,tempSensorID,0);
|
|
|
|
|
|
+ if(tempLastResult <= 2000)
|
|
|
|
+ emit Enable_Ask(true,tempSensorID,2);
|
|
|
|
+ else if(tempLastResult <= 3800)
|
|
|
|
+ emit Enable_Ask(true,tempSensorID,1);
|
|
|
|
+ else
|
|
|
|
+ emit Enable_Ask(true,tempSensorID,0);
|
|
|
|
+ std::cout<<"finish decode result:"<<QDateTime::currentMSecsSinceEpoch()<<std::endl;
|
|
decodeTimer.restart();
|
|
decodeTimer.restart();
|
|
}
|
|
}
|
|
}
|
|
}
|