CAN_FUNC.c 24.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 19
/*增加外发计算部分引用文件*/
#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
20

hu's avatar
hu committed
21 22 23 24
/*---------------------------------------------------------------------------
使用しない Byte、bit に関しては全て 1(B)をセットして出力すること
对于不使用的Byte、bit,全部设置1(B)并输出
----------------------------------------------------------------------------*/
hu's avatar
hu committed
25
USER_ECU User_ECU;
hu's avatar
hu committed
26 27
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FEAE17
hu's avatar
hu committed
28
 * Description    :
hu's avatar
hu committed
29 30 31 32 33
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
34
typedef union
hu's avatar
hu committed
35 36
{
    uint8_t Data[8] ;
hu's avatar
hu committed
37
    struct
hu's avatar
hu committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
    {
        //0~FA:0~2000 [kPa] FB~FF:Not used // Factor:8
        uint8_t Main_Air_Pressure               : 8 ;//WET 预留

        uint8_t Not_used0                       : 2 ;
        uint8_t Not_used1                       : 2 ;
        uint8_t Not_used2                       : 2 ;
        uint8_t Not_used3                       : 2 ;
        //0~FA:0~2000 [kPa] FB~FF:Not used // Factor:8
        uint8_t Service_Brake_Circuit1_AirPressure          : 8 ;
        //0~FA:0~2000 [kPa] FB~FF:Not used // Factor:8
        uint8_t Service_Brake_Circuit2_AirPressure          : 8 ;

        uint8_t Not_used4                       : 8 ;
        //0~2D0:0~36 [V] 2D1~FFFF:Not used // Factor:0.05
        uint8_t Power_Supply_Voltage_L          : 8 ;
        uint8_t Power_Supply_Voltage_H          : 8 ;

        uint8_t SW_ECONO                        : 2 ;
        uint8_t Rader_Stain_Information         : 2 ;
        uint8_t Not_used5                       : 2 ;
        uint8_t Parking_Brake_Switch            : 2 ;
hu's avatar
hu committed
60 61
    } bit;
} _Msg18FEAE17Map;
hu's avatar
hu committed
62 63 64 65 66

