Commit 7c419289 authored by hu's avatar hu

增加气压表配置功能

parent e6df2277
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
project .intvect 1536
project .text 297644
project .text 297884
project .rodata 412311
project .secinfo 120
project .syscall 6
......
......@@ -4,27 +4,26 @@
#include "CAN_Communication_Matrix.h"
#include "RTE_ADC.h"
//-------------------------------------------
//主负气压 数据处理 wangboyu
//-------------------------------------------
#include "Common_Interface.h"
//断码显示
//-------------------------------------------
//344 - 3.1.2.FRONT/REAR空气计显示
//342 - 3.3. FRONT/REAR气压指针
//-------------------------------------------
#define PRI_ID 0
#define SEC_ID 1
#define PRI_ID 0
#define SEC_ID 1
#define TableLenMax 6u
#define TableLenMax 6u
#define EnTable 0 // 0 - 计算 1 - 查表
#define EnTable 0 // 0 - 计算 1 - 查表
#define VALID_TIME 100 // 2S
#define VALID_TIME 100 // 2S
static struct
{
uint8_t SumCnt ;
uint8_t SumCnt ;
uint32_t Voltage ;
uint16_t Result ;
} AirPressureFilter[2u] ;
......@@ -57,23 +56,23 @@ void AirPressure_KL30_Init(void)
{
uint8_t i = 0 ;
uint32_t u32slope = 0 ;
AirPressureVariable.VoltageTable[ 0 ] = 500 ;
AirPressureVariable.VoltageTable[ 0 ] = 500 ;
AirPressureVariable.kPaTable[ 0 ] = 0 ;
AirPressureVariable.VoltageTable[ 1 ] = 1750 ;
AirPressureVariable.VoltageTable[ 1 ] = 1750 ;
AirPressureVariable.kPaTable[ 1 ] = 500 ;
AirPressureVariable.VoltageTable[ 2 ] = 1960 ;
AirPressureVariable.VoltageTable[ 2 ] = 1960 ;
AirPressureVariable.kPaTable[ 2 ] = 583 ;
AirPressureVariable.VoltageTable[ 3 ] = 2000 ;
AirPressureVariable.VoltageTable[ 3 ] = 2000 ;
AirPressureVariable.kPaTable[ 3 ] = 600 ;
AirPressureVariable.VoltageTable[ 4 ] = 3000 ;
AirPressureVariable.VoltageTable[ 4 ] = 3000 ;
AirPressureVariable.kPaTable[ 4 ] = 1000 ;
AirPressureVariable.VoltageTable[ 5 ] = 4250 ;
AirPressureVariable.VoltageTable[ 5 ] = 4250 ;
AirPressureVariable.kPaTable[ 5 ] = 1500 ;
for (i = 0; i < (TableLenMax - 1); i ++)
......@@ -256,8 +255,22 @@ void AirPressure_AdcData_Filter(void)
uint16_t PriVoltage = 0 ;
uint16_t SecVoltage = 0 ;
u8PriValid = RTE_Read_PRIMARY_AIR_Valid();
u8SecValid = RTE_Read_SECONDARY_AIR_Valid();
if ((K_Line_Set.K_Line_LID42 == 0x00) || (K_Line_Set.K_Line_LID42 == 0x02))
{
u8PriValid = RTE_Read_PRIMARY_AIR_Valid();
u8SecValid = RTE_Read_SECONDARY_AIR_Valid();
}
else if ((K_Line_Set.K_Line_LID42 == 0x01) || (K_Line_Set.K_Line_LID42 == 0x03))
{
u8PriValid = RTE_Read_SECONDARY_AIR_Valid();
u8SecValid = RTE_Read_PRIMARY_AIR_Valid();
}
else /*配置无效时*/
{
u8PriValid = RTE_Read_PRIMARY_AIR_Valid();
u8SecValid = RTE_Read_SECONDARY_AIR_Valid();
}
if (u8PriValid)
{
if (AirPressureFilter[PRI_ID].SumCnt < 10)
......
......@@ -7,24 +7,24 @@
//-------------------------------------------
//燃油 数据处理 wangboyu 2021-8-31 15:19:14
//-------------------------------------------
//342 - 4.2.燃油表
// 342 - 4.2.燃油表
//-------------------------------------------
/*----------------------------------------------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 10 11 12
0 1 2 3 4 5 6 7 8 9 10 11 12
阻值(Up) - 144.5 126.5 108.1 90.9 75.7 60.6 47.3 38.2 29.1 21 15.5 9.9
阻值(Up) - 144.5 126.5 108.1 90.9 75.7 60.6 47.3 38.2 29.1 21 15.5 9.9
step 13 23 33 43 52 61 68 73 79 83 86 90
step 13 23 33 43 52 61 68 73 79 83 86 90
阻值(Down) 150 137.3 119.1 100.9 84.8 69.7 54.5 43.6 34.5 25.4 18.8 13.2 -
阻值(Down) 150 137.3 119.1 100.9 84.8 69.7 54.5 43.6 34.5 25.4 18.8 13.2 -
step 0 17 27 38 47 55 64 70 76 81 84 88
step 0 17 27 38 47 55 64 70 76 81 84 88
*-----------------------------------------------------------------------------------------------------------------------*/
static uint8_t Fuel_CurSeg = 0 ;
static uint8_t Fuel_CurSeg = 0;
/*-------------------------------------------------------------------------
* Function Name : Fuel_User_KL30_Init
......@@ -36,37 +36,37 @@ static uint8_t Fuel_CurSeg = 0 ;
--------------------------------------------------------------------------*/
void Fuel_User_KL30_Init(void)
{
FuelStruct FuelInitPara ;
AFC_INIT AFCInit ;
FuelStruct FuelInitPara;
AFC_INIT AFCInit;
uint32_t ODO_Value = 0u;
ODO_Value = Data_ODO_Read();
FuelInitPara.FuelShortCircuitR = FUEL_R_MIN_VAL;
FuelInitPara.FuelOpenCircuitR = FUEL_R_MAX_VAL;
FuelInitPara.DisplayZoneBoundary[0] = DISPLAY_BOUNDARY_ES ; //1500
FuelInitPara.DisplayZoneBoundary[1] = DISPLAY_BOUNDARY_1 ; //1500
FuelInitPara.DisplayZoneBoundary[2] = DISPLAY_BOUNDARY_2 ; //1373
FuelInitPara.DisplayZoneBoundary[3] = DISPLAY_BOUNDARY_3 ; //1191
FuelInitPara.DisplayZoneBoundary[4] = DISPLAY_BOUNDARY_4 ; //1009
FuelInitPara.DisplayZoneBoundary[5] = DISPLAY_BOUNDARY_5 ; // 848
FuelInitPara.DisplayZoneBoundary[6] = DISPLAY_BOUNDARY_6 ; // 697
FuelInitPara.DisplayZoneBoundary[7] = DISPLAY_BOUNDARY_7 ; // 545
FuelInitPara.DisplayZoneBoundary[8] = DISPLAY_BOUNDARY_8 ; // 436
FuelInitPara.DisplayZoneBoundary[9] = DISPLAY_BOUNDARY_9 ; // 345
FuelInitPara.DisplayZoneBoundary[10] = DISPLAY_BOUNDARY_10 ; // 254
FuelInitPara.DisplayZoneBoundary[11] = DISPLAY_BOUNDARY_11 ; // 188
FuelInitPara.DisplayZoneBoundary[12] = DISPLAY_BOUNDARY_12 ; // 132
FuelInitPara.DisplayZoneBoundary[13] = DISPLAY_BOUNDARY_13 ; // 40
FuelInitPara.DisplayZoneBoundary[14] = DISPLAY_BOUNDARY_FS ; // 30
AFCInit.CalcAFCMaxNum = 100; /*50公里或者100公里已更新*/
AFCInit.AFCMin = 30; /*油耗最小值十倍*/
AFCInit.AFCMax = 300; /*油耗最大值*/
AFCInit.AFCPreinstall = 80; /*油耗初始值*/
AFCInit.CurODO = ODO_Value * 100; /*总共里数100倍*/
AFCInit.MaxDRMileage = 69900; /*续航里程最大值*/
FuelInitPara.FuelShortCircuitR = FUEL_R_MIN_VAL;
FuelInitPara.FuelOpenCircuitR = FUEL_R_MAX_VAL;
FuelInitPara.DisplayZoneBoundary[0] = DISPLAY_BOUNDARY_ES; // 1500
FuelInitPara.DisplayZoneBoundary[1] = DISPLAY_BOUNDARY_1; // 1500
FuelInitPara.DisplayZoneBoundary[2] = DISPLAY_BOUNDARY_2; // 1373
FuelInitPara.DisplayZoneBoundary[3] = DISPLAY_BOUNDARY_3; // 1191
FuelInitPara.DisplayZoneBoundary[4] = DISPLAY_BOUNDARY_4; // 1009
FuelInitPara.DisplayZoneBoundary[5] = DISPLAY_BOUNDARY_5; // 848
FuelInitPara.DisplayZoneBoundary[6] = DISPLAY_BOUNDARY_6; // 697
FuelInitPara.DisplayZoneBoundary[7] = DISPLAY_BOUNDARY_7; // 545
FuelInitPara.DisplayZoneBoundary[8] = DISPLAY_BOUNDARY_8; // 436
FuelInitPara.DisplayZoneBoundary[9] = DISPLAY_BOUNDARY_9; // 345
FuelInitPara.DisplayZoneBoundary[10] = DISPLAY_BOUNDARY_10; // 254
FuelInitPara.DisplayZoneBoundary[11] = DISPLAY_BOUNDARY_11; // 188
FuelInitPara.DisplayZoneBoundary[12] = DISPLAY_BOUNDARY_12; // 132
FuelInitPara.DisplayZoneBoundary[13] = DISPLAY_BOUNDARY_13; // 40
FuelInitPara.DisplayZoneBoundary[14] = DISPLAY_BOUNDARY_FS; // 30
AFCInit.CalcAFCMaxNum = 100; /*50公里或者100公里已更新*/
AFCInit.AFCMin = 30; /*油耗最小值十倍*/
AFCInit.AFCMax = 300; /*油耗最大值*/
AFCInit.AFCPreinstall = 80; /*油耗初始值*/
AFCInit.CurODO = ODO_Value * 100; /*总共里数100倍*/
AFCInit.MaxDRMileage = 69900; /*续航里程最大值*/
InitFuelParamter(&FuelInitPara);
InitAFC(&AFCInit);
......@@ -82,20 +82,16 @@ void Fuel_User_KL30_Init(void)
}
void Fuel_User_KL15_ON_Init(void)
{
}
void Fuel_User_KL15_OFF_Init(void)
{
}
void Fuel_User_Wakeup_Init(void)
{
}
void Fuel_User_Sleep_Init(void)
{
}
/*-------------------------------------------------------------------------
* Function Name : Fuel_User_KL15_ON_Processing_Service
......@@ -105,87 +101,82 @@ void Fuel_User_Sleep_Init(void)
* Return : None
* onther : 10Ms调用
--------------------------------------------------------------------------*/
static uint16_t wbyTestR = 0 ;
static uint8_t wbyTestStep = 0 ;
static uint8_t Fuel_CyrStep = 0u;
void Fuel_User_KL15_ON_Processing_Service(void)
{
AFC_PARA AFCPara ;
uint8_t FuelR_Valid = 0 ;
uint16_t FuelR = 0 ;
uint8_t Vspeed_Valid = 0 ;
uint16_t Vspeed = 0 ;
uint8_t Espeed_Valid = 0 ;
uint16_t Espeed = 0 ;
uint8_t FuelMode = 0 ;
uint8_t Step = 0 ;
AFC_PARA AFCPara;
uint8_t FuelR_Valid = 0u;
uint8_t Vspeed_Valid = 0u;
uint8_t Espeed_Valid = 0u;
uint8_t FuelMode = 0u;
uint8_t Step = 0u;
uint16_t FuelR = 0u;
uint16_t Vspeed = 0u;
uint16_t Espeed = 0u;
uint16_t FuelResistanceV = 0u;
uint32_t ODO_Value = 0u;
// In ---> Lib
// In ---> Lib
FuelR_Valid = RTE_Read_FUEL_R_Valid();
Vspeed_Valid = Common_Get_Act_V_Speed_Valid();
Espeed_Valid = Common_Get_Act_E_Speed_Valid();
if (Common_Get_IG_Sts_Valid() == COMMON_Valid)
if ((Common_Get_IG_Sts() == COMMON_POWER_ON) && (Common_Get_IG_Sts_Valid() == COMMON_Valid))
{
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
if (FuelR_Valid)
{
if (FuelR_Valid)
{
FuelR = RTE_Read_FUEL_R();
//FuelR = wbyTestR ;
}
else
{
FuelR = 0 ;
}
FuelR = RTE_Read_FUEL_R();
}
else
{
FuelR = 0;
}
if (Vspeed_Valid)
{
Vspeed = Common_Get_Act_V_Speed();
}
else
{
Vspeed = 0 ;
}
if (Vspeed_Valid)
{
Vspeed = Common_Get_Act_V_Speed();
}
else
{
Vspeed = 0;
}
if (Espeed_Valid)
{
Espeed = Common_Get_Act_E_Speed();
}
else
{
Espeed = 0 ;
}
if (Espeed_Valid)
{
Espeed = Common_Get_Act_E_Speed();
}
else
{
Espeed = 0;
}
SetPowerSt(1);
AFCTimerCall();
SetPowerSt(1);
AFCTimerCall();
ODO_Value = Data_ODO_Read();
ODO_Value = Data_ODO_Read();
AFCPara.CurODO = ODO_Value * 100; // m
AFCPara.FuleConsume = 0 ;
AFCPara.RPM = Espeed; // 1
AFCPara.Speed = (Vspeed * 10);// 0.1
AFCPara.CurODO = ODO_Value * 100; // m
AFCPara.FuleConsume = 0;
AFCPara.RPM = Espeed; // 1
AFCPara.Speed = (Vspeed * 10); // 0.1
SetAFCPara(&AFCPara);
FuelFSM(FuelR);
}
}
// Lib ---> Out
FuelMode = GetFuelSensorState(); /*燃油状态获取*/
SetAFCPara((AFC_PARA *)&AFCPara);
FuelFSM(FuelR); /*新版增加系数*/
Step = GetFuelStep();
wbyTestStep = GetFuelStep();
FuelResistanceV = GetFuelResistance(); //燃油电阻获取
// Lib ---> Out
FuelMode = GetFuelSensorState(); /*燃油状态获取*/
if (FuelMode == FuelSensorNormal)
{
Fuel_CurSeg = Step ;
}
else
{
Fuel_CurSeg = 0 ;
if (FuelMode == FuelSensorNormal)
{
Fuel_CurSeg = (uint16_t)GetFuelSeg(); /*段*/
Fuel_CyrStep = (uint16_t)GetFuelStep(); /*步*/
}
else
{
Fuel_CurSeg = 0u;
Fuel_CyrStep = 0u;
}
}
}
/*-------------------------------------------------------------------------
......@@ -199,8 +190,8 @@ void Fuel_User_KL15_ON_Processing_Service(void)
void Fuel_User_KL15_OFF_Processing_Service(void)
{
uint8_t i;
uint8_t FuelR_Valid = 0 ;
uint16_t FuelR = 0 ;
uint8_t FuelR_Valid = 0;
uint16_t FuelR = 0;
FuelR_Valid = RTE_Read_FUEL_R_Valid();
FuelR = RTE_Read_FUEL_R();
......@@ -217,8 +208,6 @@ void Fuel_User_KL15_OFF_Processing_Service(void)
FuelFSM(FuelR);
}
}
}
/*-------------------------------------------------------------------------
......@@ -231,7 +220,7 @@ void Fuel_User_KL15_OFF_Processing_Service(void)
--------------------------------------------------------------------------*/
uint8_t Fuel_Get_CurSeg(void)
{
return Fuel_CurSeg ;
return Fuel_CurSeg;
}
/*-------------------------------------------------------------------------
* Function Name : Fuel_Get_Percent
......@@ -243,27 +232,26 @@ uint8_t Fuel_Get_CurSeg(void)
--------------------------------------------------------------------------*/
uint8_t Fuel_Get_Percent(void)
{
uint16_t Percent = 0 ;
uint8_t Step = 0 ;
uint16_t Percent = 0;
uint8_t Step = 0;
Step = GetFuelStep();
if (Step <= 10)
{
Percent = 0 ;
Percent = 0;
}
else if (Step >= 90)
{
Percent = 100 ;
Percent = 100;
}
else
{
Step -= 10 ;
Percent = Step ;
Percent *= 100 ; //放大100倍
Percent /= 80 ; // 90 - 10
Step -= 10;
Percent = Step;
Percent *= 100; //放大100倍
Percent /= 80; // 90 - 10
}
return Percent ;
return Percent;
}
uint16_t Fuel_Get_Res(void)
......@@ -277,11 +265,11 @@ uint16_t Fuel_Get_Step(void)
uint8_t Fuel_Get_LowAlarm(void)
{
uint8_t u8Result = 0 ;
uint8_t FuelMode = 0 ;
uint8_t Step = 0 ;
uint8_t FuelR_Valid = 0 ;
uint16_t FuelR = 0 ;
uint8_t u8Result = 0;
uint8_t FuelMode = 0;
uint8_t Step = 0;
uint8_t FuelR_Valid = 0;
uint16_t FuelR = 0;
FuelR_Valid = RTE_Read_FUEL_R_Valid();
FuelMode = GetFuelSensorState();
......@@ -294,29 +282,26 @@ uint8_t Fuel_Get_LowAlarm(void)
if (FuelMode == FuelSensorNormal)
{
if (FuelR > 30 && FuelR < 3000 )
if (FuelR > 30 && FuelR < 3000)
{
if (Step < 20)
{
u8Result = 1 ;
u8Result = 1;
}
else
{
u8Result = 0 ;
u8Result = 0;
}
}
else
{
u8Result = 0 ;
u8Result = 0;
}
}
else
{
u8Result = 0 ;
u8Result = 0;
}
return u8Result ;
return u8Result;
}
#include "GaugesInterface.h"
#include "Menu.h"
/**@struct _GaugesInfoInit
*this is _GaugesInfoInit
*/
*this is _GaugesInfoInit
*/
#include "Common_Interface.h"
static const uint16_t GaugesDataInInit[GaugesTotal][3][25] =
static const uint16_t GaugesDataInInit[GaugesTotal][3][25] =
{
/*车速*/
{ {0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{
{0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 5 , 9 , 13 , 17 , 21 , 25 , 30 , 35 , 40 , 45 , 50 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
{0, 5, 9, 13, 17, 21, 25, 30, 35, 40, 45, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
},
/*转速*/
{ {0u, 1000, 1500, 2000, 2500, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0u, 1000, 1500, 2000, 2500, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0u, 6 , 11 , 16 , 21 , 27 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
{0u, 6, 11, 16, 21, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
},
/*水温*/
{ { 0 , 50, 55, 61, 66, 72, 77, 102, 104, 106, 108, 110, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{49 , 54, 60, 65, 71, 76, 101, 103, 105, 107, 109, 110, 210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0 , 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10 , 11 , 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
{ { 0, 50, 55, 61, 66, 72, 77, 102, 104, 106, 108, 110, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{49, 54, 60, 65, 71, 76, 101, 103, 105, 107, 109, 110, 210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
},
/*PRI气压*/
{ {0 , 500, 720, 940, 1160, 1380, 1600, 1820, 2040, 2260, 2480, 2700, 2920, 3140, 3360, 3580 , 3800 , 4020, 4240, 4500, 0, 0, 0, 0, 0},
{0 , 610, 830, 1050, 1270, 1490, 1710, 1930, 2150, 2370, 2590, 2810, 3030, 3250, 3470, 3690 , 3910 , 4130, 4350, 4500, 0, 0, 0, 0, 0},
{0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 0, 0, 0, 0, 0}
{ {500, 720, 940, 1160, 1380, 1600, 1820, 2040, 2260, 2480, 2700, 2920, 3140, 3360, 3580, 3800, 4020, 4240, 4500, 0, 0, 0, 0, 0},
{610, 830, 1050, 1270, 1490, 1710, 1930, 2150, 2370, 2590, 2810, 3030, 3250, 3470, 3690, 3910, 4130, 4350, 4500, 0, 0, 0, 0, 0},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 0, 0, 0, 0}
},
/*SEC气压*/
{ {0 , 500, 720, 940, 1160, 1380, 1600, 1820, 2040, 2260, 2480, 2700, 2920, 3140, 3360, 3580 , 3800 , 4020, 4240, 4500, 0, 0, 0, 0, 0},
{0 , 610, 830, 1050, 1270, 1490, 1710, 1930, 2150, 2370, 2590, 2810, 3030, 3250, 3470, 3690 , 3910 , 4130, 4350, 4500, 0, 0, 0, 0, 0},
{0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18, 0, 0, 0, 0, 0}
{ {500, 720, 940, 1160, 1380, 1600, 1820, 2040, 2260, 2480, 2700, 2920, 3140, 3360, 3580, 3800, 4020, 4240, 4500, 0, 0, 0, 0, 0},
{610, 830, 1050, 1270, 1490, 1710, 1930, 2150, 2370, 2590, 2810, 3030, 3250, 3470, 3690, 3910, 4130, 4350, 4500, 0, 0, 0, 0, 0},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 0, 0, 0, 0}
},
/*WET气压*/
{ {500, 730, 960, 1190, 1420, 1650, 1880, 2100, 2330, 2560, 2790, 3020, 3250, 3480, 3710 , 3940 , 4170, 4400, 4500, 0, 0, 0, 0, 0, 0},
{600, 830, 1060, 1290, 1520, 1750, 1980, 2200, 2430, 2660, 2890, 3120, 3350, 3580, 3810 , 4040 , 4270, 4500, 4500, 0, 0, 0, 0, 0, 0},
{0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18, 0, 0, 0, 0, 0, 0}
{ {500, 730, 960, 1190, 1420, 1650, 1880, 2100, 2330, 2560, 2790, 3020, 3250, 3480, 3710, 3940, 4170, 4400, 4500, 0, 0, 0, 0, 0, 0},
{600, 830, 1060, 1290, 1520, 1750, 1980, 2200, 2430, 2660, 2890, 3120, 3350, 3580, 3810, 4040, 4270, 4500, 4500, 0, 0, 0, 0, 0, 0},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 0, 0, 0, 0, 0}
},
/*电池电压*/
{ {0 , 17000, 19000, 20000, 21000, 22000, 23000, 24000, 25000, 26000, 27000, 28000, 29000, 30000, 30500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0 , 17000, 18500, 19500, 20500, 21500, 22500, 23500, 24500, 25500, 26500, 27500, 28500, 29500, 30000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
{ {0, 17000, 19000, 20000, 21000, 22000, 23000, 24000, 25000, 26000, 27000, 28000, 29000, 30000, 30500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 17000, 18500, 19500, 20500, 21500, 22500, 23500, 24500, 25500, 26500, 27500, 28500, 29500, 30000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
},
};
/*指示类型*/ /*表头1 表头2 表头3 表头4*/ /*表头5*/ /*表头6*/ /*表头7*/
static const uint8_t GaugesIndicatType[GaugesTotal] = {LEDOtherType, LEDOtherType, LEDTempType, LEDGasType, LEDGasType, LEDGasType,LEDOtherType}; /*初始化表头显示类型,例如水温,气压*/
/*每个表头包含的参数个数*/ /*表头1 表头2 表头3 表头4*/
/*指示类型*/ /*表头1 表头2 表头3 表头4*/ /*表头5*/ /*表头6*/ /*表头7*/
static const uint8_t GaugesIndicatType[GaugesTotal] = {LEDOtherType, LEDOtherType, LEDTempType, LEDGasType, LEDGasType, LEDGasType, LEDOtherType}; /*初始化表头显示类型,例如水温,气压*/
/*每个表头包含的参数个数*/ /*表头1 表头2 表头3 表头4*/
static const uint8_t GaugesParaNum[GaugesTotal] = {12, 6, 13, 19, 19, 19 , 14};
static const uint8_t GaugesParaNum[GaugesTotal] = {12, 6, 13, 19, 19, 19, 15};
/*每个表头IGON后开始走动时间*/ /*表头1 表头2 表头3 表头4 表头5 表头6*/
static const uint16_t GaugesStarMoveTime[GaugesTotal] = {0, 0, 0, 0, 0, 0, 0,};/*0是上电就开始走动,其他参数是ms*/
/*每个表头IGON后是否自检*/ /*表头1 表头2 表头3 表头4 表头5 表头6*/
static const uint16_t GaugesTest[GaugesTotal] = {1, 1, 1, 1, 1, 0, 0,};/*1是自检,0不自检*/
/*每个表头IGON后开始走动时间*/ /*表头1 表头2 表头3 表头4 表头5 表头6*/
static const uint16_t GaugesStarMoveTime[GaugesTotal] =
{
0,
0,
0,
0,
0,
0,
0,
}; /*0是上电就开始走动,其他参数是ms*/
/*每个表头IGON后是否自检*/ /*表头1 表头2 表头3 表头4 表头5 表头6*/
static const uint16_t GaugesTest[GaugesTotal] =
{
1,
1,
1,
1,
1,
0,
0,
}; /*1是自检,0不自检*/
/*每个表头自检走动每格时间*/
const uint16_t SeftTest_Gauges_Times[GaugesTotal] = {1500 / (30 + 1), 1500 / (27 + 1) , 1500 / (12 + 1), 1500 / (18 + 1), 1500 / (18 + 1), 0, 0};
uint16_t RealDataIn[GaugesTotal];
const uint16_t SeftTest_Gauges_Times[GaugesTotal] = {1500 / (30 + 1), 1500 / (27 + 1), 1500 / (12 + 1), 1500 / (18 + 1), 1500 / (18 + 1), 0, 0};
uint16_t RealDataIn[GaugesTotal];
_GaugesInfoInit GaugesInfo_Init_Table[GaugesTotal];
/**@brief User Gauge K30 Init function
* @author TYW
* @param[in] GaugeNum Gauge Postion
* @param[in] GParam Gauge Struct
* @since 1.0.0.0
*/
* @author TYW
* @param[in] GaugeNum Gauge Postion
* @param[in] GParam Gauge Struct
* @since 1.0.0.0
*/
void UserGaugeK30Init(void)
{
uint8_t i = 0u;
uint8_t j = 0u;
for (i = 0u; i < GaugesTotal; i++)
{
GaugesInfo_Init_Table[i] .SectorNum = GaugesParaNum[i];
GaugesInfo_Init_Table[i] .GaugesType = GaugesIndicatType[i];
GaugesInfo_Init_Table[i] .GaugesDataIn = &RealDataIn[i];
GaugesInfo_Init_Table[i] .GaugesStartTime = GaugesStarMoveTime[i];
GaugesInfo_Init_Table[i] .GaugesTestFlag = GaugesTest[i];
GaugesInfo_Init_Table[i].SectorNum = GaugesParaNum[i];
GaugesInfo_Init_Table[i].GaugesType = GaugesIndicatType[i];
GaugesInfo_Init_Table[i].GaugesDataIn = &RealDataIn[i];
GaugesInfo_Init_Table[i].GaugesStartTime = GaugesStarMoveTime[i];
GaugesInfo_Init_Table[i].GaugesTestFlag = GaugesTest[i];
for (j = 0u; j < GaugesParaNum[i]; j++)
{
GaugesInfo_Init_Table[i] .ReferenceDataInUp[j] = GaugesDataInInit[i][0][j];
GaugesInfo_Init_Table[i] .ReferenceDataInDown[j] = GaugesDataInInit[i][1][j];
GaugesInfo_Init_Table[i] .ReferenceDataInOut[j] = GaugesDataInInit[i][2][j];
GaugesInfo_Init_Table[i].ReferenceDataInUp[j] = GaugesDataInInit[i][0][j];
GaugesInfo_Init_Table[i].ReferenceDataInDown[j] = GaugesDataInInit[i][1][j];
GaugesInfo_Init_Table[i].ReferenceDataInOut[j] = GaugesDataInInit[i][2][j];
}
}
GaugesK15Init_OFF();
}
/**@brief User Gauge K15 Init function
* @author TYW
* @param[in] GaugeNum Gauge Postion
* @param[in] GParam Gauge Struct
* @since 1.0.0.0
*/
* @author TYW
* @param[in] GaugeNum Gauge Postion
* @param[in] GParam Gauge Struct
* @since 1.0.0.0
*/
void UserGaugeK15Init(void)
{
uint8_t i = 0u;
uint8_t j = 0u;
for (i = 0u; i < GaugesTotal; i++)
{
GaugesInfo_Init_Table[i] .SectorNum = GaugesParaNum[i];
GaugesInfo_Init_Table[i] .GaugesType = GaugesIndicatType[i];
GaugesInfo_Init_Table[i] .GaugesDataIn = &RealDataIn[i];
GaugesInfo_Init_Table[i] .GaugesStartTime = GaugesStarMoveTime[i];
GaugesInfo_Init_Table[i] .GaugesTestFlag = GaugesTest[i];
GaugesInfo_Init_Table[i].SectorNum = GaugesParaNum[i];
GaugesInfo_Init_Table[i].GaugesType = GaugesIndicatType[i];
GaugesInfo_Init_Table[i].GaugesDataIn = &RealDataIn[i];
GaugesInfo_Init_Table[i].GaugesStartTime = GaugesStarMoveTime[i];
GaugesInfo_Init_Table[i].GaugesTestFlag = GaugesTest[i];
for (j = 0u; j < GaugesParaNum[i]; j++)
{
GaugesInfo_Init_Table[i] .ReferenceDataInUp[j] = GaugesDataInInit[i][0][j];
GaugesInfo_Init_Table[i] .ReferenceDataInDown[j] = GaugesDataInInit[i][1][j];
GaugesInfo_Init_Table[i] .ReferenceDataInOut[j] = GaugesDataInInit[i][2][j];
GaugesInfo_Init_Table[i].ReferenceDataInUp[j] = GaugesDataInInit[i][0][j];
GaugesInfo_Init_Table[i].ReferenceDataInDown[j] = GaugesDataInInit[i][1][j];
GaugesInfo_Init_Table[i].ReferenceDataInOut[j] = GaugesDataInInit[i][2][j];
}
}
GaugesK15Init_ON();
}
/**@brief Gauge Schedule function
* @author TYW
* @param[in] GaugeNum Gauge Postion
* @param[in] GParam Gauge Struct
* @since 1.0.0.0
*/
* @author TYW
* @param[in] GaugeNum Gauge Postion
* @param[in] GParam Gauge Struct
* @since 1.0.0.0
*/
void UserGaugeSchedule(void)
{
uint8_t i = 0u;
......@@ -129,78 +146,73 @@ void UserGaugeSchedule(void)
for (i = 0u; i < GaugesTotal; i++)
{
GaugeSchedule(i, &GaugesInfo_Init_Table[i]);
}
}
/**@brief Set Gauges Paragram function
* @author TYW
* @param[in] GaugesID Gauge Name
* @param[in] GaugesVal Gauges Val
* @since 1.0.0.0
*/
* @author TYW
* @param[in] GaugesID Gauge Name
* @param[in] GaugesVal Gauges Val
* @since 1.0.0.0
*/
void SetGaugesPara(uint8_t GaugesID, uint16_t GaugesVal)
{
RealDataIn[GaugesID] = GaugesVal;
}
/**@brief Get Gauges Max Out Val function
* @author TYW
* @param[in] GaugesID Gauge Name
* @since 1.0.0.0
*/
* @author TYW
* @param[in] GaugesID Gauge Name
* @since 1.0.0.0
*/
uint16_t GetGaugesMaxOutVal(uint8_t GaugesID)
{
return GaugesInfo_Init_Table[GaugesID] .ReferenceDataInOut[GaugesParaNum[GaugesID] - 1u] ;
return GaugesInfo_Init_Table[GaugesID].ReferenceDataInOut[GaugesParaNum[GaugesID] - 1u];
}
/**@brief Set Gauges Up Val function
* @author TYW
* @param[in] GaugesID Gauge Name
* @param[in] GaugesVal Gauges Val
* @since 1.0.0.0
*/
* @author TYW
* @param[in] GaugesID Gauge Name
* @param[in] GaugesVal Gauges Val
* @since 1.0.0.0
*/
void SetGaugesUpVal(uint8_t GaugesID, uint16_t GaugesUpVal[])
{
uint8_t i;
for (i = 0u; i < GaugesParaNum[GaugesID]; i++)
{
GaugesInfo_Init_Table[GaugesID] .ReferenceDataInUp[i] = GaugesUpVal[i];
GaugesInfo_Init_Table[GaugesID].ReferenceDataInUp[i] = GaugesUpVal[i];
}
}
/**@brief Set Gauges Dwom Val function
* @author TYW
* @param[in] GaugesID Gauge Name
* @param[in] GaugesVal Gauges Val
* @since 1.0.0.0
*/
* @author TYW
* @param[in] GaugesID Gauge Name
* @param[in] GaugesVal Gauges Val
* @since 1.0.0.0
*/
void SetGaugesDownVal(uint8_t GaugesID, uint16_t GaugesDownVal[])
{
uint8_t i;
for (i = 0u; i < GaugesParaNum[GaugesID]; i++)
{
GaugesInfo_Init_Table[GaugesID] .ReferenceDataInDown[i] = GaugesDownVal[i];
GaugesInfo_Init_Table[GaugesID].ReferenceDataInDown[i] = GaugesDownVal[i];
}
}
/**@brief Set Gauges Out Val function
* @author TYW
* @param[in] GaugesID Gauge Name
* @param[in] GaugesVal Gauges Val
* @since 1.0.0.0
*/
* @author TYW
* @param[in] GaugesID Gauge Name
* @param[in] GaugesVal Gauges Val
* @since 1.0.0.0
*/
void SetGaugesOutVal(uint8_t GaugesID, uint16_t GaugesOutVal[])
{
uint8_t i;
for (i = 0u; i < GaugesParaNum[GaugesID]; i++)
{
GaugesInfo_Init_Table[GaugesID] .ReferenceDataInOut[i] = GaugesOutVal[i];
GaugesInfo_Init_Table[GaugesID].ReferenceDataInOut[i] = GaugesOutVal[i];
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment