CAN_FUNC.c 36.5 KB
Newer Older
hu's avatar
hu committed
1
#include "CAN_FUNC.h"
hu's avatar
hu committed
2
#include "CAN_Communication_Matrix.h"
hu's avatar
hu committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*增加外发计算部分引用文件*/
#include "Common_Interface.h"
#include "Gauges.h"
#include "GaugesInterface.h"
#include "Telltales.h"

#include "GUI.h"
#include "Data_CoolantTemperature.h"
#include "Data_Voltmeter.h"
#include "Data_AirPressure.h"
#include "RTE_TIME.h"
#include "Services_Mileage.h"
#include "RTE_ADC.h"
#include "Data_Fuel_User.h"

#include "Line_in.h"
hu's avatar
hu committed
19
#include "Menu.h"
hu's avatar
hu committed
20

hu's avatar
hu committed
21
static uint8_t User_BCM_Flag;
hu's avatar
hu committed
22

hu's avatar
hu committed
23 24 25
uint8_t TpmsMsg18033317SendFlag = 0;

uint8_t Msg_18021733[8];
hu's avatar
hu committed
26
static uint8_t TXNum_18033317;
hu's avatar
hu committed
27 28 29 30
/*---------------------------------------------------------------------------
使用しない Byte、bit に関しては全て 1(B)をセットして出力すること
对于不使用的Byte、bit,全部设置1(B)并输出
----------------------------------------------------------------------------*/
hu's avatar
hu committed
31
USER_ECU User_ECU;
hu's avatar
hu committed
32 33
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FEAE17
hu's avatar
hu committed
34
 * Description    :
hu's avatar
hu committed
35
 * Input          : None  18FEAE17
hu's avatar
hu committed
36 37 38 39
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
40
void Can_Set_Buff_18FEAE17(uint8_t CopyData[])
hu's avatar
hu committed
41
{
hu's avatar
hu committed
42
    uint16_t Main_Air_Pressure = 0u;                  /*0~FA:0~2000 [kPa] FB~FF:Not used  8倍*/
hu's avatar
hu committed
43 44
    uint16_t Service_Brake_Circuit1_AirPressure = 0u; /*0~FA:0~2000 [kPa] FB~FF:Not used  8倍*/
    uint16_t Service_Brake_Circuit2_AirPressure = 0u; /*0~FA:0~2000 [kPa] FB~FF:Not used  8倍*/
hu's avatar
hu committed
45
    uint16_t Power_Supply_Voltage = 0u;               /*0~2D0:0~36 [V] 2D1~FFFF:Not used*/
hu's avatar
hu committed
46 47 48
    uint8_t Parking_Brake_Switch = 0u;
    uint8_t Rader_Stain_Information = 0u;
    uint8_t SW_ECONO = 0u;
hu's avatar
hu committed
49

hu's avatar
hu committed
50
    /*WET*/
hu's avatar
hu committed
51
    Main_Air_Pressure = (uint8_t)((Common_Get_WET_Data() - 500u) / 20u);
hu's avatar
hu committed
52

hu's avatar
hu committed
53 54 55 56
    /*气压状态*/
    if ((K_Line_Set.K_Line_LID42 == 0x00u) || (K_Line_Set.K_Line_LID42 == 0x03u))
    {
        if (Common_Get_Air1_Data() != 0u)
hu's avatar
hu committed
57
        {
hu's avatar
hu committed
58
            Service_Brake_Circuit1_AirPressure = (uint8_t)((Common_Get_Air1_Data() - 500u) / 20u);
hu's avatar
hu committed
59
        }
hu's avatar
hu committed
60
        else
hu's avatar
hu committed
61
        {
hu's avatar
hu committed
62
            Service_Brake_Circuit1_AirPressure = 0u;
hu's avatar
hu committed
63 64
        }

hu's avatar
hu committed
65
        if (Common_Get_Air2_Data() != 0u)
hu's avatar
hu committed
66
        {
hu's avatar
hu committed
67
            Service_Brake_Circuit2_AirPressure = (uint8_t)((Common_Get_Air2_Data() - 500u) / 20u);
hu's avatar
hu committed
68
        }
hu's avatar
hu committed
69
        else
hu's avatar
hu committed
70
        {
hu's avatar
hu committed
71
            Service_Brake_Circuit2_AirPressure = 0u;
hu's avatar
hu committed
72
        }
hu's avatar
hu committed
73
    }
hu's avatar
hu committed
74
    else if ((K_Line_Set.K_Line_LID42 == 0x01u) || (K_Line_Set.K_Line_LID42 == 0x02u))
hu's avatar
hu committed
75
    {
hu's avatar
hu committed
76
        if (Common_Get_Air2_Data() != 0u)
hu's avatar
hu committed
77
        {
hu's avatar
hu committed
78
            Service_Brake_Circuit1_AirPressure = (uint8_t)((Common_Get_Air2_Data() - 500u) / 20u);
hu's avatar
hu committed
79
        }
hu's avatar
hu committed
80
        else
hu's avatar
hu committed
81
        {
hu's avatar
hu committed
82
            Service_Brake_Circuit1_AirPressure = 0u;
hu's avatar
hu committed
83 84
        }

hu's avatar
hu committed
85
        if (Common_Get_Air1_Data() != 0u)
hu's avatar
hu committed
86
        {
hu's avatar
hu committed
87
            Service_Brake_Circuit2_AirPressure = (uint8_t)((Common_Get_Air1_Data() - 500u) / 20u);
hu's avatar
hu committed
88
        }
hu's avatar
hu committed
89
        else
hu's avatar
hu committed
90
        {
hu's avatar
hu committed
91
            Service_Brake_Circuit2_AirPressure = 0u;
hu's avatar
hu committed
92
        }
hu's avatar
hu committed
93
    }
hu's avatar
hu committed
94

hu's avatar
hu committed
95 96 97 98
    /*电源电压*/
    Power_Supply_Voltage = 0u;

    /*驻车制动外发*/
hu's avatar
hu committed
99
    if (Line_In_Get_Status(LINE_IN_PARK_BRAKE) == 0u)
hu's avatar
hu committed
100
    {
hu's avatar
hu committed
101
        Parking_Brake_Switch = 1u;
hu's avatar
hu committed
102 103 104
    }
    else
    {
hu's avatar
hu committed
105
        Parking_Brake_Switch = 0u;
hu's avatar
hu committed
106 107
    }

hu's avatar
hu committed
108 109 110
    Rader_Stain_Information = 0u;
    SW_ECONO = 0u;

hu's avatar
hu committed
111 112 113 114 115 116 117
    CopyData[0] = (uint8_t)(Main_Air_Pressure & 0xFFu);                  /* 1  */
    CopyData[1] = 0u;                                                    /* 2  */
    CopyData[2] = (uint8_t)(Service_Brake_Circuit1_AirPressure & 0xFFu); /* 3  */
    CopyData[3] = (uint8_t)(Service_Brake_Circuit2_AirPressure & 0xFFu); /* 4  */
    CopyData[4] = 0u;                                                    /* 5  */
    CopyData[5] = (uint8_t)(Power_Supply_Voltage & 0xFFU);               /* 6  */
    CopyData[6] = (uint8_t)((Power_Supply_Voltage >> 8u) & 0xFFu);       /* 7  */
hu's avatar
hu committed
118 119
    CopyData[7] = (uint8_t)(((Parking_Brake_Switch << 6u) & 0xC0u) |
                            ((Rader_Stain_Information << 2u) & 0x0Cu) |
hu's avatar
hu committed
120
                            (SW_ECONO & 0x03u)); /* 8  */
hu's avatar
hu committed
121 122 123 124
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FF3E17
hu's avatar
hu committed
125
 * Description    :
hu's avatar
hu committed
126
 * Input          : None   18FF3E17
hu's avatar
hu committed
127 128 129 130
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
131
void Can_Set_Buff_18FF3E17(uint8_t CopyData[])
hu's avatar
hu committed
132
{
hu's avatar
hu committed
133 134 135 136 137 138 139 140 141
    uint32_t Pulse_Correction_Facor = 0u;
    uint8_t SW_PTO = 0u;
    uint8_t AEBS_ON_OFF_Info = 0u;
    uint8_t HID_Auto_Leveling = 0u;
    uint8_t MIL_Lamp_Status = 0u;
    uint16_t Fuel_Gauges_AD_Value = 0u;
    uint8_t TURN_L_Lamp_Status = 0u;
    uint8_t DstWarnVolume_Set = 0u;

hu's avatar
hu committed
142
    CopyData[0] = (uint8_t)((Pulse_Correction_Facor) & 0xFFu);       /* 1  */
hu's avatar
hu committed
143 144 145 146 147 148 149 150 151 152
    CopyData[1] = (uint8_t)((Pulse_Correction_Facor >> 8u) & 0xFFu); /* 2  */
    CopyData[2] = (uint8_t)(((SW_PTO << 7u) & 0x80u) |
                            ((AEBS_ON_OFF_Info << 4u) & 0x30u) |
                            ((HID_Auto_Leveling << 1u) & 0x02u));       /* 3  */
    CopyData[3] = (uint8_t)(((MIL_Lamp_Status << 7u) & 0x80u) | 0x7Fu); /* 4  */
    CopyData[4] = (uint8_t)(Fuel_Gauges_AD_Value & 0xFFu);              /* 5  */
    CopyData[5] = 0u;                                                   /* 6  */
    CopyData[6] = 0u;                                                   /* 7  */
    CopyData[7] = (uint8_t)(((TURN_L_Lamp_Status << 5u) & 0x10u) |
                            ((DstWarnVolume_Set & 0x07))); /* 8  */
hu's avatar
hu committed
153 154 155
}
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FED917
hu's avatar
hu committed
156
 * Description    :
hu's avatar
hu committed
157
 * Input          : None  18FED917
hu's avatar
hu committed
158 159 160 161
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
162
void Can_Set_Buff_18FED917(uint8_t CopyData[])
hu's avatar
hu committed
163
{
hu's avatar
hu committed
164 165 166 167
    uint8_t Blanding_SW_Signal = 0u;
    uint8_t Tralier_ABS_Fully_Operational = 0u;
    uint8_t Tlailer_ABS_Detect = 0u;
    uint8_t Tlailer_Connected = 0u;
hu's avatar
hu committed
168

hu's avatar
hu committed
169
    Blanding_SW_Signal = Line_In_Get_Status(LINE_IN_RET_BLENDING); /*A10*/
hu's avatar
hu committed
170

hu's avatar
hu committed
171
    Tlailer_Connected = Line_In_Get_Status(LINE_IN_TRAILER_CONNECT); /*B6*/
hu's avatar
hu committed
172

hu's avatar
hu committed
173
    if (Line_In_Get_Status(LINE_IN_TRAILER_CONNECT) == 1u)
hu's avatar
hu committed
174
    {
hu's avatar
hu committed
175
        Tlailer_ABS_Detect = Line_In_Get_Status(LINE_IN_ABS_DETECT); /*A33*/
hu's avatar
hu committed
176

hu's avatar
hu committed
177 178 179 180 181 182 183 184
        if (Line_In_Get_Status(LINE_IN_ABS_DETECT) == 1u)
        {
            Tralier_ABS_Fully_Operational = Line_In_Get_Status(LINE_IN_TRAILER_ABS); /*B33*/
        }
        else
        {
            Tralier_ABS_Fully_Operational = 0u;
        }
hu's avatar
hu committed
185
    }
hu's avatar
hu committed
186
    else
hu's avatar
hu committed
187
    {
hu's avatar
hu committed
188 189
        Tlailer_ABS_Detect = 3u;
        Tralier_ABS_Fully_Operational = 3u;
hu's avatar
hu committed
190
    }
hu's avatar
hu committed
191 192 193 194 195 196 197 198 199 200 201 202 203

    CopyData[0] = (uint8_t)(((Blanding_SW_Signal << 4u) & 0x30u) |
                            0xCFu); /* 1  */
    CopyData[1] = (uint8_t)(((Tralier_ABS_Fully_Operational << 2u) & 0x0Cu) |
                            ((Tlailer_ABS_Detect << 4u) & 0x30u) |
                            ((Tlailer_Connected << 6u) & 0xC0u) |
                            0x03u); /* 2  */
    CopyData[2] = 0u;               /* 3  */
    CopyData[3] = 0u;               /* 4  */
    CopyData[4] = 0u;               /* 5  */
    CopyData[5] = 0u;               /* 6  */
    CopyData[6] = 0u;               /* 7  */
    CopyData[7] = 0u;               /* 8  */
hu's avatar
hu committed
204
}
hu's avatar
hu committed
205

hu's avatar
hu committed
206
/*-------------------------------------------------------------------------
hu's avatar
hu committed
207
 * Function Name  : Can_Set_Buff_18FEE617
hu's avatar
hu committed
208
 * Description    :
hu's avatar
hu committed
209
 * Input          : None  18FEE617
hu's avatar
hu committed
210 211 212 213
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
214
void Can_Set_Buff_18FEE617(uint8_t CopyData[])
hu's avatar
hu committed
215
{
hu's avatar
hu committed
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
    uint8_t Seconds = 0u;
    uint8_t Minutes = 0u;
    uint8_t Hours = 0u;
    uint8_t Month = 0u;
    uint8_t Day = 0u;
    uint8_t Year = 0u;

    Seconds = Get_RTC_SECOND() * 4u;
    Minutes = Get_RTC_MINUTE();
    Hours = Get_RTC_HOUR();
    Month = Get_RTC_MONTH();
    Day = Get_RTC_DATE() * 4u;
    Year = (uint8_t)((Get_RTC_YEAR() + 2000u - 1985u) & 0xFFu);

    CopyData[0] = (uint8_t)Seconds; /* 1  */
    CopyData[1] = (uint8_t)Minutes; /* 2  */
    CopyData[2] = (uint8_t)Hours;   /* 3  */
    CopyData[3] = (uint8_t)Month;   /* 4  */
    CopyData[4] = (uint8_t)Day;     /* 5  */
    CopyData[5] = (uint8_t)Year;    /* 6  */
    CopyData[6] = 0u;               /* 7  */
    CopyData[7] = 0u;               /* 8  */
hu's avatar
hu committed
238 239 240 241
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FEE017
hu's avatar
hu committed
242
 * Description    :
hu's avatar
hu committed
243
 * Input          : None  18FEE017
hu's avatar
hu committed
244 245 246 247
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
248
void Can_Set_Buff_18FEE017(uint8_t CopyData[])
hu's avatar
hu committed
249
{
hu's avatar
hu committed
250 251 252 253 254 255 256 257 258 259 260 261
    uint32_t Total_Vehicle_Distance = 0u; /*总计里程*/

    Total_Vehicle_Distance = Data_ODO_Read();

    CopyData[0] = 0xFFu;                                                           /* 1  */
    CopyData[1] = 0xFFu;                                                           /* 2  */
    CopyData[2] = 0xFFu;                                                           /* 3  */
    CopyData[3] = 0xFFu;                                                           /* 4  */
    CopyData[4] = (uint8_t)((Total_Vehicle_Distance * 8u / 10u) & 0xFFu);          /* 5  */
    CopyData[5] = (uint8_t)(((Total_Vehicle_Distance * 8u / 10u) >> 8u) & 0xFFu);  /* 6  */
    CopyData[6] = (uint8_t)(((Total_Vehicle_Distance * 8u / 10u) >> 16u) & 0xFFu); /* 7  */
    CopyData[7] = (uint8_t)(((Total_Vehicle_Distance * 8u / 10u) >> 24u) & 0xFFu); /* 8  */
hu's avatar
hu committed
262 263 264 265
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FEFC17
hu's avatar
hu committed
266
 * Description    :
hu's avatar
hu committed
267
 * Input          : None  18FEFC17
hu's avatar
hu committed
268 269 270 271
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
272
void Can_Set_Buff_18FEFC17(uint8_t CopyData[])
hu's avatar
hu committed
273
{
hu's avatar
hu committed
274 275 276 277 278 279 280 281
    uint8_t Washer_Fluid_Level = 0u;
    uint8_t Fuel_Level_1 = 0u; /*仪表外发*/
    uint8_t Engine_Fuel_Filter_Differential_Pressure = 0u;
    uint8_t Engine_Oil_Filter_Differential_Pressure = 0u;
    uint16_t Cargo_Ambient_Temperature = 0u;
    uint8_t Fuel_Level_2 = 0u;
    uint8_t Engine_Oil_Filter_Differential = 0u;

hu's avatar
hu committed
282 283 284 285
    uint16_t Get_Step = 0u;
    Get_Step = Fuel_Get_Step();

    if (Get_Step > 10u)
hu's avatar
hu committed
286
    {
hu's avatar
hu committed
287
        Fuel_Level_1 = (uint8_t)((Get_Step - 10u) * 50u / 24u);
hu's avatar
hu committed
288
    }
hu's avatar
hu committed
289
    else
hu's avatar
hu committed
290
    {
hu's avatar
hu committed
291
        Fuel_Level_1 = 0u;
hu's avatar
hu committed
292
    }
hu's avatar
hu committed
293 294 295 296 297 298 299 300 301

    CopyData[0] = (uint8_t)Washer_Fluid_Level;                          /* 1  */
    CopyData[1] = (uint8_t)Fuel_Level_1;                                /* 2  */
    CopyData[2] = (uint8_t)Engine_Fuel_Filter_Differential_Pressure;    /* 3  */
    CopyData[3] = (uint8_t)Engine_Oil_Filter_Differential_Pressure;     /* 4  */
    CopyData[4] = (uint8_t)(Cargo_Ambient_Temperature & 0xFFu);         /* 5  */
    CopyData[5] = (uint8_t)((Cargo_Ambient_Temperature >> 8u) & 0xFFu); /* 6  */
    CopyData[6] = (uint8_t)Fuel_Level_2;                                /* 7  */
    CopyData[7] = (uint8_t)Engine_Oil_Filter_Differential;              /* 8  */
hu's avatar
hu committed
302 303 304 305
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FF2517
hu's avatar
hu committed
306
 * Description    :
hu's avatar
hu committed
307
 * Input          : None  18FF2517
hu's avatar
hu committed
308 309 310 311
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
312
void Can_Set_Buff_18FF2517(uint8_t CopyData[])
hu's avatar
hu committed
313
{
hu's avatar
hu committed
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
    uint16_t Year = 0u;
    uint8_t Month = 0u;
    uint8_t Day = 0u;
    uint8_t Hour = 0u;
    uint8_t Minute = 0u;
    uint32_t ODO_Meter = 0u;

    Year = Get_RTC_YEAR();
    Month = Get_RTC_MONTH();
    Day = Get_RTC_DATE();
    Hour = Get_RTC_HOUR();
    Minute = Get_RTC_MINUTE();

    CopyData[0] = (uint8_t)(Year & 0xFFu);               /* 1  */
    CopyData[1] = (uint8_t)Month;                        /* 2  */
    CopyData[2] = (uint8_t)Day;                          /* 3  */
    CopyData[3] = (uint8_t)Hour;                         /* 4  */
    CopyData[4] = (uint8_t)Minute;                       /* 5  */
    CopyData[5] = (uint8_t)(ODO_Meter & 0xFFu);          /* 6  */
    CopyData[6] = (uint8_t)((ODO_Meter >> 8u) & 0xFFu);  /* 7  */
    CopyData[7] = (uint8_t)((ODO_Meter >> 16u) & 0xFFu); /* 8  */
hu's avatar
hu committed
335 336 337 338
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FF2A17
hu's avatar
hu committed
339
 * Description    :
hu's avatar
hu committed
340
 * Input          : None 18FF2A17
hu's avatar
hu committed
341 342 343 344
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
345
void Can_Set_Buff_18FF2A17(uint8_t CopyData[])
hu's avatar
hu committed
346
{
hu's avatar
hu committed
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
    uint8_t Water_Temp_Level = 0u;            /*水温状态*/
    uint8_t Remining_Fuel_Warning = 0u;       /*剩余燃料报警*/
    uint8_t Battery_Maintenance_Warning = 0u; /*电池维护报警*/
    uint8_t Over_Heat_Warning_Status = 0u;    /*水温状态*/
    uint8_t Meter_Malfunction = 0u;           /*仪表故障*/
    uint8_t SRS_Input = 0u;
    uint8_t SW_Rear_Body_Warning = 0u;
    uint8_t SW_Sheetbelt = 0u;
    uint8_t SW_Oil_Pressure = 0u;
    uint8_t SW_Coolant_Level = 0u;
    uint8_t SW_Water_Separator = 0u;
    uint8_t SW_Clutch = 0u;
    uint8_t SW_Air_Low_Pressure = 0u;
    uint8_t SW_MT_Range = 0u;
    uint8_t SW_MT_Spriter = 0u;
    uint8_t SW_KickDrive = 0u;
    uint8_t SW_DefLock = 0u;
    uint8_t ACG_L_Terminal = 0u;
    uint8_t Reserve = 0u;
    uint8_t SW_Dr_Door = 0u;
    uint8_t EDS_Smoother_WL_Status = 0u;
    uint8_t EBS_Warning_Red = 0u;
    uint8_t EBS_Warning_Yellow = 0u;
    uint8_t ESC_Operating = 0u;
    uint8_t Air_Sus_Warning = 0u;
    uint8_t Roll_Warning = 0u;
    uint8_t ROWS_Warning = 0u;
    uint8_t Mult_Indication = 0u;
    uint8_t SW_KeyRemind = 0u;
    uint8_t SW_Hi_Beam = 0u;
    uint8_t TURN_R_Lamp_Status = 0u;
    uint8_t SW_Illmi = 0u;
    uint8_t SW_SpotLamp = 0u;
    uint8_t SW_Accessory_Air = 0u;
    uint8_t SW_Trailer_Brake = 0u;
    uint8_t Input_Trailer_Info = 0u;
    uint8_t Input_Trailer_ABS = 0u;
    uint8_t SW_Coupler_Lock = 0u;
    uint8_t SW_Parking = 0u;
    uint8_t IGN_Voltage = 0u;
    uint8_t MJX_MEB9_Manual_TM_Range_Low = 0u;
    uint8_t Range_Air_Cut_Warning = 0u;
    uint8_t IRIS_Warning_Lamp_Status = 0u;

    /*手刹状态*/
392
    if (Line_In_Get_Status(LINE_IN_PARK_BRAKE) == 1u)
hu's avatar
hu committed
393 394 395
        SW_Parking = 1 ;
    else
        SW_Parking = 0 ;
hu's avatar
hu committed
396

hu's avatar
hu committed
397
    /*水温状态*/
398 399
    if ((Get_ID_18FEEE00_Sig_Engine_Coolant_Temperature() > 0xFA) ||
            (CAN_SIG_LOST == CAN_MSG_Status(ID_CanMsg18FEEE00_Msg_Count)))
hu's avatar
hu committed
400
    {
hu's avatar
hu committed
401 402
        Water_Temp_Level = 2;
        Over_Heat_Warning_Status = 0;
hu's avatar
hu committed
403
    }
404
    else if ((Coolant_Get_CurSeg() >= 0) && (Coolant_Get_CurSeg() < 12))
hu's avatar
hu committed
405
    {
hu's avatar
hu committed
406 407
        Water_Temp_Level = 0 ;
        Over_Heat_Warning_Status = 0 ;
hu's avatar
hu committed
408
    }
409
    else  if ((Coolant_Get_CurSeg() >= 12) && (Coolant_Get_CurSeg() <= 13))
hu's avatar
hu committed
410
    {
hu's avatar
hu committed
411
        Water_Temp_Level = 1 ;
hu's avatar
hu committed
412

413
        if (Common_Get_Disp_V_Speed() > 20)
hu's avatar
hu committed
414 415 416
            Over_Heat_Warning_Status = 0 ;
        else
            Over_Heat_Warning_Status = 1 ;
hu's avatar
hu committed
417
    }
hu's avatar
hu committed
418

hu's avatar
hu committed
419
    /*电源电压*/
420
    IGN_Voltage  = (9 + Gui_Get_Voltmeter_DisplayMode()) * 10 ;
hu's avatar
hu committed
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463

    CopyData[0] = (uint8_t)(((Water_Temp_Level << 6u) & 0xC0u) |
                            ((Remining_Fuel_Warning << 5u) & 0x20u) |
                            ((Battery_Maintenance_Warning << 3u) & 0x18u) |
                            ((Over_Heat_Warning_Status << 2u) & 0x04u) |
                            (Meter_Malfunction & 0x03u)); /* 1  */
    CopyData[1] = (uint8_t)(((SRS_Input << 7u) & 0x80u) |
                            ((SW_Rear_Body_Warning << 6u) & 0x040u) |
                            ((SW_Sheetbelt << 5u) & 0x20u) |
                            ((SW_Oil_Pressure << 4u) & 0x10u) |
                            ((SW_Coolant_Level << 3u) & 0x08u) |
                            ((SW_Water_Separator << 2u) & 0x04u) |
                            ((SW_Clutch << 1u) & 0x02u) |
                            (SW_Air_Low_Pressure & 0x01u)); /* 2  */
    CopyData[2] = (uint8_t)(((SW_MT_Range << 7u) & 0x80u) |
                            ((SW_MT_Spriter << 6u) & 0x040u) |
                            ((SW_KickDrive << 5u) & 0x20u) |
                            ((SW_DefLock << 4u) & 0x10u) |
                            ((ACG_L_Terminal << 3u) & 0x08u) |
                            ((SW_Dr_Door << 1u) & 0x02u) |
                            (EDS_Smoother_WL_Status & 0x01u)); /* 3  */
    CopyData[3] = (uint8_t)(((EBS_Warning_Red << 7u) & 0x80u) |
                            ((EBS_Warning_Yellow << 6u) & 0x040u) |
                            ((ESC_Operating << 5u) & 0x20u) |
                            ((Air_Sus_Warning << 4u) & 0x10u) |
                            ((Roll_Warning << 3u) & 0x08u) |
                            ((ROWS_Warning << 2u) & 0x04u) |
                            (Mult_Indication & 0x03u)); /* 4  */
    CopyData[4] = (uint8_t)(((SW_KeyRemind << 7u) & 0x80u) |
                            ((SW_Hi_Beam << 6u) & 0x040u) |
                            ((TURN_R_Lamp_Status << 5u) & 0x20u) |
                            ((SW_Illmi << 3u) & 0x08u) |
                            ((SW_SpotLamp << 1u) & 0x02u) |
                            (SW_Accessory_Air & 0x01u)); /* 5  */
    CopyData[5] = (uint8_t)(((SW_Trailer_Brake << 6u) & 0xC0u) |
                            ((Input_Trailer_Info << 5u) & 0x20u) |
                            ((Input_Trailer_ABS << 4u) & 0x10u) |
                            ((SW_Coupler_Lock << 3u) & 0x04u) |
                            (SW_Parking & 0x03)); /* 6  */
    CopyData[6] = (uint8_t)(IGN_Voltage & 0xFFu); /* 7  */
    CopyData[7] = (uint8_t)(((MJX_MEB9_Manual_TM_Range_Low << 7u) & 0x80u) |
                            ((Range_Air_Cut_Warning << 6u) & 0x40u) |
                            ((IRIS_Warning_Lamp_Status << 5u) & 0x20u)); /* 8  */
hu's avatar
hu committed
464
}
hu's avatar
hu committed
465

hu's avatar
hu committed
466 467
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FF9D17
hu's avatar
hu committed
468
 * Description    :
hu's avatar
hu committed
469
 * Input          : None 18FF9D17
hu's avatar
hu committed
470 471 472 473
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
474
void Can_Set_Buff_18FF9D17(uint8_t CopyData[])
hu's avatar
hu committed
475
{
hu's avatar
hu committed
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
    uint8_t Fuel_Level = 0u;

    uint16_t Get_Step = 0u;
    Get_Step = Fuel_Get_Step();

    /*燃油剩余百分比     精度 1% 偏移量 0 */
    if (Get_Step > 10u)
    {
        Fuel_Level = (uint8_t)((Get_Step - 10u) * 100u / 120u);
    }
    else
    {
        Fuel_Level = 0u;
    }

    CopyData[0] = (uint8_t)(Fuel_Level & 0xFFu); /* 1  */
hu's avatar
hu committed
492 493 494 495 496 497 498
    CopyData[1] = 0u;                            /* 2  */
    CopyData[2] = 0u;                            /* 3  */
    CopyData[3] = 0u;                            /* 4  */
    CopyData[4] = 0u;                            /* 5  */
    CopyData[5] = 0u;                            /* 6  */
    CopyData[6] = 0u;                            /* 7  */
    CopyData[7] = 0u;                            /* 8  */
hu's avatar
hu committed
499 500 501 502
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FFE517
hu's avatar
hu committed
503
 * Description    :
hu's avatar
hu committed
504
 * Input          : None  18FFE517
hu's avatar
hu committed
505 506
 * Output         : None
 * Return         : None
hu's avatar
hu committed
507
 * onther         : Event triggered   事件型报文
hu's avatar
hu committed
508
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
509
void Can_Set_Buff_18FFE517(uint8_t CopyData[])
hu's avatar
hu committed
510
{
hu's avatar
hu committed
511 512 513 514
    uint8_t DTC_Clear_Request = 0u;
    uint8_t Req_0Point = 0u;
    uint8_t Ferry_Mode_Cancel = 0u;
    uint8_t System_Demonstration_Request = 0u;
hu's avatar
hu committed
515 516 517 518 519 520

    DTC_Clear_Request = 0u;
    Req_0Point = 0u;
    Ferry_Mode_Cancel = 0u;
    System_Demonstration_Request = 0u;

hu's avatar
hu committed
521 522
    CopyData[0] = (uint8_t)(DTC_Clear_Request & 0xFFu); /* 1  */
    CopyData[1] = (uint8_t)(Req_0Point & 0xFFu);        /* 2  */
hu's avatar
hu committed
523
    CopyData[2] = (uint8_t)(((Ferry_Mode_Cancel << 7u) & 0x80U) |
hu's avatar
hu committed
524 525 526 527 528 529
                            (System_Demonstration_Request & 0x7Fu)); /* 3  */
    CopyData[3] = 0u;                                                /* 4  */
    CopyData[4] = 0u;                                                /* 5  */
    CopyData[5] = 0u;                                                /* 6  */
    CopyData[6] = 0u;                                                /* 7  */
    CopyData[7] = 0u;                                                /* 8  */
hu's avatar
hu committed
530 531 532
}
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18EF2D17
hu's avatar
hu committed
533
 * Description    :
hu's avatar
hu committed
534
 * Input          : None 18EF2D17  未见此报文
hu's avatar
hu committed
535 536 537 538
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
539
void Can_Set_Buff_18EF2D17(uint8_t CopyData[])
hu's avatar
hu committed
540
{
hu's avatar
hu committed
541 542 543 544 545 546 547 548
    CopyData[0] = 0u; /* 1  */
    CopyData[1] = 0u; /* 2  */
    CopyData[2] = 0u; /* 3  */
    CopyData[3] = 0u; /* 4  */
    CopyData[4] = 0u; /* 5  */
    CopyData[5] = 0u; /* 6  */
    CopyData[6] = 0u; /* 7  */
    CopyData[7] = 0u; /* 8  */
hu's avatar
hu committed
549 550 551
}
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18033317
hu's avatar
hu committed
552
 * Description    : 胎压匹配外发报文 事件型
hu's avatar
hu committed
553
 * Input          : None  18033317
hu's avatar
hu committed
554 555 556 557
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
558
void Can_Set_Buff_18033317(uint8_t CopyData[])
hu's avatar
hu committed
559
{
hu's avatar
hu committed
560 561
    uint8_t Pair_cmd = 0u;

hu's avatar
hu committed
562 563
    Common_SetTXNum_18033317();

hu's avatar
hu committed
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
    if (User_set_Num.User_TpmsStatus == 2)
    {
        CopyData[0] = 0x61u;
        switch (User_set_Num.User_Tpms)
        {
        case 1 :
            CopyData[1] = 0x12;
            break;
        case 2 :
            CopyData[1] = 0x13;
            break;
        case 3 :
            CopyData[1] = 0x22;
            break;
        case 4 :
            CopyData[1] = 0x23;
            break;
        case 5 :
            CopyData[1] = 0x31;
            break;
        case 6 :
            CopyData[1] = 0x32;
            break;
        case 7 :
            CopyData[1] = 0x33;
            break;
        case 8 :
            CopyData[1] = 0x34;
            break;
        case 9 :
            CopyData[1] = 0x41;
            break;
        case 10 :
            CopyData[1] = 0x42;
            break;
        case 11 :
            CopyData[1] = 0x43;
            break;
        case 12 :
            CopyData[1] = 0x44;
            break;
        default    :
            break   ;
        }
    }
hu's avatar
hu committed
609
    else if (User_set_Num.User_TpmsStatus == 1)
hu's avatar
hu committed
610 611 612 613
    {
        CopyData[0] = 0x91;                        /* 1  */
        CopyData[1] = 0u;                          /* 2  */
    }
hu's avatar
hu committed
614

hu's avatar
hu committed
615 616 617 618 619 620
    CopyData[2] = 0u;                          /* 3  */
    CopyData[3] = 0u;                          /* 4  */
    CopyData[4] = 0u;                          /* 5  */
    CopyData[5] = 0u;                          /* 6  */
    CopyData[6] = 0u;                          /* 7  */
    CopyData[7] = 0u;                          /* 8  */
hu's avatar
hu committed
621
}
hu's avatar
hu committed
622 623 624 625 626
void Id18033317_Send_Service(void)
{
    if (User_set_Num.User_TpmsSend == 3u)
    {
        Can_Msg_Tx_Overwrite(MSGID_18033317, 3u, 50 * 1000);
hu's avatar
hu committed
627 628 629

        User_set_Num.User_TpmsSend = 0u;
        TXNum_18033317 = 0u;
hu's avatar
hu committed
630 631
    }
}
hu's avatar
hu committed
632 633
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_180433A2
hu's avatar
hu committed
634
 * Description    :
hu's avatar
hu committed
635
 * Input          : None 180433A2
hu's avatar
hu committed
636 637 638 639
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
640
void Can_Set_Buff_180433A2(uint8_t CopyData[])
hu's avatar
hu committed
641
{
hu's avatar
hu committed
642 643 644 645 646
    uint8_t Setup_cmd = 0u;

    Setup_cmd = 0u;

    CopyData[0] = (uint8_t)(Setup_cmd & 0xFFu); /* 1  */
hu's avatar
hu committed
647 648 649 650 651 652 653
    CopyData[1] = 0u;                           /* 2  */
    CopyData[2] = 0u;                           /* 3  */
    CopyData[3] = 0u;                           /* 4  */
    CopyData[4] = 0u;                           /* 5  */
    CopyData[5] = 0u;                           /* 6  */
    CopyData[6] = 0u;                           /* 7  */
    CopyData[7] = 0u;                           /* 8  */
hu's avatar
hu committed
654 655 656 657 658
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18EF1817
 * Description    :
hu's avatar
hu committed
659
 * Input          : None 18EF1817
hu's avatar
hu committed
660 661 662 663 664
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
void Can_Set_Buff_18EF1817(uint8_t CopyData[])
hu's avatar
hu committed
665
{
hu's avatar
hu committed
666 667
    uint8_t Trip_Type = 0u;

hu's avatar
hu committed
668
    if (State_Flag.FState_ClearOilTx == 0x02u)
hu's avatar
hu committed
669 670 671
    {
        if (Trip_Type == TRAPA)
        {
hu's avatar
hu committed
672 673 674 675 676 677 678 679
            CopyData[0] = 0x40;
            CopyData[1] = 0x50;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
680 681 682
        }
        else if (Trip_Type == TRAPB)
        {
hu's avatar
hu committed
683 684 685 686 687 688 689 690
            CopyData[0] = 0x40;
            CopyData[1] = 0x60;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
691
        }
hu's avatar
hu committed
692

hu's avatar
hu committed
693
        User_BCM_Flag = 1u; /*从头轮询*/
hu's avatar
hu committed
694
        State_Flag.FState_ClearOilTx = 0x00u;
hu's avatar
hu committed
695 696
        State_Flag.FState_ClearOilRx = 0u;
        State_Flag.FState_COilTimeOut = 0u;
hu's avatar
hu committed
697 698 699 700 701
    }
    else
    {
        if ((State_Flag.FState_ClearOilRx == 0u) && (State_Flag.FState_COilTimeOut != FState_COilTimeOutNum))
        {
hu's avatar
hu committed
702
            return;
hu's avatar
hu committed
703 704 705 706 707 708 709 710 711 712 713
        }

        User_BCM_Flag++;
        if (User_BCM_Flag > 11u)
        {
            User_BCM_Flag = 1u;
        }

        switch (User_BCM_Flag)
        {
        case 1:
hu's avatar
hu committed
714 715 716 717 718 719 720 721
            CopyData[0] = 0x01;
            CopyData[1] = 0x50;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
722 723
            break;
        case 2:
hu's avatar
hu committed
724 725 726 727 728 729 730 731
            CopyData[0] = 0x01;
            CopyData[1] = 0x51;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
732 733
            break;
        case 3:
hu's avatar
hu committed
734 735 736 737 738 739 740 741
            CopyData[0] = 0x01;
            CopyData[1] = 0x52;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
742 743
            break;
        case 4:
hu's avatar
hu committed
744 745 746 747 748 749 750 751
            CopyData[0] = 0x01;
            CopyData[1] = 0x53;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
752 753
            break;
        case 5:
hu's avatar
hu committed
754 755 756 757 758 759 760 761
            CopyData[0] = 0x01;
            CopyData[1] = 0x54;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
762 763
            break;
        case 6:
hu's avatar
hu committed
764 765 766 767 768 769 770 771
            CopyData[0] = 0x01;
            CopyData[1] = 0x60;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
772 773
            break;
        case 7:
hu's avatar
hu committed
774 775 776 777 778 779 780 781
            CopyData[0] = 0x01;
            CopyData[1] = 0x61;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
782 783
            break;
        case 8:
hu's avatar
hu committed
784 785 786 787 788 789 790 791
            CopyData[0] = 0x01;
            CopyData[1] = 0x62;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
792 793
            break;
        case 9:
hu's avatar
hu committed
794 795 796 797 798 799 800 801
            CopyData[0] = 0x01;
            CopyData[1] = 0x63;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
802 803
            break;
        case 10:
hu's avatar
hu committed
804 805 806 807 808 809 810 811
            CopyData[0] = 0x01;
            CopyData[1] = 0x64;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
812 813
            break;
        case 11:
hu's avatar
hu committed
814 815 816 817 818 819 820 821
            CopyData[0] = 0x01;
            CopyData[1] = 0x22;
            CopyData[2] = 0x00;
            CopyData[3] = 0x00;
            CopyData[4] = 0x00;
            CopyData[5] = 0x00;
            CopyData[6] = 0xFF;
            CopyData[7] = 0xFF;
hu's avatar
hu committed
822 823 824 825
            break;
        default:
            break;
        }
hu's avatar
hu committed
826 827
    }
}
hu's avatar
hu committed
828

hu's avatar
hu committed
829
void Id18EF1817_Send_Service(void)
hu's avatar
hu committed
830
{
hu's avatar
hu committed
831 832
    /*准备事件型*/
    if (State_Flag.FState_ClearOilTx == 1u)
hu's avatar
hu committed
833 834
    {
        Can_Msg_Tx_Overwrite(MSGID_18EF1817, 1u, 100 * 1000);
hu's avatar
hu committed
835 836
        /*事件型复制*/
        State_Flag.FState_ClearOilTx = 2u;
hu's avatar
hu committed
837 838 839 840 841 842 843 844 845 846 847
    }
    else
    {
        if ((State_Flag.FState_ClearOilRx == 0u) && (State_Flag.FState_COilTimeOut != FState_COilTimeOutNum))
        {
            Can_Msg_Tx_Overwrite(MSGID_18EF1817, 0u, 100 * 1000);
        }
        else
        {
            Can_Msg_Tx_Overwrite(MSGID_18EF1817, 0xFFFFu, 100 * 1000);
        }
hu's avatar
hu committed
848
    }
hu's avatar
hu committed
849 850
}

hu's avatar
hu committed
851 852
/*-------------------------------------------------------------------------
 * Function Name  : Drive_Info_IC1_STATUS_Rx
hu's avatar
hu committed
853
 * Description    : 18EF1718 报文循环接收处理  100ms任务中执行
hu's avatar
hu committed
854 855 856 857 858
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873
void Drive_Info_IC1_STATUS_Rx(void)
{
    uint32_t Temp = 0u;
    uint8_t Data_Sig = 0u;
    uint8_t Data_Type = 0u;

    Data_Sig = Get_ID_18EF1718_Sig_Response_Code();
    Data_Type = Get_ID_18EF1718_Sig_Data_Type();
    Temp = Get_ID_18EF1718_Sig_Date();

    switch (Data_Sig)
    {
    case 0x81:
        switch (Data_Type)
        {
hu's avatar
hu committed
874 875
        case 0x50:
            User_ECU.TripA_Fuel = Temp;
hu's avatar
hu committed
876
            break;
hu's avatar
hu committed
877 878
        case 0x51:
            User_ECU.TripA_Average_Speed = Temp;
hu's avatar
hu committed
879
            break;
hu's avatar
hu committed
880 881
        case 0x52:
            User_ECU.TripA_Fuel_Consume = Temp;
hu's avatar
hu committed
882
            break;
hu's avatar
hu committed
883 884
        case 0x53:
            User_ECU.TripA_Idling = Temp;
hu's avatar
hu committed
885
            break;
hu's avatar
hu committed
886 887
        case 0x54:
            User_ECU.TripA_Runing = Temp;
hu's avatar
hu committed
888
            break;
hu's avatar
hu committed
889 890
        case 0x60:
            User_ECU.TripB_Fuel = Temp;
hu's avatar
hu committed
891
            break;
hu's avatar
hu committed
892 893
        case 0x61:
            User_ECU.TripB_Average_Speed = Temp;
hu's avatar
hu committed
894
            break;
hu's avatar
hu committed
895 896
        case 0x62:
            User_ECU.TripB_Fuel_Consume = Temp;
hu's avatar
hu committed
897
            break;
hu's avatar
hu committed
898 899
        case 0x63:
            User_ECU.TripB_Idling = Temp;
hu's avatar
hu committed
900
            break;
hu's avatar
hu committed
901 902
        case 0x64:
            User_ECU.TripB_Runing = Temp;
hu's avatar
hu committed
903
            break;
hu's avatar
hu committed
904 905
        case 0x22:
            User_ECU.Engine_Surplus = Temp;
hu's avatar
hu committed
906 907 908 909 910 911 912 913
            break;
        default:
            break;
        }
        break;
    case 0x40:
        switch (Data_Type)
        {
hu's avatar
hu committed
914 915
        case 0x50:
            User_ECU.TripA_Fuel = Temp;
hu's avatar
hu committed
916
            break;
hu's avatar
hu committed
917 918
        case 0x51:
            User_ECU.TripA_Average_Speed = Temp;
hu's avatar
hu committed
919
            break;
hu's avatar
hu committed
920 921
        case 0x52:
            User_ECU.TripA_Fuel_Consume = Temp;
hu's avatar
hu committed
922
            break;
hu's avatar
hu committed
923 924
        case 0x53:
            User_ECU.TripA_Idling = Temp;
hu's avatar
hu committed
925
            break;
hu's avatar
hu committed
926 927
        case 0x54:
            User_ECU.TripA_Runing = Temp;
hu's avatar
hu committed
928
            break;
hu's avatar
hu committed
929 930
        case 0x60:
            User_ECU.TripB_Fuel = Temp;
hu's avatar
hu committed
931
            break;
hu's avatar
hu committed
932 933
        case 0x61:
            User_ECU.TripB_Average_Speed = Temp;
hu's avatar
hu committed
934
            break;
hu's avatar
hu committed
935 936
        case 0x62:
            User_ECU.TripB_Fuel_Consume = Temp;
hu's avatar
hu committed
937
            break;
hu's avatar
hu committed
938 939
        case 0x63:
            User_ECU.TripB_Idling = Temp;
hu's avatar
hu committed
940
            break;
hu's avatar
hu committed
941 942
        case 0x64:
            User_ECU.TripB_Runing = Temp;
hu's avatar
hu committed
943
            break;
hu's avatar
hu committed
944 945
        case 0x22:
            User_ECU.Engine_Surplus = Temp;
hu's avatar
hu committed
946 947 948 949 950 951 952 953 954
            break;
        default:
            break;
        }
        break;
    default:
        break;
    }

hu's avatar
hu committed
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970
#if 0
    if (State_Flag.FState_COilTimeOut < FState_COilTimeOutNum)
    {
        State_Flag.FState_COilTimeOut++;

        if (State_Flag.FState_COilTimeOut == FState_COilTimeOutNum)
        {
            State_Flag.FState_ClearOilTx = 0u;
        }
    }

    if (Data_Sig == 0x40u)
    {
        State_Flag.FState_ClearOilRx == 1;
    }
#endif
hu's avatar
hu committed
971 972
}

hu's avatar
hu committed
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001
void Drive_Info_IC3_STATUS_Rx(void)
{
    if (bCurMenuIDX != _MN_DSP_LEVEL3_4_MENU_5)
    {
        if (TPMS_Matching.FLAG == 1)
            return;

        TPMS_Matching.T01 = 0u;
        TPMS_Matching.T02 = 0u;
        TPMS_Matching.T03 = 0u;
        TPMS_Matching.T04 = 0u;
        TPMS_Matching.T05 = 0u;
        TPMS_Matching.T06 = 0u;
        TPMS_Matching.T07 = 0u;
        TPMS_Matching.T08 = 0u;
        TPMS_Matching.T09 = 0u;
        TPMS_Matching.T10 = 0u;
        TPMS_Matching.T11 = 0u;
        TPMS_Matching.T12 = 0u;

        TPMS_Matching.FLAG = 1u;
    }

    if ((Msg_18021733[0] == 0x61) && (Common_Get_TPMS_TEST_OFF_Time_Sta() == 0))
    {
        TPMS_Matching.FLAG = 0;

        Msg_18021733[0] = 0;

hu's avatar
hu committed
1002
        if ((User_set_Num.User_TpmsStatus == 2) && (Common_GetTXNum_18033317() >= 3u))
hu's avatar
hu committed
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074
        {
            switch (User_set_Num.User_Tpms)
            {
            case 1:
                TPMS_Matching.T01 = 1;
                break;
            case 2:
                TPMS_Matching.T02 = 1;
                break;
            case 3:
                TPMS_Matching.T03 = 1;
                break;
            case 4:
                TPMS_Matching.T04 = 1;
                break;
            case 5:
                TPMS_Matching.T05 = 1;
                break;
            case 6:
                TPMS_Matching.T06 = 1;
                break;
            case 7:
                TPMS_Matching.T07 = 1;
                break;
            case 8:
                TPMS_Matching.T08 = 1;
                break;
            case 9:
                TPMS_Matching.T09 = 1;
                break;
            case 10:
                TPMS_Matching.T10 = 1;
                break;
            case 11:
                TPMS_Matching.T11 = 1;
                break;
            case 12:
                TPMS_Matching.T12 = 1;
                break;
            default:
                break;
            }

            User_set_Num.User_Tpms ++;

            if (User_set_Num.User_Tpms == 0x0d)
                User_set_Num.User_TpmsStatus = 0;
            else
                User_set_Num.User_TpmsStatus = 1;
        }
    }
    else  if ((Msg_18021733[0]  == 0xFF) && (Msg_18021733[1]  == 0x06))
    {
        TPMS_Matching.FLAG = 0;

        Msg_18021733[0] = 0;
        Msg_18021733[1] = 0;
        User_set_Num.User_TpmsStatus = 1;
    }
    else if (Common_Get_TPMS_TEST_OFF_Time_Sta() == 1u)
    {
        TPMS_Matching.FLAG = 0;

        Msg_18021733[0] = 0;
        Msg_18021733[1] = 0;
        User_set_Num.User_TpmsStatus = 1;
    }
}

void MSG_18021733_REC_COPY(uint8_t copy[])
{
    uint8_t i = 0u;
hu's avatar
hu committed
1075

hu's avatar
hu committed
1076 1077 1078 1079 1080
    for (i = 0u; i < 8u; i++)
    {
        Msg_18021733[i] = copy[i];
    }
}
hu's avatar
hu committed
1081 1082 1083 1084 1085 1086 1087 1088
/*-------------------------------------------------------------------------
 * Function Name  : Common_Data_Get_TripA_Fuel
 * Description    :
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
1089 1090
uint32_t Common_Data_Get_TripA_Fuel(void)
{
hu's avatar
hu committed
1091
    return User_ECU.TripA_Fuel;
hu's avatar
hu committed
1092
}
hu's avatar
hu committed
1093 1094 1095 1096 1097 1098 1099 1100 1101

/*-------------------------------------------------------------------------
 * Function Name  : Common_Data_Get_TripA_Average_Speed
 * Description    :
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
1102 1103
uint32_t Common_Data_Get_TripA_Average_Speed(void)
{
hu's avatar
hu committed
1104
    return User_ECU.TripA_Average_Speed;
hu's avatar
hu committed
1105
}
hu's avatar
hu committed
1106 1107 1108 1109 1110 1111 1112 1113 1114

/*-------------------------------------------------------------------------
 * Function Name  : Common_Data_Get_TripB_Fuel
 * Description    :
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
1115 1116
uint32_t Common_Data_Get_TripB_Fuel(void)
{
hu's avatar
hu committed
1117
    return User_ECU.TripB_Fuel;
hu's avatar
hu committed
1118
}
hu's avatar
hu committed
1119 1120 1121 1122 1123 1124 1125 1126 1127

/*-------------------------------------------------------------------------
 * Function Name  : Common_Data_Get_TripB_Average_Speed
 * Description    :
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
1128 1129
uint32_t Common_Data_Get_TripB_Average_Speed(void)
{
hu's avatar
hu committed
1130
    return User_ECU.TripB_Average_Speed;
hu's avatar
hu committed
1131
}
hu's avatar
hu committed
1132 1133 1134 1135 1136 1137 1138 1139 1140

void Common_SetTXNum_18033317(void)
{
    TXNum_18033317 ++;
}
uint8_t Common_GetTXNum_18033317(void)
{
    return TXNum_18033317;
}