void Can_Set_Buff_18FEAE17(uint8_t CopyData [])
{
    uint8_t i ;
    _Msg18FEAE17Map MsgMap ;
hu's avatar
hu committed
67
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
68 69 70
    {
        MsgMap.Data[ i ] = 0xff ;
    }
71 72
    //MsgMap.bit.Service_Brake_Circuit1_AirPressure = (uint8_t)(AirPressure_Get_kPa(0) >> 3) ;
    //MsgMap.bit.Service_Brake_Circuit2_AirPressure = (uint8_t)(AirPressure_Get_kPa(1) >> 3) ;
hu's avatar
hu committed
73

hu's avatar
hu committed
74
    if (RTE_Read_KL30_Valid())
hu's avatar
hu committed
75 76 77 78 79 80 81 82 83 84 85
    {

        MsgMap.bit.Power_Supply_Voltage_L = (uint8_t)(RTE_Read_KL30_Voltage() / 50);
        MsgMap.bit.Power_Supply_Voltage_H = (uint8_t)((RTE_Read_KL30_Voltage() / 50) >> 8);

    }
    else
    {
        MsgMap.bit.Power_Supply_Voltage_L = 0;
        MsgMap.bit.Power_Supply_Voltage_H = 0;
    }
hu's avatar
hu committed
86 87

    if (Line_In_Get_Status(LINE_IN_PARK_BRAKE))
hu's avatar
hu committed
88 89 90 91 92 93 94 95
    {
        MsgMap.bit.Parking_Brake_Switch = 1 ;
    }
    else
    {
        MsgMap.bit.Parking_Brake_Switch = 0 ;
    }

hu's avatar
hu committed
96
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
97 98 99 100 101 102 103
    {
        CopyData[ i ] = MsgMap.Data[ i ]  ;
    }
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FF3E17
hu's avatar
hu committed
104
 * Description    :
hu's avatar
hu committed
105 106 107 108 109
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
110
typedef union
hu's avatar
hu committed
111 112
{
    uint8_t Data[8] ;
hu's avatar
hu committed
113
    struct
hu's avatar
hu committed
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
    {

        uint16_t Pulse_Correction_Facor         : 16 ;

        uint8_t Not_used0                       : 1 ;
        uint8_t HID_Auto_Leveling               : 1 ;
        uint8_t Not_used1                       : 1 ;
        uint8_t Not_used2                       : 1 ;
        uint8_t AEBS_ON_OFF_Info                : 2 ;
        uint8_t Not_used3                       : 1 ;
        uint8_t SW_PTO                          : 1 ;

        uint8_t Not_used4                       : 7 ;
        uint8_t MIL_Lamp_Status                 : 1 ;

        uint8_t Fuel_Gauges_AD_Value            : 8 ;

        uint8_t Not_used5                       : 8 ;

        uint8_t Not_used6                       : 8 ;

        uint8_t DstWarnVolume_Set               : 3 ;
        uint8_t Not_used7                       : 1 ;
        uint8_t Not_used8                       : 1 ;
        uint8_t TURN_L_Lamp_Status              : 1 ;
        uint8_t Not_used9                       : 1 ;
hu's avatar
hu committed
140
        uint8_t Not_used10                      : 1 ;
hu's avatar
hu committed
141 142
    } bit;
} _Msg18FF3E17Map;
hu's avatar
hu committed
143 144 145 146
void Can_Set_Buff_18FF3E17(uint8_t CopyData [])
{
    uint8_t i ;
    _Msg18FF3E17Map MsgMap ;
hu's avatar
hu committed
147
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
148 149 150 151 152 153
    {
        MsgMap.Data[ i ] = 0xff ;
    }



hu's avatar
hu committed
154
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
155 156 157 158 159 160
    {
        CopyData[ i ] = MsgMap.Data[ i ]  ;
    }
}
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FED917
hu's avatar
hu committed
161
 * Description    :
hu's avatar
hu committed
162 163 164 165 166
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
167
typedef union
hu's avatar
hu committed
168 169
{
    uint8_t Data[8] ;
hu's avatar
hu committed
170
    struct
hu's avatar
hu committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
    {
        uint8_t Not_used0                       : 4 ;
        uint8_t BlendingSwitchPosition          : 2 ;
        uint8_t Not_used1                       : 2 ;

        uint8_t Not_used2                       : 2 ;
        uint8_t TralierABSFullyOperational      : 2 ;
        uint8_t TralierABSDitected              : 2 ;
        uint8_t TralierConnected                : 2 ;

        uint8_t Not_used3                       : 8 ;
        uint8_t Not_used4                       : 8 ;
        uint8_t Not_used5                       : 8 ;
        uint8_t Not_used6                       : 8 ;
        uint8_t Not_used7                       : 8 ;
        uint8_t Not_used8                       : 8 ;

hu's avatar
hu committed
188 189
    } bit;
} _Msg18FED917Map;
hu's avatar
hu committed
190 191 192 193
void Can_Set_Buff_18FED917(uint8_t CopyData [])
{
    uint8_t i ;
    _Msg18FED917Map MsgMap ;
hu's avatar
hu committed
194
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
195 196 197 198 199 200
    {
        MsgMap.Data[ i ] = 0xff ;
    }



hu's avatar
hu committed
201
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
202 203 204 205 206 207 208
    {
        CopyData[ i ] = MsgMap.Data[ i ]  ;
    }
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FEE617
hu's avatar
hu committed
209
 * Description    :
hu's avatar
hu committed
210 211 212 213 214
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
215
typedef union
hu's avatar
hu committed
216 217
{
    uint8_t Data[8] ;
hu's avatar
hu committed
218
    struct
hu's avatar
hu committed
219 220 221 222 223 224 225 226 227
    {
        uint8_t Seconds                         : 8 ;//Factor 0.25
        uint8_t Minutes                         : 8 ;
        uint8_t Hours                           : 8 ;
        uint8_t Month                           : 8 ;
        uint8_t Day                             : 8 ;//Factor 0.25
        uint8_t Year                            : 8 ;//Offset 1985
        uint8_t Not_used                        : 8 ;
        uint8_t Not_used1                       : 8 ;
hu's avatar
hu committed
228 229
    } bit;
} _Msg18FEE617Map;
hu's avatar
hu committed
230 231 232 233
void Can_Set_Buff_18FEE617(uint8_t CopyData [])
{
    uint8_t i ;
    _Msg18FEE617Map MsgMap ;
hu's avatar
hu committed
234
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
235 236 237 238 239 240 241 242 243
    {
        MsgMap.Data[ i ] = 0xff ;
    }

    MsgMap.bit.Seconds = Get_RTC_SECOND() << 2;
    MsgMap.bit.Minutes = Get_RTC_MINUTE();
    MsgMap.bit.Hours   = Get_RTC_HOUR();
    MsgMap.bit.Day     = Get_RTC_DATE() << 2 ;
    MsgMap.bit.Month   = Get_RTC_MONTH();
hu's avatar
hu committed
244
    MsgMap.bit.Year    = Get_RTC_YEAR() + 15;
hu's avatar
hu committed
245

hu's avatar
hu committed
246
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
247 248 249 250 251 252
    {
        CopyData[ i ] = MsgMap.Data[ i ]  ;
    }
}
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18EF1817
hu's avatar
hu committed
253
 * Description    :
hu's avatar
hu committed
254 255 256 257 258 259 260 261 262 263
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/

//Byte:6为最高级别Byte,Byte:3为最低级别Byte
void Can_Set_Buff_18EF1817(uint8_t CopyData [])
{

hu's avatar
hu committed
264

hu's avatar
hu committed
265 266 267 268
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FEE017
hu's avatar
hu committed
269
 * Description    :
hu's avatar
hu committed
270 271 272 273 274
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
275
typedef union
hu's avatar
hu committed
276 277
{
    uint8_t Data[8] ;
hu's avatar
hu committed
278
    struct
hu's avatar
hu committed
279 280 281 282 283 284 285 286 287 288 289
    {
        //uint32_t Not_used                        : 32 ;
        //uint32_t Total_Vehicle_Distance          : 32 ; //Factor 0.125
        uint8_t Not_used                        : 8 ;
        uint8_t                         : 8 ;
        uint8_t                         : 8 ;
        uint8_t                         : 8 ;
        uint8_t                         : 8 ;
        uint8_t                         : 8 ;
        uint8_t                         : 8 ;
        uint8_t                         : 8 ;
hu's avatar
hu committed
290 291
    } bit;
} _Msg18FEE017Map;
hu's avatar
hu committed
292 293 294 295
void Can_Set_Buff_18FEE017(uint8_t CopyData [])
{
    uint8_t i ;
    _Msg18FEE017Map MsgMap ;
hu's avatar
hu committed
296
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
297 298 299 300 301 302
    {
        MsgMap.Data[ i ] = 0xff ;
    }

    //MsgMap.bit.Total_Vehicle_Distance = (Data_ODO_Read()/10) << 3 ;

hu's avatar
hu committed
303
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
304 305 306 307 308 309 310
    {
        CopyData[ i ] = MsgMap.Data[ i ]  ;
    }
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FEFC17
hu's avatar
hu committed
311
 * Description    :
hu's avatar
hu committed
312 313 314 315 316
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
317
typedef union
hu's avatar
hu committed
318 319
{
    uint8_t Data[8] ;
hu's avatar
hu committed
320
    struct
hu's avatar
hu committed
321 322 323 324 325 326 327 328
    {
        uint8_t WasherFluidLevel                         : 8 ;//Factor 0.4
        uint8_t FuelLevel_1                              : 8 ;//Factor 0.4
        uint8_t EngFuelFilterDiffPressure                : 8 ;//Factor 2
        uint8_t EngOilFilterDiffPressure                 : 8 ;//Factor 0.5
        uint16_t CargoAmbientTemperature                  : 16;//Factor 0.03125  Offset -273
        uint8_t FuelLevel_2                              : 8 ;//Factor 0.4
        uint8_t EngOilFilterDiffPressure_ExtRange        : 8 ;//Factor 5
hu's avatar
hu committed
329 330
    } bit;
} _Msg18FEFC17Map;
hu's avatar
hu committed
331 332 333 334
void Can_Set_Buff_18FEFC17(uint8_t CopyData [])
{
    uint8_t i ;
    _Msg18FEFC17Map MsgMap ;
hu's avatar
hu committed
335
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
336 337 338 339 340 341
    {
        MsgMap.Data[ i ] = 0xff ;
    }



hu's avatar
hu committed
342
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
343 344 345 346 347 348 349
    {
        CopyData[ i ] = MsgMap.Data[ i ]  ;
    }
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FF2517
hu's avatar
hu committed
350
 * Description    :
hu's avatar
hu committed
351 352 353 354 355
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
356
typedef union
hu's avatar
hu committed
357 358
{
    uint8_t Data[8] ;
hu's avatar
hu committed
359
    struct
hu's avatar
hu committed
360 361 362 363 364 365 366 367 368
    {
        uint8_t Year                                  : 8 ;//0~63: 0~99 [Year]
        uint8_t Month                                 : 8 ;//1~C: 1~12 [Month]
        uint8_t Day                                   : 8 ;//1~1F: 1~31 [Day]
        uint8_t Hour                                  : 8 ;//0~18:0~24 [Hour]
        uint8_t Minute                                : 8 ;//0~3B: 0~59 [Minute]
        uint8_t ODOMeter_L                            : 8 ;
        uint8_t ODOMeter_M                            : 8 ;
        uint8_t ODOMeter_H                            : 8 ;
hu's avatar
hu committed
369 370
    } bit;
} _Msg18FF2517Map;
hu's avatar
hu committed
371 372 373 374
void Can_Set_Buff_18FF2517(uint8_t CopyData [])
{
    uint8_t i ;
    _Msg18FF2517Map MsgMap ;
hu's avatar
hu committed
375
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
376 377 378 379 380 381 382 383 384 385
    {
        MsgMap.Data[ i ] = 0xff ;
    }

    MsgMap.bit.Year = Get_RTC_YEAR() ;
    MsgMap.bit.Month = Get_RTC_MONTH() ;
    MsgMap.bit.Hour = Get_RTC_HOUR() ;
    MsgMap.bit.Day = Get_RTC_DATE() ;
    MsgMap.bit.Year = Get_RTC_YEAR() ;
    MsgMap.bit.Minute = Get_RTC_MINUTE() ;
hu's avatar
hu committed
386 387 388
    MsgMap.bit.ODOMeter_L = (uint8_t)(Data_ODO_Read() / 10) ;
    MsgMap.bit.ODOMeter_M = (uint8_t)((Data_ODO_Read() / 10) >> 8)  ;
    MsgMap.bit.ODOMeter_H = (uint8_t)((Data_ODO_Read() / 10) >> 16) ;
hu's avatar
hu committed
389

hu's avatar
hu committed
390
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
391 392 393 394 395 396 397
    {
        CopyData[ i ] = MsgMap.Data[ i ]  ;
    }
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FF2A17
hu's avatar
hu committed
398
 * Description    :
hu's avatar
hu committed
399 400 401 402 403
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
404
typedef union
hu's avatar
hu committed
405 406
{
    uint8_t Data[8] ;
hu's avatar
hu committed
407
    struct
hu's avatar
hu committed
408 409 410 411 412 413 414 415 416 417 418 419 420 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 464 465 466
    {
        uint8_t Meter_Malfunction               : 2 ;
        uint8_t Over_Heat_Warning_Status        : 1 ;
        uint8_t Battery_Maintenance_Warning     : 2 ;
        uint8_t Remining_Fuel_Warning           : 1 ;
        uint8_t Water_Temp_Level                : 2 ;

        uint8_t SW_Air_Low_Pressure             : 1 ;
        uint8_t SW_Clutch                       : 1 ;
        uint8_t SW_Water_Separator              : 1 ;
        uint8_t SW_Coolant_Level                : 1 ;
        uint8_t SW_Oil_Pressure                 : 1 ;
        uint8_t SW_Sheetbelt                    : 1 ;
        uint8_t SW_Rear_Body_Warning            : 1 ;
        uint8_t SRS_Input                       : 1 ;

        uint8_t EDS_Smoother_WL_Status          : 1 ;
        uint8_t SW_Dr_Door                      : 1 ;
        uint8_t Reserve                         : 1 ;
        uint8_t ACG_L_Terminal                  : 1 ;
        uint8_t SW_DefLock                      : 1 ;
        uint8_t SW_KickDrive                    : 1 ;
        uint8_t SW_MT_Spriter                   : 1 ;
        uint8_t SW_MT_Range                     : 1 ;

        uint8_t Mult_Indication                 : 2 ;
        uint8_t ROWS_Warning                    : 1 ;
        uint8_t Roll_Warning                    : 1 ;
        uint8_t Air_Sus_Warning                 : 1 ;
        uint8_t ESC_Operating                   : 1 ;
        uint8_t EBS_Warning_Yellow              : 1 ;
        uint8_t EBS_Warning_Red                 : 1 ;

        uint8_t SW_Accessory_Air                : 1 ;
        uint8_t SW_SpotLamp                     : 1 ;
        uint8_t Not_used                        : 1 ;
        uint8_t SW_Illmi                        : 1 ;
        uint8_t Not_used0                       : 1 ;
        uint8_t TURN_R_Lamp_Status              : 1 ;
        uint8_t SW_Hi_Beam                      : 1 ;
        uint8_t SW_KeyRemind                    : 1 ;

        uint8_t SW_Parking                      : 2 ;
        uint8_t Not_used1                       : 1 ;
        uint8_t SW_Coupler_Lock                 : 1 ;
        uint8_t Input_Trailer_ABS               : 1 ;
        uint8_t Input_Trailer_Info              : 1 ;
        uint8_t SW_Trailer_Brake                : 2 ;

        uint8_t IGN_Voltage                     : 8 ;

        uint8_t Not_used2                       : 1 ;
        uint8_t Not_used3                       : 1 ;
        uint8_t Not_used4                       : 1 ;
        uint8_t Not_used5                       : 1 ;
        uint8_t Not_used6                       : 1 ;
        uint8_t IRIS_Warning_Lamp_Status        : 1 ;
        uint8_t Range_Air_Cut_Warning           : 1 ;
        uint8_t MJX_MEB9_Manual_TM_Range_Low    : 1 ;
hu's avatar
hu committed
467 468
    } bit;
} _Msg18FF2A17Map;
hu's avatar
hu committed
469 470 471 472 473 474 475 476

void Can_Set_Buff_18FF2A17(uint8_t CopyData [])
{
    uint32_t Ign_Time ;
    uint8_t i = 0 ;
    uint16_t Voltage = 0 ;
    Ign_Time = Common_GetIgnOnTime();
    _Msg18FF2A17Map MsgMap ;
hu's avatar
hu committed
477
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
478 479 480 481
    {
        MsgMap.Data[ i ]  = 0xff ;
    }

hu's avatar
hu committed
482 483
    //Byte:0
    if (Coolant_Get_Valid())
hu's avatar
hu committed
484
    {
hu's avatar
hu committed
485
        if (Ign_Time < 3000)
hu's avatar
hu committed
486 487 488 489 490 491
        {
            MsgMap.bit.Water_Temp_Level = 0 ;
            MsgMap.bit.Over_Heat_Warning_Status = 0 ;
        }
        else
        {
hu's avatar
hu committed
492
            if (Coolant_Get_CurSeg() <= 10)
hu's avatar
hu committed
493 494 495 496
            {
                MsgMap.bit.Water_Temp_Level = 0 ;
                MsgMap.bit.Over_Heat_Warning_Status = 0 ;
            }
hu's avatar
hu committed
497
            else if (Coolant_Get_CurSeg() == 11 || Coolant_Get_CurSeg() == 12)
hu's avatar
hu committed
498
            {
hu's avatar
hu committed
499
                MsgMap.bit.Water_Temp_Level = 1 ;
hu's avatar
hu committed
500 501 502
                MsgMap.bit.Over_Heat_Warning_Status = 1 ;
            }

hu's avatar
hu committed
503

hu's avatar
hu committed
504 505 506 507 508 509
        }
    }
    else
    {
        MsgMap.bit.Water_Temp_Level = 2 ;
        MsgMap.bit.Over_Heat_Warning_Status = 0 ;
hu's avatar
hu committed
510 511
    }

hu's avatar
hu committed
512
    //Get_Voltmeter_Valid();
hu's avatar
hu committed
513 514 515 516
    if (Get_Voltmeter_AvrVoltage())
    {
        //0x00~0xFA : 9~34 [V]
        Voltage = Get_Voltmeter_AvrVoltage();
hu's avatar
hu committed
517 518
        Voltage += 50 ;
        Voltage /= 100 ;
hu's avatar
hu committed
519
        if (Voltage >= 90)
hu's avatar
hu committed
520 521 522 523 524 525 526
        {
            Voltage -= 90 ;
        }
        else
        {
            Voltage = 0 ;
        }
hu's avatar
hu committed
527 528
    }
    MsgMap.bit.IGN_Voltage  = Voltage ;
hu's avatar
hu committed
529

hu's avatar
hu committed
530
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
531 532 533
    {
        CopyData[ i ] = MsgMap.Data[ i ] ;
    }
hu's avatar
hu committed
534

hu's avatar
hu committed
535 536 537
}
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FF9D17
hu's avatar
hu committed
538
 * Description    :
hu's avatar
hu committed
539 540 541 542 543
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
544
typedef union
hu's avatar
hu committed
545 546
{
    uint8_t Data[8] ;
hu's avatar
hu committed
547
    struct
hu's avatar
hu committed
548 549 550 551 552 553 554 555 556
    {
        uint8_t Fuel_Level                              : 8 ;//0~64:0~100[%] FE:failure
        uint8_t NotUsed                                 : 8 ;
        uint8_t NotUsed1                                : 8 ;
        uint8_t NotUsed2                                : 8 ;
        uint8_t NotUsed3                                : 8 ;
        uint8_t NotUsed4                                : 8 ;
        uint8_t NotUsed5                                : 8 ;
        uint8_t NotUsed6                                : 8 ;
hu's avatar
hu committed
557 558
    } bit;
} _Msg18FF9D17Map;
hu's avatar
hu committed
559 560 561 562
void Can_Set_Buff_18FF9D17(uint8_t CopyData [])
{
    uint8_t i ;
    _Msg18FF9D17Map MsgMap ;
hu's avatar
hu committed
563
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
564 565 566 567 568 569
    {
        MsgMap.Data[ i ] = 0xff ;
    }

    MsgMap.bit.Fuel_Level = Fuel_Get_Percent() ;

hu's avatar
hu committed
570
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
571 572 573 574 575 576 577
    {
        CopyData[ i ] = MsgMap.Data[ i ]  ;
    }
}

/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18FFE517
hu's avatar
hu committed
578
 * Description    :
hu's avatar
hu committed
579 580 581 582 583
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : Event triggered
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
584
typedef union
hu's avatar
hu committed
585 586
{
    uint8_t Data[8] ;
hu's avatar
hu committed
587
    struct
hu's avatar
hu committed
588 589 590 591
    {
        uint8_t DTC_Clear_Request                          : 8 ;
        uint8_t Req_0Point                                 : 8 ;
        uint8_t System_Demonstration_Request               : 7 ;
hu's avatar
hu committed
592
        uint8_t Ferry_Mode_Cancel                          : 1 ;
hu's avatar
hu committed
593 594 595 596 597
        uint8_t Not_used                                   : 8 ;
        uint8_t Not_used1                                  : 8 ;
        uint8_t Not_used2                                  : 8 ;
        uint8_t Not_used3                                  : 8 ;
        uint8_t Not_used4                                  : 8 ;
hu's avatar
hu committed
598 599
    } bit;
} _Msg18FFE517Map;
hu's avatar
hu committed
600 601 602 603
void Can_Set_Buff_18FFE517(uint8_t CopyData [])
{
    uint8_t i ;
    _Msg18FFE517Map MsgMap ;
hu's avatar
hu committed
604
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
605 606 607 608 609
    {
        MsgMap.Data[ i ] = 0xff ;
    }


hu's avatar
hu committed
610
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
611 612 613 614 615 616
    {
        CopyData[ i ] = MsgMap.Data[ i ]  ;
    }
}
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18EF2D17
hu's avatar
hu committed
617
 * Description    :
hu's avatar
hu committed
618 619 620 621 622 623 624 625
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
void Can_Set_Buff_18EF2D17(uint8_t CopyData [])
{
    uint8_t i ;
hu's avatar
hu committed
626
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
627 628 629 630 631 632
    {
        CopyData[ i ] = 0xff ;
    }
}
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_18033317
hu's avatar
hu committed
633
 * Description    :
hu's avatar
hu committed
634 635 636 637 638
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
639
typedef union
hu's avatar
hu committed
640 641
{
    uint8_t Data[8] ;
hu's avatar
hu committed
642
    struct
hu's avatar
hu committed
643 644 645
    {
        uint8_t PairCmd                                    : 8 ;
        uint8_t TireNumber                                 : 8 ;
hu's avatar
hu committed
646

hu's avatar
hu committed
647 648 649 650 651 652
        uint8_t Not_used                                   : 8 ;
        uint8_t Not_used1                                  : 8 ;
        uint8_t Not_used2                                  : 8 ;
        uint8_t Not_used3                                  : 8 ;
        uint8_t Not_used4                                  : 8 ;
        uint8_t Not_used5                                  : 8 ;
hu's avatar
hu committed
653 654
    } bit;
} _Msg18033317Map;
hu's avatar
hu committed
655 656 657
void Can_Set_Buff_18033317(uint8_t CopyData [])
{
    uint8_t i ;
hu's avatar
hu committed
658
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
659 660 661 662 663 664
    {
        CopyData[ i ] = 0xff ;
    }
}
/*-------------------------------------------------------------------------
 * Function Name  : Can_Set_Buff_180433A2
hu's avatar
hu committed
665
 * Description    :
hu's avatar
hu committed
666 667 668 669 670
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
hu's avatar
hu committed
671
typedef union
hu's avatar
hu committed
672 673
{
    uint8_t Data[8] ;
hu's avatar
hu committed
674
    struct
hu's avatar
hu committed
675 676
    {
        uint8_t SetupCmd                                   : 8 ;
hu's avatar
hu committed
677

hu's avatar
hu committed
678 679 680 681 682 683 684
        uint8_t Not_used                                   : 8 ;
        uint8_t Not_used1                                  : 8 ;
        uint8_t Not_used2                                  : 8 ;
        uint8_t Not_used3                                  : 8 ;
        uint8_t Not_used4                                  : 8 ;
        uint8_t Not_used5                                  : 8 ;
        uint8_t Not_used6                                  : 8 ;
hu's avatar
hu committed
685 686
    } bit;
} _Msg180433A2Map;
hu's avatar
hu committed
687 688 689
void Can_Set_Buff_180433A2(uint8_t CopyData [])
{
    uint8_t i ;
hu's avatar
hu committed
690
    for (i = 0 ; i < 8 ; i ++)
hu's avatar
hu committed
691 692 693 694 695
    {
        CopyData[ i ] = 0xff ;
    }
}

hu's avatar
hu committed
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818
/*CAN接收处理*/
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)
        {
        case 0x50 :
            User_ECU.TripA_Fuel          = Temp ;
            break;
        case 0x51 :
            User_ECU.TripA_Average_Speed = Temp ;
            break;
        case 0x52 :
            User_ECU.TripA_Fuel_Consume  = Temp ;
            break;
        case 0x53 :
            User_ECU.TripA_Idling        = Temp ;
            break;
        case 0x54 :
            User_ECU.TripA_Runing        = Temp ;
            break;
        case 0x60 :
            User_ECU.TripB_Fuel          = Temp ;
            break;
        case 0x61 :
            User_ECU.TripB_Average_Speed = Temp ;
            break;
        case 0x62 :
            User_ECU.TripB_Fuel_Consume  = Temp ;
            break;
        case 0x63 :
            User_ECU.TripB_Idling        = Temp ;
            break;
        case 0x64 :
            User_ECU.TripB_Runing        = Temp ;
            break;
        case 0x22 :
            User_ECU.Engine_Surplus      = Temp ;
            break;
        default:
            break;
        }
        break;
    case 0x40:
        switch (Data_Type)
        {
        case 0x50 :
            User_ECU.TripA_Fuel          = Temp ;
            break;
        case 0x51 :
            User_ECU.TripA_Average_Speed = Temp ;
            break;
        case 0x52 :
            User_ECU.TripA_Fuel_Consume  = Temp ;
            break;
        case 0x53 :
            User_ECU.TripA_Idling        = Temp ;
            break;
        case 0x54 :
            User_ECU.TripA_Runing        = Temp ;
            break;
        case 0x60 :
            User_ECU.TripB_Fuel          = Temp ;
            break;
        case 0x61 :
            User_ECU.TripB_Average_Speed = Temp ;
            break;
        case 0x62 :
            User_ECU.TripB_Fuel_Consume  = Temp ;
            break;
        case 0x63 :
            User_ECU.TripB_Idling        = Temp ;
            break;
        case 0x64 :
            User_ECU.TripB_Runing        = Temp ;
            break;
        case 0x22 :
            User_ECU.Engine_Surplus      = Temp ;
            break;
        default:
            break;
        }
        break;
    default:
        break;
    }

    //if (State_Flag.FState_COilTimeOut < FState_COilTimeOutNum)
    //{
    //    State_Flag.FState_COilTimeOut++;
    //}
    //if (Data_Sig == 0x40u)
    //{
    //    State_Flag.FState_ClearOilRx == 1;
    //}
}

uint32_t Common_Data_Get_TripA_Fuel(void)
{
    return User_ECU.TripA_Fuel ;
}
uint32_t Common_Data_Get_TripA_Average_Speed(void)
{
    return User_ECU.TripA_Average_Speed ;
}
uint32_t Common_Data_Get_TripB_Fuel(void)
{
    return User_ECU.TripB_Fuel ;
}
uint32_t Common_Data_Get_TripB_Average_Speed(void)
{
    return User_ECU.TripB_Average_Speed ;
}
hu's avatar
hu committed
819